Playlist: update service so it supports both read+write (#55959)

This commit is contained in:
Ryan McKinley
2022-10-04 08:11:18 -07:00
committed by GitHub
parent d293055ef6
commit 3b1a8d45ed
14 changed files with 118 additions and 287 deletions

View File

@@ -10,16 +10,17 @@ seqs: [
{
schemas: [
{//0.0
// Unique playlist identifier for internal use, set by Grafana.
id: int64 @grafana(decisionNeeded)
// Unique playlist identifier. Generated on creation, either by the
// creator of the playlist of by the application.
uid: string
// Name of the playlist.
name: string
// Interval sets the time between switching views in a playlist.
// FIXME: Is this based on a standardized format or what options are available? Can datemath be used?
interval: string | *"5m"
// The ordered list of items that the playlist will iterate over.
items?: [...#PlaylistItem]
@@ -27,26 +28,20 @@ seqs: [
// Definitions (referenced above) are declared below
#PlaylistItem: {
// FIXME: The prefixDropper removes playlist from playlist_id, that doesn't work for us since it'll mean we'll have Id twice.
// ID of the playlist item for internal use by Grafana. Deprecated.
id: int64 @grafana(decisionNeeded)
// PlaylistID for the playlist containing the item. Deprecated.
playlistid: int64 @grafana(decisionNeeded)
// Type of the item.
type: "dashboard_by_uid" | "dashboard_by_id" | "dashboard_by_tag"
// Value depends on type and describes the playlist item.
//
// - dashboard_by_id: The value is an internal numerical identifier set by Grafana. This
// is not portable as the numerical identifier is non-deterministic between different instances.
// Will be replaced by dashboard_by_uid in the future.
// Will be replaced by dashboard_by_uid in the future. (deprecated)
// - dashboard_by_tag: The value is a tag which is set on any number of dashboards. All
// dashboards behind the tag will be added to the playlist.
// - dashboard_by_uid: The value is the dashboard UID
value: string
// Title is the human-readable identifier for the playlist item.
title: string @grafana(decisionNeeded)
// Order is the position in the list for the item. Deprecated.
order: int64 | *0 @grafana(decisionNeeded)
// Title is an unused property -- it will be removed in the future
title: string
}
}
]

View File

@@ -31,9 +31,6 @@ const (
// THIS TYPE IS INTENDED FOR INTERNAL USE BY THE GRAFANA BACKEND, AND IS SUBJECT TO BREAKING CHANGES.
// Equivalent Go types at stable import paths are provided in https://github.com/grafana/grok.
type Model struct {
// Unique playlist identifier for internal use, set by Grafana.
Id int64 `json:"id"`
// Interval sets the time between switching views in a playlist.
// FIXME: Is this based on a standardized format or what options are available? Can datemath be used?
Interval string `json:"interval"`
@@ -54,17 +51,7 @@ type Model struct {
// THIS TYPE IS INTENDED FOR INTERNAL USE BY THE GRAFANA BACKEND, AND IS SUBJECT TO BREAKING CHANGES.
// Equivalent Go types at stable import paths are provided in https://github.com/grafana/grok.
type PlaylistItem struct {
// FIXME: The prefixDropper removes playlist from playlist_id, that doesn't work for us since it'll mean we'll have Id twice.
// ID of the playlist item for internal use by Grafana. Deprecated.
Id int64 `json:"id"`
// Order is the position in the list for the item. Deprecated.
Order int `json:"order"`
// ID for the playlist containing the item. Deprecated.
Playlistid int64 `json:"playlistid"`
// Title is the human-readable identifier for the playlist item.
// Title is an unused property -- it will be removed in the future
Title string `json:"title"`
// Type of the item.
@@ -74,9 +61,10 @@ type PlaylistItem struct {
//
// - dashboard_by_id: The value is an internal numerical identifier set by Grafana. This
// is not portable as the numerical identifier is non-deterministic between different instances.
// Will be replaced by dashboard_by_uid in the future.
// Will be replaced by dashboard_by_uid in the future. (deprecated)
// - dashboard_by_tag: The value is a tag which is set on any number of dashboards. All
// dashboards behind the tag will be added to the playlist.
// - dashboard_by_uid: The value is the dashboard UID
Value string `json:"value"`
}