diff --git a/packages/frontend/editor-ui/src/app/utils/nodeTypes/createFrontendNodeTypes.ts b/packages/frontend/editor-ui/src/app/utils/nodeTypes/createFrontendNodeTypes.ts deleted file mode 100644 index f8f96a379d4..00000000000 --- a/packages/frontend/editor-ui/src/app/utils/nodeTypes/createFrontendNodeTypes.ts +++ /dev/null @@ -1,35 +0,0 @@ -import { ERROR_TRIGGER_NODE_TYPE } from '@/app/constants'; -import type { NodeTypesStore } from '@/app/stores/nodeTypes.store'; -import type { INodeType, INodeTypes } from 'n8n-workflow'; - -export function createFrontendNodeTypes( - nodeTypesStore: Pick, -): INodeTypes { - const nodeTypes: INodeTypes = { - nodeTypes: {}, - init: async (): Promise => {}, - getByNameAndVersion: (nodeType: string, version?: number): INodeType | undefined => { - const nodeTypeDescription = - nodeTypesStore.getNodeType(nodeType, version) ?? - nodeTypesStore.communityNodeType(nodeType)?.nodeDescription ?? - null; - if (nodeTypeDescription === null) { - return undefined; - } - - return { - description: nodeTypeDescription, - // As we do not have the trigger/poll functions available in the frontend - // we use the information available to figure out what are trigger nodes - // @ts-ignore - trigger: - (![ERROR_TRIGGER_NODE_TYPE].includes(nodeType) && - nodeTypeDescription.inputs.length === 0 && - !nodeTypeDescription.webhooks) || - undefined, - }; - }, - } as unknown as INodeTypes; - - return nodeTypes; -} diff --git a/packages/frontend/editor-ui/src/features/ai/instanceAi/workflowSetup/components/WorkflowSetupSectionBody.vue b/packages/frontend/editor-ui/src/features/ai/instanceAi/workflowSetup/components/WorkflowSetupSectionBody.vue index fe2910d14cb..1d76ace5af0 100644 --- a/packages/frontend/editor-ui/src/features/ai/instanceAi/workflowSetup/components/WorkflowSetupSectionBody.vue +++ b/packages/frontend/editor-ui/src/features/ai/instanceAi/workflowSetup/components/WorkflowSetupSectionBody.vue @@ -6,7 +6,6 @@ import NodeCredentials from '@/features/credentials/components/NodeCredentials.v import ParameterInputList from '@/features/ndv/parameters/components/ParameterInputList.vue'; import { useCredentialsStore } from '@/features/credentials/credentials.store'; import { useNodeTypesStore } from '@/app/stores/nodeTypes.store'; -import { createFrontendNodeTypes } from '@/app/utils/nodeTypes/createFrontendNodeTypes'; import useEnvironmentsStore from '@/features/settings/environments.ee/environments.store'; import { ExpressionLocalResolveContextSymbol } from '@/app/constants'; import { Workflow, type IConnections, type INodeProperties } from 'n8n-workflow'; @@ -24,7 +23,6 @@ const i18n = useI18n(); const credentialsStore = useCredentialsStore(); const nodeTypesStore = useNodeTypesStore(); const environmentsStore = useEnvironmentsStore(); -const frontendNodeTypes = createFrontendNodeTypes(nodeTypesStore); const credentialType = computed(() => props.section.credentialType); @@ -99,7 +97,7 @@ const expressionContext = computed(() nodes: [node], connections, active: false, - nodeTypes: frontendNodeTypes, + nodeTypes: nodeTypesStore.getAllNodeTypes(), }); return { diff --git a/packages/frontend/editor-ui/src/features/ai/instanceAi/workflowSetup/composables/useWorkflowSetupApply.test.ts b/packages/frontend/editor-ui/src/features/ai/instanceAi/workflowSetup/composables/useWorkflowSetupApply.test.ts index c7a10053fab..b4a377af02f 100644 --- a/packages/frontend/editor-ui/src/features/ai/instanceAi/workflowSetup/composables/useWorkflowSetupApply.test.ts +++ b/packages/frontend/editor-ui/src/features/ai/instanceAi/workflowSetup/composables/useWorkflowSetupApply.test.ts @@ -87,19 +87,10 @@ describe('useWorkflowSetupApply', () => { await h.applyMachine.apply({ nodeCredentials }); - expect(h.store.confirmAction).toHaveBeenCalledWith( - 'req-1', - true, - undefined, - undefined, - undefined, - undefined, - undefined, - { - action: 'apply', - nodeCredentials, - }, - ); + expect(h.store.confirmAction).toHaveBeenCalledWith('req-1', { + kind: 'setupWorkflowApply', + nodeCredentials, + }); }); it('posts apply confirmation with node parameters', async () => { @@ -108,19 +99,10 @@ describe('useWorkflowSetupApply', () => { await h.applyMachine.apply({ nodeParameters }); - expect(h.store.confirmAction).toHaveBeenCalledWith( - 'req-1', - true, - undefined, - undefined, - undefined, - undefined, - undefined, - { - action: 'apply', - nodeParameters, - }, - ); + expect(h.store.confirmAction).toHaveBeenCalledWith('req-1', { + kind: 'setupWorkflowApply', + nodeParameters, + }); }); it('resets state when posting apply confirmation fails', async () => { @@ -171,13 +153,7 @@ describe('useWorkflowSetupApply', () => { expect(h.store.confirmAction).toHaveBeenCalledWith( 'req-2', - true, - undefined, - undefined, - undefined, - undefined, - undefined, - expect.any(Object), + expect.objectContaining({ kind: 'setupWorkflowApply' }), ); expect(h.store.resolveConfirmation).toHaveBeenCalledWith('req-2', 'approved'); }); @@ -247,7 +223,10 @@ describe('useWorkflowSetupApply', () => { await h.applyMachine.defer(); - expect(h.store.confirmAction).toHaveBeenCalledWith('req-1', false); + expect(h.store.confirmAction).toHaveBeenCalledWith('req-1', { + kind: 'approval', + approved: false, + }); expect(h.applyMachine.terminalState.value).toBe('deferred'); expect(h.store.resolveConfirmation).toHaveBeenCalledWith('req-1', 'deferred'); }); diff --git a/packages/frontend/editor-ui/src/features/ai/instanceAi/workflowSetup/composables/useWorkflowSetupApply.ts b/packages/frontend/editor-ui/src/features/ai/instanceAi/workflowSetup/composables/useWorkflowSetupApply.ts index 89743d52766..db044649f8e 100644 --- a/packages/frontend/editor-ui/src/features/ai/instanceAi/workflowSetup/composables/useWorkflowSetupApply.ts +++ b/packages/frontend/editor-ui/src/features/ai/instanceAi/workflowSetup/composables/useWorkflowSetupApply.ts @@ -89,19 +89,10 @@ export function useWorkflowSetupApply(deps: { if (terminalState.value === 'applying') return; terminalState.value = 'applying'; - const postSuccess = await deps.store.confirmAction( - deps.requestId.value, - true, - undefined, - undefined, - undefined, - undefined, - undefined, - { - action: 'apply', - ...payload, - }, - ); + const postSuccess = await deps.store.confirmAction(deps.requestId.value, { + kind: 'setupWorkflowApply', + ...payload, + }); // confirmAction already toasts on POST failure; just reset so the wizard // re-renders with the user's selections and they can try again. @@ -141,7 +132,10 @@ export function useWorkflowSetupApply(deps: { if (terminalState.value === 'applying') return; terminalState.value = 'applying'; - const success = await deps.store.confirmAction(deps.requestId.value, false); + const success = await deps.store.confirmAction(deps.requestId.value, { + kind: 'approval', + approved: false, + }); if (success) { terminalState.value = 'deferred'; deps.store.resolveConfirmation(deps.requestId.value, 'deferred');