diff --git a/ui/src/shared/components/Dygraph.js b/ui/src/shared/components/Dygraph.js index ed5e4e9ce..4613d2969 100644 --- a/ui/src/shared/components/Dygraph.js +++ b/ui/src/shared/components/Dygraph.js @@ -21,11 +21,13 @@ export default class Dygraph extends Component { }, sortType: null, legendOrder: 'asc', + filterText: '', } this.getTimeSeries = ::this.getTimeSeries this.sync = ::this.sync this.handleSortLegend = ::this.handleSortLegend + this.handleLegendInputChange = ::this.handleLegendInputChange } static defaultProps = { @@ -60,6 +62,10 @@ export default class Dygraph extends Component { }) } + handleLegendInputChange(e) { + this.setState({filterText: e.target.value}) + } + sortByType(list, sortType, order) { if (!sortType) { return list @@ -238,11 +244,11 @@ export default class Dygraph extends Component { return '' }, }) + // part of optional workaround for preventing updateOptions from breaking legend // if (this.lastMouseMoveEvent) { // dygraph.mouseMove_(this.lastMouseMoveEvent) // } - dygraph.resize() const {w} = this.dygraph.getArea() this.props.setResolution(w) @@ -256,11 +262,16 @@ export default class Dygraph extends Component { } render() { - const {legend} = this.state + const {legend, filterText} = this.state return (