Merge pull request #489 from selfhost-alt/configurable-backup-size

Make maximum backup size configurable
This commit is contained in:
advplyr 2022-04-23 17:06:59 -05:00 committed by GitHub
commit c5a9c2bf5a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 24 additions and 5 deletions

View file

@ -20,6 +20,14 @@
<p class="pl-4 text-lg">Number of backups to keep</p>
</div>
<div class="flex items-center py-2">
<ui-text-input type="number" v-model="maxBackupSize" no-spinner :disabled="updatingServerSettings" :padding-x="1" text-center class="w-10" @change="updateBackupsSettings" />
<ui-tooltip :text="maxBackupSizeTooltip">
<p class="pl-4 text-lg">Maximum backup size (in GB) <span class="material-icons icon-text">info_outlined</span></p>
</ui-tooltip>
</div>
<tables-backups-table />
</div>
</div>
@ -32,6 +40,7 @@ export default {
updatingServerSettings: false,
dailyBackups: true,
backupsToKeep: 2,
maxBackupSize: 1,
newServerSettings: {}
}
},
@ -47,19 +56,27 @@ export default {
dailyBackupsTooltip() {
return 'Runs at 1am every day (your server time). Saved in /metadata/backups.'
},
maxBackupSizeTooltip() {
return 'As a safeguard against misconfiguration, backups will fail if they exceed the configured size.'
},
serverSettings() {
return this.$store.state.serverSettings
}
},
methods: {
updateBackupsSettings() {
if (isNaN(this.maxBackupSize) || this.maxBackupSize <= 0) {
this.$toast.error('Invalid maximum backup size')
return
}
if (isNaN(this.backupsToKeep) || this.backupsToKeep <= 0 || this.backupsToKeep > 99) {
this.$toast.error('Invalid number of backups to keep')
return
}
var updatePayload = {
backupSchedule: this.dailyBackups ? '0 1 * * *' : false,
backupsToKeep: Number(this.backupsToKeep)
backupsToKeep: Number(this.backupsToKeep),
maxBackupSize: Number(this.maxBackupSize)
}
this.updateServerSettings(updatePayload)
},
@ -81,6 +98,7 @@ export default {
this.backupsToKeep = this.newServerSettings.backupsToKeep || 2
this.dailyBackups = !!this.newServerSettings.backupSchedule
this.maxBackupSize = this.newServerSettings.maxBackupSize || 1
}
},
mounted() {