Merge pull request #294 from influxdata/feature/filter-by-app

allow users to filter by apps
pull/292/head
Andrew Watkins 2016-10-27 12:07:50 -07:00 committed by GitHub
commit dceb2216b5
1 changed files with 12 additions and 1 deletions

View File

@ -29,7 +29,18 @@ const HostsTable = React.createClass({
},
filterHosts(allHosts, searchTerm) {
const hosts = allHosts.filter((h) => h.name.search(searchTerm) !== -1);
const hosts = allHosts.filter((h) => {
let apps = null;
if (h.apps) {
apps = h.apps.join(', ');
} else {
apps = '';
}
return (
h.name.search(searchTerm) !== -1 ||
apps.search(searchTerm) !== -1
);
});
this.setState({searchTerm, filteredHosts: hosts});
},