feat(editor): Execute sub-workflow UX and copy updates (no-changelog) (#12834)

This commit is contained in:
Milorad FIlipović
2025-01-28 11:33:23 +01:00
committed by GitHub
parent 13652c5ee2
commit de49c23971
18 changed files with 539 additions and 46 deletions

View File

@@ -1,4 +1,3 @@
import { loadWorkflowInputMappings } from 'n8n-nodes-base/dist/utils/workflowInputsResourceMapping/GenericFunctions';
import type {
INodeTypeBaseDescription,
ISupplyDataFunctions,
@@ -7,6 +6,7 @@ import type {
INodeTypeDescription,
} from 'n8n-workflow';
import { localResourceMapping } from './methods';
import { WorkflowToolService } from './utils/WorkflowToolService';
import { versionDescription } from './versionDescription';
@@ -21,9 +21,7 @@ export class ToolWorkflowV2 implements INodeType {
}
methods = {
localResourceMapping: {
loadWorkflowInputMappings,
},
localResourceMapping,
};
async supplyData(this: ISupplyDataFunctions, itemIndex: number): Promise<SupplyData> {

View File

@@ -0,0 +1 @@
export * as localResourceMapping from './localResourceMapping';

View File

@@ -0,0 +1,24 @@
import { loadWorkflowInputMappings } from 'n8n-nodes-base/dist/utils/workflowInputsResourceMapping/GenericFunctions';
import type { ILocalLoadOptionsFunctions, ResourceMapperFields } from 'n8n-workflow';
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-workflows trigger</a>`
: 'sub-workflows trigger';
switch (dataMode) {
case 'passthrough':
emptyFieldsNotice = `This sub-workflow will consume all input data passed to it. Define specific expected input in the ${subworkflowLink}.`;
break;
default:
emptyFieldsNotice = `This sub-workflow will not receive any input when called by your AI node. Define your expected input in the ${subworkflowLink}.`;
break;
}
}
return { fields, emptyFieldsNotice };
}

View File

@@ -107,7 +107,7 @@ export const versionDescription: INodeTypeDescription = {
typeOptions: {
loadOptionsDependsOn: ['workflowId.value'],
resourceMapper: {
localResourceMapperMethod: 'loadWorkflowInputMappings',
localResourceMapperMethod: 'loadSubWorkflowInputs',
valuesLabel: 'Workflow Inputs',
mode: 'map',
fieldWords: {