Show busy indicator in reboot button
This commit is contained in:
@@ -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);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user