Improve backup creation UI

- Do not prompt the user if he really wants to create a backup
- Show error message if a backup can't be created at the moment
This commit is contained in:
Johannes Zellner
2017-01-19 17:04:20 +01:00
parent d845f1ae5b
commit f5c6862627
2 changed files with 19 additions and 14 deletions

View File

@@ -100,16 +100,26 @@ angular.module('Application').controller('SettingsController', ['$scope', '$loca
$scope.createBackup = {
busy: false,
percent: 100,
errorMessage: '',
doCreateBackup: function () {
$('#createBackupModal').modal('hide');
$scope.createBackup.busy = true;
$scope.createBackup.percent = 100;
$scope.createBackup.percent = 0;
$scope.createBackup.errorMessage = '';
Client.backup(function (error) {
if (error) {
console.error(error);
if (error.statusCode === 409) {
$scope.createBackup.errorMessage = 'App task is currently in progress. Please retry later.';
} else {
$scope.createBackup.errorMessage = error.message;
console.error(error);
}
$scope.createBackup.busy = false;
$('#createBackupFailedModal').modal('show');
return;
}
function checkIfDone() {
@@ -131,10 +141,6 @@ angular.module('Application').controller('SettingsController', ['$scope', '$loca
checkIfDone();
});
},
showCreateBackup: function () {
$('#createBackupModal').modal('show');
}
};