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
a2257ec3
Commit
a2257ec3
authored
Dec 19, 2016
by
bergquist
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tech(alerting): renames pause all method
parent
ecdf1888
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
8 additions
and
12 deletions
+8
-12
pkg/api/alerting.go
+2
-2
pkg/api/api.go
+1
-1
pkg/services/alerting/eval_handler_test.go
+0
-4
pkg/services/sqlstore/alert.go
+4
-4
pkg/services/sqlstore/alert_test.go
+1
-1
No files found.
pkg/api/alerting.go
View file @
a2257ec3
...
...
@@ -286,8 +286,8 @@ func PauseAlert(c *middleware.Context, dto dtos.PauseAlertCommand) Response {
return
Json
(
200
,
result
)
}
//POST /api/a
lerts/pause
func
PauseAlerts
(
c
*
middleware
.
Context
,
dto
dtos
.
PauseAllAlertsCommand
)
Response
{
//POST /api/a
dmin/pause-all-alerts
func
PauseAl
lAl
erts
(
c
*
middleware
.
Context
,
dto
dtos
.
PauseAllAlertsCommand
)
Response
{
updateCmd
:=
models
.
PauseAllAlertCommand
{
Paused
:
dto
.
Paused
,
}
...
...
pkg/api/api.go
View file @
a2257ec3
...
...
@@ -289,7 +289,7 @@ func Register(r *macaron.Macaron) {
r
.
Get
(
"/users/:id/quotas"
,
wrap
(
GetUserQuotas
))
r
.
Put
(
"/users/:id/quotas/:target"
,
bind
(
m
.
UpdateUserQuotaCmd
{}),
wrap
(
UpdateUserQuota
))
r
.
Get
(
"/stats"
,
AdminGetStats
)
r
.
Post
(
"/pause-all-alerts"
,
bind
(
dtos
.
PauseAllAlertsCommand
{}),
wrap
(
PauseAlerts
))
r
.
Post
(
"/pause-all-alerts"
,
bind
(
dtos
.
PauseAllAlertsCommand
{}),
wrap
(
PauseAl
lAl
erts
))
},
reqGrafanaAdmin
)
// rendering
...
...
pkg/services/alerting/eval_handler_test.go
View file @
a2257ec3
...
...
@@ -18,10 +18,6 @@ func (c *conditionStub) Eval(context *EvalContext) (*ConditionResult, error) {
return
&
ConditionResult
{
Firing
:
c
.
firing
,
EvalMatches
:
c
.
matches
,
Operator
:
c
.
operator
,
NoDataFound
:
c
.
noData
},
nil
}
func
(
c
*
conditionStub
)
GetDatasourceId
()
(
datasourceId
*
int64
,
exist
bool
)
{
return
nil
,
false
}
func
TestAlertingExecutor
(
t
*
testing
.
T
)
{
Convey
(
"Test alert execution"
,
t
,
func
()
{
handler
:=
NewEvalHandler
()
...
...
pkg/services/sqlstore/alert.go
View file @
a2257ec3
...
...
@@ -19,8 +19,8 @@ func init() {
bus
.
AddHandler
(
"sql"
,
GetAllAlertQueryHandler
)
bus
.
AddHandler
(
"sql"
,
SetAlertState
)
bus
.
AddHandler
(
"sql"
,
GetAlertStatesForDashboard
)
bus
.
AddHandler
(
"sql"
,
PauseAlert
Rule
)
bus
.
AddHandler
(
"sql"
,
PauseAllAlert
Rule
)
bus
.
AddHandler
(
"sql"
,
PauseAlert
)
bus
.
AddHandler
(
"sql"
,
PauseAllAlert
s
)
}
func
GetAlertById
(
query
*
m
.
GetAlertByIdQuery
)
error
{
...
...
@@ -250,7 +250,7 @@ func SetAlertState(cmd *m.SetAlertStateCommand) error {
})
}
func
PauseAlert
Rule
(
cmd
*
m
.
PauseAlertCommand
)
error
{
func
PauseAlert
(
cmd
*
m
.
PauseAlertCommand
)
error
{
return
inTransaction
(
func
(
sess
*
xorm
.
Session
)
error
{
if
len
(
cmd
.
AlertIds
)
==
0
{
return
fmt
.
Errorf
(
"command contains no alertids"
)
...
...
@@ -280,7 +280,7 @@ func PauseAlertRule(cmd *m.PauseAlertCommand) error {
})
}
func
PauseAllAlert
Rule
(
cmd
*
m
.
PauseAllAlertCommand
)
error
{
func
PauseAllAlert
s
(
cmd
*
m
.
PauseAllAlertCommand
)
error
{
return
inTransaction
(
func
(
sess
*
xorm
.
Session
)
error
{
var
newState
string
if
cmd
.
Paused
{
...
...
pkg/services/sqlstore/alert_test.go
View file @
a2257ec3
...
...
@@ -55,7 +55,7 @@ func TestAlertingDataAccess(t *testing.T) {
Paused
:
true
,
}
err
=
PauseAllAlert
Rule
(
cmd
)
err
=
PauseAllAlert
s
(
cmd
)
So
(
err
,
ShouldBeNil
)
Convey
(
"cannot updated paused alert"
,
func
()
{
...
...
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