Commit 0918063c by bergquist

fix(playlist): move dashboard uri cration to Backend

parent 22c001c8
......@@ -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 {
......
......@@ -34,6 +34,17 @@ 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
//
type PlaylistQuery struct {
......
......@@ -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);
});
});
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment