Make more use of app state variables

This commit is contained in:
Johannes Zellner
2022-09-13 11:44:54 +02:00
parent 403a96162b
commit 4046da9368
2 changed files with 20 additions and 19 deletions
+5 -5
View File
@@ -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;