Playlist: Split PlaylistItem into standalone TS type (#56343)

* playlist: Split PlaylistItem into standalone TS type

* update playlist model

* actually set the title

Co-authored-by: Ryan McKinley <ryantxu@gmail.com>
This commit is contained in:
sam boyer
2022-10-04 16:08:26 -04:00
committed by GitHub
co-authored by Ryan McKinley
parent 2c1c98f3b6
commit ba97b268d0
6 changed files with 40 additions and 30 deletions
+3 -3
View File
@@ -39,10 +39,10 @@ seqs: [
// dashboards behind the tag will be added to the playlist.
// - dashboard_by_uid: The value is the dashboard UID
value: string
// Title is an unused property -- it will be removed in the future
title: string
}
title?: string
} @cuetsy(kind="interface")
}
]
}
+1 -1
View File
@@ -52,7 +52,7 @@ type Model struct {
// Equivalent Go types at stable import paths are provided in https://github.com/grafana/grok.
type PlaylistItem struct {
// Title is an unused property -- it will be removed in the future
Title string `json:"title"`
Title *string `json:"title,omitempty"`
// Type of the item.
Type PlaylistItemType `json:"type"`
@@ -55,6 +55,12 @@ func (s *Service) Get(ctx context.Context, q *playlist.GetPlaylistByUidQuery) (*
for i := 0; i < len(rawItems); i++ {
items[i].Type = playlist.PlaylistItemType(rawItems[i].Type)
items[i].Value = rawItems[i].Value
// Add the unused title to the result
title := rawItems[i].Title
if title != "" {
items[i].Title = &title
}
}
return &playlist.PlaylistDTO{
Uid: v.UID,