From 6fbd9dc260c737bc7774e08b234a7431e2c442f9 Mon Sep 17 00:00:00 2001 From: advplyr Date: Tue, 26 Oct 2021 18:29:04 -0500 Subject: [PATCH] Fix: initializing backup settings #146 --- client/pages/config/backups.vue | 24 ++++++++++++++++++++++-- client/pages/config/index.vue | 2 -- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/client/pages/config/backups.vue b/client/pages/config/backups.vue index 6d56ada4..2e4aa6d3 100644 --- a/client/pages/config/backups.vue +++ b/client/pages/config/backups.vue @@ -31,12 +31,24 @@ export default { return { updatingServerSettings: false, dailyBackups: true, - backupsToKeep: 2 + backupsToKeep: 2, + newServerSettings: {} + } + }, + watch: { + serverSettings(newVal, oldVal) { + if (newVal && !oldVal) { + this.newServerSettings = { ...this.serverSettings } + this.initServerSettings() + } } }, computed: { dailyBackupsTooltip() { return 'Runs at 1am every day (your server time). Saved in /metadata/backups.' + }, + serverSettings() { + return this.$store.state.serverSettings } }, methods: { @@ -63,8 +75,16 @@ export default { console.error('Failed to update server settings', error) this.updatingServerSettings = false }) + }, + initServerSettings() { + this.newServerSettings = this.serverSettings ? { ...this.serverSettings } : {} + + this.backupsToKeep = this.newServerSettings.backupsToKeep || 2 + this.dailyBackups = !!this.newServerSettings.backupSchedule } }, - mounted() {} + mounted() { + this.initServerSettings() + } } \ No newline at end of file diff --git a/client/pages/config/index.vue b/client/pages/config/index.vue index 0f6f55c0..6c142b12 100644 --- a/client/pages/config/index.vue +++ b/client/pages/config/index.vue @@ -145,8 +145,6 @@ export default { this.storeCoversInAudiobookDir = this.newServerSettings.coverDestination === this.$constants.CoverDestination.AUDIOBOOK this.storeCoversInAudiobookDir = this.newServerSettings.coverDestination === this.$constants.CoverDestination.AUDIOBOOK - this.backupsToKeep = this.newServerSettings.backupsToKeep || 2 - this.dailyBackups = !!this.newServerSettings.backupSchedule }, resetAudiobooks() { if (confirm('WARNING! This action will remove all audiobooks from the database including any updates or matches you have made. This does not do anything to your actual files. Shall we continue?')) {