mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Merge pull request #3816 from node-red/import-junction-fix
Include junctions/groups when exporting subflows plus related fixes
This commit is contained in:
commit
d53cd209f7
@ -868,14 +868,7 @@ RED.nodes = (function() {
|
|||||||
var node;
|
var node;
|
||||||
|
|
||||||
if (allNodes.hasTab(id)) {
|
if (allNodes.hasTab(id)) {
|
||||||
removedNodes = allNodes.getNodes(id).filter(n => {
|
removedNodes = allNodes.getNodes(id).slice()
|
||||||
if (n.type === 'junction') {
|
|
||||||
removedJunctions.push(n)
|
|
||||||
return false
|
|
||||||
} else {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
for (i in configNodes) {
|
for (i in configNodes) {
|
||||||
if (configNodes.hasOwnProperty(i)) {
|
if (configNodes.hasOwnProperty(i)) {
|
||||||
@ -885,6 +878,7 @@ RED.nodes = (function() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
removedJunctions = RED.nodes.junctions(id)
|
||||||
|
|
||||||
for (i=0;i<removedNodes.length;i++) {
|
for (i=0;i<removedNodes.length;i++) {
|
||||||
var result = removeNode(removedNodes[i].id);
|
var result = removeNode(removedNodes[i].id);
|
||||||
@ -1331,7 +1325,6 @@ RED.nodes = (function() {
|
|||||||
} else {
|
} else {
|
||||||
nodeSet = [sf];
|
nodeSet = [sf];
|
||||||
}
|
}
|
||||||
console.log(nodeSet);
|
|
||||||
return createExportableNodeSet(nodeSet);
|
return createExportableNodeSet(nodeSet);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
@ -1367,6 +1360,10 @@ RED.nodes = (function() {
|
|||||||
exportedConfigNodes[n.id] = true;
|
exportedConfigNodes[n.id] = true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
subflowSet = subflowSet.concat(RED.nodes.junctions(subflowId))
|
||||||
|
subflowSet = subflowSet.concat(RED.nodes.groups(subflowId))
|
||||||
|
|
||||||
var exportableSubflow = createExportableNodeSet(subflowSet, exportedIds, exportedSubflows, exportedConfigNodes);
|
var exportableSubflow = createExportableNodeSet(subflowSet, exportedIds, exportedSubflows, exportedConfigNodes);
|
||||||
nns = exportableSubflow.concat(nns);
|
nns = exportableSubflow.concat(nns);
|
||||||
}
|
}
|
||||||
|
@ -506,6 +506,13 @@ RED.subflow = (function() {
|
|||||||
RED.nodes.groups(id).forEach(function(n) {
|
RED.nodes.groups(id).forEach(function(n) {
|
||||||
removedGroups.push(n);
|
removedGroups.push(n);
|
||||||
})
|
})
|
||||||
|
|
||||||
|
var removedJunctions = RED.nodes.junctions(id)
|
||||||
|
for (var i=0;i<removedJunctions.length;i++) {
|
||||||
|
var removedEntities = RED.nodes.removeJunction(removedJunctions[i])
|
||||||
|
removedLinks = removedLinks.concat(removedEntities.links)
|
||||||
|
}
|
||||||
|
|
||||||
var removedConfigNodes = [];
|
var removedConfigNodes = [];
|
||||||
for (var i=0;i<removedNodes.length;i++) {
|
for (var i=0;i<removedNodes.length;i++) {
|
||||||
var removedEntities = RED.nodes.remove(removedNodes[i].id);
|
var removedEntities = RED.nodes.remove(removedNodes[i].id);
|
||||||
@ -536,6 +543,7 @@ RED.subflow = (function() {
|
|||||||
nodes:removedNodes,
|
nodes:removedNodes,
|
||||||
links:removedLinks,
|
links:removedLinks,
|
||||||
groups: removedGroups,
|
groups: removedGroups,
|
||||||
|
junctions: removedJunctions,
|
||||||
subflows: [activeSubflow]
|
subflows: [activeSubflow]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user