mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-18 18:41:14 +00:00
feat(editor): Add ability to extract sub-workflows to canvas context menu (#15538)
This commit is contained in:
@@ -927,4 +927,38 @@ export class Workflow {
|
||||
|
||||
return this.__getStartNode(Object.keys(this.nodes));
|
||||
}
|
||||
|
||||
getConnectionsBetweenNodes(
|
||||
sources: string[],
|
||||
targets: string[],
|
||||
): Array<[IConnection, IConnection]> {
|
||||
const result: Array<[IConnection, IConnection]> = [];
|
||||
|
||||
for (const source of sources) {
|
||||
for (const type of Object.keys(this.connectionsBySourceNode[source] ?? {})) {
|
||||
for (const sourceIndex of Object.keys(this.connectionsBySourceNode[source][type])) {
|
||||
for (const connectionIndex of Object.keys(
|
||||
this.connectionsBySourceNode[source][type][parseInt(sourceIndex, 10)] ?? [],
|
||||
)) {
|
||||
const targetConnectionData =
|
||||
this.connectionsBySourceNode[source][type][parseInt(sourceIndex, 10)]?.[
|
||||
parseInt(connectionIndex, 10)
|
||||
];
|
||||
if (targetConnectionData && targets.includes(targetConnectionData?.node)) {
|
||||
result.push([
|
||||
{
|
||||
node: source,
|
||||
index: parseInt(sourceIndex, 10),
|
||||
type: type as NodeConnectionType,
|
||||
},
|
||||
targetConnectionData,
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user