fixed regex issue

This commit is contained in:
Patrick O'Carroll 2018-01-05 15:19:25 +01:00
parent 3797054eb4
commit fc6d14127d
2 changed files with 8 additions and 8 deletions

View File

@ -52,7 +52,7 @@ export class AlertRuleList extends React.Component<IContainerProps, any> {
render() {
const { nav, alertList } = this.props;
let regex = new RegExp(this.state.search, 'ig');
let regex = new RegExp(this.state.search, 'i');
return (
<div>

View File

@ -10,6 +10,13 @@ export const AlertListStore = types
rules: types.array(AlertRule),
stateFilter: types.optional(types.string, 'all'),
})
.views(self => ({
searchFilter(regex) {
return self.rules.filter(alert => {
return regex.test(alert.name) || regex.test(alert.stateText);
});
},
}))
.actions(self => ({
loadRules: flow(function* load(filters) {
const backendSrv = getEnv(self).backendSrv;
@ -31,11 +38,4 @@ export const AlertListStore = types
self.rules.push(AlertRule.create(rule));
}
}),
}))
.views(self => ({
searchFilter(regex) {
return self.rules.filter(alert => {
return regex.test(alert.name) || regex.test(alert.stateText);
});
},
}));