mirror of https://github.com/node-red/node-red.git
Merge pull request #4803 from node-red/4798-include-groups-inflowapi
Ensure group nodes are properly exported in /flow apipull/4804/head
commit
379fbd7c7e
|
@ -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)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue