1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Search subflows instances when looking for given node id

This commit is contained in:
Nick O'Leary 2019-03-12 14:25:36 +00:00
parent 9c474cc089
commit d3d9533493
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9

View File

@ -176,9 +176,9 @@ class Flow {
subflowDefinition, subflowDefinition,
node node
); );
this.subflowInstanceNodes[id] = subflow;
subflow.start(); subflow.start();
this.activeNodes[id] = subflow.node; this.activeNodes[id] = subflow.node;
this.subflowInstanceNodes[id] = subflow;
// this.subflowInstanceNodes[id] = nodes.map(function(n) { return n.id}); // this.subflowInstanceNodes[id] = nodes.map(function(n) { return n.id});
// for (var i=0;i<nodes.length;i++) { // for (var i=0;i<nodes.length;i++) {
@ -313,6 +313,19 @@ class Flow {
} else if (this.activeNodes[id]) { } else if (this.activeNodes[id]) {
// TEMP: this is a subflow internal node within this flow // TEMP: this is a subflow internal node within this flow
return this.activeNodes[id]; return this.activeNodes[id];
} else {
// The node could be inside one of this flow's subflows
var node;
for (var sfId in this.subflowInstanceNodes) {
if (this.subflowInstanceNodes.hasOwnProperty(sfId)) {
node = this.subflowInstanceNodes[sfId].getNode(id,cancelBubble);
if (node) {
return node;
}
}
}
} }
if (!cancelBubble) { if (!cancelBubble) {
return this.parent.getNode(id); return this.parent.getNode(id);