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 (
-
-
- | Hostname |
- Status |
- CPU |
- Load |
- Apps |
-
- {
- hosts.map(({name, id}) => {
- return (
-
- | {name} |
- UP |
- 98% |
- 1.12 |
- influxdb, ntp, system |
-
- );
- })
- }
-
+
+
+
+
+
+
+ | Hostname |
+ Status |
+ CPU |
+ Load |
+ Apps |
+
+ {
+ this.state.filteredHosts.map(({name, id}) => {
+ return (
+
+ | {name} |
+ UP |
+ 98% |
+ 1.12 |
+ influxdb, ntp, system |
+
+ );
+ })
+ }
+
+
);
},
});