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

Nodes with hasUsers set to false should not appear unused

This commit is contained in:
Nick O'Leary 2017-01-15 13:37:21 +00:00
parent 4b64aad5ce
commit a03ccd7b59
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9

View File

@ -113,7 +113,7 @@ RED.sidebar.config = (function() {
if (showUnusedOnly) { if (showUnusedOnly) {
var hiddenCount = nodes.length; var hiddenCount = nodes.length;
nodes = nodes.filter(function(n) { nodes = nodes.filter(function(n) {
return n.users.length === 0; return n._def.hasUsers!==false && n.users.length === 0;
}) })
hiddenCount = hiddenCount - nodes.length; hiddenCount = hiddenCount - nodes.length;
if (hiddenCount > 0) { if (hiddenCount > 0) {
@ -151,11 +151,12 @@ RED.sidebar.config = (function() {
var entry = $('<li class="palette_node config_node palette_node_id_'+node.id.replace(/\./g,"-")+'"></li>').appendTo(list); var entry = $('<li class="palette_node config_node palette_node_id_'+node.id.replace(/\./g,"-")+'"></li>').appendTo(list);
$('<div class="palette_label"></div>').text(label).appendTo(entry); $('<div class="palette_label"></div>').text(label).appendTo(entry);
if (node._def.hasUsers !== false) {
var iconContainer = $('<div/>',{class:"palette_icon_container palette_icon_container_right"}).text(node.users.length).appendTo(entry); var iconContainer = $('<div/>',{class:"palette_icon_container palette_icon_container_right"}).text(node.users.length).appendTo(entry);
if (node.users.length === 0) { if (node.users.length === 0) {
entry.addClass("config_node_unused"); entry.addClass("config_node_unused");
} }
}
entry.on('click',function(e) { entry.on('click',function(e) {
RED.sidebar.info.refresh(node); RED.sidebar.info.refresh(node);
}); });