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:
parent
7406ab6017
commit
5bb27109bf
@ -118,6 +118,7 @@ RED.search = (function() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function ensureSelectedIsVisible() {
|
function ensureSelectedIsVisible() {
|
||||||
var selectedEntry = searchResults.find("li.selected");
|
var selectedEntry = searchResults.find("li.selected");
|
||||||
if (selectedEntry.length === 1) {
|
if (selectedEntry.length === 1) {
|
||||||
@ -143,6 +144,7 @@ RED.search = (function() {
|
|||||||
search($(this).val());
|
search($(this).val());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
searchInput.on('keydown',function(evt) {
|
searchInput.on('keydown',function(evt) {
|
||||||
var children;
|
var children;
|
||||||
if (results.length > 0) {
|
if (results.length > 0) {
|
||||||
@ -229,12 +231,13 @@ RED.search = (function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function reveal(node) {
|
function reveal(node) {
|
||||||
hide();
|
hide();
|
||||||
RED.view.reveal(node.id);
|
RED.view.reveal(node.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
function show() {
|
function show(v) {
|
||||||
if (disabled) {
|
if (disabled) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -250,11 +253,13 @@ RED.search = (function() {
|
|||||||
createDialog();
|
createDialog();
|
||||||
}
|
}
|
||||||
dialog.slideDown(300);
|
dialog.slideDown(300);
|
||||||
|
searchInput.searchBox('value',v)
|
||||||
RED.events.emit("search:open");
|
RED.events.emit("search:open");
|
||||||
visible = true;
|
visible = true;
|
||||||
}
|
}
|
||||||
searchInput.focus();
|
searchInput.focus();
|
||||||
}
|
}
|
||||||
|
|
||||||
function hide() {
|
function hide() {
|
||||||
if (visible) {
|
if (visible) {
|
||||||
RED.keyboard.remove("escape");
|
RED.keyboard.remove("escape");
|
||||||
|
@ -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);
|
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) {
|
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) {
|
if (node.users.length === 0) {
|
||||||
entry.addClass("config_node_unused");
|
entry.addClass("config_node_unused");
|
||||||
}
|
}
|
||||||
@ -161,7 +162,6 @@ RED.sidebar.config = (function() {
|
|||||||
});
|
});
|
||||||
RED.view.redraw();
|
RED.view.redraw();
|
||||||
});
|
});
|
||||||
|
|
||||||
entry.on('mouseout',function(e) {
|
entry.on('mouseout',function(e) {
|
||||||
RED.nodes.eachNode(function(node) {
|
RED.nodes.eachNode(function(node) {
|
||||||
if(node.highlighted) {
|
if(node.highlighted) {
|
||||||
|
Loading…
Reference in New Issue
Block a user