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

Config search (#1880)

* Let nodes be findable direct from config node info

* add link to search as <a> tag

* don't expose onclick in sidebar
This commit is contained in:
Dave Conway-Jones 2018-09-17 11:35:00 +01:00 committed by Nick O'Leary
parent 7406ab6017
commit 5bb27109bf
2 changed files with 8 additions and 3 deletions

View File

@ -118,6 +118,7 @@ RED.search = (function() {
}
}
}
function ensureSelectedIsVisible() {
var selectedEntry = searchResults.find("li.selected");
if (selectedEntry.length === 1) {
@ -143,6 +144,7 @@ RED.search = (function() {
search($(this).val());
}
});
searchInput.on('keydown',function(evt) {
var children;
if (results.length > 0) {
@ -229,12 +231,13 @@ RED.search = (function() {
});
}
function reveal(node) {
hide();
RED.view.reveal(node.id);
}
function show() {
function show(v) {
if (disabled) {
return;
}
@ -250,11 +253,13 @@ RED.search = (function() {
createDialog();
}
dialog.slideDown(300);
searchInput.searchBox('value',v)
RED.events.emit("search:open");
visible = true;
}
searchInput.focus();
}
function hide() {
if (visible) {
RED.keyboard.remove("escape");

View File

@ -140,7 +140,8 @@ RED.sidebar.config = (function() {
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);
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"}).appendTo(entry);
var butt = $('<a href="#"/>').click(function(e) { e.preventDefault(); RED.search.show(node.id); }).text(node.users.length).appendTo(iconContainer);
if (node.users.length === 0) {
entry.addClass("config_node_unused");
}
@ -161,7 +162,6 @@ RED.sidebar.config = (function() {
});
RED.view.redraw();
});
entry.on('mouseout',function(e) {
RED.nodes.eachNode(function(node) {
if(node.highlighted) {