fix(editor): Show left-hand NDV floating nodes in correct order (#14126)

This commit is contained in:
jeanpaul
2025-03-25 09:13:28 +01:00
committed by GitHub
parent a082a16c5d
commit 71f281b90d
3 changed files with 124 additions and 2 deletions

View File

@@ -1,5 +1,10 @@
import { setCredentialValues } from '../composables/modals/credential-modal';
import { clickCreateNewCredential, setParameterSelectByContent } from '../composables/ndv';
import {
clickCreateNewCredential,
clickGetBackToCanvas,
setParameterSelectByContent,
} from '../composables/ndv';
import { openNode } from '../composables/workflow';
import {
EDIT_FIELDS_SET_NODE_NAME,
MANUAL_TRIGGER_NODE_DISPLAY_NAME,
@@ -617,6 +622,42 @@ describe('NDV', () => {
// Sinse code tool require alphanumeric tool name it would also show an error(2 errors, 1 for each tool node)
cy.get('[class*=hasIssues]').should('have.length', 3);
});
it('should have the floating nodes in correct order', () => {
cy.createFixtureWorkflow('Floating_Nodes.json', 'Floating Nodes');
cy.ifCanvasVersion(
() => {},
() => {
// Needed in V2 as all nodes remain selected when clicking on a selected node
workflowPage.actions.deselectAll();
},
);
// The first merge node has the wires crossed, so `Edit Fields1` is first in the order of connected nodes
openNode('Merge');
getFloatingNodeByPosition('inputMain').should('exist');
getFloatingNodeByPosition('inputMain').should('have.length', 2);
getFloatingNodeByPosition('inputMain')
.first()
.should('have.attr', 'data-node-name', 'Edit Fields1');
getFloatingNodeByPosition('inputMain')
.last()
.should('have.attr', 'data-node-name', 'Edit Fields0');
clickGetBackToCanvas();
// The second merge node does not have wires crossed, so `Edit Fields0` is first
openNode('Merge1');
getFloatingNodeByPosition('inputMain').should('exist');
getFloatingNodeByPosition('inputMain').should('have.length', 2);
getFloatingNodeByPosition('inputMain')
.first()
.should('have.attr', 'data-node-name', 'Edit Fields0');
getFloatingNodeByPosition('inputMain')
.last()
.should('have.attr', 'data-node-name', 'Edit Fields1');
});
});
it('should show node name and version in settings', () => {

View File

@@ -87,6 +87,54 @@
1600,
740
]
},
{
"parameters": {},
"type": "n8n-nodes-base.merge",
"typeVersion": 3.1,
"position": [
440,
-140
],
"id": "a00959d3-8d4b-40af-b4f2-35ca3d73fd84",
"name": "Merge"
},
{
"parameters": {
"options": {}
},
"type": "n8n-nodes-base.set",
"typeVersion": 3.4,
"position": [
-20,
-120
],
"id": "a5cbc221-ccfd-4034-a648-6a192834af81",
"name": "Edit Fields0"
},
{
"parameters": {
"options": {}
},
"type": "n8n-nodes-base.set",
"typeVersion": 3.4,
"position": [
0,
100
],
"id": "d3b4c17a-bee8-418b-a721-5debafd1ce11",
"name": "Edit Fields1"
},
{
"parameters": {},
"type": "n8n-nodes-base.merge",
"typeVersion": 3.1,
"position": [
440,
100
],
"id": "b23a2a43-ffac-41a5-a265-054e21a57d70",
"name": "Merge1"
}
],
"pinData": {},
@@ -161,7 +209,40 @@
}
]
]
},
"Edit Fields0": {
"main": [
[
{
"node": "Merge",
"type": "main",
"index": 1
},
{
"node": "Merge1",
"type": "main",
"index": 0
}
]
]
},
"Edit Fields1": {
"main": [
[
{
"node": "Merge",
"type": "main",
"index": 0
},
{
"node": "Merge1",
"type": "main",
"index": 1
}
]
]
}
},
"active": false,
"settings": {

View File

@@ -76,7 +76,7 @@ const connectedNodes = computed<
).reverse(),
[FloatingNodePosition.left]: getINodesFromNames(
workflow.getParentNodes(rootName, NodeConnectionTypes.Main, 1),
),
).reverse(),
};
});