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