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

Fix RED.nodes.filterNodes when searching full node set

This commit is contained in:
Nick O'Leary 2021-09-29 10:43:41 +01:00
parent b427eca21f
commit ab2d3bfd80
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9

View File

@ -448,12 +448,18 @@ RED.nodes = (function() {
doZFilter = true; doZFilter = true;
} }
} }
var objectLookup = false;
if (searchSet === null) { if (searchSet === null) {
searchSet = nodes; searchSet = Object.keys(nodes);
objectLookup = true;
} }
for (var n=0;n<searchSet.length;n++) { for (var n=0;n<searchSet.length;n++) {
var node = searchSet[n]; var node = searchSet[n];
if (objectLookup) {
node = nodes[node];
}
if (filter.hasOwnProperty("type") && node.type !== filter.type) { if (filter.hasOwnProperty("type") && node.type !== filter.type) {
continue; continue;
} }
@ -1118,8 +1124,8 @@ RED.nodes = (function() {
} }
} }
if ((!n._def.defaults || !n._def.defaults.hasOwnProperty("l")) && n.hasOwnProperty('l')) { if ((!n._def.defaults || !n._def.defaults.hasOwnProperty("l")) && n.hasOwnProperty('l')) {
var isLink = /^link (in|out)$/.test(node.type); var showLabel = n._def.hasOwnProperty("showLabel")?n._def.showLabel:true;
if (isLink == n.l) { if (showLabel != n.l) {
node.l = n.l; node.l = n.l;
} }
} }