diff --git a/client/components/routeservers/actions.jsx b/client/components/routeservers/actions.jsx index b53742e..2dd0930 100644 --- a/client/components/routeservers/actions.jsx +++ b/client/components/routeservers/actions.jsx @@ -27,6 +27,8 @@ export const LOAD_ROUTESERVER_ROUTES_FILTERED_SUCCESS = '@birdseye/LOAD_ROUTESER export const LOAD_ROUTESERVER_ROUTES_NOEXPORT_SUCCESS = '@birdseye/LOAD_ROUTESERVER_ROUTES_NOEXPORT_SUCCESS'; export const SET_PROTOCOLS_FILTER_VALUE = '@birdseye/SET_PROTOCOLS_FILTER_VALUE'; +export const SET_PROTOCOLS_FILTER = '@birdseye/SET_PROTOCOLS_FILTER'; + export const SET_ROUTES_FILTER_VALUE = '@birdseye/SET_ROUTES_FILTER_VALUE'; @@ -220,7 +222,17 @@ export function setProtocolsFilterValue(value) { return { type: SET_PROTOCOLS_FILTER_VALUE, payload: { - protocolsFilterValue: value + value: value + } + } +} + + +export function setProtocolsFilter(value) { + return { + type: SET_PROTOCOLS_FILTER, + payload: { + value: value, } } } diff --git a/client/components/routeservers/page.jsx b/client/components/routeservers/page.jsx index 3f34c18..bdb1357 100644 --- a/client/components/routeservers/page.jsx +++ b/client/components/routeservers/page.jsx @@ -1,4 +1,6 @@ +import {debounce} from 'underscore' + import React from 'react' import {connect} from 'react-redux' @@ -10,16 +12,34 @@ import SearchInput from 'components/search-input' import Protocols from './protocols' -import {setProtocolsFilterValue} from './actions' +import {setProtocolsFilterValue, + setProtocolsFilter} from './actions' class RouteserversPage extends React.Component { - setFilter(value) { - this.props.dispatch( - setProtocolsFilterValue(value) - ); + constructor(props) { + super(props); + this.dispatchDebounced = debounce(this.props.dispatch, 350); } + + setFilter(value) { + // Set filter value (for input rendering) + this.props.dispatch(setProtocolsFilterValue(value)); + + // Set filter delayed + this.dispatchDebounced(setProtocolsFilter(value)); + + } + + + componentDidMount() { + // Reset Filters + this.props.dispatch(setProtocolsFilterValue("")); + this.props.dispatch(setProtocolsFilter("")); + } + + render() { return(