diff --git a/src/js/index.js b/src/js/index.js index 10cbe8e5b..50aef2ea9 100644 --- a/src/js/index.js +++ b/src/js/index.js @@ -189,6 +189,12 @@ app.filter('installError', function () { }; }); +app.filter('activeTask', function () { + return function (app) { + return app.taskId !== null; + }; +}); + app.filter('installSuccess', function () { return function (app) { return app.installationState === ISTATES.INSTALLED; @@ -324,6 +330,47 @@ app.filter('installationStateLabel', function() { }; }); +// this appears when task is getting canceled +app.filter('installationStateCancelTask', function() { + return function(app) { + switch (app.installationState) { + case ISTATES.PENDING_INSTALL: return 'installing'; + case ISTATES.PENDING_CLONE: return 'cloning'; + case ISTATES.PENDING_CONFIGURE: return 'configuring'; + case ISTATES.PENDING_UNINSTALL: return 'uninstalling'; + case ISTATES.PENDING_RESTORE: return 'restoring'; + case ISTATES.PENDING_UPDATE: return 'updating'; + case ISTATES.PENDING_BACKUP: return 'backing up'; + case ISTATES.INSTALLED: { + if (app.runState === 'pending_start') return 'starting'; + else if (app.runState === 'pending_stop') return 'stopping'; + } + } + + return app.installationState; + }; +}); + +app.filter('installationStateCancelTooltip', function() { + return function(app) { + switch (app.installationState) { + case ISTATES.PENDING_INSTALL: return 'install'; + case ISTATES.PENDING_CLONE: return 'clone'; + case ISTATES.PENDING_CONFIGURE: return 'configure'; + case ISTATES.PENDING_UNINSTALL: return 'uninstall'; + case ISTATES.PENDING_RESTORE: return 'restore'; + case ISTATES.PENDING_UPDATE: return 'update'; + case ISTATES.PENDING_BACKUP: return 'backup'; + case ISTATES.INSTALLED: { + if (app.runState === 'pending_start') return 'start'; + else if (app.runState === 'pending_stop') return 'stop'; + } + } + + return app.installationState; + }; +}); + app.filter('readyToUpdate', function () { return function (apps) { return apps.every(function (app) { diff --git a/src/views/apps.html b/src/views/apps.html index d1d7c26ce..cc6324d4f 100644 --- a/src/views/apps.html +++ b/src/views/apps.html @@ -457,6 +457,27 @@ + +