Fix take ownership of organizations

Take ownership code got moved into its own directive in Oct, but we forgot we have a call in superuser panel for orgs as well. Fix this, and simplify the call sites
This commit is contained in:
Joseph Schorr 2017-03-22 12:25:20 -04:00
parent 789e35668c
commit 1d3af2b0bd
4 changed files with 32 additions and 12 deletions

View file

@ -10,7 +10,7 @@
})
}]);
function SuperuserCtrl($scope, ApiService, Features, UserService, ContainerService, AngularPollChannel, CoreDialog, TableService) {
function SuperuserCtrl($scope, $location, ApiService, Features, UserService, ContainerService, AngularPollChannel, CoreDialog, TableService) {
if (!Features.SUPER_USERS) {
return;
}
@ -198,6 +198,24 @@
});
};
$scope.askTakeOwnership = function (entity) {
$scope.takeOwnershipInfo = {
'entity': entity
};
};
$scope.takeOwnership = function (info, callback) {
var errorDisplay = ApiService.errorDisplay('Could not take ownership of namespace', callback);
var params = {
'namespace': info.entity.username || info.entity.name
};
ApiService.takeOwnership(null, params).then(function () {
callback(true);
$location.path('/organization/' + params.namespace);
}, errorDisplay)
};
$scope.checkStatus = function() {
ContainerService.checkStatus(function(resp) {
$('#restartingContainerModal').modal('hide');