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
2248bf43
Commit
2248bf43
authored
Jan 04, 2018
by
Patrick O'Carroll
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added search function
parent
0068e827
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
3 deletions
+14
-3
public/app/containers/AlertRuleList/AlertRuleList.tsx
+14
-3
No files found.
public/app/containers/AlertRuleList/AlertRuleList.tsx
View file @
2248bf43
...
...
@@ -23,6 +23,7 @@ export class AlertRuleList extends React.Component<IContainerProps, any> {
this
.
props
.
nav
.
load
(
'alerting'
,
'alert-list'
);
this
.
fetchRules
();
this
.
state
=
{
search
:
''
};
}
onStateFilterChanged
=
evt
=>
{
...
...
@@ -44,9 +45,19 @@ export class AlertRuleList extends React.Component<IContainerProps, any> {
});
};
onSearchFilter
(
event
)
{
this
.
setState
({
search
:
event
.
target
.
value
});
console
.
log
(
'yo'
);
}
render
()
{
const
{
nav
,
alertList
}
=
this
.
props
;
let
regex
=
new
RegExp
(
this
.
state
.
search
,
'ig'
);
const
filteredAlerts
=
alertList
.
rules
.
filter
(
alert
=>
{
return
regex
.
test
(
alert
.
name
)
||
regex
.
test
(
alert
.
stateText
);
});
return
(
<
div
>
<
PageHeader
model=
{
nav
as
any
}
/>
...
...
@@ -58,8 +69,8 @@ export class AlertRuleList extends React.Component<IContainerProps, any> {
type=
"text"
className=
"gf-form-input width-13"
placeholder=
"Search alert"
value=
{
this
.
s
earchQuery
}
onChange=
{
this
.
on
QueryUpdated
}
value=
{
this
.
s
tate
.
search
}
onChange=
{
this
.
on
SearchFilter
.
bind
(
this
)
}
/>
<
i
className=
"gf-form-input-icon fa fa-search"
/>
</
label
>
...
...
@@ -83,7 +94,7 @@ export class AlertRuleList extends React.Component<IContainerProps, any> {
<
section
>
<
ol
className=
"alert-rule-list"
>
{
alertList
.
rule
s
.
map
(
rule
=>
<
AlertRuleItem
rule=
{
rule
}
key=
{
rule
.
id
}
/>)
}
{
filteredAlert
s
.
map
(
rule
=>
<
AlertRuleItem
rule=
{
rule
}
key=
{
rule
.
id
}
/>)
}
</
ol
>
</
section
>
</
div
>
...
...
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