From 7f08bc83588abf6076d8c3091200490153225e7b Mon Sep 17 00:00:00 2001 From: Jade McGough Date: Wed, 26 Oct 2016 17:04:02 -0700 Subject: [PATCH] allow users to filter by apps --- ui/src/hosts/components/HostsTable.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/ui/src/hosts/components/HostsTable.js b/ui/src/hosts/components/HostsTable.js index 7eae8ee58..0d2427522 100644 --- a/ui/src/hosts/components/HostsTable.js +++ b/ui/src/hosts/components/HostsTable.js @@ -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}); },