implemented snapshot name parsing
This commit is contained in:
parent
a024d93e02
commit
85d63d5ae2
8 changed files with 175 additions and 36 deletions
|
@ -4,12 +4,13 @@
|
|||
name="Groupfolder Filesystem Snapshots"
|
||||
:limit-width="false">
|
||||
<div v-if="!loading">
|
||||
<Field :is="setting.sensitive ? NcPasswordField : NcTextField"
|
||||
<Field :is="getAppSettingComponent(setting)"
|
||||
v-for="setting in app_settings"
|
||||
v-bind="getAppSettingProps(setting)"
|
||||
:key="setting.id"
|
||||
class="settings_field"
|
||||
:value="settings?.[setting.id]"
|
||||
:label="setting.name"
|
||||
@update:modelValue="(newValue) => updateSetting(setting.id, newValue)"
|
||||
@update:value="(newValue) => updateSetting(setting.id, newValue)" />
|
||||
</div>
|
||||
</NcSettingsSection>
|
||||
|
@ -18,7 +19,7 @@
|
|||
<script setup>
|
||||
import { ref } from "vue";
|
||||
import debounceFunction from 'debounce-fn';
|
||||
import { NcSettingsSection, NcTextField, NcPasswordField } from "@nextcloud/vue"
|
||||
import { NcSettingsSection, NcTextField, NcPasswordField, NcSelect } from "@nextcloud/vue"
|
||||
|
||||
import { adminSettingsApi } from "./adminSettingsApi.js";
|
||||
|
||||
|
@ -26,10 +27,53 @@ 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"},
|
||||
{id: "filesystem_mountpoint_path", name: "Filesystem Mountpoint Path", type: "text" },
|
||||
{id: "filesystem_snapshots_path", name: "Filesystem Snapshots Path", type: "text"},
|
||||
{
|
||||
id: "snapshot_naming_scheme",
|
||||
name: "Snapshot Naming Scheme",
|
||||
type: "select",
|
||||
options: [
|
||||
{
|
||||
id: '',
|
||||
label: 'None',
|
||||
},
|
||||
{
|
||||
id: 'zfs-auto-snapshot',
|
||||
label: 'zfs-auto-snapshot',
|
||||
},
|
||||
]
|
||||
},
|
||||
];
|
||||
|
||||
const getAppSettingComponent = function(appSetting) {
|
||||
if(appSetting.type === "select") {
|
||||
return NcSelect;
|
||||
} else {
|
||||
if(appSetting?.sensitive) {
|
||||
return NcPasswordField;
|
||||
} else {
|
||||
return NcTextField;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const getAppSettingProps = function(appSetting) {
|
||||
if(appSetting.type === "select") {
|
||||
return {
|
||||
options: appSetting.options,
|
||||
label: "label",
|
||||
inputLabel: appSetting.name,
|
||||
reduce: (option) => ( option.id )
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
label: appSetting.name,
|
||||
clearable: false,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
adminSettingsApi.getAllSettings().then((result) => {
|
||||
settings.value = result;
|
||||
loading.value = false;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue