allow users to filter by apps

pull/294/head
Jade McGough 2016-10-26 17:04:02 -07:00
parent e40ea8a836
commit 7f08bc8358
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});
},