ff-admin/src/components/admin/management/setting/BackupSetting.vue

54 lines
1.6 KiB
Vue
Raw Normal View History

2025-04-28 12:39:32 +02:00
<template>
2025-04-29 13:10:30 +02:00
<BaseSetting title="Backup Einstellungen" :submit-function="submit" v-slot="{ enableEdit }">
<div class="w-full">
<label for="copies">Anzahl paralleler Backups (optional)</label>
<input id="copies" type="text" :readonly="!enableEdit" :value="backupSettings['backup.copies']" />
2025-04-28 12:39:32 +02:00
</div>
2025-04-29 13:10:30 +02:00
<div class="w-full">
<label for="interval">Intervall zur Backup-Erstellung (optional)</label>
<input id="interval" type="text" :readonly="!enableEdit" :value="backupSettings['backup.interval']" /></div
></BaseSetting>
2025-04-28 12:39:32 +02:00
</template>
<script setup lang="ts">
2025-04-29 13:10:30 +02:00
import { useAbilityStore } from "@/stores/ability";
2025-04-28 14:36:47 +02:00
import { useSettingStore } from "@/stores/admin/management/setting";
2025-04-29 13:10:30 +02:00
import { mapActions, mapState } from "pinia";
2025-04-28 12:39:32 +02:00
import { defineComponent } from "vue";
2025-04-29 13:10:30 +02:00
import BaseSetting from "./BaseSetting.vue";
2025-04-28 12:39:32 +02:00
</script>
<script lang="ts">
2025-04-28 14:36:47 +02:00
export default defineComponent({
2025-04-29 13:10:30 +02:00
data() {
return {
enableEdit: false as boolean,
status: undefined as undefined | "loading" | "success" | "failed",
};
},
2025-04-28 14:36:47 +02:00
computed: {
...mapState(useSettingStore, ["readByTopic"]),
2025-04-29 13:10:30 +02:00
...mapState(useAbilityStore, ["can"]),
2025-04-28 14:36:47 +02:00
backupSettings() {
return this.readByTopic("backup");
},
},
2025-04-29 13:10:30 +02:00
methods: {
...mapActions(useSettingStore, ["updateSettings"]),
submit(e: any) {
const formData = e.target.elements;
return this.updateSettings([
{
key: "backup.copies",
value: formData.copies.value || null,
},
{
key: "backup.interval",
value: formData.interval.value || null,
},
]);
},
},
2025-04-28 14:36:47 +02:00
});
2025-04-28 12:39:32 +02:00
</script>