diff --git a/src/js/client.js b/src/js/client.js index a0dedfe74..370e17637 100644 --- a/src/js/client.js +++ b/src/js/client.js @@ -346,6 +346,14 @@ angular.module('Application').service('Client', ['$http', '$interval', 'md5', 'N }).error(defaultErrorHandler(callback)); }; + Client.prototype.backupApp = function (appId, callback) { + var data = { }; + post('/api/v1/apps/' + appId + '/backup', data).success(function (data, status) { + if (status !== 202) return callback(new ClientError(status, data)); + callback(null); + }).error(defaultErrorHandler(callback)); + }; + Client.prototype.uninstallApp = function (appId, password, callback) { var data = { password: password }; post('/api/v1/apps/' + appId + '/uninstall', data).success(function (data, status) { diff --git a/src/theme.scss b/src/theme.scss index e83e43873..2d718fec8 100644 --- a/src/theme.scss +++ b/src/theme.scss @@ -452,6 +452,10 @@ multiselect { overflow-y: auto; } +.modal-body .panel-body { + padding: 5px; +} + .modal-footer { padding-top: 0; } diff --git a/src/views/apps.html b/src/views/apps.html index 320c5e5b8..b5d1976da 100644 --- a/src/views/apps.html +++ b/src/views/apps.html @@ -168,44 +168,62 @@ @@ -407,7 +425,7 @@
- +
diff --git a/src/views/apps.js b/src/views/apps.js index 89e1665e6..cd966e68f 100644 --- a/src/views/apps.js +++ b/src/views/apps.js @@ -184,6 +184,18 @@ angular.module('Application').controller('AppsController', ['$scope', '$location $scope.appRestore.selectedBackup = backup; }, + createBackup: function () { + Client.backupApp($scope.appRestore.app.id, function (error) { + if (error) { + Client.error(error); + } else { + $('#appRestoreModal').modal('hide'); + } + + Client.refreshInstalledApps(); // reflect the new app state immediately + }); + }, + show: function (app) { $scope.reset(); @@ -205,7 +217,7 @@ angular.module('Application').controller('AppsController', ['$scope', '$location return false; // prevent propagation and default }, - submit: function () { + restore: function () { $scope.appRestore.busy = true; $scope.appRestore.error.password = null;