Add ui bits to be able to reboot the server
This commit is contained in:
@@ -8,6 +8,7 @@ angular.module('Application').controller('SystemController', ['$scope', '$locati
|
||||
$scope.config = Client.getConfig();
|
||||
$scope.ready = false;
|
||||
$scope.addons = {};
|
||||
$scope.isRebootRequired = false;
|
||||
|
||||
function refresh(addonName, callback) {
|
||||
callback = callback || function () {};
|
||||
@@ -26,6 +27,27 @@ angular.module('Application').controller('SystemController', ['$scope', '$locati
|
||||
});
|
||||
}
|
||||
|
||||
$scope.reboot = {
|
||||
busy: false,
|
||||
|
||||
show: function () {
|
||||
$scope.reboot.busy = false;
|
||||
|
||||
$('#rebootModal').modal('show');
|
||||
},
|
||||
|
||||
submit: function () {
|
||||
$scope.reboot.busy = true;
|
||||
|
||||
Client.reboot(function (error) {
|
||||
$scope.reboot.busy = false;
|
||||
if (error) return Client.error(error);
|
||||
|
||||
$('#rebootModal').modal('hide');
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
$scope.restartAddon = function (addonName) {
|
||||
function waitForActive(addonName) {
|
||||
refresh(addonName, function () {
|
||||
@@ -103,17 +125,23 @@ angular.module('Application').controller('SystemController', ['$scope', '$locati
|
||||
};
|
||||
|
||||
Client.onReady(function () {
|
||||
Client.getAddons(function (error, result) {
|
||||
if (error) return Client.error(error);
|
||||
Client.isRebootRequired(function (error, result) {
|
||||
if (error) console.error(error);
|
||||
|
||||
result.forEach(function (a) {
|
||||
$scope.addons[a] = { name: a };
|
||||
$scope.isRebootRequired = !!result;
|
||||
|
||||
Client.getAddons(function (error, result) {
|
||||
if (error) return Client.error(error);
|
||||
|
||||
result.forEach(function (a) {
|
||||
$scope.addons[a] = { name: a };
|
||||
});
|
||||
|
||||
// just kick off the status fetching
|
||||
refreshAll();
|
||||
|
||||
$scope.ready = true;
|
||||
});
|
||||
|
||||
// just kick off the status fetching
|
||||
refreshAll();
|
||||
|
||||
$scope.ready = true;
|
||||
});
|
||||
});
|
||||
}]);
|
||||
|
||||
Reference in New Issue
Block a user