Fix display of start/stop button

This commit is contained in:
Girish Ramakrishnan
2019-12-16 16:27:24 -08:00
parent b67c09a4c1
commit 119969634e
2 changed files with 16 additions and 3 deletions

View File

@@ -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);