Show a warning in the superuser panel if a container restart is required, and provide a button to do so. This change also moves the restart and monitoring code into a service

This commit is contained in:
Joseph Schorr 2015-01-26 13:46:57 -05:00
parent c88d97cf8b
commit 6a0158d361
5 changed files with 164 additions and 47 deletions

View file

@ -1,4 +1,4 @@
function SuperUserAdminCtrl($scope, $timeout, ApiService, Features, UserService, AngularPollChannel, CoreDialog) {
function SuperUserAdminCtrl($scope, $timeout, ApiService, Features, UserService, ContainerService, AngularPollChannel, CoreDialog) {
if (!Features.SUPER_USERS) {
return;
}
@ -7,6 +7,7 @@ function SuperUserAdminCtrl($scope, $timeout, ApiService, Features, UserService,
UserService.updateUserIn($scope);
$scope.configStatus = null;
$scope.requiresRestart = null;
$scope.logsCounter = 0;
$scope.newUser = {};
$scope.createdUser = null;
@ -17,6 +18,10 @@ function SuperUserAdminCtrl($scope, $timeout, ApiService, Features, UserService,
$scope.logsScrolled = false;
$scope.csrf_token = window.__token;
$scope.configurationSaved = function() {
$scope.requiresRestart = true;
};
$scope.showCreateUser = function() {
$scope.createdUser = null;
$('#createUserModal').modal('show');
@ -183,9 +188,24 @@ function SuperUserAdminCtrl($scope, $timeout, ApiService, Features, UserService,
}, ApiService.errorDisplay('Cannot send recovery email'))
};
$scope.restartContainer = function() {
$('#restartingContainerModal').modal({
keyboard: false,
backdrop: 'static'
});
ContainerService.restartContainer();
$timeout(function() {
$scope.checkStatus();
}, 2000);
};
$scope.checkStatus = function() {
ApiService.scRegistryStatus(null, null).then(function(resp) {
ContainerService.checkStatus(function(resp) {
$('#restartingContainerModal').modal('hide');
$scope.configStatus = resp['status'];
$scope.requiresRestart = resp['requires_restart'];
if ($scope.configStatus == 'ready') {
$scope.loadUsers();
} else {
@ -197,7 +217,7 @@ function SuperUserAdminCtrl($scope, $timeout, ApiService, Features, UserService,
var title = "Installation Incomplete";
CoreDialog.fatal(title, message);
}
}, ApiService.errorDisplay('Cannot load status. Please report this to support'), /* background */true);
});
};
// Load the initial status.