diff --git a/backend/rest/backend.go b/backend/rest/backend.go index a50b23c7..b7fb5af8 100644 --- a/backend/rest/backend.go +++ b/backend/rest/backend.go @@ -211,8 +211,8 @@ func (b *Backend) BackupCreate(req *http.Request) (interface{}, error) { fmt.Printf("parse error: %v\n", err.Error()) return nil, errors.New("app is missing") } - _ = b.JobMaster.Offer("backup.create", func() error { return b.backup.Create(request.App) }) - return "submitted", nil + err = b.JobMaster.Offer("backup.create", func() error { return b.backup.Create(request.App) }) + return "submitted", err } func (b *Backend) BackupRestore(req *http.Request) (interface{}, error) { @@ -222,13 +222,13 @@ func (b *Backend) BackupRestore(req *http.Request) (interface{}, error) { fmt.Printf("parse error: %v\n", err.Error()) return nil, errors.New("file is missing") } - _ = b.JobMaster.Offer("backup.restore", func() error { return b.backup.Restore(request.File) }) - return "submitted", nil + err = b.JobMaster.Offer("backup.restore", func() error { return b.backup.Restore(request.File) }) + return "submitted", err } func (b *Backend) InstallerUpgrade(_ *http.Request) (interface{}, error) { - _ = b.JobMaster.Offer("installer.upgrade", func() error { return b.installer.Upgrade() }) - return "submitted", nil + err := b.JobMaster.Offer("installer.upgrade", func() error { return b.installer.Upgrade() }) + return "submitted", err } func (b *Backend) JobStatus(_ *http.Request) (interface{}, error) { diff --git a/www/src/views/App.vue b/www/src/views/App.vue index dbe62505..0512ac33 100644 --- a/www/src/views/App.vue +++ b/www/src/views/App.vue @@ -120,9 +120,8 @@ export default { info: undefined, appId: undefined, action: '', - loading: undefined, progress: true, - progressPercentage: 20, + progressPercentage: 0, progressSummary: '', progressIndeterminate: true, appActionConfirmationVisible: false, @@ -147,15 +146,15 @@ export default { this.progressSummary = '' this.progress = false }, - loadApp () { - return axios - .get('/rest/app', { params: { app_id: this.appId } }) - .then(resp => { - this.info = resp.data.data - }) - .catch(err => { - this.$refs.error.showAxios(err) - }) + async loadApp() { + try { + let resp = await axios + .get('/rest/app', {params: {app_id: this.appId}}) + this.info = resp.data.data + } catch (err) { + this.$refs.error.showAxios(err) + ; + } }, open () { window.location.href = this.info.app.url diff --git a/www/src/views/Backup.vue b/www/src/views/Backup.vue index 53f05758..47c1485c 100644 --- a/www/src/views/Backup.vue +++ b/www/src/views/Backup.vue @@ -4,26 +4,41 @@

Backup

-
+
+ + + + {{ progressSummary }} + + + + + + + + + + +
+
- Auto: - - - - + + + - - - - - - - - - + + + + + + + + @@ -86,7 +101,6 @@ import axios from 'axios' import * as Common from '../js/common.js' import Dialog from '../components/Dialog.vue' import Notification from '../components/Notification.vue' -import { ElLoading } from 'element-plus' export default { name: 'Backup', @@ -104,7 +118,10 @@ export default { auto: 'no', autoDay: 0, autoHour: 0, - visibility: 'hidden' + progressSummary: '', + progress: true, + progressPercentage: 20, + progressIndeterminate: true, } }, computed: { @@ -116,16 +133,17 @@ export default { Dialog }, mounted () { - this.progressShow() + this.progressShow("Loading backup list") this.reload() }, methods: { - progressShow () { - this.loading = ElLoading.service({ lock: true, text: 'Loading', background: 'rgba(0, 0, 0, 0.7)' }) + progressShow (summary) { + this.progressSummary = summary + this.progress = true }, progressHide () { - this.visibility = 'visible' - this.loading.close() + this.progressSummary = '' + this.progress = false }, removeConfirm (file) { this.file = file @@ -160,14 +178,14 @@ export default { Notification.error(error) }, restore () { + this.progressShow('Restoring: ' + this.file) axios .post('/rest/backup/restore', { file: this.file }) .then(() => { - Notification.info('Restoring an app from a backup') Common.runAfterJobIsComplete( setTimeout, () => { - Notification.success('Backup restore has finished') + this.progressHide() this.reload() }, Notification.error, @@ -197,7 +215,7 @@ export default { .catch(this.showError) }, saveAuto () { - this.progressShow() + this.progressShow("Saving auto backup settings") axios.post('/rest/backup/auto', { auto: this.auto, day: this.autoDay, hour: this.autoHour }) .then(() => {