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
3fd707f3
Commit
3fd707f3
authored
Sep 02, 2018
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
redux: progress
parent
2a64d19f
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
15 deletions
+19
-15
public/app/features/alerting/AlertRuleList.tsx
+15
-13
public/app/features/alerting/state/actions.ts
+4
-2
No files found.
public/app/features/alerting/AlertRuleList.tsx
View file @
3fd707f3
...
...
@@ -15,12 +15,11 @@ interface Props {
alertRules
:
AlertRule
[];
updateLocation
:
typeof
updateLocation
;
getAlertRulesAsync
:
typeof
getAlertRulesAsync
;
stateFilter
:
string
;
}
interface
State
{
rules
:
AlertRule
[];
search
:
string
;
stateFilter
:
string
;
}
export
class
AlertRuleList
extends
PureComponent
<
Props
,
State
>
{
...
...
@@ -37,29 +36,31 @@ export class AlertRuleList extends PureComponent<Props, State> {
super
(
props
);
this
.
state
=
{
rules
:
[],
search
:
''
,
stateFilter
:
''
,
};
}
componentDidMount
()
{
this
.
fetchRules
();
this
.
fetchRules
(
this
.
getStateFilter
()
);
}
onStateFilterChanged
=
evt
=>
{
this
.
props
.
updateLocation
({
query
:
{
state
:
evt
.
target
.
value
},
});
this
.
fetchRules
();
this
.
fetchRules
(
evt
.
target
.
value
);
};
async
fetchRules
()
{
await
this
.
props
.
getAlertRulesAsync
();
getStateFilter
():
string
{
const
{
stateFilter
}
=
this
.
props
;
if
(
stateFilter
)
{
return
stateFilter
.
toString
();
}
return
'all'
;
}
// this.props.alertList.loadRules({
// state: this.props.view.query.get('state') || 'all',
// });
async
fetchRules
(
stateFilter
:
string
)
{
await
this
.
props
.
getAlertRulesAsync
({
state
:
stateFilter
});
}
onOpenHowTo
=
()
=>
{
...
...
@@ -76,7 +77,7 @@ export class AlertRuleList extends PureComponent<Props, State> {
render
()
{
const
{
navModel
,
alertRules
}
=
this
.
props
;
const
{
search
,
stateFilter
}
=
this
.
state
;
const
{
search
}
=
this
.
state
;
return
(
<
div
>
...
...
@@ -99,7 +100,7 @@ export class AlertRuleList extends PureComponent<Props, State> {
<
label
className=
"gf-form-label"
>
States
</
label
>
<
div
className=
"gf-form-select-wrapper width-13"
>
<
select
className=
"gf-form-input"
onChange=
{
this
.
onStateFilterChanged
}
value=
{
stateFilter
}
>
<
select
className=
"gf-form-input"
onChange=
{
this
.
onStateFilterChanged
}
value=
{
this
.
getStateFilter
()
}
>
{
this
.
stateFilters
.
map
(
AlertStateFilterOption
)
}
</
select
>
</
div
>
...
...
@@ -200,6 +201,7 @@ export class AlertRuleItem extends React.Component<AlertRuleItemProps, any> {
const
mapStateToProps
=
(
state
:
StoreState
)
=>
({
navModel
:
getNavModel
(
state
.
navIndex
,
'alert-list'
),
alertRules
:
state
.
alertRules
,
stateFilter
:
state
.
location
.
query
.
state
,
});
const
mapDispatchToProps
=
{
...
...
public/app/features/alerting/state/actions.ts
View file @
3fd707f3
...
...
@@ -14,9 +14,11 @@ export const loadAlertRules = (rules: AlertRule[]): LoadAlertRulesAction => ({
export
type
Action
=
LoadAlertRulesAction
;
export
const
getAlertRulesAsync
=
()
=>
async
(
dispatch
:
Dispatch
<
Action
>
):
Promise
<
AlertRule
[]
>
=>
{
export
const
getAlertRulesAsync
=
(
options
:
{
state
:
string
})
=>
async
(
dispatch
:
Dispatch
<
Action
>
):
Promise
<
AlertRule
[]
>
=>
{
try
{
const
rules
=
await
getBackendSrv
().
get
(
'/api/alerts'
,
{}
);
const
rules
=
await
getBackendSrv
().
get
(
'/api/alerts'
,
options
);
dispatch
(
loadAlertRules
(
rules
));
return
rules
;
}
catch
(
error
)
{
...
...
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