Fix merge issues
Some checks failed
CI: Python / Checks (push) Has been cancelled

This commit is contained in:
Svetoslav Dekov 2026-05-07 14:37:54 +03:00
parent 413730d737
commit bb90476acc
No known key found for this signature in database
4 changed files with 22 additions and 86 deletions

View File

@ -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<NodeTypesStore, 'getNodeType' | 'communityNodeType'>,
): INodeTypes {
const nodeTypes: INodeTypes = {
nodeTypes: {},
init: async (): Promise<void> => {},
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;
}

View File

@ -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<ExpressionLocalResolveContext | undefined>(()
nodes: [node],
connections,
active: false,
nodeTypes: frontendNodeTypes,
nodeTypes: nodeTypesStore.getAllNodeTypes(),
});
return {

View File

@ -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');
});

View File

@ -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');