|
@@ -46,15 +46,13 @@ export class AlertRuleList extends React.Component<IContainerProps, any> {
|
|
|
});
|
|
});
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
- onSearchFilter(event) {
|
|
|
|
|
- this.setState({ search: event.target.value });
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ onSearchFilter = evt => {
|
|
|
|
|
+ this.props.alertList.setSearchState(evt.target.value);
|
|
|
|
|
+ };
|
|
|
|
|
|
|
|
render() {
|
|
render() {
|
|
|
const { nav, alertList } = this.props;
|
|
const { nav, alertList } = this.props;
|
|
|
|
|
|
|
|
- let regex = new RegExp(this.state.search, 'i');
|
|
|
|
|
-
|
|
|
|
|
return (
|
|
return (
|
|
|
<div>
|
|
<div>
|
|
|
<PageHeader model={nav as any} />
|
|
<PageHeader model={nav as any} />
|
|
@@ -66,8 +64,8 @@ export class AlertRuleList extends React.Component<IContainerProps, any> {
|
|
|
type="text"
|
|
type="text"
|
|
|
className="gf-form-input width-13"
|
|
className="gf-form-input width-13"
|
|
|
placeholder="Search alert"
|
|
placeholder="Search alert"
|
|
|
- value={this.state.search}
|
|
|
|
|
- onChange={this.onSearchFilter.bind(this)}
|
|
|
|
|
|
|
+ value={alertList.search}
|
|
|
|
|
+ onChange={this.onSearchFilter}
|
|
|
/>
|
|
/>
|
|
|
<i className="gf-form-input-icon fa fa-search" />
|
|
<i className="gf-form-input-icon fa fa-search" />
|
|
|
</label>
|
|
</label>
|
|
@@ -92,8 +90,8 @@ export class AlertRuleList extends React.Component<IContainerProps, any> {
|
|
|
<section>
|
|
<section>
|
|
|
<ol className="alert-rule-list">
|
|
<ol className="alert-rule-list">
|
|
|
{alertList
|
|
{alertList
|
|
|
- .searchFilter(regex)
|
|
|
|
|
- .map(rule => <AlertRuleItem rule={rule} key={rule.id} search={this.state.search} />)}
|
|
|
|
|
|
|
+ .searchFilter()
|
|
|
|
|
+ .map(rule => <AlertRuleItem rule={rule} key={rule.id} search={alertList.search} />)}
|
|
|
</ol>
|
|
</ol>
|
|
|
</section>
|
|
</section>
|
|
|
</div>
|
|
</div>
|