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
6b9db0c0
Commit
6b9db0c0
authored
Dec 19, 2016
by
bergquist
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
style(alerting): simplify support for pausing multiple alerts
parent
4ef95cfd
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
10 deletions
+6
-10
pkg/services/sqlstore/alert.go
+6
-10
No files found.
pkg/services/sqlstore/alert.go
View file @
6b9db0c0
...
@@ -250,23 +250,19 @@ func PauseAlertRule(cmd *m.PauseAlertCommand) error {
...
@@ -250,23 +250,19 @@ func PauseAlertRule(cmd *m.PauseAlertCommand) error {
return
inTransaction
(
func
(
sess
*
xorm
.
Session
)
error
{
return
inTransaction
(
func
(
sess
*
xorm
.
Session
)
error
{
var
buffer
bytes
.
Buffer
var
buffer
bytes
.
Buffer
params
:=
make
([]
interface
{},
0
)
params
:=
make
([]
interface
{},
0
)
buffer
.
WriteString
(
`UPDATE alert SET state = ?`
)
alertIdCount
:=
len
(
cmd
.
AlertIds
)
if
alertIdCount
==
1
{
buffer
.
WriteString
(
` WHERE id = ?`
)
}
else
if
alertIdCount
>
1
{
buffer
.
WriteString
(
` WHERE id IN (?`
+
strings
.
Repeat
(
",?"
,
len
(
cmd
.
AlertIds
)
-
1
)
+
`)`
)
}
buffer
.
WriteString
(
`UPDATE alert SET state = ?`
)
if
cmd
.
Paused
{
if
cmd
.
Paused
{
params
=
append
(
params
,
string
(
m
.
AlertStatePaused
))
params
=
append
(
params
,
string
(
m
.
AlertStatePaused
))
}
else
{
}
else
{
params
=
append
(
params
,
string
(
m
.
AlertStatePending
))
params
=
append
(
params
,
string
(
m
.
AlertStatePending
))
}
}
for
_
,
v
:=
range
cmd
.
AlertIds
{
if
len
(
cmd
.
AlertIds
)
>
0
{
params
=
append
(
params
,
v
)
buffer
.
WriteString
(
` WHERE id IN (?`
+
strings
.
Repeat
(
",?"
,
len
(
cmd
.
AlertIds
)
-
1
)
+
`)`
)
for
_
,
v
:=
range
cmd
.
AlertIds
{
params
=
append
(
params
,
v
)
}
}
}
res
,
err
:=
sess
.
Exec
(
buffer
.
String
(),
params
...
)
res
,
err
:=
sess
.
Exec
(
buffer
.
String
(),
params
...
)
...
...
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