mirror of https://github.com/node-red/node-red.git
Add 'no matches' message to package search results
parent
2e87ebe800
commit
e3b7c5fce7
|
@ -352,6 +352,10 @@ RED.palette.editor = (function() {
|
||||||
for (var i=0;i<Math.min(10,filteredList.length);i++) {
|
for (var i=0;i<Math.min(10,filteredList.length);i++) {
|
||||||
packageList.editableList('addItem',filteredList[i]);
|
packageList.editableList('addItem',filteredList[i]);
|
||||||
}
|
}
|
||||||
|
if (filteredList.length === 0) {
|
||||||
|
packageList.editableList('addItem',{});
|
||||||
|
}
|
||||||
|
|
||||||
if (filteredList.length > 10) {
|
if (filteredList.length > 10) {
|
||||||
packageList.editableList('addItem',{start:10,more:filteredList.length-10})
|
packageList.editableList('addItem',{start:10,more:filteredList.length-10})
|
||||||
}
|
}
|
||||||
|
@ -430,6 +434,7 @@ RED.palette.editor = (function() {
|
||||||
|
|
||||||
nodeList = $('<ol>',{id:"palette-module-list", style:"position: absolute;top: 35px;bottom: 0;left: 0;right: 0px;"}).appendTo(modulesTab).editableList({
|
nodeList = $('<ol>',{id:"palette-module-list", style:"position: absolute;top: 35px;bottom: 0;left: 0;right: 0px;"}).appendTo(modulesTab).editableList({
|
||||||
addButton: false,
|
addButton: false,
|
||||||
|
scrollOnAdd: false,
|
||||||
sort: function(A,B) {
|
sort: function(A,B) {
|
||||||
return A.info.name.localeCompare(B.info.name);
|
return A.info.name.localeCompare(B.info.name);
|
||||||
},
|
},
|
||||||
|
@ -442,6 +447,7 @@ RED.palette.editor = (function() {
|
||||||
},
|
},
|
||||||
addItem: function(container,i,object) {
|
addItem: function(container,i,object) {
|
||||||
var entry = object.info;
|
var entry = object.info;
|
||||||
|
if (entry) {
|
||||||
var headerRow = $('<div>',{class:"palette-module-header"}).appendTo(container);
|
var headerRow = $('<div>',{class:"palette-module-header"}).appendTo(container);
|
||||||
var titleRow = $('<div class="palette-module-meta palette-module-name"><i class="fa fa-cube"></i></div>').appendTo(headerRow);
|
var titleRow = $('<div class="palette-module-meta palette-module-name"><i class="fa fa-cube"></i></div>').appendTo(headerRow);
|
||||||
$('<span>').html(entry.name).appendTo(titleRow);
|
$('<span>').html(entry.name).appendTo(titleRow);
|
||||||
|
@ -526,6 +532,9 @@ RED.palette.editor = (function() {
|
||||||
evt.preventDefault();
|
evt.preventDefault();
|
||||||
})
|
})
|
||||||
refreshNodeModule(entry.name);
|
refreshNodeModule(entry.name);
|
||||||
|
} else {
|
||||||
|
$('<div>',{class:"red-ui-search-empty"}).html(RED._('search.empty')).appendTo(container);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -546,10 +555,9 @@ RED.palette.editor = (function() {
|
||||||
.appendTo(searchDiv)
|
.appendTo(searchDiv)
|
||||||
.searchBox({
|
.searchBox({
|
||||||
delay: 300,
|
delay: 300,
|
||||||
minimumLength: 2,
|
|
||||||
change: function() {
|
change: function() {
|
||||||
var searchTerm = $(this).val();
|
var searchTerm = $(this).val();
|
||||||
if (searchTerm.length >= 2) {
|
if (searchTerm.length > 0) {
|
||||||
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}});
|
||||||
|
@ -557,11 +565,9 @@ RED.palette.editor = (function() {
|
||||||
searchInput.searchBox('count',filteredList.length+" / "+loadedList.length);
|
searchInput.searchBox('count',filteredList.length+" / "+loadedList.length);
|
||||||
} else {
|
} else {
|
||||||
searchInput.searchBox('count',loadedList.length);
|
searchInput.searchBox('count',loadedList.length);
|
||||||
if (searchTerm.length === 0) {
|
|
||||||
packageList.editableList('empty');
|
packageList.editableList('empty');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
@ -603,7 +609,9 @@ RED.palette.editor = (function() {
|
||||||
|
|
||||||
packageList = $('<ol>',{style:"position: absolute;top: 78px;bottom: 0;left: 0;right: 0px;"}).appendTo(installTab).editableList({
|
packageList = $('<ol>',{style:"position: absolute;top: 78px;bottom: 0;left: 0;right: 0px;"}).appendTo(installTab).editableList({
|
||||||
addButton: false,
|
addButton: false,
|
||||||
|
scrollOnAdd: false,
|
||||||
addItem: function(container,i,object) {
|
addItem: function(container,i,object) {
|
||||||
|
|
||||||
if (object.more) {
|
if (object.more) {
|
||||||
container.addClass('palette-module-more');
|
container.addClass('palette-module-more');
|
||||||
var moreRow = $('<div>',{class:"palette-module-header palette-module"}).appendTo(container);
|
var moreRow = $('<div>',{class:"palette-module-header palette-module"}).appendTo(container);
|
||||||
|
@ -620,6 +628,7 @@ RED.palette.editor = (function() {
|
||||||
})
|
})
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (object.info) {
|
||||||
var entry = object.info;
|
var entry = object.info;
|
||||||
var headerRow = $('<div>',{class:"palette-module-header"}).appendTo(container);
|
var headerRow = $('<div>',{class:"palette-module-header"}).appendTo(container);
|
||||||
var titleRow = $('<div class="palette-module-meta"><i class="fa fa-cube"></i></div>').appendTo(headerRow);
|
var titleRow = $('<div class="palette-module-meta"><i class="fa fa-cube"></i></div>').appendTo(headerRow);
|
||||||
|
@ -652,6 +661,9 @@ RED.palette.editor = (function() {
|
||||||
object.elements = {
|
object.elements = {
|
||||||
installButton:installButton
|
installButton:installButton
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
$('<div>',{class:"red-ui-search-empty"}).html(RED._('search.empty')).appendTo(container);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -101,6 +101,5 @@
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
font-style: italic;
|
font-style: italic;
|
||||||
background: $background-color;
|
|
||||||
color: $form-placeholder-color;
|
color: $form-placeholder-color;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue