[go: up one dir, main page]

Skip to content

Commit

Permalink
Ensure group nodes are properly exported in /flow api
Browse files Browse the repository at this point in the history
  • Loading branch information
knolleary committed Jun 26, 2024
1 parent 52bbd82 commit efdc1b1
Showing 1 changed file with 24 additions and 2 deletions.
26 changes: 24 additions & 2 deletions packages/node_modules/@node-red/runtime/lib/flows/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -645,16 +645,27 @@ function getFlow(id) {
if (id !== 'global') {
result.nodes = [];
}

if (flow.groups) {
var nodeIds = Object.keys(flow.groups);
if (nodeIds.length > 0) {
nodeIds.forEach(function(nodeId) {
var node = jsonClone(flow.groups[nodeId]);
delete node.credentials;
result.nodes.push(node)
})
}
}
if (flow.nodes) {
var nodeIds = Object.keys(flow.nodes);
if (nodeIds.length > 0) {
result.nodes = nodeIds.map(function(nodeId) {
nodeIds.forEach(function(nodeId) {
var node = jsonClone(flow.nodes[nodeId]);
if (node.type === 'link out') {
delete node.wires;
}
delete node.credentials;
return node;
result.nodes.push(node)
})
}
}
Expand All @@ -680,6 +691,17 @@ function getFlow(id) {
delete node.credentials
return node
});
if (subflow.groups) {
var nodeIds = Object.keys(subflow.groups);
if (nodeIds.length > 0) {
nodeIds.forEach(function(nodeId) {
var node = jsonClone(subflow.groups[nodeId]);
delete node.credentials;
subflow.nodes.push(node)
})
}
delete subflow.groups
}
if (subflow.configs) {
var configIds = Object.keys(subflow.configs);
subflow.configs = configIds.map(function(id) {
Expand Down

0 comments on commit efdc1b1

Please sign in to comment.