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
ee400df9
Commit
ee400df9
authored
Jan 05, 2016
by
nikita-graf
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove dashboard from playlist when its destroyed
parent
be1fb131
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
8 deletions
+28
-8
pkg/models/playlist.go
+8
-8
pkg/services/sqlstore/dashboard.go
+20
-0
No files found.
pkg/models/playlist.go
View file @
ee400df9
...
@@ -12,12 +12,12 @@ var (
...
@@ -12,12 +12,12 @@ var (
// Playlist model
// Playlist model
type
Playlist
struct
{
type
Playlist
struct
{
Id
int64
`json:"id"`
Id
int64
`json:"id"`
Title
string
`json:"title"`
Title
string
`json:"title"`
Type
string
`json:"type"`
Type
string
`json:"type"`
Timespan
string
`json:"timespan"`
Timespan
string
`json:"timespan"`
Data
[]
int
`json:"data"`
Data
[]
int
64
`json:"data"`
OrgId
int64
`json:"-"`
OrgId
int64
`json:"-"`
}
}
type
PlaylistDashboard
struct
{
type
PlaylistDashboard
struct
{
...
@@ -49,7 +49,7 @@ type UpdatePlaylistQuery struct {
...
@@ -49,7 +49,7 @@ type UpdatePlaylistQuery struct {
Title
string
Title
string
Type
string
Type
string
Timespan
string
Timespan
string
Data
[]
int
Data
[]
int
64
Result
*
Playlist
Result
*
Playlist
}
}
...
@@ -58,7 +58,7 @@ type CreatePlaylistQuery struct {
...
@@ -58,7 +58,7 @@ type CreatePlaylistQuery struct {
Title
string
Title
string
Type
string
Type
string
Timespan
string
Timespan
string
Data
[]
int
Data
[]
int
64
OrgId
int64
OrgId
int64
Result
*
Playlist
Result
*
Playlist
...
...
pkg/services/sqlstore/dashboard.go
View file @
ee400df9
...
@@ -220,6 +220,26 @@ func DeleteDashboard(cmd *m.DeleteDashboardCommand) error {
...
@@ -220,6 +220,26 @@ func DeleteDashboard(cmd *m.DeleteDashboardCommand) error {
}
}
}
}
var
playlists
=
make
(
m
.
Playlists
,
0
)
err
=
sess
.
Where
(
"data LIKE ?"
,
fmt
.
Sprintf
(
"%%%v%%"
,
dashboard
.
Id
))
.
Find
(
&
playlists
)
if
err
!=
nil
{
return
err
}
for
_
,
playlist
:=
range
playlists
{
filteredData
:=
make
([]
int64
,
0
)
for
_
,
plDashboardId
:=
range
playlist
.
Data
{
if
plDashboardId
!=
dashboard
.
Id
{
filteredData
=
append
(
filteredData
,
plDashboardId
)
}
}
playlist
.
Data
=
filteredData
_
,
err
=
sess
.
Id
(
playlist
.
Id
)
.
Cols
(
"data"
)
.
Update
(
playlist
)
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