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')
.toLowerCase()
.indexOf(term) !== -1 ||
(get(item, 'Tags') || [])
.join('')
.toLowerCase()
.indexOf(term) !== -1 ||
get(item, 'Port')
.toString()
.toLowerCase()

View File

@ -26,10 +26,16 @@ const widthDeclaration = function(num) {
};
export default Controller.extend(WithHealthFiltering, {
filter: function(item, { s = '', status = '' }) {
const term = s.toLowerCase();
return (
get(item, 'Name')
(get(item, 'Name')
.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() {