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

@@ -30,14 +30,15 @@ export class ExecuteWorkflowTrigger implements INodeType {
eventTriggerDescription: '',
maxNodes: 1,
defaults: {
name: 'Workflow Input Trigger',
name: 'When Executed by Another Workflow',
color: '#ff6d5a',
},
inputs: [],
outputs: [NodeConnectionType.Main],
hints: [
{
message: 'Please make sure to define your input fields.',
message:
"This workflow isn't set to accept any input data. Fill out the workflow input schema or change the workflow to accept any data passed to it.",
// This condition checks if we have no input fields, which gets a bit awkward:
// For WORKFLOW_INPUTS: keys() only contains `VALUES` if at least one value is provided
// For JSON_EXAMPLE: We remove all whitespace and check if we're left with an empty object. Note that we already error if the example is not valid JSON
@@ -58,8 +59,8 @@ export class ExecuteWorkflowTrigger implements INodeType {
{
name: 'Workflow Call',
value: 'worklfow_call',
description: 'When called by another workflow using Execute Workflow Trigger',
action: 'When Called by Another Workflow',
description: 'When executed by another workflow using Execute Workflow Trigger',
action: 'When executed by Another Workflow',
},
],
default: 'worklfow_call',
@@ -142,7 +143,7 @@ export class ExecuteWorkflowTrigger implements INodeType {
},
},
{
displayName: 'Workflow Inputs',
displayName: 'Workflow Input Schema',
name: WORKFLOW_INPUTS,
placeholder: 'Add field',
type: 'fixedCollection',
@@ -168,7 +169,8 @@ export class ExecuteWorkflowTrigger implements INodeType {
type: 'string',
default: '',
placeholder: 'e.g. fieldName',
description: 'Name of the field',
description:
'A unique name for this workflow input, used to reference it from another workflows',
required: true,
noDataExpression: true,
},
@@ -176,7 +178,8 @@ export class ExecuteWorkflowTrigger implements INodeType {
displayName: 'Type',
name: 'type',
type: 'options',
description: 'The field value type',
description:
"Expected data type for this input value. Determines how this field's values are stored, validated, and displayed.",
options: TYPE_OPTIONS,
required: true,
default: 'string',
@@ -208,10 +211,10 @@ export class ExecuteWorkflowTrigger implements INodeType {
return [inputData];
} else {
const newParams = getFieldEntries(this);
const newKeys = new Set(newParams.map((x) => x.name));
const newKeys = new Set(newParams.fields.map((x) => x.name));
const itemsInSchema: INodeExecutionData[] = inputData.map((row, index) => ({
json: {
...Object.fromEntries(newParams.map((x) => [x.name, FALLBACK_DEFAULT_VALUE])),
...Object.fromEntries(newParams.fields.map((x) => [x.name, FALLBACK_DEFAULT_VALUE])),
// Need to trim to the expected schema to support legacy Execute Workflow callers passing through all their data
// which we do not want to expose past this node.
..._.pickBy(row.json, (_value, key) => newKeys.has(key)),