added admin settings gui
This commit is contained in:
parent
b79f6cab6b
commit
31a419b536
7 changed files with 1489 additions and 828 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -4,4 +4,4 @@
|
|||
/build/
|
||||
node_modules/
|
||||
/.php-cs-fixer.cache
|
||||
js/*hot-update.*
|
||||
js/
|
|
@ -1,4 +1,21 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
"routes" => [
|
||||
[
|
||||
'name' => 'AdminSettings#index',
|
||||
'url' => '/adminSettings',
|
||||
'verb' => 'GET'
|
||||
],
|
||||
[
|
||||
'name' => 'AdminSettings#show',
|
||||
'url' => '/adminSettings/{key}',
|
||||
'verb' => 'GET'
|
||||
],
|
||||
[
|
||||
'name' => 'AdminSettings#update',
|
||||
'url' => '/adminSettings/{key}',
|
||||
'verb' => 'PATCH'
|
||||
],
|
||||
]
|
||||
];
|
||||
|
|
2189
package-lock.json
generated
2189
package-lock.json
generated
File diff suppressed because it is too large
Load diff
34
package.json
34
package.json
|
@ -5,35 +5,37 @@
|
|||
"author": "Jonathan Treffler <mail@jonathan-treffler.de>",
|
||||
"contributors": [],
|
||||
"bugs": {
|
||||
"url": "https://git.verdigado.com/verdigado/nextcloud_groupfolder_filesystem_snapshots/issues"
|
||||
"url": "https://git.verdigado.com/verdigado/nextcloud_groupfolder_filesystem_snapshots/issues"
|
||||
},
|
||||
"repository": {
|
||||
"url": "https://git.verdigado.com/verdigado/nextcloud_groupfolder_filesystem_snapshots",
|
||||
"type": "git"
|
||||
"url": "https://git.verdigado.com/verdigado/nextcloud_groupfolder_filesystem_snapshots",
|
||||
"type": "git"
|
||||
},
|
||||
"homepage": "https://git.verdigado.com/verdigado/nextcloud_groupfolder_filesystem_snapshots",
|
||||
"license": "agpl",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"build": "webpack --node-env production --progress",
|
||||
"dev": "webpack --node-env development --progress",
|
||||
"watch": "webpack --node-env development --progress --watch"
|
||||
"build": "webpack --node-env production --progress",
|
||||
"dev": "webpack --node-env development --progress",
|
||||
"watch": "webpack --node-env development --progress --watch"
|
||||
},
|
||||
"dependencies": {
|
||||
"@nextcloud/axios": "^2.3.0",
|
||||
"@nextcloud/vue": "^7.4.0",
|
||||
"vue": "^2.7.14"
|
||||
"@nextcloud/axios": "^2.3.0",
|
||||
"@nextcloud/router": "^3.0.1",
|
||||
"@nextcloud/vue": "^8.11.2",
|
||||
"debounce-fn": "^6.0.0",
|
||||
"vue": "^2.7.14"
|
||||
},
|
||||
"browserslist": [
|
||||
"extends @nextcloud/browserslist-config"
|
||||
"extends @nextcloud/browserslist-config"
|
||||
],
|
||||
"engines": {
|
||||
"node": "^16.0.0",
|
||||
"npm": "^7.0.0 || ^8.0.0"
|
||||
"node": "^16.0.0",
|
||||
"npm": "^7.0.0 || ^8.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@nextcloud/babel-config": "^1.0.0",
|
||||
"@nextcloud/browserslist-config": "^2.3.0",
|
||||
"@nextcloud/webpack-vue-config": "^5.4.0"
|
||||
"@nextcloud/babel-config": "^1.0.0",
|
||||
"@nextcloud/browserslist-config": "^2.3.0",
|
||||
"@nextcloud/webpack-vue-config": "^5.4.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
50
src/AdminSettings.vue
Normal file
50
src/AdminSettings.vue
Normal file
|
@ -0,0 +1,50 @@
|
|||
<template>
|
||||
<div>
|
||||
<NcSettingsSection
|
||||
name="Groupfolder Filesystem Snapshots"
|
||||
:limit-width="false">
|
||||
<div v-if="!loading">
|
||||
<Field :is="setting.sensitive ? NcPasswordField : NcTextField"
|
||||
v-for="setting in app_settings"
|
||||
:key="setting.id"
|
||||
class="settings_field"
|
||||
:value="settings?.[setting.id]"
|
||||
:label="setting.name"
|
||||
@update:value="(newValue) => updateSetting(setting.id, newValue)" />
|
||||
</div>
|
||||
</NcSettingsSection>
|
||||
</div>
|
||||
</template>
|
||||
<script setup>
|
||||
import { ref } from "vue";
|
||||
import debounceFunction from 'debounce-fn';
|
||||
import { NcSettingsSection, NcTextField, NcPasswordField } from "@nextcloud/vue"
|
||||
|
||||
import { adminSettingsApi } from "./adminSettingsApi.js";
|
||||
|
||||
let loading = ref(true);
|
||||
let settings = ref({});
|
||||
|
||||
const app_settings = [
|
||||
{id: "filesystem_mountpoint_path", name: "Filesystem Mountpoint Path"},
|
||||
{id: "filesystem_snapshots_path", name: "Filesystem Snapshots Path"},
|
||||
];
|
||||
|
||||
adminSettingsApi.getAllSettings().then((result) => {
|
||||
settings.value = result;
|
||||
loading.value = false;
|
||||
});
|
||||
|
||||
const updateSetting = debounceFunction((key, value) => {
|
||||
console.log("updateSetting", key, value);
|
||||
settings.value[key] = value;
|
||||
adminSettingsApi.setSetting(key, value).then(() => {
|
||||
});
|
||||
})
|
||||
|
||||
</script>
|
||||
<style scoped>
|
||||
.settings_field {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
</style>
|
|
@ -0,0 +1,9 @@
|
|||
import Vue from 'vue'
|
||||
import App from './AdminSettings.vue'
|
||||
|
||||
Vue.mixin({ methods: { t, n } })
|
||||
|
||||
export default new Vue({
|
||||
el: '#groupfolder_filesystem_snapshots_admin_settings',
|
||||
render: h => h(App),
|
||||
})
|
16
src/adminSettingsApi.js
Normal file
16
src/adminSettingsApi.js
Normal file
|
@ -0,0 +1,16 @@
|
|||
import axios from "@nextcloud/axios"
|
||||
import { generateUrl } from "@nextcloud/router"
|
||||
|
||||
axios.defaults.baseURL = generateUrl("/apps/groupfolder_filesystem_snapshots")
|
||||
|
||||
export const adminSettingsApi = {
|
||||
getAllSettings() {
|
||||
return axios.get("/adminSettings").then((res) => res.data)
|
||||
},
|
||||
getSetting(key) {
|
||||
return axios.get("/adminSettings/" + key).then((res) => res.data)
|
||||
},
|
||||
setSetting(key, value) {
|
||||
return axios.patch("/adminSettings/" + key, { value }).then((res) => res.data)
|
||||
},
|
||||
}
|
Loading…
Reference in a new issue