Move app start/stop to uninstall

This commit is contained in:
Johannes Zellner
2020-11-16 14:42:02 +01:00
parent 5d2f3d51bf
commit 5435f3f9c1
2 changed files with 33 additions and 33 deletions

View File

@@ -1093,6 +1093,23 @@ angular.module('Application').controller('AppController', ['$scope', '$location'
$scope.uninstall = {
busy: false,
error: {},
busyRunState: false,
startButton: false,
toggleRunState: function () {
var func = $scope.app.runState === RSTATES.STOPPED ? Client.startApp : Client.stopApp;
$scope.uninstall.busyRunState = true;
func($scope.app.id, function (error) {
if (error) return Client.error(error);
refreshApp($scope.app.id, function (error) {
if (error) return Client.error(error);
$timeout(function () { $scope.uninstall.busyRunState = false; }, 1000);
});
});
},
show: function () {
$scope.uninstall.error = {};
@@ -1126,24 +1143,7 @@ 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) {
if (error) return Client.error(error);
refreshApp($scope.app.id, function (error) {
if (error) return Client.error(error);
$timeout(function () { $scope.console.busyRunState = false; }, 1000);
});
});
}
show: function () {}
};
$scope.restore = {
@@ -1518,9 +1518,9 @@ angular.module('Application').controller('AppController', ['$scope', '$location'
// 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;
$scope.uninstall.startButton = app.installationState === ISTATES.PENDING_START;
} else {
$scope.console.startButton = app.runState === RSTATES.STOPPED;
$scope.uninstall.startButton = app.runState === RSTATES.STOPPED;
}
callback();