Skip to content

Commit

Permalink
fix(editor): Show correct status on canceled executions (n8n-io#5813)
Browse files Browse the repository at this point in the history
Co-authored-by: Milorad Filipovic <[email protected]>
  • Loading branch information
2 people authored and believe-Mahesh committed Apr 4, 2023
1 parent b46eb38 commit 0773dde
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 26 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
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,7 @@
<execution-time :start-time="execution.startedAt" />
</n8n-text>
<n8n-text
v-else-if="
executionUIDetails.name !== 'waiting' && executionUIDetails.name !== 'unknown'
"
v-else-if="executionUIDetails.runningTime !== ''"
:color="isActive ? 'text-dark' : 'text-base'"
size="small"
>
Expand Down
38 changes: 15 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,26 @@ 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 && execution.stoppedAt) {
const stoppedAt = execution.stoppedAt
? new Date(execution.stoppedAt).getTime()
: Date.now();
status.runningTime = this.displayTimer(
stoppedAt - new Date(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 0773dde

Please sign in to comment.