From 90b4bfc472ef132d2280b175ae7410dfb8e549b2 Mon Sep 17 00:00:00 2001 From: Michael Kret <88898367+michael-radency@users.noreply.github.com> Date: Thu, 3 Oct 2024 15:09:37 +0300 Subject: [PATCH] fix: Show result of waiting execution on canvas after execution complete (#10815) Co-authored-by: Shireen Missi <94372015+ShireenMissi@users.noreply.github.com> Co-authored-by: Shireen Missi --- .../@n8n/api-types/src/frontend-settings.ts | 1 + packages/cli/src/services/frontend.service.ts | 1 + .../cli/templates/form-trigger.handlebars | 8 + packages/editor-ui/src/Interface.ts | 2 + packages/editor-ui/src/__tests__/defaults.ts | 1 + .../editor-ui/src/components/InputPanel.vue | 9 + packages/editor-ui/src/components/Node.vue | 35 +++- .../src/components/NodeExecuteButton.vue | 4 +- .../editor-ui/src/components/OutputPanel.vue | 6 + packages/editor-ui/src/components/RunData.vue | 11 ++ .../parts/CanvasNodeStatusIcons.vue | 34 +++- .../__tests__/useRunWorkflow.spec.ts | 75 ++++++- .../src/composables/useCanvasMapping.ts | 25 ++- .../src/composables/usePushConnection.ts | 13 -- .../src/composables/useRunWorkflow.ts | 185 ++++++++++++++---- .../src/plugins/i18n/locales/en.json | 5 + packages/editor-ui/src/stores/root.store.ts | 15 +- .../editor-ui/src/stores/settings.store.ts | 1 + .../editor-ui/src/stores/workflows.store.ts | 11 ++ .../utils/__tests__/executionUtils.spec.ts | 10 - .../editor-ui/src/utils/executionUtils.ts | 81 ++++---- packages/editor-ui/src/views/NodeView.v2.vue | 25 ++- packages/editor-ui/src/views/NodeView.vue | 29 ++- packages/nodes-base/nodes/Wait/Wait.node.ts | 8 - 24 files changed, 466 insertions(+), 129 deletions(-) diff --git a/packages/@n8n/api-types/src/frontend-settings.ts b/packages/@n8n/api-types/src/frontend-settings.ts index d50408bc3c..c70826d4d1 100644 --- a/packages/@n8n/api-types/src/frontend-settings.ts +++ b/packages/@n8n/api-types/src/frontend-settings.ts @@ -33,6 +33,7 @@ export interface FrontendSettings { endpointFormWaiting: string; endpointWebhook: string; endpointWebhookTest: string; + endpointWebhookWaiting: string; saveDataErrorExecution: WorkflowSettings.SaveDataExecution; saveDataSuccessExecution: WorkflowSettings.SaveDataExecution; saveManualExecutions: boolean; diff --git a/packages/cli/src/services/frontend.service.ts b/packages/cli/src/services/frontend.service.ts index 600059422a..ea8a135ff2 100644 --- a/packages/cli/src/services/frontend.service.ts +++ b/packages/cli/src/services/frontend.service.ts @@ -88,6 +88,7 @@ export class FrontendService { endpointFormWaiting: this.globalConfig.endpoints.formWaiting, endpointWebhook: this.globalConfig.endpoints.webhook, endpointWebhookTest: this.globalConfig.endpoints.webhookTest, + endpointWebhookWaiting: this.globalConfig.endpoints.webhookWaiting, saveDataErrorExecution: config.getEnv('executions.saveDataOnError'), saveDataSuccessExecution: config.getEnv('executions.saveDataOnSuccess'), saveManualExecutions: config.getEnv('executions.saveDataManualExecutions'), diff --git a/packages/cli/templates/form-trigger.handlebars b/packages/cli/templates/form-trigger.handlebars index 67818629f5..5493a76e7f 100644 --- a/packages/cli/templates/form-trigger.handlebars +++ b/packages/cli/templates/form-trigger.handlebars @@ -735,6 +735,14 @@ } return; + }).then(() => { + window.addEventListener('storage', function(event) { + if (event.key === 'n8n_redirect_to_next_form_test_page' && event.newValue) { + const newUrl = event.newValue; + localStorage.removeItem('n8n_redirect_to_next_form_test_page'); + window.location.replace(newUrl); + } + }); }) .catch(function (error) { console.error('Error:', error); diff --git a/packages/editor-ui/src/Interface.ts b/packages/editor-ui/src/Interface.ts index 972593bceb..21849861ef 100644 --- a/packages/editor-ui/src/Interface.ts +++ b/packages/editor-ui/src/Interface.ts @@ -874,6 +874,7 @@ export interface RootState { endpointFormWaiting: string; endpointWebhook: string; endpointWebhookTest: string; + endpointWebhookWaiting: string; pushConnectionActive: boolean; timezone: string; executionTimeout: number; @@ -905,6 +906,7 @@ export interface IRootState { endpointFormWaiting: string; endpointWebhook: string; endpointWebhookTest: string; + endpointWebhookWaiting: string; executionId: string | null; executingNode: string[]; executionWaitingForWebhook: boolean; diff --git a/packages/editor-ui/src/__tests__/defaults.ts b/packages/editor-ui/src/__tests__/defaults.ts index a8f6f6ca05..6ea31053b3 100644 --- a/packages/editor-ui/src/__tests__/defaults.ts +++ b/packages/editor-ui/src/__tests__/defaults.ts @@ -16,6 +16,7 @@ export const defaultSettings: FrontendSettings = { endpointFormWaiting: '', endpointWebhook: '', endpointWebhookTest: '', + endpointWebhookWaiting: '', enterprise: { sharing: false, ldap: false, diff --git a/packages/editor-ui/src/components/InputPanel.vue b/packages/editor-ui/src/components/InputPanel.vue index 24b7e7f6b2..1cc4da099d 100644 --- a/packages/editor-ui/src/components/InputPanel.vue +++ b/packages/editor-ui/src/components/InputPanel.vue @@ -24,6 +24,7 @@ import InputNodeSelect from './InputNodeSelect.vue'; import NodeExecuteButton from './NodeExecuteButton.vue'; import RunData from './RunData.vue'; import WireMeUp from './WireMeUp.vue'; +import { waitingNodeTooltip } from '@/utils/executionUtils'; type MappingMode = 'debugging' | 'mapping'; @@ -237,6 +238,9 @@ export default defineComponent({ isMultiInputNode(): boolean { return this.activeNodeType !== null && this.activeNodeType.inputs.length > 1; }, + waitingMessage(): string { + return waitingNodeTooltip(); + }, }, watch: { inputMode: { @@ -448,6 +452,11 @@ export default defineComponent({ + + + +