mirror of
				https://github.com/node-red/node-red.git
				synced 2025-03-01 10:36:34 +00:00 
			
		
		
		
	Add hidden count when config node filtered
This commit is contained in:
		| @@ -45,14 +45,16 @@ RED.sidebar.config = (function() { | ||||
|             var container = $('<div class="palette-category workspace-config-node-category" id="workspace-config-node-category-'+name+'"></div>').appendTo(parent); | ||||
|             var header = $('<div class="workspace-config-node-tray-header palette-header"><i class="fa fa-angle-down expanded"></i></div>').appendTo(container); | ||||
|             if (label) { | ||||
|                 $('<span/>').text(label).appendTo(header); | ||||
|                 $('<span class="config-node-label"/>').text(label).appendTo(header); | ||||
|             } else { | ||||
|                 $('<span data-i18n="sidebar.config.'+name+'">').appendTo(header); | ||||
|                 $('<span class="config-node-label" data-i18n="sidebar.config.'+name+'">').appendTo(header); | ||||
|             } | ||||
|             $('<span class="config-node-filter-info"></span>').appendTo(header); | ||||
|             category = $('<ul class="palette-content config-node-list"></ul>').appendTo(container); | ||||
|             container.i18n(); | ||||
|             var icon = header.find("i"); | ||||
|             var result = { | ||||
|                 label: label, | ||||
|                 list: category, | ||||
|                 size: function() { | ||||
|                     return result.list.find("li:not(.config_node_none)").length | ||||
| @@ -90,6 +92,11 @@ RED.sidebar.config = (function() { | ||||
|                 } | ||||
|             }); | ||||
|             categories[name] = result; | ||||
|         } else { | ||||
|             if (categories[name].label !== label) { | ||||
|                 categories[name].list.parent().find('.config-node-label').text(label); | ||||
|                 categories[name].label = label; | ||||
|             } | ||||
|         } | ||||
|         return categories[name]; | ||||
|     } | ||||
| @@ -104,9 +111,18 @@ RED.sidebar.config = (function() { | ||||
|             return 0; | ||||
|         }); | ||||
|         if (showUnusedOnly) { | ||||
|             var hiddenCount = nodes.length; | ||||
|             nodes = nodes.filter(function(n) { | ||||
|                 return n.users.length === 0; | ||||
|             }) | ||||
|             hiddenCount = hiddenCount - nodes.length; | ||||
|             if (hiddenCount > 0) { | ||||
|                 list.parent().find('.config-node-filter-info').text(RED._('sidebar.config.filtered',{count:hiddenCount})).show(); | ||||
|             } else { | ||||
|                 list.parent().find('.config-node-filter-info').hide(); | ||||
|             } | ||||
|         } else { | ||||
|             list.parent().find('.config-node-filter-info').hide(); | ||||
|         } | ||||
|         list.empty(); | ||||
|         if (nodes.length === 0) { | ||||
|   | ||||
| @@ -140,8 +140,8 @@ RED.workspaces = (function() { | ||||
|                         if (workspace.label != label) { | ||||
|                             workspace_tabs.renameTab(workspace.id,label); | ||||
|                             RED.nodes.dirty(true); | ||||
|                             RED.sidebar.config.refresh(); | ||||
|                             $("#menu-item-workspace-menu-"+workspace.id.replace(".","-")).text(label); | ||||
|                             // TODO: update entry in menu | ||||
|                         } | ||||
|                         $( this ).dialog( "close" ); | ||||
|                     } | ||||
|   | ||||
| @@ -114,11 +114,16 @@ | ||||
| } | ||||
|  | ||||
| .palette-header { | ||||
|     position: relative; | ||||
|     background: $palette-header-background; | ||||
|     cursor: pointer; | ||||
|     text-align: left; | ||||
|     padding: 9px; | ||||
|     font-weight: bold; | ||||
|     overflow: hidden; | ||||
|     white-space: nowrap; | ||||
|     text-overflow: ellipsis; | ||||
|  | ||||
| } | ||||
| .palette-header i { | ||||
|     margin: 3px 10px 3px 3px; | ||||
|   | ||||
| @@ -67,3 +67,15 @@ | ||||
|     border-style: dashed; | ||||
|     color: #aaa; | ||||
| } | ||||
| .config-node-filter-info { | ||||
|     position: absolute; | ||||
|     top: 0; | ||||
|     right:0; | ||||
|     height: 38px; | ||||
|     line-height: 38px; | ||||
|     padding: 0 8px; | ||||
|     background: $palette-header-background; | ||||
|     font-size: 0.8em; | ||||
|     color: #999; | ||||
|     font-weight: normal; | ||||
| } | ||||
|   | ||||
| @@ -207,7 +207,8 @@ | ||||
|             "subflows": "subflows", | ||||
|             "flows": "flows", | ||||
|             "filterUnused":"unused", | ||||
|             "filterAll":"all" | ||||
|             "filterAll":"all", | ||||
|             "filtered": "__count__ hidden" | ||||
|         } | ||||
|     }, | ||||
|     "typedInput": { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user