Fix display of start/stop button
This commit is contained in:
+4
-2
@@ -745,8 +745,10 @@
|
||||
<div class="col-md-12">
|
||||
<label class="control-label">Start / Stop</label>
|
||||
<p>Apps can be stopped to conserve server resources. They will continue to be backed up but won't be updated.</p>
|
||||
<button class="btn btn-success pull-right" ng-class="{ 'btn-danger': app.runState === 'running' }" ng-click="console.toggleRunState()" ng-disabled="app.taskId || app.error || console.busyRunState"><i ng-show="console.busyRunState" class="fa fa-circle-notch fa-spin"></i>
|
||||
{{ app.runState === 'running' ? 'Stop App' : 'Start App' }}
|
||||
<button class="btn btn-success pull-right" ng-class="{ 'btn-danger': !console.startButton }" ng-click="console.toggleRunState()
|
||||
" ng-disabled="app.taskId || app.error || console.busyRunState">
|
||||
<i ng-show="app.installationState === 'pending_start' || app.installationState === 'pending_stop'" class="fa fa-circle-notch fa-spin"></i>
|
||||
{{ console.startButton ? 'Start App' : 'Stop App' }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
+12
-1
@@ -657,15 +657,19 @@ angular.module('Application').controller('AppController', ['$scope', '$location'
|
||||
$scope.console = {
|
||||
show: function () {},
|
||||
busyRunState: false,
|
||||
startButton: false,
|
||||
|
||||
toggleRunState: function () {
|
||||
var func = $scope.app.runState === RSTATES.STOPPED ? Client.startApp : Client.stopApp;
|
||||
$scope.console.busyRunState = true;
|
||||
|
||||
func($scope.app.id, function (error) {
|
||||
$scope.console.busyRunState = false;
|
||||
if (error) return Client.error(error);
|
||||
|
||||
$timeout(function () {
|
||||
$scope.console.busyRunState = false;
|
||||
}, 1000);
|
||||
|
||||
refreshApp($scope.app.id);
|
||||
});
|
||||
}
|
||||
@@ -996,6 +1000,13 @@ angular.module('Application').controller('AppController', ['$scope', '$location'
|
||||
|
||||
$scope.app = app;
|
||||
|
||||
// show 'Start App' if app is starting or is stopped
|
||||
if (app.installationState === ISTATES.PENDING_START || app.installationState === ISTATES.PENDING_STOP) {
|
||||
$scope.console.startButton = app.installationState === ISTATES.PENDING_START;
|
||||
} else {
|
||||
$scope.console.startButton = app.runState === RSTATES.STOPPED;
|
||||
}
|
||||
|
||||
if (app.taskId) {
|
||||
Client.getTask(app.taskId, function (error, task) {
|
||||
if (error) return callback(error);
|
||||
|
||||
Reference in New Issue
Block a user