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
423331da
Commit
423331da
authored
Nov 05, 2018
by
bergquist
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
alerting: delete alerts when parent folder is deleted
closes #13322
parent
0df14f3f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
4 deletions
+18
-4
pkg/services/sqlstore/dashboard.go
+18
-4
No files found.
pkg/services/sqlstore/dashboard.go
View file @
423331da
...
@@ -327,20 +327,34 @@ func DeleteDashboard(cmd *m.DeleteDashboardCommand) error {
...
@@ -327,20 +327,34 @@ func DeleteDashboard(cmd *m.DeleteDashboardCommand) error {
if
dashboard
.
IsFolder
{
if
dashboard
.
IsFolder
{
deletes
=
append
(
deletes
,
"DELETE FROM dashboard_provisioning WHERE dashboard_id in (select id from dashboard where folder_id = ?)"
)
deletes
=
append
(
deletes
,
"DELETE FROM dashboard_provisioning WHERE dashboard_id in (select id from dashboard where folder_id = ?)"
)
deletes
=
append
(
deletes
,
"DELETE FROM dashboard WHERE folder_id = ?"
)
deletes
=
append
(
deletes
,
"DELETE FROM dashboard WHERE folder_id = ?"
)
}
for
_
,
sql
:=
range
deletes
{
_
,
err
:=
sess
.
Exec
(
sql
,
dashboard
.
Id
)
dashIds
:=
[]
struct
{
Id
int64
}{}
err
:=
sess
.
SQL
(
"select id from dashboard where folder_id = ?"
,
dashboard
.
Id
)
.
Find
(
&
dashIds
)
if
err
!=
nil
{
if
err
!=
nil
{
return
err
return
err
}
}
for
_
,
id
:=
range
dashIds
{
if
err
:=
deleteAlertDefinition
(
id
.
Id
,
sess
);
err
!=
nil
{
return
nil
}
}
}
}
if
err
:=
deleteAlertDefinition
(
dashboard
.
Id
,
sess
);
err
!=
nil
{
if
err
:=
deleteAlertDefinition
(
dashboard
.
Id
,
sess
);
err
!=
nil
{
return
nil
return
nil
}
}
for
_
,
sql
:=
range
deletes
{
_
,
err
:=
sess
.
Exec
(
sql
,
dashboard
.
Id
)
if
err
!=
nil
{
return
err
}
}
return
nil
return
nil
})
})
}
}
...
...
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