Make stop/start work again

This commit is contained in:
Girish Ramakrishnan
2019-09-23 15:50:41 -07:00
parent 70fae41042
commit 6ac1160bf2
3 changed files with 15 additions and 13 deletions

View File

@@ -667,7 +667,7 @@ angular.module('Application').controller('AppController', ['$scope', '$location'
$scope.debug = {
show: function () {},
appIsRestarting: false,
busyRunState: false,
stopAppTask: function (taskId) {
Client.stopTask(taskId, function (error) {
@@ -676,16 +676,16 @@ angular.module('Application').controller('AppController', ['$scope', '$location'
});
},
restartApp: function () {
$scope.debug.appIsRestarting = true;
toggleRunState: function () {
var func = $scope.app.runState === RSTATES.STOPPED ? Client.startApp : Client.stopApp;
$scope.debug.busyRunState = true;
function done(error) {
if (error) Client.error(error);
$scope.debug.appIsRestarting = false;
}
func($scope.app.id, function (error) {
$scope.debug.busyRunState = false;
if (error) return Client.error(error);
if ($scope.app.runState === RSTATES.STOPPED) Client.startApp($scope.app.id, done);
else Client.restartApp($scope.app.id, done);
refreshApp();
});
}
};