Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nexpie-grafana-theme
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kornkitt Poolsup
nexpie-grafana-theme
Commits
3797054e
Commit
3797054e
authored
Jan 05, 2018
by
Patrick O'Carroll
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
made a view of filtered list
parent
5079dcdc
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
5 deletions
+8
-5
public/app/containers/AlertRuleList/AlertRuleList.tsx
+1
-5
public/app/stores/AlertListStore/AlertListStore.ts
+7
-0
No files found.
public/app/containers/AlertRuleList/AlertRuleList.tsx
View file @
3797054e
...
@@ -47,16 +47,12 @@ export class AlertRuleList extends React.Component<IContainerProps, any> {
...
@@ -47,16 +47,12 @@ export class AlertRuleList extends React.Component<IContainerProps, any> {
onSearchFilter
(
event
)
{
onSearchFilter
(
event
)
{
this
.
setState
({
search
:
event
.
target
.
value
});
this
.
setState
({
search
:
event
.
target
.
value
});
console
.
log
(
'yo'
);
}
}
render
()
{
render
()
{
const
{
nav
,
alertList
}
=
this
.
props
;
const
{
nav
,
alertList
}
=
this
.
props
;
let
regex
=
new
RegExp
(
this
.
state
.
search
,
'ig'
);
let
regex
=
new
RegExp
(
this
.
state
.
search
,
'ig'
);
const
filteredAlerts
=
alertList
.
rules
.
filter
(
alert
=>
{
return
regex
.
test
(
alert
.
name
)
||
regex
.
test
(
alert
.
stateText
);
});
return
(
return
(
<
div
>
<
div
>
...
@@ -94,7 +90,7 @@ export class AlertRuleList extends React.Component<IContainerProps, any> {
...
@@ -94,7 +90,7 @@ export class AlertRuleList extends React.Component<IContainerProps, any> {
<
section
>
<
section
>
<
ol
className=
"alert-rule-list"
>
<
ol
className=
"alert-rule-list"
>
{
filteredAlerts
.
map
(
rule
=>
<
AlertRuleItem
rule=
{
rule
}
key=
{
rule
.
id
}
/>)
}
{
alertList
.
searchFilter
(
regex
)
.
map
(
rule
=>
<
AlertRuleItem
rule=
{
rule
}
key=
{
rule
.
id
}
/>)
}
</
ol
>
</
ol
>
</
section
>
</
section
>
</
div
>
</
div
>
...
...
public/app/stores/AlertListStore/AlertListStore.ts
View file @
3797054e
...
@@ -31,4 +31,11 @@ export const AlertListStore = types
...
@@ -31,4 +31,11 @@ export const AlertListStore = types
self
.
rules
.
push
(
AlertRule
.
create
(
rule
));
self
.
rules
.
push
(
AlertRule
.
create
(
rule
));
}
}
}),
}),
}))
.
views
(
self
=>
({
searchFilter
(
regex
)
{
return
self
.
rules
.
filter
(
alert
=>
{
return
regex
.
test
(
alert
.
name
)
||
regex
.
test
(
alert
.
stateText
);
});
},
}));
}));
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment