Add basic searching by tags using the freetext search near-term

This commit is contained in:
John Cowen 2018-07-12 14:47:41 +01:00
parent 6c9f4fbe8a
commit f993130937
2 changed files with 12 additions and 2 deletions

View file

@ -26,6 +26,10 @@ export default Controller.extend(WithFiltering, {
get(item, 'ID') get(item, 'ID')
.toLowerCase() .toLowerCase()
.indexOf(term) !== -1 || .indexOf(term) !== -1 ||
(get(item, 'Tags') || [])
.join('')
.toLowerCase()
.indexOf(term) !== -1 ||
get(item, 'Port') get(item, 'Port')
.toString() .toString()
.toLowerCase() .toLowerCase()

View file

@ -26,10 +26,16 @@ const widthDeclaration = function(num) {
}; };
export default Controller.extend(WithHealthFiltering, { export default Controller.extend(WithHealthFiltering, {
filter: function(item, { s = '', status = '' }) { filter: function(item, { s = '', status = '' }) {
const term = s.toLowerCase();
return ( return (
get(item, 'Name') (get(item, 'Name')
.toLowerCase() .toLowerCase()
.indexOf(s.toLowerCase()) !== -1 && item.hasStatus(status) .indexOf(term) !== -1 ||
(get(item, 'Tags') || [])
.join('')
.toLowerCase()
.indexOf(term) !== -1) &&
item.hasStatus(status)
); );
}, },
totalWidth: computed('{maxPassing,maxWarning,maxCritical}', function() { totalWidth: computed('{maxPassing,maxWarning,maxCritical}', function() {