mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 18:12:04 +00:00
fix(editor): Nodes in disabled state appear in the logs (no-changelog) (#15054)
This commit is contained in:
@@ -37,7 +37,10 @@ const runDataProps = computed<
|
|||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
node,
|
node: {
|
||||||
|
...node,
|
||||||
|
disabled: false, // For RunData component to render data from disabled nodes as well
|
||||||
|
},
|
||||||
runIndex: source.previousNodeRun ?? 0,
|
runIndex: source.previousNodeRun ?? 0,
|
||||||
overrideOutputs: [source.previousNodeOutput ?? 0],
|
overrideOutputs: [source.previousNodeOutput ?? 0],
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -609,6 +609,19 @@ describe(createLogEntries, () => {
|
|||||||
}),
|
}),
|
||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should not include runs for disabled nodes', () => {
|
||||||
|
const workflow = createTestWorkflowObject({
|
||||||
|
nodes: [createTestNode({ name: 'A' }), createTestNode({ name: 'B', disabled: true })],
|
||||||
|
connections: {
|
||||||
|
A: { main: [[{ node: 'B', type: NodeConnectionTypes.Main, index: 0 }]] },
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(
|
||||||
|
createLogEntries(workflow, { A: [createTestTaskData()], B: [createTestTaskData()] }),
|
||||||
|
).toEqual([expect.objectContaining({ node: expect.objectContaining({ name: 'A' }) })]);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe(deepToRaw, () => {
|
describe(deepToRaw, () => {
|
||||||
|
|||||||
@@ -383,9 +383,11 @@ function findLogEntryToAutoSelectRec(
|
|||||||
|
|
||||||
export function createLogEntries(workflow: Workflow, runData: IRunData) {
|
export function createLogEntries(workflow: Workflow, runData: IRunData) {
|
||||||
const runs = Object.entries(runData)
|
const runs = Object.entries(runData)
|
||||||
.filter(([nodeName]) => workflow.getChildNodes(nodeName, 'ALL_NON_MAIN').length === 0)
|
|
||||||
.flatMap(([nodeName, taskData]) =>
|
.flatMap(([nodeName, taskData]) =>
|
||||||
taskData.map((task, runIndex) => ({ nodeName, task, runIndex })),
|
workflow.getChildNodes(nodeName, 'ALL_NON_MAIN').length > 0 ||
|
||||||
|
workflow.getNode(nodeName)?.disabled
|
||||||
|
? [] // skip sub nodes and disabled nodes
|
||||||
|
: taskData.map((task, runIndex) => ({ nodeName, task, runIndex })),
|
||||||
)
|
)
|
||||||
.sort((a, b) => {
|
.sort((a, b) => {
|
||||||
if (a.task.executionIndex !== undefined && b.task.executionIndex !== undefined) {
|
if (a.task.executionIndex !== undefined && b.task.executionIndex !== undefined) {
|
||||||
|
|||||||
@@ -224,7 +224,9 @@ describe('useRunWorkflow({ router })', () => {
|
|||||||
expect(response).toEqual(mockResponse);
|
expect(response).toEqual(mockResponse);
|
||||||
expect(workflowsStore.executionWaitingForWebhook).toBe(true);
|
expect(workflowsStore.executionWaitingForWebhook).toBe(true);
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('runWorkflow()', () => {
|
||||||
it('should prevent execution and show error message when workflow is active with single webhook trigger', async () => {
|
it('should prevent execution and show error message when workflow is active with single webhook trigger', async () => {
|
||||||
const pinia = createTestingPinia({ stubActions: false });
|
const pinia = createTestingPinia({ stubActions: false });
|
||||||
setActivePinia(pinia);
|
setActivePinia(pinia);
|
||||||
@@ -305,9 +307,7 @@ describe('useRunWorkflow({ router })', () => {
|
|||||||
type: 'error',
|
type: 'error',
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
|
||||||
|
|
||||||
describe('runWorkflow()', () => {
|
|
||||||
it('should return undefined if UI action "workflowRunning" is active', async () => {
|
it('should return undefined if UI action "workflowRunning" is active', async () => {
|
||||||
const { runWorkflow } = useRunWorkflow({ router });
|
const { runWorkflow } = useRunWorkflow({ router });
|
||||||
vi.mocked(workflowsStore).setActiveExecutionId('123');
|
vi.mocked(workflowsStore).setActiveExecutionId('123');
|
||||||
@@ -632,6 +632,25 @@ describe('useRunWorkflow({ router })', () => {
|
|||||||
expect(workflowsStore.runWorkflow).toHaveBeenCalledWith(dataCaptor);
|
expect(workflowsStore.runWorkflow).toHaveBeenCalledWith(dataCaptor);
|
||||||
expect(dataCaptor.value).toHaveProperty('runData', undefined);
|
expect(dataCaptor.value).toHaveProperty('runData', undefined);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should set execution data to null if the execution did not start successfully', async () => {
|
||||||
|
const { runWorkflow } = useRunWorkflow({ router });
|
||||||
|
const workflow = mock<Workflow>({ name: 'Test Workflow' });
|
||||||
|
|
||||||
|
vi.mocked(workflowHelpers).getCurrentWorkflow.mockReturnValue(workflow);
|
||||||
|
vi.mocked(workflowHelpers).getWorkflowDataToSave.mockResolvedValue({
|
||||||
|
id: workflow.id,
|
||||||
|
nodes: [],
|
||||||
|
} as unknown as IWorkflowData);
|
||||||
|
|
||||||
|
// Simulate failed execution start
|
||||||
|
vi.mocked(workflowsStore).runWorkflow.mockRejectedValueOnce(new Error());
|
||||||
|
|
||||||
|
await runWorkflow({});
|
||||||
|
|
||||||
|
expect(workflowsStore.runWorkflow).toHaveBeenCalledTimes(1);
|
||||||
|
expect(workflowsStore.setWorkflowExecutionData).lastCalledWith(null);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('consolidateRunDataAndStartNodes()', () => {
|
describe('consolidateRunDataAndStartNodes()', () => {
|
||||||
|
|||||||
@@ -368,6 +368,7 @@ export function useRunWorkflow(useRunWorkflowOpts: { router: ReturnType<typeof u
|
|||||||
|
|
||||||
return runWorkflowApiResponse;
|
return runWorkflowApiResponse;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
workflowsStore.setWorkflowExecutionData(null);
|
||||||
workflowHelpers.setDocumentTitle(workflow.name as string, 'ERROR');
|
workflowHelpers.setDocumentTitle(workflow.name as string, 'ERROR');
|
||||||
toast.showError(error, i18n.baseText('workflowRun.showError.title'));
|
toast.showError(error, i18n.baseText('workflowRun.showError.title'));
|
||||||
return undefined;
|
return undefined;
|
||||||
|
|||||||
Reference in New Issue
Block a user