mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Fix check for existing config nodes in subflow export set
This commit is contained in:
parent
dad47ade38
commit
3bd1bfc769
@ -852,6 +852,7 @@ RED.nodes = (function() {
|
|||||||
RED.nodes.eachConfig(function(n) {
|
RED.nodes.eachConfig(function(n) {
|
||||||
if (n.z == subflowId) {
|
if (n.z == subflowId) {
|
||||||
subflowSet.push(n);
|
subflowSet.push(n);
|
||||||
|
exportedConfigNodes[n.id] = true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
var exportableSubflow = createExportableNodeSet(subflowSet, exportedIds, exportedSubflows, exportedConfigNodes);
|
var exportableSubflow = createExportableNodeSet(subflowSet, exportedIds, exportedSubflows, exportedConfigNodes);
|
||||||
@ -859,37 +860,35 @@ RED.nodes = (function() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (node.type !== "subflow") {
|
if (node.type !== "subflow") {
|
||||||
if (nns.findIndex((v) => v && v.id === node.id) == -1) {
|
var convertedNode = RED.nodes.convertNode(node);
|
||||||
var convertedNode = RED.nodes.convertNode(node);
|
for (var d in node._def.defaults) {
|
||||||
for (var d in node._def.defaults) {
|
if (node._def.defaults[d].type) {
|
||||||
if (node._def.defaults[d].type) {
|
var nodeList = node[d];
|
||||||
var nodeList = node[d];
|
if (!Array.isArray(nodeList)) {
|
||||||
if (!Array.isArray(nodeList)) {
|
nodeList = [nodeList];
|
||||||
nodeList = [nodeList];
|
}
|
||||||
}
|
nodeList = nodeList.filter(function(id) {
|
||||||
nodeList = nodeList.filter(function(id) {
|
if (id in configNodes) {
|
||||||
if (id in configNodes) {
|
var confNode = configNodes[id];
|
||||||
var confNode = configNodes[id];
|
if (confNode._def.exportable !== false) {
|
||||||
if (confNode._def.exportable !== false) {
|
if (!(id in exportedConfigNodes)) {
|
||||||
if (!(id in exportedConfigNodes)) {
|
exportedConfigNodes[id] = true;
|
||||||
exportedConfigNodes[id] = true;
|
set.push(confNode);
|
||||||
set.push(confNode);
|
return true;
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
return true;
|
return false;
|
||||||
})
|
|
||||||
if (nodeList.length === 0) {
|
|
||||||
convertedNode[d] = Array.isArray(node[d])?[]:""
|
|
||||||
} else {
|
|
||||||
convertedNode[d] = Array.isArray(node[d])?nodeList:nodeList[0]
|
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
|
})
|
||||||
|
if (nodeList.length === 0) {
|
||||||
|
convertedNode[d] = Array.isArray(node[d])?[]:""
|
||||||
|
} else {
|
||||||
|
convertedNode[d] = Array.isArray(node[d])?nodeList:nodeList[0]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
nns.push(convertedNode);
|
|
||||||
}
|
}
|
||||||
|
nns.push(convertedNode);
|
||||||
if (node.type === "group") {
|
if (node.type === "group") {
|
||||||
nns = nns.concat(createExportableNodeSet(node.nodes, exportedIds, exportedSubflows, exportedConfigNodes));
|
nns = nns.concat(createExportableNodeSet(node.nodes, exportedIds, exportedSubflows, exportedConfigNodes));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user