diff --git a/dashboard/src/components/SystemBackupList.vue b/dashboard/src/components/SystemBackupList.vue index b1d3d606d..a5e4fbdde 100644 --- a/dashboard/src/components/SystemBackupList.vue +++ b/dashboard/src/components/SystemBackupList.vue @@ -164,16 +164,7 @@ async function refreshBackups() { result.forEach(function (backup) { backup.site = sites.value.find(t => t.id === backup.siteId); - - // filled when opening the info dialog - we only show apps for the moment - backup.contents = backup.dependsOn.filter(c => c.indexOf('app_') === 0).map(c => { - return { - id: c, - label: null, - fqdn: null, - stats: null - }; - }); + backup.appCount = backup.dependsOn.filter(c => c.indexOf('app_') === 0).length; }); backups.value = result; @@ -195,6 +186,7 @@ const infoDialog = useTemplateRef('infoDialog'); const infoBackup = ref({ contents: [] }); async function onInfo(backup) { infoBackup.value = backup; + infoBackup.value.contents = []; infoDialog.value.open(); // amend detailed app info @@ -207,20 +199,27 @@ async function onInfo(backup) { appsById[app.id] = app; }); - for (const content of infoBackup.value.contents) { - const match = content.id.match(/app_(.*?)_.*/); // *? means non-greedy + for (const contentId of infoBackup.value.dependsOn) { + const match = contentId.match(/(mail|app)_(.*?)_.*/); // *? means non-greedy if (!match) continue; - const [error, backup] = await backupsModel.get(content.id); + const [error, backup] = await backupsModel.get(contentId); if (error) console.error(error); + const content = { id: null, label: null, fqdn: null, stats: null }; content.stats = backup.stats; - const app = appsById[match[1]]; - if (app) { - content.id = app.id; - content.label = app.label; - content.fqdn = app.fqdn; + if (match[1] === 'mail') { + content.id = 'mail'; + content.label = 'Mail Server'; } else { - content.id = match[1]; + const app = appsById[match[2]]; + if (app) { + content.id = app.id; + content.label = app.label; + content.fqdn = app.fqdn; + } else { // uninstalled app + content.id = match[2]; + } } + infoBackup.value.contents.push(content); } } @@ -313,7 +312,8 @@ defineExpose({ refresh });

{{ $t('backups.backupDetails.list', { appCount: infoBackup.contents.length }) }}:

- {{ content.label || content.fqdn }} + {{ content.label }} + {{ content.label || content.fqdn }} {{ content.id }}  {{ prettyFileSize(content.stats.size) }} - {{ content.stats.fileCount }} file(s)
@@ -355,7 +355,7 @@ defineExpose({ refresh }); diff --git a/src/backuptask.js b/src/backuptask.js index 51979983f..ce9583c48 100644 --- a/src/backuptask.js +++ b/src/backuptask.js @@ -422,7 +422,7 @@ async function backupApp(app, backupSite, options, progressCallback) { await snapshotApp(app, progressCallback); } else { const tag = (new Date()).toISOString().replace(/[T.]/g, '-').replace(/[:Z]/g,''); - backup = await backupAppWithTag(app, backupSite, tag, options, progressCallback); + backup = await backupAppWithTag(app, backupSite, tag, options, progressCallback); // { id, stats } } await locks.release(`${locks.TYPE_APP_BACKUP_PREFIX}${app.id}`); @@ -582,7 +582,7 @@ async function appBackup(appId, backupSiteId, options, progressCallback) { await progressCallback({ percent: 1, message: `Backing up ${app.fqdn}. Waiting for lock` }); const startTime = new Date(); - const backup = await backupApp(app, backupSite, options, progressCallback); + const backup = await backupApp(app, backupSite, options, progressCallback); // { id, stats } await progressCallback({ percent: 100, message: `app ${app.fqdn} backup finished. Took ${(new Date() - startTime)/1000} seconds` }); return backup.id; }