Add cancel action for active app tasks

This commit is contained in:
Girish Ramakrishnan
2019-08-29 14:28:45 -07:00
parent 5387054000
commit 8eee0b809c
3 changed files with 96 additions and 4 deletions

View File

@@ -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) {