mirror of
https://github.com/node-red/node-red.git
synced 2025-03-01 10:36:34 +00:00
Merge pull request #4803 from node-red/4798-include-groups-inflowapi
Ensure group nodes are properly exported in /flow api
This commit is contained in:
commit
379fbd7c7e
@ -645,16 +645,27 @@ function getFlow(id) {
|
|||||||
if (id !== 'global') {
|
if (id !== 'global') {
|
||||||
result.nodes = [];
|
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) {
|
if (flow.nodes) {
|
||||||
var nodeIds = Object.keys(flow.nodes);
|
var nodeIds = Object.keys(flow.nodes);
|
||||||
if (nodeIds.length > 0) {
|
if (nodeIds.length > 0) {
|
||||||
result.nodes = nodeIds.map(function(nodeId) {
|
nodeIds.forEach(function(nodeId) {
|
||||||
var node = jsonClone(flow.nodes[nodeId]);
|
var node = jsonClone(flow.nodes[nodeId]);
|
||||||
if (node.type === 'link out') {
|
if (node.type === 'link out') {
|
||||||
delete node.wires;
|
delete node.wires;
|
||||||
}
|
}
|
||||||
delete node.credentials;
|
delete node.credentials;
|
||||||
return node;
|
result.nodes.push(node)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -680,6 +691,17 @@ function getFlow(id) {
|
|||||||
delete node.credentials
|
delete node.credentials
|
||||||
return node
|
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) {
|
if (subflow.configs) {
|
||||||
var configIds = Object.keys(subflow.configs);
|
var configIds = Object.keys(subflow.configs);
|
||||||
subflow.configs = configIds.map(function(id) {
|
subflow.configs = configIds.map(function(id) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user