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
d27bb4d3
Commit
d27bb4d3
authored
Jan 29, 2016
by
bergquist
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
style(playlist): move dashboard access to dashboard.go
parent
64a18874
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
24 additions
and
24 deletions
+24
-24
pkg/api/playlist_play.go
+1
-1
pkg/models/dashboards.go
+5
-0
pkg/models/playlist.go
+0
-5
pkg/services/sqlstore/dashboard.go
+18
-0
pkg/services/sqlstore/playlist.go
+0
-18
No files found.
pkg/api/playlist_play.go
View file @
d27bb4d3
...
@@ -14,7 +14,7 @@ func populateDashboardsById(dashboardByIds []int64) ([]m.PlaylistDashboardDto, e
...
@@ -14,7 +14,7 @@ func populateDashboardsById(dashboardByIds []int64) ([]m.PlaylistDashboardDto, e
result
:=
make
([]
m
.
PlaylistDashboardDto
,
0
)
result
:=
make
([]
m
.
PlaylistDashboardDto
,
0
)
if
len
(
dashboardByIds
)
>
0
{
if
len
(
dashboardByIds
)
>
0
{
dashboardQuery
:=
m
.
Get
Playlist
DashboardsQuery
{
DashboardIds
:
dashboardByIds
}
dashboardQuery
:=
m
.
GetDashboardsQuery
{
DashboardIds
:
dashboardByIds
}
if
err
:=
bus
.
Dispatch
(
&
dashboardQuery
);
err
!=
nil
{
if
err
:=
bus
.
Dispatch
(
&
dashboardQuery
);
err
!=
nil
{
return
result
,
errors
.
New
(
"Playlist not found"
)
//TODO: dont swallow error
return
result
,
errors
.
New
(
"Playlist not found"
)
//TODO: dont swallow error
}
}
...
...
pkg/models/dashboards.go
View file @
d27bb4d3
...
@@ -146,3 +146,8 @@ type GetDashboardTagsQuery struct {
...
@@ -146,3 +146,8 @@ type GetDashboardTagsQuery struct {
OrgId
int64
OrgId
int64
Result
[]
*
DashboardTagCloudItem
Result
[]
*
DashboardTagCloudItem
}
}
type
GetDashboardsQuery
struct
{
DashboardIds
[]
int64
Result
*
[]
Dashboard
}
pkg/models/playlist.go
View file @
d27bb4d3
...
@@ -119,8 +119,3 @@ type GetPlaylistItemsByIdQuery struct {
...
@@ -119,8 +119,3 @@ type GetPlaylistItemsByIdQuery struct {
PlaylistId
int64
PlaylistId
int64
Result
*
[]
PlaylistItem
Result
*
[]
PlaylistItem
}
}
type
GetPlaylistDashboardsQuery
struct
{
DashboardIds
[]
int64
Result
*
PlaylistDashboards
}
pkg/services/sqlstore/dashboard.go
View file @
d27bb4d3
...
@@ -14,6 +14,7 @@ import (
...
@@ -14,6 +14,7 @@ import (
func
init
()
{
func
init
()
{
bus
.
AddHandler
(
"sql"
,
SaveDashboard
)
bus
.
AddHandler
(
"sql"
,
SaveDashboard
)
bus
.
AddHandler
(
"sql"
,
GetDashboard
)
bus
.
AddHandler
(
"sql"
,
GetDashboard
)
bus
.
AddHandler
(
"sql"
,
GetDashboards
)
bus
.
AddHandler
(
"sql"
,
DeleteDashboard
)
bus
.
AddHandler
(
"sql"
,
DeleteDashboard
)
bus
.
AddHandler
(
"sql"
,
SearchDashboards
)
bus
.
AddHandler
(
"sql"
,
SearchDashboards
)
bus
.
AddHandler
(
"sql"
,
GetDashboardTags
)
bus
.
AddHandler
(
"sql"
,
GetDashboardTags
)
...
@@ -223,3 +224,20 @@ func DeleteDashboard(cmd *m.DeleteDashboardCommand) error {
...
@@ -223,3 +224,20 @@ func DeleteDashboard(cmd *m.DeleteDashboardCommand) error {
return
nil
return
nil
})
})
}
}
func
GetDashboards
(
query
*
m
.
GetDashboardsQuery
)
error
{
if
len
(
query
.
DashboardIds
)
==
0
{
return
m
.
ErrCommandValidationFailed
}
var
dashboards
=
make
([]
m
.
Dashboard
,
0
)
err
:=
x
.
In
(
"id"
,
query
.
DashboardIds
)
.
Find
(
&
dashboards
)
query
.
Result
=
&
dashboards
if
err
!=
nil
{
return
err
}
return
nil
}
pkg/services/sqlstore/playlist.go
View file @
d27bb4d3
...
@@ -15,7 +15,6 @@ func init() {
...
@@ -15,7 +15,6 @@ func init() {
bus
.
AddHandler
(
"sql"
,
DeletePlaylist
)
bus
.
AddHandler
(
"sql"
,
DeletePlaylist
)
bus
.
AddHandler
(
"sql"
,
SearchPlaylists
)
bus
.
AddHandler
(
"sql"
,
SearchPlaylists
)
bus
.
AddHandler
(
"sql"
,
GetPlaylist
)
bus
.
AddHandler
(
"sql"
,
GetPlaylist
)
bus
.
AddHandler
(
"sql"
,
GetPlaylistDashboards
)
bus
.
AddHandler
(
"sql"
,
GetPlaylistItem
)
bus
.
AddHandler
(
"sql"
,
GetPlaylistItem
)
}
}
...
@@ -162,20 +161,3 @@ func GetPlaylistItem(query *m.GetPlaylistItemsByIdQuery) error {
...
@@ -162,20 +161,3 @@ func GetPlaylistItem(query *m.GetPlaylistItemsByIdQuery) error {
return
err
return
err
}
}
func
GetPlaylistDashboards
(
query
*
m
.
GetPlaylistDashboardsQuery
)
error
{
if
len
(
query
.
DashboardIds
)
==
0
{
return
m
.
ErrCommandValidationFailed
}
var
dashboards
=
make
(
m
.
PlaylistDashboards
,
0
)
err
:=
x
.
In
(
"id"
,
query
.
DashboardIds
)
.
Find
(
&
dashboards
)
query
.
Result
=
&
dashboards
if
err
!=
nil
{
return
err
}
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