diff --git a/src/js/index.js b/src/js/index.js index 1069e1993..c3377eed8 100644 --- a/src/js/index.js +++ b/src/js/index.js @@ -192,11 +192,11 @@ app.filter('selectedStateFilter', ['Client', function (Client) { return apps.filter(function (app) { if (!selectedState || !selectedState.state) return true; - if (selectedState.state === 'running') return app.runState === 'running' && app.health === 'healthy' && app.installationState === 'installed'; - if (selectedState.state === 'stopped') return app.runState === 'stopped'; + if (selectedState.state === 'running') return app.runState === RSTATES.RUNNING && app.health === HSTATES.HEALTHY && app.installationState === ISTATES.INSTALLED; + if (selectedState.state === 'stopped') return app.runState === RSTATES.STOPPED; if (selectedState.state === 'update_available') return !!(Client.getConfig().update[app.id] && Client.getConfig().update[app.id].manifest.version && Client.getConfig().update[app.id].manifest.version !== app.manifest.version); - return app.runState === 'running' && (app.health !== 'healthy' || app.installationState !== 'installed'); // not responding + return app.runState === RSTATES.RUNNING && (app.health !== HSTATES.HEALTHY || app.installationState !== ISTATES.INSTALLED); // not responding }); }; }]); @@ -309,12 +309,12 @@ app.filter('installationStateLabel', function () { case ISTATES.INSTALLED: { if (app.debugMode) { return 'Recovery Mode'; - } else if (app.runState === 'running') { + } else if (app.runState === RSTATES.RUNNING) { if (!app.health) return 'Starting...'; // no data yet if (app.type === APP_TYPES.LINK) return ''; if (app.health === HSTATES.HEALTHY) return 'Running'; return 'Not responding'; // dead/exit/unhealthy - } else if (app.runState === 'stopped') return 'Stopped'; + } else if (app.runState === RSTATES.STOPPED) return 'Stopped'; else return app.runState; } default: return app.installationState; diff --git a/src/views/apps.js b/src/views/apps.js index 3d8f693b7..b2073b9d4 100644 --- a/src/views/apps.js +++ b/src/views/apps.js @@ -81,23 +81,24 @@ angular.module('Application').controller('AppsController', ['$scope', '$translat $event.originalEvent.preventDefault(); } - if (app.installationState === ISTATES.ERROR) { - if ($scope.isOperator(app)) $scope.showAppConfigure(app, 'repair'); - + if (app.installationState !== ISTATES.INSTALLED) { + if (app.installationState === ISTATES.ERROR && $scope.isOperator(app)) $scope.showAppConfigure(app, 'repair'); return stopEvent(); - } else if (app.installationState === ISTATES.INSTALLED) { - // app.health can also be null to indicate insufficient data - if (app.runState === RSTATES.STOPPED) return stopEvent(); + } - if (app.health === HSTATES.UNHEALTHY || app.health === HSTATES.ERROR || app.health === HSTATES.DEAD) { - if ($scope.isOperator(app)) $scope.showAppConfigure(app, 'repair'); - return stopEvent(); - } + // app.health can also be null to indicate insufficient data + if (!app.health) return stopEvent(); + if (app.runState === RSTATES.STOPPED) return stopEvent(); + if (app.runState === RSTATES.STOPPED) return stopEvent(); - if (app.pendingPostInstallConfirmation) { - $scope.appPostInstallConfirm.show(app); - return stopEvent(); - } + if (app.health === HSTATES.UNHEALTHY || app.health === HSTATES.ERROR || app.health === HSTATES.DEAD) { + if ($scope.isOperator(app)) $scope.showAppConfigure(app, 'repair'); + return stopEvent(); + } + + if (app.pendingPostInstallConfirmation) { + $scope.appPostInstallConfirm.show(app); + return stopEvent(); } };