feat(n8n Form Trigger Node): New node (#7130)

Github issue / Community forum post (link here to close automatically):

based on https://github.com/joffcom/n8n-nodes-form-trigger

---------

Co-authored-by: Giulio Andreini <g.andreini@gmail.com>
This commit is contained in:
Michael Kret
2023-10-17 07:09:30 +03:00
committed by GitHub
parent 869b8f14ca
commit 3ddc176dfa
26 changed files with 1328 additions and 32 deletions

View File

@@ -3,7 +3,12 @@ import { mapStores } from 'pinia';
import type { IExecutionPushResponse, IExecutionResponse, IStartRunData } from '@/Interface';
import type { IRunData, IRunExecutionData, ITaskData, IWorkflowBase } from 'n8n-workflow';
import { NodeHelpers, NodeConnectionType, TelemetryHelpers } from 'n8n-workflow';
import {
NodeHelpers,
NodeConnectionType,
TelemetryHelpers,
FORM_TRIGGER_PATH_IDENTIFIER,
} from 'n8n-workflow';
import { externalHooks } from '@/mixins/externalHooks';
import { workflowHelpers } from '@/mixins/workflowHelpers';
@@ -13,6 +18,8 @@ import { useTitleChange } from '@/composables/useTitleChange';
import { useUIStore } from '@/stores/ui.store';
import { useWorkflowsStore } from '@/stores/workflows.store';
import { useRootStore } from '@/stores/n8nRoot.store';
import { FORM_TRIGGER_NODE_TYPE } from '../constants';
import { openPopUpWindow } from '@/utils/executionUtils';
export const workflowRun = defineComponent({
mixins: [externalHooks, workflowHelpers],
@@ -259,6 +266,27 @@ export const workflowRun = defineComponent({
const runWorkflowApiResponse = await this.runWorkflowApi(startRunData);
if (runWorkflowApiResponse.waitingForWebhook) {
for (const node of workflowData.nodes) {
if (node.type !== FORM_TRIGGER_NODE_TYPE) {
continue;
}
if (
options.destinationNode &&
options.destinationNode !== node.name &&
!directParentNodes.includes(node.name)
) {
continue;
}
if (node.name === options.destinationNode || !node.disabled) {
const testUrl = `${this.rootStore.getWebhookTestUrl}/${node.webhookId}/${FORM_TRIGGER_PATH_IDENTIFIER}`;
openPopUpWindow(testUrl);
}
}
}
await this.$externalHooks().run('workflowRun.runWorkflow', {
nodeName: options.destinationNode,
source: options.source,