mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-21 20:00:02 +00:00
fix(editor): Ignore unconnected nodes when executing workflow (#14683)
This commit is contained in:
@@ -259,14 +259,28 @@ describe('useWorkflowsStore', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe('nodesIssuesExist', () => {
|
describe('nodesIssuesExist', () => {
|
||||||
it('should return true when a node has issues', () => {
|
it('should return true when a node has issues and connected', () => {
|
||||||
|
workflowsStore.workflow.nodes = [
|
||||||
|
{ name: 'Node1', issues: { error: ['Error message'] } },
|
||||||
|
{ name: 'Node2' },
|
||||||
|
] as unknown as IWorkflowDb['nodes'];
|
||||||
|
|
||||||
|
workflowsStore.workflow.connections = {
|
||||||
|
Node1: { main: [[{ node: 'Node2' } as IConnection]] },
|
||||||
|
};
|
||||||
|
|
||||||
|
const hasIssues = workflowsStore.nodesIssuesExist;
|
||||||
|
expect(hasIssues).toBe(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should return false when node has issues but it is not connected', () => {
|
||||||
workflowsStore.workflow.nodes = [
|
workflowsStore.workflow.nodes = [
|
||||||
{ name: 'Node1', issues: { error: ['Error message'] } },
|
{ name: 'Node1', issues: { error: ['Error message'] } },
|
||||||
{ name: 'Node2' },
|
{ name: 'Node2' },
|
||||||
] as unknown as IWorkflowDb['nodes'];
|
] as unknown as IWorkflowDb['nodes'];
|
||||||
|
|
||||||
const hasIssues = workflowsStore.nodesIssuesExist;
|
const hasIssues = workflowsStore.nodesIssuesExist;
|
||||||
expect(hasIssues).toBe(true);
|
expect(hasIssues).toBe(false);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should return false when no nodes have issues', () => {
|
it('should return false when no nodes have issues', () => {
|
||||||
@@ -275,6 +289,10 @@ describe('useWorkflowsStore', () => {
|
|||||||
{ name: 'Node2' },
|
{ name: 'Node2' },
|
||||||
] as unknown as IWorkflowDb['nodes'];
|
] as unknown as IWorkflowDb['nodes'];
|
||||||
|
|
||||||
|
workflowsStore.workflow.connections = {
|
||||||
|
Node1: { main: [[{ node: 'Node2' } as IConnection]] },
|
||||||
|
};
|
||||||
|
|
||||||
const hasIssues = workflowsStore.nodesIssuesExist;
|
const hasIssues = workflowsStore.nodesIssuesExist;
|
||||||
expect(hasIssues).toBe(false);
|
expect(hasIssues).toBe(false);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -256,19 +256,15 @@ export const useWorkflowsStore = defineStore(STORES.WORKFLOWS, () => {
|
|||||||
}, {});
|
}, {});
|
||||||
});
|
});
|
||||||
|
|
||||||
const nodesIssuesExist = computed(() => {
|
const nodesIssuesExist = computed(() =>
|
||||||
for (const node of workflow.value.nodes) {
|
workflow.value.nodes.some((node) => {
|
||||||
const isNodeDisabled = node.disabled === true;
|
const nodeHasIssues = !!Object.keys(node.issues ?? {}).length;
|
||||||
const noNodeIssues = node.issues === undefined || Object.keys(node.issues).length === 0;
|
const isConnected =
|
||||||
if (isNodeDisabled || noNodeIssues) {
|
Object.keys(outgoingConnectionsByNodeName(node.name)).length > 0 ||
|
||||||
continue;
|
Object.keys(incomingConnectionsByNodeName(node.name)).length > 0;
|
||||||
}
|
return !node.disabled && isConnected && nodeHasIssues;
|
||||||
|
}),
|
||||||
return true;
|
);
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
|
|
||||||
const pinnedWorkflowData = computed(() => workflow.value.pinData);
|
const pinnedWorkflowData = computed(() => workflow.value.pinData);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user