diff --git a/package.json b/package.json index cc2bc19f95b..2f79acc41df 100644 --- a/package.json +++ b/package.json @@ -150,6 +150,7 @@ "react-dom": "^16.2.0", "react-grid-layout": "^0.16.1", "react-popper": "^0.7.5", + "react-highlight-words": "^0.10.0", "react-sizeme": "^2.3.6", "remarkable": "^1.7.1", "rxjs": "^5.4.3", diff --git a/public/app/containers/AlertRuleList/AlertRuleList.jest.tsx b/public/app/containers/AlertRuleList/AlertRuleList.jest.tsx index 1025a7991f6..a12340555e9 100644 --- a/public/app/containers/AlertRuleList/AlertRuleList.jest.tsx +++ b/public/app/containers/AlertRuleList/AlertRuleList.jest.tsx @@ -45,7 +45,7 @@ describe('AlertRuleList', () => { it('should render 1 rule', () => { page.update(); - let ruleNode = page.find('.card-item-wrapper'); + let ruleNode = page.find('.alert-rule-item'); expect(toJson(ruleNode)).toMatchSnapshot(); }); diff --git a/public/app/containers/AlertRuleList/AlertRuleList.tsx b/public/app/containers/AlertRuleList/AlertRuleList.tsx index 02eaa847a2c..36426c77943 100644 --- a/public/app/containers/AlertRuleList/AlertRuleList.tsx +++ b/public/app/containers/AlertRuleList/AlertRuleList.tsx @@ -5,6 +5,7 @@ import PageHeader from 'app/core/components/PageHeader/PageHeader'; import { IAlertRule } from 'app/stores/AlertListStore/AlertListStore'; import appEvents from 'app/core/app_events'; import IContainerProps from 'app/containers/IContainerProps'; +import Highlighter from 'react-highlight-words'; @inject('view', 'nav', 'alertList') @observer @@ -23,11 +24,6 @@ export class AlertRuleList extends React.Component { this.props.nav.load('alerting', 'alert-list'); this.fetchRules(); - this.handleTooltipPositionChange = this.handleTooltipPositionChange.bind(this); - - this.state = { - tooltipPosition: 'auto', - }; } onStateFilterChanged = evt => { @@ -49,12 +45,10 @@ export class AlertRuleList extends React.Component { }); }; - handleTooltipPositionChange(evt) { - evt.preventDefault(); - this.setState({ - tooltipPosition: evt.target.value, - }); - } + onSearchQueryChange = evt => { + this.props.alertList.setSearchQuery(evt.target.value); + }; + render() { const { nav, alertList } = this.props; @@ -63,8 +57,20 @@ export class AlertRuleList extends React.Component {
+
+ +
- +