Skip to content

Commit

Permalink
Merge pull request #2 from node-red/link-call-support
Browse files Browse the repository at this point in the history
Handle link call nodes when creating flow model
  • Loading branch information
knolleary authored Dec 1, 2021
2 parents dd9bede + ccf8803 commit d018eb5
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 13 deletions.
16 changes: 9 additions & 7 deletions lib/NRFlowSet.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class NRFlowSet {
// config.{id,type} are removed in NRNode constructor
const node = new NRNode(config)
this.nodes.set(node.id, node);
if (node.type === "link in" || node.type === "link out") {
if (node.type === "link call" || node.type === "link in" || node.type === "link out") {
linkNodes.push(node);
}
}
Expand Down Expand Up @@ -88,12 +88,14 @@ class NRFlowSet {
if (!createdLinks.has(linkIdentifier)) {
createdLinks.add(linkIdentifier);
let remoteNode = this.nodes.get(remoteId);
let sourceNode = linkNode.type === "link in"?remoteNode:linkNode;
let destinationNode = linkNode.type === "link in"?linkNode:remoteNode;
let wire = new NRWire(sourceNode, 0, destinationNode, 0, true);
sourceNode.addOutboundWire(wire);
destinationNode.addInboundWire(wire);
this.wires.push(wire);
if (remoteNode) {
let sourceNode = linkNode.type === "link in"?remoteNode:linkNode;
let destinationNode = linkNode.type === "link in"?linkNode:remoteNode;
let wire = new NRWire(sourceNode, 0, destinationNode, 0, true);
sourceNode.addOutboundWire(wire);
destinationNode.addInboundWire(wire);
this.wires.push(wire);
}
}
})
})
Expand Down
12 changes: 6 additions & 6 deletions lib/NRNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,12 +155,12 @@ class NRNode extends NRObject {
*/
getNextNodes(followVirtual) {
let result = [];
this.outboundWires.forEach(wire => {
if (!wire.virtual || followVirtual) {
result.push(wire.destinationNode);
}
});
return result;
this.outboundWires.forEach(wire => {
if (!wire.virtual || followVirtual) {
result.push(wire.destinationNode);
}
});
return result;
}

/**
Expand Down

0 comments on commit d018eb5

Please sign in to comment.