Skip to content

Commit

Permalink
Enhance backup UI
Browse files Browse the repository at this point in the history
javalikescript committed May 8, 2022

Verified

This commit was signed with the committer’s verified signature.
jaraco Jason R. Coombs
1 parent 86dc4aa commit 8cac0b6
Showing 2 changed files with 15 additions and 3 deletions.
4 changes: 2 additions & 2 deletions extensions/web-base/www/app.html
Original file line number Diff line number Diff line change
@@ -236,9 +236,9 @@
<json :name="'Configuration'" :obj="config" :schema="schema"></json>
<button v-on:click="onSave()"><i class="far fa-save"></i>&nbsp;Save</button>
<p>Backup and Restore</p>
<button v-on:click="backup"><i class="fas fa-box"></i>&nbsp;Create Backup</button>
<button v-on:click="backup" :disabled="working"><i class="fas fa-box"></i>&nbsp;Create Backup</button>
<a v-if="filename" :href="'/engine/tmp/' + filename" download>{{filename}}</a>
<button v-on:click="selectFile"><i class="fas fa-box-open"></i>&nbsp;Deploy Backup</button>
<button v-on:click="selectFile" :disabled="working"><i class="fas fa-box-open"></i>&nbsp;Deploy Backup</button>
<input v-on:change="uploadThenDeploy" type="file" accept=".zip" ref="uploadInput" style="display: none;" />
</page-article>
</app-page>
14 changes: 13 additions & 1 deletion extensions/web-base/www/app/app.js
Original file line number Diff line number Diff line change
@@ -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() {

0 comments on commit 8cac0b6

Please sign in to comment.