From d7a60611e2531cf11947f5a014b0b2554282e659 Mon Sep 17 00:00:00 2001 From: Michael Kret Date: Wed, 18 Sep 2024 09:27:34 +0300 Subject: [PATCH] setWorkflowExecutionRunData fix --- packages/editor-ui/src/components/Node.vue | 2 +- packages/editor-ui/src/composables/useCanvasMapping.ts | 3 ++- packages/editor-ui/src/composables/useRunWorkflow.ts | 10 ++++++---- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/packages/editor-ui/src/components/Node.vue b/packages/editor-ui/src/components/Node.vue index 7c99fad935..a12a9478ac 100644 --- a/packages/editor-ui/src/components/Node.vue +++ b/packages/editor-ui/src/components/Node.vue @@ -321,7 +321,7 @@ const nodeTitle = computed(() => { const waiting = computed(() => { const workflowExecution = workflowsStore.getWorkflowExecution as ExecutionSummary; - if (workflowExecution?.waitTill) { + if (workflowExecution?.waitTill && !workflowExecution?.finished) { const lastNodeExecuted = get(workflowExecution, 'data.resultData.lastNodeExecuted'); if (props.name === lastNodeExecuted) { const node = props.workflow.getNode(lastNodeExecuted); diff --git a/packages/editor-ui/src/composables/useCanvasMapping.ts b/packages/editor-ui/src/composables/useCanvasMapping.ts index 2561dde544..bd4aadf3b1 100644 --- a/packages/editor-ui/src/composables/useCanvasMapping.ts +++ b/packages/editor-ui/src/composables/useCanvasMapping.ts @@ -325,7 +325,8 @@ export function useCanvasMapping({ if (workflowExecution && lastNodeExecuted && isExecutionSummary(workflowExecution)) { if ( node.name === workflowExecution.data?.resultData?.lastNodeExecuted && - workflowExecution.waitTill + workflowExecution?.waitTill && + !workflowExecution?.finished ) { const waitDate = new Date(workflowExecution.waitTill); diff --git a/packages/editor-ui/src/composables/useRunWorkflow.ts b/packages/editor-ui/src/composables/useRunWorkflow.ts index 1beb6f025e..2d1524715e 100644 --- a/packages/editor-ui/src/composables/useRunWorkflow.ts +++ b/packages/editor-ui/src/composables/useRunWorkflow.ts @@ -345,24 +345,27 @@ export function useRunWorkflow(useRunWorkflowOpts: { router: ReturnType => { return await new Promise((resolve) => { const interval = setInterval(async () => { - const execution = await workflowsStore.getExecution(executionId as string); + const execution = await workflowsStore.getExecution((executionId as string) || ''); + localStorage.removeItem(FORM_RELOAD); if (!execution || workflowsStore.workflowExecutionData === null) { clearInterval(interval); resolve(); return; } - if (execution.finished || ['error', 'canceled', 'crashed'].includes(execution.status)) { workflowsStore.setWorkflowExecutionData(execution); nodeHelpers.updateNodesExecutionIssues(); + uiStore.removeActiveAction('workflowRunning'); clearInterval(interval); resolve(); return; } - if (execution.data) { + if (execution.data?.waitTill) { workflowsStore.setWorkflowExecutionRunData(execution.data); + } else { + console.log(execution); } if (execution.status === 'waiting') { @@ -373,7 +376,6 @@ export function useRunWorkflow(useRunWorkflowOpts: { router: ReturnType