consul/ui/packages/consul-ui/app/search/predicates/intention.js

13 lines
471 B
JavaScript
Raw Normal View History

export default () => (term) => (item) => {
const source = item.SourceName.toLowerCase();
const destination = item.DestinationName.toLowerCase();
const allLabel = 'All Services (*)'.toLowerCase();
const lowerTerm = term.toLowerCase();
return (
source.indexOf(lowerTerm) !== -1 ||
destination.indexOf(lowerTerm) !== -1 ||
(source === '*' && allLabel.indexOf(lowerTerm) !== -1) ||
(destination === '*' && allLabel.indexOf(lowerTerm) !== -1)
);
}