naming fixes and added test file

This commit is contained in:
Patrick O'Carroll
2018-01-09 15:16:55 +01:00
parent 48548f0641
commit d48be3ca15
3 changed files with 74 additions and 9 deletions

View File

@@ -46,8 +46,8 @@ export class AlertRuleList extends React.Component<IContainerProps, any> {
});
};
onSearchFilter = evt => {
this.props.alertList.setSearchState(evt.target.value);
onSearchQueryChange = evt => {
this.props.alertList.setSearchQuery(evt.target.value);
};
render() {
@@ -65,7 +65,7 @@ export class AlertRuleList extends React.Component<IContainerProps, any> {
className="gf-form-input width-13"
placeholder="Search alert"
value={alertList.search}
onChange={this.onSearchFilter}
onChange={this.onSearchQueryChange}
/>
<i className="gf-form-input-icon fa fa-search" />
</label>
@@ -89,9 +89,9 @@ export class AlertRuleList extends React.Component<IContainerProps, any> {
<section>
<ol className="alert-rule-list">
{alertList
.searchFilter()
.map(rule => <AlertRuleItem rule={rule} key={rule.id} search={alertList.search} />)}
{alertList.filteredRules.map(rule => (
<AlertRuleItem rule={rule} key={rule.id} search={alertList.search} />
))}
</ol>
</section>
</div>