Move reboot server dialog and logic to main view

This commit is contained in:
Johannes Zellner
2020-11-05 16:45:45 +01:00
parent 61c1622cbf
commit 93a7137d10
6 changed files with 43 additions and 83 deletions

View File

@@ -13,6 +13,28 @@ angular.module('Application').controller('MainController', ['$scope', '$route',
$scope.notifications = [];
$scope.hideNavBarActions = $location.path() === '/logs';
$scope.reboot = {
busy: false,
show: function () {
$scope.reboot.busy = false;
$('#rebootModal').modal('show');
},
submit: function () {
$scope.reboot.busy = true;
Client.reboot(function (error) {
if (error) return Client.error(error);
$('#rebootModal').modal('hide');
// trigger refetch to show offline banner
$timeout(function () { Client.getStatus(function () {}); }, 5000);
});
}
};
$scope.isActive = function (url) {
if (!$route.current) return false;
return $route.current.$$route.originalPath.indexOf(url) === 0;