diff --git a/src/js/terminal.js b/src/js/terminal.js index c2dc4375c..3b722d233 100644 --- a/src/js/terminal.js +++ b/src/js/terminal.js @@ -3,7 +3,7 @@ /* global angular */ /* global $ */ /* global Terminal */ -/* global RSTATES */ +/* global RSTATES,ISTATES */ // create main application module var app = angular.module('Application', ['angular-md5', 'ui-notification']); @@ -123,13 +123,15 @@ app.controller('TerminalController', ['$scope', '$timeout', '$location', 'Client $scope.restartApp = function () { $scope.restartAppBusy = true; + $scope.appBusy = true; + var appId = $scope.selected.value; function waitUntilStopped(callback) { refreshApp(appId, function (error, result) { if (error) return callback(error); - if (result.runState === RSTATES.STOPPED) return callback(); + if (result.installationState === ISTATES.INSTALLED && result.runState === RSTATES.STOPPED) return callback(); setTimeout(waitUntilStopped.bind(null, callback), 2000); }); } @@ -138,12 +140,13 @@ app.controller('TerminalController', ['$scope', '$timeout', '$location', 'Client if (error) console.error('Failed to stop app.', error); waitUntilStopped(function (error) { - if (error) return console.error('Failed to get app status.', error); + if (error) console.error('Failed to get app status.', error); Client.startApp(appId, function (error) { if (error) console.error('Failed to start app.', error); $scope.restartAppBusy = false; + $scope.appBusy = false; }); }); }); @@ -234,13 +237,6 @@ app.controller('TerminalController', ['$scope', '$timeout', '$location', 'Client var result = $scope.selectedAppInfo; - // we expect this to be called _after_ a reconfigure was issued - if (result.installationState === 'installed') { - $scope.appBusy = false; - } else if (result.installationState !== 'error') { - $scope.appBusy = true; - } - $scope.schedulerTasks = result.manifest.addons.scheduler ? Object.keys(result.manifest.addons.scheduler).map(function (k) { return { name: k, command: result.manifest.addons.scheduler[k].command }; }) : []; $scope.terminal = new Terminal(); diff --git a/src/terminal.html b/src/terminal.html index a0a1ffd48..6728d5a0c 100644 --- a/src/terminal.html +++ b/src/terminal.html @@ -129,7 +129,7 @@
-
- MySQL - Postgres - MongoDB - Redis + + + + - Restart - Upload to /tmp - Uploading... - Download - Pause - Resume + + + + + +

  + Restarting app... Restarting app in paused mode... - App is being reconfigured... - Waiting for app to start... + App is being resumed... App is being installed...