mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
[outline] Connect search dialog to outline filter box
This commit is contained in:
parent
55a5917282
commit
12dc4ab1fa
@ -157,6 +157,11 @@ RED.search = (function() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
var copySearchContainer = $('<button type="button" class="red-ui-button red-ui-button-small"><i class="fa fa-caret-right"></button>').appendTo(searchDiv).on('click', function(evt) {
|
||||||
|
evt.preventDefault();
|
||||||
|
RED.sidebar.info.outliner.search(searchInput.val())
|
||||||
|
hide();
|
||||||
|
});
|
||||||
|
|
||||||
searchInput.on('keydown',function(evt) {
|
searchInput.on('keydown',function(evt) {
|
||||||
var children;
|
var children;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
RED.sidebar.info.outliner = (function() {
|
RED.sidebar.info.outliner = (function() {
|
||||||
|
|
||||||
var treeList;
|
var treeList;
|
||||||
|
var searchInput;
|
||||||
var flowList;
|
var flowList;
|
||||||
var subflowList;
|
var subflowList;
|
||||||
var globalConfigNodes;
|
var globalConfigNodes;
|
||||||
@ -222,23 +222,21 @@ RED.sidebar.info.outliner = (function() {
|
|||||||
var container = $("<div>", {class:"red-ui-info-outline"}).css({'height': '400px'});
|
var container = $("<div>", {class:"red-ui-info-outline"}).css({'height': '400px'});
|
||||||
var toolbar = $("<div>", {class:"red-ui-info-outline-toolbar"}).appendTo(container);
|
var toolbar = $("<div>", {class:"red-ui-info-outline-toolbar"}).appendTo(container);
|
||||||
|
|
||||||
var searchInput = $('<input type="text">').appendTo(toolbar).searchBox({
|
searchInput = $('<input type="text">').appendTo(toolbar).searchBox({
|
||||||
delay: 100,
|
delay: 300,
|
||||||
change: function() {
|
change: function() {
|
||||||
var val = $(this).val().trim().toLowerCase();
|
var val = $(this).val();
|
||||||
|
var searchResults = RED.search.search(val);
|
||||||
if (val) {
|
if (val) {
|
||||||
|
var resultMap = {};
|
||||||
|
for (var i=0,l=searchResults.length;i<l;i++) {
|
||||||
|
resultMap[searchResults[i].node.id] = true;
|
||||||
|
}
|
||||||
var c = treeList.treeList('filter',function(item) {
|
var c = treeList.treeList('filter',function(item) {
|
||||||
if (item.depth === 0) {
|
if (item.depth === 0) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (item.id && objects[item.id]) {
|
return item.id && objects[item.id] && resultMap[item.id]
|
||||||
var l = ((objects[item.id].type||"")+" "+(objects[item.id].name||"")+" "+(objects[item.id].id||"")+" "+(objects[item.id].label||"")).toLowerCase();
|
|
||||||
var isMatch = l.indexOf(val) > -1;
|
|
||||||
if (isMatch) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
treeList.treeList('filter',null);
|
treeList.treeList('filter',null);
|
||||||
@ -421,6 +419,9 @@ RED.sidebar.info.outliner = (function() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
build: build
|
build: build,
|
||||||
|
search: function(val) {
|
||||||
|
searchInput.searchBox('value',val)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
|
@ -24,6 +24,13 @@
|
|||||||
top: 0px;
|
top: 0px;
|
||||||
border: 1px solid $primary-border-color;
|
border: 1px solid $primary-border-color;
|
||||||
box-shadow: 0 0 10px $shadow;
|
box-shadow: 0 0 10px $shadow;
|
||||||
|
background: $secondary-background;
|
||||||
|
|
||||||
|
.red-ui-searchBox-container {
|
||||||
|
display: inline-block;
|
||||||
|
margin-right: 6px;
|
||||||
|
width: calc(100% - 30px);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.red-ui-type-search {
|
.red-ui-type-search {
|
||||||
|
@ -369,7 +369,7 @@ div.red-ui-info-table {
|
|||||||
top:0;
|
top:0;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
right: 0px;
|
right: 0px;
|
||||||
padding: 2px 0 0 1px;
|
padding: 2px 8px 0 1px;
|
||||||
text-align: right;
|
text-align: right;
|
||||||
background: $list-item-background;
|
background: $list-item-background;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user