Add modal to edit backup label and preserveSecs

This commit is contained in:
Johannes Zellner
2022-04-05 14:41:41 +02:00
parent 2692a3bca7
commit 9c6b3a9825
3 changed files with 85 additions and 2 deletions

View File

@@ -368,6 +368,39 @@ angular.module('Application').controller('BackupsController', ['$scope', '$locat
download(filename, JSON.stringify(tmp, null, 4));
};
$scope.editBackup = {
busy: false,
error: null,
backup: null,
label: '',
preserveSecs: 0,
show: function (backup) {
$scope.editBackup.backup = backup;
$scope.editBackup.label = backup.label;
$scope.editBackup.preserveSecs = backup.preserveSecs || 0;
$scope.editBackup.error = null;
$scope.editBackup.busy = false;
$('#editBackupModal').modal('show');
},
submit: function () {
$scope.editBackup.error = null;
$scope.editBackup.busy = true;
Client.editBackup($scope.editBackup.backup.id, $scope.editBackup.label, $scope.editBackup.preserveSecs, function (error) {
$scope.editBackup.busy = false;
if (error) return $scope.editBackup.error = error.message;
fetchBackups();
$('#editBackupModal').modal('hide');
});
}
};
$scope.backupDetails = {
backup: null,
@@ -824,7 +857,7 @@ angular.module('Application').controller('BackupsController', ['$scope', '$locat
document.getElementById('gcsKeyFileInput').onchange = readFileLocally($scope.configureBackup.gcsKey, 'content', 'keyFileName');
// setup all the dialog focus handling
['configureBackupModal'].forEach(function (id) {
['configureBackupModal', 'editBackupModal'].forEach(function (id) {
$('#' + id).on('shown.bs.modal', function () {
$(this).find("[autofocus]:first").focus();
});