diff --git a/ui/src/hosts/components/HostsTable.js b/ui/src/hosts/components/HostsTable.js index afe2d09a04..bfbdfbf4e9 100644 --- a/ui/src/hosts/components/HostsTable.js +++ b/ui/src/hosts/components/HostsTable.js @@ -6,34 +6,48 @@ const HostsTable = React.createClass({ hosts: PropTypes.arrayOf(React.PropTypes.object), }, + getInitialState() { + return { + filteredHosts: this.props.hosts, + }; + }, + + filterHosts() { + const hosts = this.props.hosts.filter((h) => h.name.search(this.refs.filter.value) !== -1); + this.setState({filteredHosts: hosts}); + }, + render() { - const {hosts} = this.props; const {Table, Thead, Tr, Td, Th} = Reactable; - return ( - - - - - - - - - { - hosts.map(({name, id}) => { - return ( - - - - - - - - ); - }) - } -
HostnameStatusCPULoadApps
{name}UP98%1.12influxdb, ntp, system
+
+
+ +
+ + + + + + + + + { + this.state.filteredHosts.map(({name, id}) => { + return ( + + + + + + + + ); + }) + } +
HostnameStatusCPULoadApps
{name}UP98%1.12influxdb, ntp, system
+
); }, });