From 8cac0b6e34a2b6ce3233fe1f3af33bd446893197 Mon Sep 17 00:00:00 2001 From: javalikescript Date: Sun, 8 May 2022 14:58:24 +0200 Subject: [PATCH] Enhance backup UI --- extensions/web-base/www/app.html | 4 ++-- extensions/web-base/www/app/app.js | 14 +++++++++++++- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/extensions/web-base/www/app.html b/extensions/web-base/www/app.html index a75bff2..9bc318a 100644 --- a/extensions/web-base/www/app.html +++ b/extensions/web-base/www/app.html @@ -236,9 +236,9 @@

Backup and Restore

- + {{filename}} - + diff --git a/extensions/web-base/www/app/app.js b/extensions/web-base/www/app/app.js index 0ebbd83..f4a7de3 100644 --- a/extensions/web-base/www/app/app.js +++ b/extensions/web-base/www/app/app.js @@ -378,7 +378,8 @@ var homePage = new Vue({ data: { filename: '', schema: {}, - config: {} + config: {}, + working: false }, methods: { onShow: function() { @@ -396,10 +397,14 @@ var homePage = new Vue({ }, backup: function() { var self = this; + self.working = true; fetch('/engine/admin/backup/create', {method: 'POST'}).then(function(response) { return response.text(); }).then(function(filename) { self.filename = filename; + toaster.toast('Backup created'); + }).finally(function() { + self.working = false; }); }, selectFile: function(event) { @@ -410,6 +415,7 @@ var homePage = new Vue({ if (input.files.length !== 1) { return; } + self.working = true; var file = input.files[0]; fetch('/engine/tmp/' + file.name, { method: 'PUT', @@ -418,10 +424,16 @@ var homePage = new Vue({ }, body: file }).then(function() { + toaster.toast('Backup uploaded'); return fetch('/engine/admin/backup/deploy', { method: 'POST', body: file.name }); + }).then(function() { + toaster.toast('Backup deployed'); + window.location.reload(); + }).finally(function() { + self.working = false; }); }, onSave: function() {