mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-25 04:34:06 -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 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>(
|
||||
parameter: NodeParameterValue | INodeParameters | NodeParameterValue[] | INodeParameters[],
|
||||
opts: {
|
||||
targetItem?: TargetItem;
|
||||
inputNodeName?: string;
|
||||
inputRunIndex?: number;
|
||||
inputBranchIndex?: number;
|
||||
additionalKeys?: IWorkflowDataProxyAdditionalKeys;
|
||||
isForCredential?: boolean;
|
||||
} = {},
|
||||
opts: ResolveParameterOptions = {},
|
||||
): T | null {
|
||||
let itemIndex = opts?.targetItem?.itemIndex || 0;
|
||||
|
||||
|
@ -117,7 +120,9 @@ export function resolveParameter<T = IDataObject>(
|
|||
}
|
||||
|
||||
const inputName = NodeConnectionType.Main;
|
||||
const activeNode = useNDVStore().activeNode;
|
||||
|
||||
const activeNode =
|
||||
useNDVStore().activeNode ?? useWorkflowsStore().getNodeByName(opts.contextNodeName || '');
|
||||
let contextNode = activeNode;
|
||||
|
||||
if (activeNode) {
|
||||
|
@ -638,6 +643,7 @@ export function useWorkflowHelpers(options: { router: ReturnType<typeof useRoute
|
|||
webhookData: IWebhookDescription,
|
||||
key: string,
|
||||
stringify = true,
|
||||
nodeName?: string,
|
||||
): string {
|
||||
if (webhookData[key] === undefined) {
|
||||
return 'empty';
|
||||
|
@ -646,7 +652,7 @@ export function useWorkflowHelpers(options: { router: ReturnType<typeof useRoute
|
|||
return resolveExpression(
|
||||
webhookData[key] as string,
|
||||
undefined,
|
||||
undefined,
|
||||
{ contextNodeName: nodeName },
|
||||
stringify,
|
||||
) as string;
|
||||
} catch (e) {
|
||||
|
@ -672,9 +678,14 @@ export function useWorkflowHelpers(options: { router: ReturnType<typeof useRoute
|
|||
}
|
||||
|
||||
const workflowId = workflowsStore.workflowId;
|
||||
const path = getWebhookExpressionValue(webhookData, 'path');
|
||||
const path = getWebhookExpressionValue(webhookData, 'path', true, node.name);
|
||||
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);
|
||||
}
|
||||
|
@ -682,15 +693,7 @@ export function useWorkflowHelpers(options: { router: ReturnType<typeof useRoute
|
|||
function resolveExpression(
|
||||
expression: string,
|
||||
siblingParameters: INodeParameters = {},
|
||||
opts: {
|
||||
targetItem?: TargetItem;
|
||||
inputNodeName?: string;
|
||||
inputRunIndex?: number;
|
||||
inputBranchIndex?: number;
|
||||
c?: number;
|
||||
additionalKeys?: IWorkflowDataProxyAdditionalKeys;
|
||||
isForCredential?: boolean;
|
||||
} = {},
|
||||
opts: ResolveParameterOptions & { c?: number } = {},
|
||||
stringifyObject = true,
|
||||
) {
|
||||
const parameters = {
|
||||
|
|
Loading…
Reference in a new issue