mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-25 12:44:07 -08:00
fix(n8n Form Trigger Node): Execution from canvas (#10132)
This commit is contained in:
parent
278edd6010
commit
b07c5e2011
|
@ -67,16 +67,19 @@ import { useProjectsStore } from '@/stores/projects.store';
|
||||||
import { useTagsStore } from '@/stores/tags.store';
|
import { useTagsStore } from '@/stores/tags.store';
|
||||||
import useWorkflowsEEStore from '@/stores/workflows.ee.store';
|
import useWorkflowsEEStore from '@/stores/workflows.ee.store';
|
||||||
|
|
||||||
|
type ResolveParameterOptions = {
|
||||||
|
targetItem?: TargetItem;
|
||||||
|
inputNodeName?: string;
|
||||||
|
inputRunIndex?: number;
|
||||||
|
inputBranchIndex?: number;
|
||||||
|
additionalKeys?: IWorkflowDataProxyAdditionalKeys;
|
||||||
|
isForCredential?: boolean;
|
||||||
|
contextNodeName?: string;
|
||||||
|
};
|
||||||
|
|
||||||
export function resolveParameter<T = IDataObject>(
|
export function resolveParameter<T = IDataObject>(
|
||||||
parameter: NodeParameterValue | INodeParameters | NodeParameterValue[] | INodeParameters[],
|
parameter: NodeParameterValue | INodeParameters | NodeParameterValue[] | INodeParameters[],
|
||||||
opts: {
|
opts: ResolveParameterOptions = {},
|
||||||
targetItem?: TargetItem;
|
|
||||||
inputNodeName?: string;
|
|
||||||
inputRunIndex?: number;
|
|
||||||
inputBranchIndex?: number;
|
|
||||||
additionalKeys?: IWorkflowDataProxyAdditionalKeys;
|
|
||||||
isForCredential?: boolean;
|
|
||||||
} = {},
|
|
||||||
): T | null {
|
): T | null {
|
||||||
let itemIndex = opts?.targetItem?.itemIndex || 0;
|
let itemIndex = opts?.targetItem?.itemIndex || 0;
|
||||||
|
|
||||||
|
@ -117,7 +120,9 @@ export function resolveParameter<T = IDataObject>(
|
||||||
}
|
}
|
||||||
|
|
||||||
const inputName = NodeConnectionType.Main;
|
const inputName = NodeConnectionType.Main;
|
||||||
const activeNode = useNDVStore().activeNode;
|
|
||||||
|
const activeNode =
|
||||||
|
useNDVStore().activeNode ?? useWorkflowsStore().getNodeByName(opts.contextNodeName || '');
|
||||||
let contextNode = activeNode;
|
let contextNode = activeNode;
|
||||||
|
|
||||||
if (activeNode) {
|
if (activeNode) {
|
||||||
|
@ -638,6 +643,7 @@ export function useWorkflowHelpers(options: { router: ReturnType<typeof useRoute
|
||||||
webhookData: IWebhookDescription,
|
webhookData: IWebhookDescription,
|
||||||
key: string,
|
key: string,
|
||||||
stringify = true,
|
stringify = true,
|
||||||
|
nodeName?: string,
|
||||||
): string {
|
): string {
|
||||||
if (webhookData[key] === undefined) {
|
if (webhookData[key] === undefined) {
|
||||||
return 'empty';
|
return 'empty';
|
||||||
|
@ -646,7 +652,7 @@ export function useWorkflowHelpers(options: { router: ReturnType<typeof useRoute
|
||||||
return resolveExpression(
|
return resolveExpression(
|
||||||
webhookData[key] as string,
|
webhookData[key] as string,
|
||||||
undefined,
|
undefined,
|
||||||
undefined,
|
{ contextNodeName: nodeName },
|
||||||
stringify,
|
stringify,
|
||||||
) as string;
|
) as string;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
@ -672,9 +678,14 @@ export function useWorkflowHelpers(options: { router: ReturnType<typeof useRoute
|
||||||
}
|
}
|
||||||
|
|
||||||
const workflowId = workflowsStore.workflowId;
|
const workflowId = workflowsStore.workflowId;
|
||||||
const path = getWebhookExpressionValue(webhookData, 'path');
|
const path = getWebhookExpressionValue(webhookData, 'path', true, node.name);
|
||||||
const isFullPath =
|
const isFullPath =
|
||||||
(getWebhookExpressionValue(webhookData, 'isFullPath') as unknown as boolean) || false;
|
(getWebhookExpressionValue(
|
||||||
|
webhookData,
|
||||||
|
'isFullPath',
|
||||||
|
true,
|
||||||
|
node.name,
|
||||||
|
) as unknown as boolean) || false;
|
||||||
|
|
||||||
return NodeHelpers.getNodeWebhookUrl(baseUrl, workflowId, node, path, isFullPath);
|
return NodeHelpers.getNodeWebhookUrl(baseUrl, workflowId, node, path, isFullPath);
|
||||||
}
|
}
|
||||||
|
@ -682,15 +693,7 @@ export function useWorkflowHelpers(options: { router: ReturnType<typeof useRoute
|
||||||
function resolveExpression(
|
function resolveExpression(
|
||||||
expression: string,
|
expression: string,
|
||||||
siblingParameters: INodeParameters = {},
|
siblingParameters: INodeParameters = {},
|
||||||
opts: {
|
opts: ResolveParameterOptions & { c?: number } = {},
|
||||||
targetItem?: TargetItem;
|
|
||||||
inputNodeName?: string;
|
|
||||||
inputRunIndex?: number;
|
|
||||||
inputBranchIndex?: number;
|
|
||||||
c?: number;
|
|
||||||
additionalKeys?: IWorkflowDataProxyAdditionalKeys;
|
|
||||||
isForCredential?: boolean;
|
|
||||||
} = {},
|
|
||||||
stringifyObject = true,
|
stringifyObject = true,
|
||||||
) {
|
) {
|
||||||
const parameters = {
|
const parameters = {
|
||||||
|
|
Loading…
Reference in a new issue