Skip to content

Commit

Permalink
fix(editor): Show correct status on canceled executions
Browse files Browse the repository at this point in the history
  • Loading branch information
netroy committed Mar 29, 2023
1 parent be373bb commit 06b8468
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 23 deletions.
1 change: 1 addition & 0 deletions packages/editor-ui/src/components/ExecutionFilter.vue
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ const vModel = reactive(
const statuses = computed(() => [
{ id: 'all', name: locale.baseText('executionsList.anyStatus') },
{ id: 'error', name: locale.baseText('executionsList.error') },
{ id: 'canceled', name: locale.baseText('executionsList.canceled') },
{ id: 'running', name: locale.baseText('executionsList.running') },
{ id: 'success', name: locale.baseText('executionsList.success') },
{ id: 'waiting', name: locale.baseText('executionsList.waiting') },
Expand Down
4 changes: 4 additions & 0 deletions packages/editor-ui/src/components/ExecutionsList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -779,6 +779,8 @@ export default mixins(externalHooks, genericHelpers, executionHelpers, restApi,
if (status === 'waiting') {
text = this.$locale.baseText('executionsList.waiting');
} else if (status === 'canceled') {
text = this.$locale.baseText('executionsList.canceled');
} else if (status === 'crashed') {
text = this.$locale.baseText('executionsList.error');
} else if (status === 'new') {
Expand All @@ -801,6 +803,8 @@ export default mixins(externalHooks, genericHelpers, executionHelpers, restApi,
if (status === 'waiting') {
path = 'executionsList.statusWaiting';
} else if (status === 'canceled') {
path = 'executionsList.statusCanceled';
} else if (status === 'crashed') {
path = 'executionsList.statusText';
} else if (status === 'new') {
Expand Down
35 changes: 12 additions & 23 deletions packages/editor-ui/src/mixins/executionsHelpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,34 +50,23 @@ export const executionHelpers = mixins(genericHelpers).extend({
) {
status.name = 'running';
status.label = this.$locale.baseText('executionsList.running');
if (execution.startedAt) {
status.runningTime = this.displayTimer(
new Date().getTime() - new Date(execution.startedAt).getTime(),
true,
);
}
} else if (execution.status === 'success' || execution.finished) {
status.name = 'success';
status.label = this.$locale.baseText('executionsList.succeeded');
if (execution.stoppedAt) {
status.runningTime = this.displayTimer(
new Date(execution.stoppedAt).getTime() - new Date(execution.startedAt).getTime(),
true,
);
}
} else if (
execution.status === 'failed' ||
execution.status === 'crashed' ||
execution.stoppedAt !== null
) {
} else if (execution.status === 'failed' || execution.status === 'crashed') {
status.name = 'error';
status.label = this.$locale.baseText('executionsList.error');
if (execution.stoppedAt) {
status.runningTime = this.displayTimer(
new Date(execution.stoppedAt).getTime() - new Date(execution.startedAt).getTime(),
true,
);
}
} else if (execution.status === 'canceled') {
status.label = this.$locale.baseText('executionsList.canceled');
}

if (!execution.status) execution.status = 'unknown';

if (execution.startedAt) {
status.runningTime = this.displayTimer(
execution.stoppedAt?.getTime() ?? Date.now() - execution.startedAt.getTime(),
true,
);
}

return status;
Expand Down
2 changes: 2 additions & 0 deletions packages/editor-ui/src/plugins/i18n/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,7 @@
"executionsList.allWorkflows": "All Workflows",
"executionsList.anyStatus": "Any Status",
"executionsList.autoRefresh": "Auto refresh",
"executionsList.canceled": "Canceled",
"executionsList.confirmMessage.cancelButtonText": "",
"executionsList.confirmMessage.confirmButtonText": "Yes, delete",
"executionsList.confirmMessage.headline": "Delete Executions?",
Expand Down Expand Up @@ -496,6 +497,7 @@
"executionsList.started": "{date} at {time}",
"executionsList.id": "Execution ID",
"executionsList.status": "Status",
"executionsList.statusCanceled": "Canceled",
"executionsList.statusText": "{status} in {time}",
"executionsList.statusRunning": "{status} for {time}",
"executionsList.statusWaiting": "{status} until {time}",
Expand Down

0 comments on commit 06b8468

Please sign in to comment.