mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
fix(playlist): move dashboard uri cration to Backend
This commit is contained in:
@@ -63,7 +63,17 @@ func GetPlaylistDashboards(c *middleware.Context) Response {
|
||||
return ApiError(500, "Playlist not found", err)
|
||||
}
|
||||
|
||||
return Json(200, query.Result)
|
||||
dtos := make([]m.PlaylistDashboardDto, 0)
|
||||
for _, item := range *query.Result {
|
||||
dtos = append(dtos, m.PlaylistDashboardDto{
|
||||
Id: item.Id,
|
||||
Slug: item.Slug,
|
||||
Title: item.Title,
|
||||
Uri: "db/" + item.Slug,
|
||||
})
|
||||
}
|
||||
|
||||
return Json(200, dtos)
|
||||
}
|
||||
|
||||
func DeletePlaylist(c *middleware.Context) Response {
|
||||
|
||||
@@ -33,6 +33,17 @@ func (this PlaylistDashboard) TableName() string {
|
||||
type Playlists []*Playlist
|
||||
type PlaylistDashboards []*PlaylistDashboard
|
||||
|
||||
//
|
||||
// DTOS
|
||||
//
|
||||
|
||||
type PlaylistDashboardDto struct {
|
||||
Id int64 `json:"id"`
|
||||
Slug string `json:"slug"`
|
||||
Title string `json:"title"`
|
||||
Uri string `json:"uri"`
|
||||
}
|
||||
|
||||
//
|
||||
// COMMANDS
|
||||
//
|
||||
|
||||
@@ -105,6 +105,7 @@ func GetPlaylistDashboards(query *m.GetPlaylistDashboardsQuery) error {
|
||||
var playlist = m.Playlist{}
|
||||
|
||||
hasPlaylist, err := x.Id(query.Id).Get(&playlist)
|
||||
|
||||
query.Result = &dashboards
|
||||
|
||||
if err != nil {
|
||||
|
||||
@@ -33,9 +33,6 @@ function (angular, config, _) {
|
||||
.then(function(playlist) {
|
||||
return backendSrv.get('/api/playlists/' + playlistId + '/dashboards')
|
||||
.then(function(dashboards) {
|
||||
_.each(dashboards, function(dashboard) {
|
||||
dashboard.uri = 'db/' + dashboard.slug;
|
||||
});
|
||||
playlistSrv.start(dashboards, playlist.timespan);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user