🔨 Add addon auto stop and security menu

This commit is contained in:
SebClem 2023-01-13 22:57:38 +01:00
parent 9a02bfc6b8
commit 075604685d
Signed by: sebclem
GPG Key ID: 5A4308F6A359EA50
6 changed files with 109 additions and 3 deletions

View File

@ -31,7 +31,6 @@ import { watch } from "vue";
defineProps<{ loading: boolean }>();
const backupConfigStore = useBackupConfigStore();
const { data, addons, invertedAddons } = storeToRefs(backupConfigStore);
watch(invertedAddons, () => {
data.value.exclude.addon = [];

View File

@ -9,7 +9,7 @@
<v-row dense>
<v-col>
<v-switch
label="Auto clean Home Assistant Backups"
label="Auto clean Home Assistant backups"
v-model="data.autoClean.homeAssistant.enabled"
hide-details="auto"
density="compact"
@ -42,7 +42,7 @@
<v-row dense>
<v-col>
<v-switch
label="Auto clean Cloud Backups"
label="Auto clean Cloud backups"
v-model="data.autoClean.webdav.enabled"
hide-details="auto"
density="compact"

View File

@ -0,0 +1,34 @@
<template>
<v-card variant="elevated" elevation="7" height="100%">
<v-card-title class="text-center text-white bg-light-blue-darken-4">
Auto Stop Addon
</v-card-title>
<v-card-text class="text-white px-2 py-1">
<div v-if="loading" class="d-flex justify-center">
<v-progress-circular indeterminate color="orange"></v-progress-circular>
</div>
<v-checkbox
v-else
v-for="addon in addons"
v-model="data.autoStopAddon"
:key="addon.slug"
:label="addon.name"
:value="addon.slug"
:loading="loading"
hide-details="auto"
color="orange"
density="compact"
>
</v-checkbox>
</v-card-text>
</v-card>
</template>
<script setup lang="ts">
import { useBackupConfigStore } from "@/stores/backupConfig";
import { storeToRefs } from "pinia";
defineProps<{ loading: boolean }>();
const backupConfigStore = useBackupConfigStore();
const { data, addons } = storeToRefs(backupConfigStore);
</script>

View File

@ -0,0 +1,56 @@
<template>
<v-card variant="elevated" elevation="7">
<v-card-title class="bg-light-blue-darken-4 text-center">
Security
</v-card-title>
<v-card-text>
<v-row justify="center" v-if="loading">
<v-col class="d-flex justify-center">
<v-progress-circular
indeterminate
color="orange"
></v-progress-circular>
</v-col>
</v-row>
<template v-if="!loading">
<v-row class="mt-1">
<v-col>
<v-switch
label="Password protected backup"
v-model="data.password.enabled"
hide-details="auto"
density="compact"
inset
:loading="loading"
color="orange"
></v-switch>
</v-col>
</v-row>
<v-fade-transition>
<v-row dense v-if="data.password.enabled">
<v-col>
<div class="text-subtitle-1 text-medium-emphasis">Password</div>
<v-text-field
v-model="data.password.value"
hide-details="auto"
density="compact"
variant="outlined"
color="orange"
type="password"
></v-text-field>
</v-col>
</v-row>
</v-fade-transition>
</template>
</v-card-text>
</v-card>
</template>
<script setup lang="ts">
import { useBackupConfigStore } from "@/stores/backupConfig";
import { storeToRefs } from "pinia";
defineProps<{ loading: boolean }>();
const backupConfigStore = useBackupConfigStore();
const { data } = storeToRefs(backupConfigStore);
</script>

View File

@ -55,6 +55,17 @@
<BackupConfigAutoClean :loading="loading"></BackupConfigAutoClean>
</v-col>
</v-row>
<v-row dense>
<v-col>
<BackupConfigAutoStop :loading="loading"></BackupConfigAutoStop>
</v-col>
</v-row>
<v-divider class="my-4"></v-divider>
<v-row class="mb-10">
<v-col>
<BackupConfigSecurity :loading="loading"></BackupConfigSecurity>
</v-col>
</v-row>
</v-form>
</template>
<script setup lang="ts">
@ -68,6 +79,8 @@ import BackupConfigAddon from "./BackupConfig/BackupConfigAddon.vue";
import BackupConfigAutoBackup from "./BackupConfig/BackupConfigAutoBackup.vue";
import BackupConfigFolder from "./BackupConfig/BackupConfigFolder.vue";
import BackupConfigAutoClean from "./BackupConfig/BackupConfigAutoClean.vue";
import BackupConfigSecurity from "./BackupConfig/BackupConfigSecurity.vue";
import BackupConfigAutoStop from "./BackupConfig/BackupConfigAutoStop.vue";
const backupConfigStore = useBackupConfigStore();
const { data } = storeToRefs(backupConfigStore);

View File

@ -33,5 +33,9 @@ function cleanupConfig(config: BackupConfig) {
if (!config.autoClean.webdav.enabled) {
config.autoClean.webdav.nbrToKeep = undefined;
}
if (!config.password.enabled){
config.password.value = undefined;
}
return config;
}