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 () => {
+
+
@@ -219,7 +271,7 @@ onMounted(async () => {
- {{ prettyLongDate(slotProps.creationTime) }}
+ {{ prettyLongDate(slotProps.creationTime) }} ({{ slotProps.label }})
{{ $t('backups.listing.appCount', { appCount: slotProps.contents.length }) }}
@@ -228,8 +280,11 @@ onMounted(async () => {
-
-
+
+
+
+
+
diff --git a/dashboard/src/models/BackupsModel.js b/dashboard/src/models/BackupsModel.js
index 1d3aae9cb..122d7f8d7 100644
--- a/dashboard/src/models/BackupsModel.js
+++ b/dashboard/src/models/BackupsModel.js
@@ -31,6 +31,18 @@ function create() {
if (error || result.status !== 202) return [error || result];
return [null, result.body.taskId];
},
+ async edit(id, label, preserveSecs) {
+ // if preserveSecs === -1 we will keep it
+ let error, result;
+ try {
+ result = await fetcher.post(`${origin}/api/v1/backups/${id}`, { label, preserveSecs }, { access_token: accessToken });
+ } catch (e) {
+ error = e;
+ }
+
+ if (error || result.status !== 200) return [error || result];
+ return [null];
+ },
async getConfig() {
let error, result;
try {