Implement dropdown

This commit is contained in:
Charlie Kolb 2024-11-26 15:59:48 +01:00
parent 7012d9bb9c
commit 90fa0b45ec
No known key found for this signature in database
2 changed files with 24 additions and 4 deletions

View file

@ -22,10 +22,9 @@ export class ExecuteWorkflowTrigger implements INodeType {
eventTriggerDescription: '', eventTriggerDescription: '',
maxNodes: 1, maxNodes: 1,
defaults: { defaults: {
name: 'Execute Workflow Trigger', name: 'Workflow Input Trigger',
color: '#ff6d5a', color: '#ff6d5a',
}, },
inputs: [], inputs: [],
outputs: [NodeConnectionType.Main], outputs: [NodeConnectionType.Main],
properties: [ properties: [
@ -51,6 +50,26 @@ export class ExecuteWorkflowTrigger implements INodeType {
], ],
default: 'worklfow_call', default: 'worklfow_call',
}, },
{
displayName: 'Input Source',
name: 'inputSource',
type: 'options',
options: [
{
// eslint-disable-next-line n8n-nodes-base/node-param-display-name-miscased
name: 'Using fields below',
value: 'fields',
description: 'Provide via UI',
},
{
// eslint-disable-next-line n8n-nodes-base/node-param-display-name-miscased
name: 'Using JSON',
value: 'json',
description: 'Provide via JSON schema',
},
],
default: 'fields',
},
{ {
displayName: 'Workflow Inputs', displayName: 'Workflow Inputs',
name: WORKFLOW_INPUTS, name: WORKFLOW_INPUTS,
@ -63,7 +82,7 @@ export class ExecuteWorkflowTrigger implements INodeType {
sortable: true, sortable: true,
}, },
displayOptions: { displayOptions: {
show: { '@version': [{ _cnd: { gte: 1.1 } }] }, show: { '@version': [{ _cnd: { gte: 1.1 } }], inputSource: ['fields'] },
}, },
default: {}, default: {},
options: [ options: [
@ -78,6 +97,7 @@ export class ExecuteWorkflowTrigger implements INodeType {
default: '', default: '',
placeholder: 'e.g. fieldName', placeholder: 'e.g. fieldName',
description: 'Name of the field', description: 'Name of the field',
noDataExpression: true,
}, },
// { // {
// displayName: 'Type', // displayName: 'Type',

View file

@ -4,7 +4,7 @@ import type { IExecuteFunctions, INode, INodeExecutionData } from 'n8n-workflow'
import { ExecuteWorkflowTrigger } from '../ExecuteWorkflowTrigger.node'; import { ExecuteWorkflowTrigger } from '../ExecuteWorkflowTrigger.node';
describe('ExecuteWorkflowTrigger', () => { describe('ExecuteWorkflowTrigger', () => {
it('should return its input data', async () => { it('should return its input data on V1', async () => {
const mockInputData: INodeExecutionData[] = [ const mockInputData: INodeExecutionData[] = [
{ json: { item: 0, foo: 'bar' } }, { json: { item: 0, foo: 'bar' } },
{ json: { item: 1, foo: 'quz' } }, { json: { item: 1, foo: 'quz' } },