Refactor update functions
This commit is contained in:
@@ -496,7 +496,33 @@ angular.module('Application').controller('AppsController', ['$scope', '$location
|
||||
error: {},
|
||||
app: {},
|
||||
manifest: {},
|
||||
portBindings: {}
|
||||
portBindings: {},
|
||||
|
||||
show: function (app, updateManifest) {
|
||||
$scope.reset();
|
||||
|
||||
$scope.appUpdate.app = app;
|
||||
$scope.appUpdate.manifest = angular.copy(updateManifest);
|
||||
|
||||
$('#appUpdateModal').modal('show');
|
||||
},
|
||||
|
||||
submit: function () {
|
||||
$scope.appUpdate.busy = true;
|
||||
|
||||
Client.updateApp($scope.appUpdate.app.id, $scope.appUpdate.manifest, function (error) {
|
||||
if (error) {
|
||||
Client.error(error);
|
||||
} else {
|
||||
$scope.appUpdate.app = {};
|
||||
$('#appUpdateModal').modal('hide');
|
||||
}
|
||||
|
||||
$scope.appUpdate.busy = false;
|
||||
|
||||
Client.refreshAppCache($scope.appUpdate.app.id); // reflect the new app state immediately
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
$scope.reset = function () {
|
||||
@@ -609,32 +635,6 @@ angular.module('Application').controller('AppsController', ['$scope', '$location
|
||||
return false; // prevent propagation and default
|
||||
};
|
||||
|
||||
$scope.showUpdate = function (app, updateManifest) {
|
||||
$scope.reset();
|
||||
|
||||
$scope.appUpdate.app = app;
|
||||
$scope.appUpdate.manifest = angular.copy(updateManifest);
|
||||
|
||||
$('#appUpdateModal').modal('show');
|
||||
};
|
||||
|
||||
$scope.doUpdate = function () {
|
||||
$scope.appUpdate.busy = true;
|
||||
|
||||
Client.updateApp($scope.appUpdate.app.id, $scope.appUpdate.manifest, function (error) {
|
||||
if (error) {
|
||||
Client.error(error);
|
||||
} else {
|
||||
$scope.appUpdate.app = {};
|
||||
$('#appUpdateModal').modal('hide');
|
||||
}
|
||||
|
||||
$scope.appUpdate.busy = false;
|
||||
|
||||
Client.refreshAppCache($scope.appUpdate.app.id); // reflect the new app state immediately
|
||||
});
|
||||
};
|
||||
|
||||
$scope.renderAccessRestrictionUser = function (userId) {
|
||||
var user = $scope.users.filter(function (u) { return u.id === userId; })[0];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user