feat(editor): Indicate dirty nodes with yellow borders/connectors on canvas (#13040)

This commit is contained in:
autologie
2025-02-26 16:35:17 +01:00
committed by GitHub
parent acdd2da492
commit 75493ef6ef
34 changed files with 1247 additions and 166 deletions

View File

@@ -117,7 +117,9 @@ export class Workflow {
this.connectionsBySourceNode = parameters.connections;
// Save also the connections by the destination nodes
this.connectionsByDestinationNode = this.__getConnectionsByDestination(parameters.connections);
this.connectionsByDestinationNode = Workflow.getConnectionsByDestination(
parameters.connections,
);
this.active = parameters.active || false;
@@ -143,7 +145,7 @@ export class Workflow {
* to easily find parent nodes.
*
*/
__getConnectionsByDestination(connections: IConnections): IConnections {
static getConnectionsByDestination(connections: IConnections): IConnections {
const returnConnection: IConnections = {};
let connectionInfo;
@@ -446,7 +448,7 @@ export class Workflow {
}
// Use the updated connections to create updated connections by destination nodes
this.connectionsByDestinationNode = this.__getConnectionsByDestination(
this.connectionsByDestinationNode = Workflow.getConnectionsByDestination(
this.connectionsBySourceNode,
);
}

View File

@@ -9,7 +9,6 @@ import type {
INode,
INodeExecutionData,
INodeParameters,
INodeTypes,
IRunExecutionData,
NodeParameterValueType,
} from '@/Interfaces';
@@ -1871,16 +1870,9 @@ describe('Workflow', () => {
});
});
describe('__getConnectionsByDestination', () => {
describe('getConnectionsByDestination', () => {
it('should return empty object when there are no connections', () => {
const workflow = new Workflow({
nodes: [],
connections: {},
active: false,
nodeTypes: mock<INodeTypes>(),
});
const result = workflow.__getConnectionsByDestination({});
const result = Workflow.getConnectionsByDestination({});
expect(result).toEqual({});
});
@@ -1896,13 +1888,7 @@ describe('Workflow', () => {
],
},
};
const workflow = new Workflow({
nodes: [],
connections,
active: false,
nodeTypes: mock<INodeTypes>(),
});
const result = workflow.__getConnectionsByDestination(connections);
const result = Workflow.getConnectionsByDestination(connections);
expect(result).toEqual({
Node2: {
[NodeConnectionType.Main]: [[{ node: 'Node1', type: NodeConnectionType.Main, index: 0 }]],
@@ -1926,14 +1912,7 @@ describe('Workflow', () => {
},
};
const workflow = new Workflow({
nodes: [],
connections,
active: false,
nodeTypes: mock<INodeTypes>(),
});
const result = workflow.__getConnectionsByDestination(connections);
const result = Workflow.getConnectionsByDestination(connections);
expect(result).toEqual({
Node2: {
[NodeConnectionType.Main]: [[{ node: 'Node1', type: NodeConnectionType.Main, index: 0 }]],
@@ -1953,14 +1932,7 @@ describe('Workflow', () => {
},
};
const workflow = new Workflow({
nodes: [],
connections,
active: false,
nodeTypes: mock<INodeTypes>(),
});
const result = workflow.__getConnectionsByDestination(connections);
const result = Workflow.getConnectionsByDestination(connections);
expect(result).toEqual({});
});
@@ -1975,14 +1947,7 @@ describe('Workflow', () => {
},
};
const workflow = new Workflow({
nodes: [],
connections,
active: false,
nodeTypes: mock<INodeTypes>(),
});
const result = workflow.__getConnectionsByDestination(connections);
const result = Workflow.getConnectionsByDestination(connections);
expect(result).toEqual({
Node2: {
[NodeConnectionType.Main]: [[{ node: 'Node1', type: NodeConnectionType.Main, index: 1 }]],
@@ -2000,14 +1965,7 @@ describe('Workflow', () => {
},
};
const workflow = new Workflow({
nodes: [],
connections,
active: false,
nodeTypes: mock<INodeTypes>(),
});
const result = workflow.__getConnectionsByDestination(connections);
const result = Workflow.getConnectionsByDestination(connections);
expect(result).toEqual({
Node2: {
[NodeConnectionType.Main]: [