feat(core): Improve handling of manual executions with wait nodes (#11750)

Co-authored-by: Michael Kret <michael.k@radency.com>
This commit is contained in:
कारतोफ्फेलस्क्रिप्ट™
2024-11-18 12:58:26 +01:00
committed by GitHub
parent d5ba1a059b
commit 61696c3db3
21 changed files with 325 additions and 402 deletions

View File

@@ -6,7 +6,7 @@ import {
type IPinData,
type IRunData,
} from 'n8n-workflow';
import type { ExecutionFilterType, ExecutionsQueryFilter } from '@/Interface';
import type { ExecutionFilterType, ExecutionsQueryFilter, INodeUi } from '@/Interface';
import { isEmpty } from '@/utils/typesUtils';
import { FORM_NODE_TYPE, FORM_TRIGGER_NODE_TYPE } from '../constants';
import { useWorkflowsStore } from '@/stores/workflows.store';
@@ -136,18 +136,17 @@ export function displayForm({
}
}
export const waitingNodeTooltip = () => {
export const waitingNodeTooltip = (node: INodeUi | null | undefined) => {
if (!node) return '';
try {
const lastNode =
useWorkflowsStore().workflowExecutionData?.data?.executionData?.nodeExecutionStack[0]?.node;
const resume = lastNode?.parameters?.resume;
const resume = node?.parameters?.resume;
if (resume) {
if (!['webhook', 'form'].includes(resume as string)) {
return i18n.baseText('ndv.output.waitNodeWaiting');
}
const { webhookSuffix } = (lastNode.parameters.options ?? {}) as { webhookSuffix: string };
const { webhookSuffix } = (node.parameters.options ?? {}) as { webhookSuffix: string };
const suffix = webhookSuffix && typeof webhookSuffix !== 'object' ? `/${webhookSuffix}` : '';
let message = '';
@@ -168,13 +167,13 @@ export const waitingNodeTooltip = () => {
}
}
if (lastNode?.type === FORM_NODE_TYPE) {
if (node?.type === FORM_NODE_TYPE) {
const message = i18n.baseText('ndv.output.waitNodeWaitingForFormSubmission');
const resumeUrl = `${useRootStore().formWaitingUrl}/${useWorkflowsStore().activeExecutionId}`;
return `${message}<a href="${resumeUrl}" target="_blank">${resumeUrl}</a>`;
}
if (lastNode?.parameters.operation === SEND_AND_WAIT_OPERATION) {
if (node?.parameters.operation === SEND_AND_WAIT_OPERATION) {
return i18n.baseText('ndv.output.sendAndWaitWaitingApproval');
}
} catch (error) {