diff --git a/dashboard/src/components/BackupList.vue b/dashboard/src/components/BackupList.vue index 5120c7e0c..213ca7dcd 100644 --- a/dashboard/src/components/BackupList.vue +++ b/dashboard/src/components/BackupList.vue @@ -5,7 +5,7 @@ const i18n = useI18n(); const t = i18n.t; import { ref, onMounted, useTemplateRef } from 'vue'; -import { Button, ProgressBar, TableView, Dialog } from 'pankow'; +import { Button, ButtonGroup, ProgressBar, FormGroup, TextInput, Checkbox, TableView, Dialog } from 'pankow'; import { prettyLongDate } from 'pankow/utils'; import { TASK_TYPES, SECRET_PLACEHOLDER } from '../constants.js'; import Section from '../components/Section.vue'; @@ -151,10 +151,8 @@ async function onDownloadConfig(backup) { download(filename, JSON.stringify(tmp, null, 4)); } -function onEdit(backup) { - console.log('edit', backup); -} +// backups info dialog const infoDialog = useTemplateRef('infoDialog'); const infoBackup = ref({ contents: [] }); function onInfo(backup) { @@ -162,6 +160,37 @@ function onInfo(backup) { infoDialog.value.open(); } + +// edit backups dialog +const editDialog = useTemplateRef('editDialog'); +const editBackupError = ref(''); +const editBackupBusy = ref(false); +const editBackupId = ref(''); +const editBackupLabel = ref(''); +const editBackupPersist = ref(false); +function onEdit(backup) { + editBackupError.value = ''; + editBackupBusy.value = false; + editBackupId.value = backup.id; + editBackupLabel.value = backup.label; + editBackupPersist.value = backup.preserveSecs === -1; + editDialog.value.open(); +} + +async function onEditSubmit() { + editBackupBusy.value = true; + + const [error] = await backupsModel.edit(editBackupId.value, editBackupLabel.value, editBackupPersist.value ? -1 : 0); + if (error) { + return console.error(error); + } + + await refreshBackups(); + editBackupBusy.value = false; + editDialog.value.close(); +} + + onMounted(async () => { await refreshBackups(); await refreshTasks(); @@ -209,6 +238,29 @@ onMounted(async () => { + +

{{ editBackupError }}

+ +
+
+ + + + + + + +
+
+
+
- +