1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Fix duplicate subflow detection on import

This commit is contained in:
Nick O'Leary 2018-10-26 23:07:48 +01:00
parent 4d27ba1bda
commit 49fe13f22f
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9

View File

@ -649,9 +649,9 @@ RED.nodes = (function() {
}
function checkForMatchingSubflow(subflow,subflowNodes) {
subflowNodes = subflowNodes || [];
var i;
var match = null;
try {
RED.nodes.eachSubflow(function(sf) {
if (sf.name != subflow.name ||
sf.info != subflow.info ||
@ -680,11 +680,8 @@ RED.nodes = (function() {
}
match = sf;
throw new Error();
return false;
});
} catch(err) {
console.log(err.stack);
}
return match;
}
function compareNodes(nodeA,nodeB,idMustMatch) {
@ -1381,31 +1378,41 @@ RED.nodes = (function() {
eachNode: function(cb) {
for (var n=0;n<nodes.length;n++) {
cb(nodes[n]);
if (cb(nodes[n]) === false) {
break;
}
}
},
eachLink: function(cb) {
for (var l=0;l<links.length;l++) {
cb(links[l]);
if (cb(links[l]) === false) {
break;
}
}
},
eachConfig: function(cb) {
for (var id in configNodes) {
if (configNodes.hasOwnProperty(id)) {
cb(configNodes[id]);
if (cb(configNodes[id]) === false) {
break;
}
}
}
},
eachSubflow: function(cb) {
for (var id in subflows) {
if (subflows.hasOwnProperty(id)) {
cb(subflows[id]);
if (cb(subflows[id]) === false) {
break;
}
}
}
},
eachWorkspace: function(cb) {
for (var i=0;i<workspacesOrder.length;i++) {
cb(workspaces[workspacesOrder[i]]);
if (cb(workspaces[workspacesOrder[i]]) === false) {
break;
}
}
},