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
f3825263
Commit
f3825263
authored
Oct 10, 2016
by
bergquist
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(alerting): add pause button in alert list
parent
264590a9
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
26 additions
and
5 deletions
+26
-5
pkg/api/alerting.go
+8
-3
pkg/models/alert.go
+1
-1
public/app/features/alerting/alert_list_ctrl.ts
+14
-1
public/app/features/alerting/partials/alert_list.html
+3
-0
No files found.
pkg/api/alerting.go
View file @
f3825263
...
...
@@ -265,12 +265,17 @@ func PauseAlert(c *middleware.Context, cmd models.PauseAlertCommand) Response {
return
ApiError
(
500
,
""
,
err
)
}
response
:=
"un paused"
var
response
models
.
AlertStateType
=
models
.
AlertStateNoData
if
cmd
.
Paused
{
response
=
"paused"
response
=
models
.
AlertStatePaused
}
return
ApiSuccess
(
"Alert "
+
response
)
result
:=
map
[
string
]
interface
{}{
"alertId"
:
cmd
.
AlertId
,
"state"
:
response
,
}
return
Json
(
200
,
result
)
}
func
getAlertIdForRequest
(
c
*
middleware
.
Context
)
(
int64
,
error
)
{
...
...
pkg/models/alert.go
View file @
f3825263
...
...
@@ -104,7 +104,7 @@ type SaveAlertsCommand struct {
type
PauseAlertCommand
struct
{
OrgId
int64
AlertId
int64
`json:"alertId"`
Paused
bool
`json:"
bool
"`
Paused
bool
`json:"
paused
"`
}
type
SetAlertStateCommand
struct
{
...
...
public/app/features/alerting/alert_list_ctrl.ts
View file @
f3825263
...
...
@@ -23,7 +23,7 @@ export class AlertListCtrl {
};
/** @ngInject */
constructor
(
private
backendSrv
,
private
$location
)
{
constructor
(
private
backendSrv
,
private
$location
,
private
$scope
)
{
var
params
=
$location
.
search
();
this
.
filters
.
state
=
params
.
state
||
null
;
this
.
loadAlerts
();
...
...
@@ -43,6 +43,19 @@ export class AlertListCtrl {
});
}
pauseAlertRule
(
alertId
:
any
)
{
var
alert
=
_
.
find
(
this
.
alerts
,
{
id
:
alertId
});
var
payload
=
{
paused
:
alert
.
state
!==
"paused"
};
this
.
backendSrv
.
post
(
`/api/alerts/
${
alertId
}
/pause`
,
payload
).
then
(
result
=>
{
alert
.
state
=
result
.
state
;
alert
.
stateModel
=
alertDef
.
getStateDisplayModel
(
result
.
state
);
});
}
openHowTo
()
{
appEvents
.
emit
(
'show-modal'
,
{
src
:
'public/app/features/alerting/partials/alert_howto.html'
,
...
...
public/app/features/alerting/partials/alert_list.html
View file @
f3825263
...
...
@@ -33,6 +33,9 @@
<i
class=
"icon-gf icon-gf-settings"
></i>
</a>
</div>
<div
class=
"card-item-header"
>
<a
class=
"card-item-cog"
ng-click=
"ctrl.pauseAlertRule(alert.id)"
>
pause
</a>
</div>
</div>
<div
class=
"card-item-body"
>
<div
class=
"card-item-details"
>
...
...
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