diff --git a/src/views/system.html b/src/views/system.html index 0eea4d1b6..0e81a0089 100644 --- a/src/views/system.html +++ b/src/views/system.html @@ -139,7 +139,7 @@
Show Logs - +
diff --git a/src/views/system.js b/src/views/system.js index 010a7cbcc..4c979eadf 100644 --- a/src/views/system.js +++ b/src/views/system.js @@ -3,7 +3,7 @@ /* global angular:false */ /* global $:false */ -angular.module('Application').controller('SystemController', ['$scope', '$location', '$interval', 'Client', function ($scope, $location, $interval, Client) { +angular.module('Application').controller('SystemController', ['$scope', '$location', '$timeout', 'Client', function ($scope, $location, $timeout, Client) { Client.onReady(function () { if (!Client.getUserInfo().isAtLeastAdmin) $location.path('/'); }); $scope.config = Client.getConfig(); @@ -45,14 +45,26 @@ angular.module('Application').controller('SystemController', ['$scope', '$locati $('#rebootModal').modal('show'); }, + waitForReboot: function () { + if (Client.offline) return $scope.reboot.busy = false; // at this point, we are showing the offline banner + + Client.getStatus(function (error, status) { + if (error) return $timeout($scope.reboot.waitForReboot, 5000); + + $scope.reboot.busy = false; + }); + }, + submit: function () { $scope.reboot.busy = true; Client.reboot(function (error) { - $scope.reboot.busy = false; if (error) return Client.error(error); $('#rebootModal').modal('hide'); + + // show "busy" indicator for 5 seconds to show some ui activity + $timeout(function () { $scope.reboot.waitForReboot(); }, 5000); }); } };