From 0773dde77dd2d1ff0cb9cde4fa2f68eba8ca5383 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E0=A4=95=E0=A4=BE=E0=A4=B0=E0=A4=A4=E0=A5=8B=E0=A4=AB?= =?UTF-8?q?=E0=A5=8D=E0=A4=AB=E0=A5=87=E0=A4=B2=E0=A4=B8=E0=A5=8D=E0=A4=95?= =?UTF-8?q?=E0=A5=8D=E0=A4=B0=E0=A4=BF=E0=A4=AA=E0=A5=8D=E0=A4=9F=E2=84=A2?= Date: Thu, 30 Mar 2023 16:27:40 +0200 Subject: [PATCH] fix(editor): Show correct status on canceled executions (#5813) Co-authored-by: Milorad Filipovic --- .../src/components/ExecutionFilter.vue | 1 + .../src/components/ExecutionsList.vue | 4 ++ .../ExecutionsView/ExecutionCard.vue | 4 +- .../editor-ui/src/mixins/executionsHelpers.ts | 38 ++++++++----------- .../src/plugins/i18n/locales/en.json | 2 + 5 files changed, 23 insertions(+), 26 deletions(-) diff --git a/packages/editor-ui/src/components/ExecutionFilter.vue b/packages/editor-ui/src/components/ExecutionFilter.vue index 5cc1244954827..2b0e0dd87bfb8 100644 --- a/packages/editor-ui/src/components/ExecutionFilter.vue +++ b/packages/editor-ui/src/components/ExecutionFilter.vue @@ -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') }, diff --git a/packages/editor-ui/src/components/ExecutionsList.vue b/packages/editor-ui/src/components/ExecutionsList.vue index b29b7a3abfe1c..992a0f16b9f35 100644 --- a/packages/editor-ui/src/components/ExecutionsList.vue +++ b/packages/editor-ui/src/components/ExecutionsList.vue @@ -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') { @@ -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') { diff --git a/packages/editor-ui/src/components/ExecutionsView/ExecutionCard.vue b/packages/editor-ui/src/components/ExecutionsView/ExecutionCard.vue index a1e0f41f0cdda..8885b44490ac9 100644 --- a/packages/editor-ui/src/components/ExecutionsView/ExecutionCard.vue +++ b/packages/editor-ui/src/components/ExecutionsView/ExecutionCard.vue @@ -38,9 +38,7 @@ diff --git a/packages/editor-ui/src/mixins/executionsHelpers.ts b/packages/editor-ui/src/mixins/executionsHelpers.ts index 2f178330782e6..2887fe7da77fc 100644 --- a/packages/editor-ui/src/mixins/executionsHelpers.ts +++ b/packages/editor-ui/src/mixins/executionsHelpers.ts @@ -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; diff --git a/packages/editor-ui/src/plugins/i18n/locales/en.json b/packages/editor-ui/src/plugins/i18n/locales/en.json index 88b59b0a0cff7..f1262bf647316 100644 --- a/packages/editor-ui/src/plugins/i18n/locales/en.json +++ b/packages/editor-ui/src/plugins/i18n/locales/en.json @@ -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?", @@ -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}",