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

Default filter to All Catalogues and show nodes for small lists

This commit is contained in:
Nick O'Leary 2023-09-05 17:49:50 +01:00
parent 3a6078a56a
commit ab6d537c3e
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9

View File

@ -494,6 +494,7 @@ RED.palette.editor = (function() {
// if there is only 1 catalog, hide the select // if there is only 1 catalog, hide the select
if (catalogEntries.length > 1) { if (catalogEntries.length > 1) {
catalogSelection.prepend(`<option value="all">${RED._('palette.editor.allCatalogs')}</option>`) catalogSelection.prepend(`<option value="all">${RED._('palette.editor.allCatalogs')}</option>`)
catalogSelection.val('all')
catalogSelection.removeAttr('disabled') // permit the user to select a catalog catalogSelection.removeAttr('disabled') // permit the user to select a catalog
} }
// refresh the searchInput counter and trigger a change // refresh the searchInput counter and trigger a change
@ -523,7 +524,7 @@ RED.palette.editor = (function() {
function refreshFilteredItems() { function refreshFilteredItems() {
packageList.editableList('empty'); packageList.editableList('empty');
var currentFilter = searchInput.searchBox('value').trim(); var currentFilter = searchInput.searchBox('value').trim();
if (currentFilter === ""){ if (currentFilter === "" && loadedList.length > 20){
packageList.editableList('addItem',{count:loadedList.length}) packageList.editableList('addItem',{count:loadedList.length})
return; return;
} }
@ -893,7 +894,7 @@ RED.palette.editor = (function() {
delay: 300, delay: 300,
change: function() { change: function() {
var searchTerm = $(this).val().trim().toLowerCase(); var searchTerm = $(this).val().trim().toLowerCase();
if (searchTerm.length > 0) { if (searchTerm.length > 0 || loadedList.length < 20) {
filteredList = loadedList.filter(function(m) { filteredList = loadedList.filter(function(m) {
return (m.index.indexOf(searchTerm) > -1); return (m.index.indexOf(searchTerm) > -1);
}).map(function(f) { return {info:f}}); }).map(function(f) { return {info:f}});