mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-18 10:31:15 +00:00
feat(editor): Execute sub-workflow UX and copy updates (no-changelog) (#12834)
This commit is contained in:
committed by
GitHub
parent
13652c5ee2
commit
de49c23971
@@ -11,7 +11,7 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
"alias": ["n8n"],
|
||||
"alias": ["n8n", "call", "sub", "workflow", "sub-workflow", "subworkflow"],
|
||||
"subcategories": {
|
||||
"Core Nodes": ["Helpers", "Flow"]
|
||||
}
|
||||
|
||||
@@ -8,14 +8,12 @@ import type {
|
||||
} from 'n8n-workflow';
|
||||
|
||||
import { getWorkflowInfo } from './GenericFunctions';
|
||||
import { localResourceMapping } from './methods';
|
||||
import { generatePairedItemData } from '../../../utils/utilities';
|
||||
import {
|
||||
getCurrentWorkflowInputData,
|
||||
loadWorkflowInputMappings,
|
||||
} from '../../../utils/workflowInputsResourceMapping/GenericFunctions';
|
||||
import { getCurrentWorkflowInputData } from '../../../utils/workflowInputsResourceMapping/GenericFunctions';
|
||||
export class ExecuteWorkflow implements INodeType {
|
||||
description: INodeTypeDescription = {
|
||||
displayName: 'Execute Workflow',
|
||||
displayName: 'Execute Sub-workflow',
|
||||
name: 'executeWorkflow',
|
||||
icon: 'fa:sign-in-alt',
|
||||
iconColor: 'orange-red',
|
||||
@@ -38,7 +36,7 @@ export class ExecuteWorkflow implements INodeType {
|
||||
default: 'call_workflow',
|
||||
options: [
|
||||
{
|
||||
name: 'Call Another Workflow',
|
||||
name: 'Execute a Sub-Workflow',
|
||||
value: 'call_workflow',
|
||||
},
|
||||
],
|
||||
@@ -210,7 +208,7 @@ export class ExecuteWorkflow implements INodeType {
|
||||
typeOptions: {
|
||||
loadOptionsDependsOn: ['workflowId.value'],
|
||||
resourceMapper: {
|
||||
localResourceMapperMethod: 'loadWorkflowInputMappings',
|
||||
localResourceMapperMethod: 'loadSubWorkflowInputs',
|
||||
valuesLabel: 'Workflow Inputs',
|
||||
mode: 'map',
|
||||
fieldWords: {
|
||||
@@ -275,9 +273,7 @@ export class ExecuteWorkflow implements INodeType {
|
||||
};
|
||||
|
||||
methods = {
|
||||
localResourceMapping: {
|
||||
loadWorkflowInputMappings,
|
||||
},
|
||||
localResourceMapping,
|
||||
};
|
||||
|
||||
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
export * as localResourceMapping from './localResourceMapping';
|
||||
@@ -0,0 +1,25 @@
|
||||
import type { ILocalLoadOptionsFunctions, ResourceMapperFields } from 'n8n-workflow';
|
||||
|
||||
import { loadWorkflowInputMappings } from '@utils/workflowInputsResourceMapping/GenericFunctions';
|
||||
|
||||
export async function loadSubWorkflowInputs(
|
||||
this: ILocalLoadOptionsFunctions,
|
||||
): Promise<ResourceMapperFields> {
|
||||
const { fields, dataMode, subworkflowInfo } = await loadWorkflowInputMappings.bind(this)();
|
||||
let emptyFieldsNotice: string | undefined;
|
||||
if (fields.length === 0) {
|
||||
const subworkflowLink = subworkflowInfo?.id
|
||||
? `<a href="/workflow/${subworkflowInfo?.id}" target="_blank">sub-workflow’s trigger</a>`
|
||||
: 'sub-workflow’s trigger';
|
||||
|
||||
switch (dataMode) {
|
||||
case 'passthrough':
|
||||
emptyFieldsNotice = `This sub-workflow will consume all input data passed to it. You can define specific expected input in the ${subworkflowLink}.`;
|
||||
break;
|
||||
default:
|
||||
emptyFieldsNotice = `The sub-workflow isn't set up to accept any inputs. Change this in the ${subworkflowLink}.`;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return { fields, emptyFieldsNotice };
|
||||
}
|
||||
Reference in New Issue
Block a user