added admin settings gui
This commit is contained in:
parent
b79f6cab6b
commit
31a419b536
7 changed files with 1489 additions and 828 deletions
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>
|
Loading…
Add table
Add a link
Reference in a new issue