Use `some` for the tags search instead of munging and searching

This commit is contained in:
John Cowen 2018-07-18 18:08:22 +01:00
parent f7209e63f1
commit 9ae81696a1
2 changed files with 6 additions and 8 deletions

View File

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

View File

@ -31,10 +31,9 @@ export default Controller.extend(WithHealthFiltering, {
(get(item, 'Name')
.toLowerCase()
.indexOf(term) !== -1 ||
(get(item, 'Tags') || [])
.join('')
.toLowerCase()
.indexOf(term) !== -1) &&
(get(item, 'Tags') || []).some(function(item) {
return item.toLowerCase().indexOf(term) !== -1;
})) &&
item.hasStatus(status)
);
},