Schema: fix dashboard revision docs (#63284)

pull/63301/head
Ryan McKinley 2 years ago committed by GitHub
parent 958fb2c50a
commit 6ca9e5b440
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 52
      docs/sources/developers/kinds/core/dashboard/schema-reference.md
  2. 13
      kinds/dashboard/dashboard_kind.cue
  3. 14
      packages/grafana-schema/src/raw/dashboard/x/dashboard_types.gen.ts
  4. 16
      pkg/kinds/dashboard/dashboard_types_gen.go

@ -13,32 +13,32 @@ title: Dashboard kind
A Grafana dashboard. A Grafana dashboard.
| Property | Type | Required | Description | | Property | Type | Required | Description |
|------------------------|-----------------------------------|----------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| |------------------------|-----------------------------------|----------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `editable` | boolean | **Yes** | Whether a dashboard is editable or not. Default: `true`. | | `editable` | boolean | **Yes** | Whether a dashboard is editable or not. Default: `true`. |
| `graphTooltip` | integer | **Yes** | 0 for no shared crosshair or tooltip (default).<br/>1 for shared crosshair.<br/>2 for shared crosshair AND shared tooltip.<br/>Possible values are: `0`, `1`, `2`. Default: `0`. | | `graphTooltip` | integer | **Yes** | 0 for no shared crosshair or tooltip (default).<br/>1 for shared crosshair.<br/>2 for shared crosshair AND shared tooltip.<br/>Possible values are: `0`, `1`, `2`. Default: `0`. |
| `revision` | int64 | **Yes** | Version of the current dashboard data Default: `-1`. | | `schemaVersion` | uint16 | **Yes** | Version of the JSON schema, incremented each time a Grafana update brings<br/>changes to said schema.<br/>TODO this is the existing schema numbering system. It will be replaced by Thema's themaVersion Default: `36`. |
| `schemaVersion` | uint16 | **Yes** | Version of the JSON schema, incremented each time a Grafana update brings<br/>changes to said schema.<br/>TODO this is the existing schema numbering system. It will be replaced by Thema's themaVersion Default: `36`. | | `style` | string | **Yes** | Theme of dashboard.<br/>Possible values are: `dark`, `light`. Default: `dark`. |
| `style` | string | **Yes** | Theme of dashboard.<br/>Possible values are: `dark`, `light`. Default: `dark`. | | `annotations` | [object](#annotations) | No | TODO docs |
| `annotations` | [object](#annotations) | No | TODO docs | | `description` | string | No | Description of dashboard. |
| `description` | string | No | Description of dashboard. | | `fiscalYearStartMonth` | integer | No | The month that the fiscal year starts on. 0 = January, 11 = December Default: `0`.<br/>Constraint: `>=0 & <12`. |
| `fiscalYearStartMonth` | integer | No | The month that the fiscal year starts on. 0 = January, 11 = December Default: `0`.<br/>Constraint: `>=0 & <12`. | | `gnetId` | string | No | For dashboards imported from the https://grafana.com/grafana/dashboards/ portal |
| `gnetId` | string | No | | | `id` | integer | No | Unique numeric identifier for the dashboard.<br/>TODO must isolate or remove identifiers local to a Grafana instance...? |
| `id` | integer | No | Unique numeric identifier for the dashboard.<br/>TODO must isolate or remove identifiers local to a Grafana instance...? | | `links` | [DashboardLink](#dashboardlink)[] | No | TODO docs |
| `links` | [DashboardLink](#dashboardlink)[] | No | TODO docs | | `liveNow` | boolean | No | When set to true, the dashboard will redraw panels at an interval matching the pixel width.<br/>This will keep data "moving left" regardless of the query refresh rate. This setting helps<br/>avoid dashboards presenting stale live data |
| `liveNow` | boolean | No | TODO docs | | `panels` | [object](#panels)[] | No | |
| `panels` | [object](#panels)[] | No | | | `refresh` | | No | Refresh rate of dashboard. Represented via interval string, e.g. "5s", "1m", "1h", "1d". |
| `refresh` | | No | Refresh rate of dashboard. Represented via interval string, e.g. "5s", "1m", "1h", "1d". | | `revision` | integer | No | This property should only be used in dashboards defined by plugins. It is a quick check<br/>to see if the version has changed since the last time. Unclear why using the version property<br/>is insufficient. |
| `snapshot` | [Snapshot](#snapshot) | No | TODO docs | | `snapshot` | [Snapshot](#snapshot) | No | TODO docs |
| `tags` | string[] | No | Tags associated with dashboard. | | `tags` | string[] | No | Tags associated with dashboard. |
| `templating` | [object](#templating) | No | TODO docs | | `templating` | [object](#templating) | No | TODO docs |
| `time` | [object](#time) | No | Time range for dashboard, e.g. last 6 hours, last 7 days, etc | | `time` | [object](#time) | No | Time range for dashboard, e.g. last 6 hours, last 7 days, etc |
| `timepicker` | [object](#timepicker) | No | TODO docs<br/>TODO this appears to be spread all over in the frontend. Concepts will likely need tidying in tandem with schema changes | | `timepicker` | [object](#timepicker) | No | TODO docs<br/>TODO this appears to be spread all over in the frontend. Concepts will likely need tidying in tandem with schema changes |
| `timezone` | string | No | Timezone of dashboard. Accepts IANA TZDB zone ID or "browser" or "utc". Default: `browser`. | | `timezone` | string | No | Timezone of dashboard. Accepts IANA TZDB zone ID or "browser" or "utc". Default: `browser`. |
| `title` | string | No | Title of dashboard. | | `title` | string | No | Title of dashboard. |
| `uid` | string | No | Unique dashboard identifier that can be generated by anyone. string (8-40) | | `uid` | string | No | Unique dashboard identifier that can be generated by anyone. string (8-40) |
| `version` | uint32 | No | Version of the dashboard, incremented each time the dashboard is updated. | | `version` | uint32 | No | Version of the dashboard, incremented each time the dashboard is updated. |
| `weekStart` | string | No | TODO docs | | `weekStart` | string | No | TODO docs |
### DashboardLink ### DashboardLink

@ -24,10 +24,11 @@ lineage: seqs: [
title?: string title?: string
// Description of dashboard. // Description of dashboard.
description?: string description?: string
// This property should only be used in dashboards defined by plugins. It is a quick check
// Version of the current dashboard data // to see if the version has changed since the last time. Unclear why using the version property
revision: int64 | *-1 @grafanamaturity(NeedsExpertReview) // is insufficient.
revision?: int64 @grafanamaturity(NeedsExpertReview)
// For dashboards imported from the https://grafana.com/grafana/dashboards/ portal
gnetId?: string @grafanamaturity(NeedsExpertReview) gnetId?: string @grafanamaturity(NeedsExpertReview)
// Tags associated with dashboard. // Tags associated with dashboard.
tags?: [...string] @grafanamaturity(NeedsExpertReview) tags?: [...string] @grafanamaturity(NeedsExpertReview)
@ -61,7 +62,9 @@ lineage: seqs: [
} @grafanamaturity(NeedsExpertReview) } @grafanamaturity(NeedsExpertReview)
// The month that the fiscal year starts on. 0 = January, 11 = December // The month that the fiscal year starts on. 0 = January, 11 = December
fiscalYearStartMonth?: uint8 & <12 | *0 fiscalYearStartMonth?: uint8 & <12 | *0
// TODO docs // When set to true, the dashboard will redraw panels at an interval matching the pixel width.
// This will keep data "moving left" regardless of the query refresh rate. This setting helps
// avoid dashboards presenting stale live data
liveNow?: bool @grafanamaturity(NeedsExpertReview) liveNow?: bool @grafanamaturity(NeedsExpertReview)
// TODO docs // TODO docs
weekStart?: string @grafanamaturity(NeedsExpertReview) weekStart?: string @grafanamaturity(NeedsExpertReview)

@ -673,6 +673,9 @@ export interface Dashboard {
* The month that the fiscal year starts on. 0 = January, 11 = December * The month that the fiscal year starts on. 0 = January, 11 = December
*/ */
fiscalYearStartMonth?: number; fiscalYearStartMonth?: number;
/**
* For dashboards imported from the https://grafana.com/grafana/dashboards/ portal
*/
gnetId?: string; gnetId?: string;
/** /**
* Configuration of dashboard cursor sync behavior. * Configuration of dashboard cursor sync behavior.
@ -688,7 +691,9 @@ export interface Dashboard {
*/ */
links?: Array<DashboardLink>; links?: Array<DashboardLink>;
/** /**
* TODO docs * When set to true, the dashboard will redraw panels at an interval matching the pixel width.
* This will keep data "moving left" regardless of the query refresh rate. This setting helps
* avoid dashboards presenting stale live data
*/ */
liveNow?: boolean; liveNow?: boolean;
panels?: Array<(Panel | RowPanel | GraphPanel | HeatmapPanel)>; panels?: Array<(Panel | RowPanel | GraphPanel | HeatmapPanel)>;
@ -697,9 +702,11 @@ export interface Dashboard {
*/ */
refresh?: (string | false); refresh?: (string | false);
/** /**
* Version of the current dashboard data * This property should only be used in dashboards defined by plugins. It is a quick check
* to see if the version has changed since the last time. Unclear why using the version property
* is insufficient.
*/ */
revision: number; revision?: number;
/** /**
* Version of the JSON schema, incremented each time a Grafana update brings * Version of the JSON schema, incremented each time a Grafana update brings
* changes to said schema. * changes to said schema.
@ -827,7 +834,6 @@ export const defaultDashboard: Partial<Dashboard> = {
graphTooltip: DashboardCursorSync.Off, graphTooltip: DashboardCursorSync.Off,
links: [], links: [],
panels: [], panels: [],
revision: -1,
schemaVersion: 36, schemaVersion: 36,
style: 'dark', style: 'dark',
tags: [], tags: [],

@ -212,8 +212,10 @@ type Dashboard struct {
Editable bool `json:"editable"` Editable bool `json:"editable"`
// The month that the fiscal year starts on. 0 = January, 11 = December // The month that the fiscal year starts on. 0 = January, 11 = December
FiscalYearStartMonth *int `json:"fiscalYearStartMonth,omitempty"` FiscalYearStartMonth *int `json:"fiscalYearStartMonth,omitempty"`
GnetId *string `json:"gnetId,omitempty"`
// For dashboards imported from the https://grafana.com/grafana/dashboards/ portal
GnetId *string `json:"gnetId,omitempty"`
// 0 for no shared crosshair or tooltip (default). // 0 for no shared crosshair or tooltip (default).
// 1 for shared crosshair. // 1 for shared crosshair.
@ -227,15 +229,19 @@ type Dashboard struct {
// TODO docs // TODO docs
Links *[]Link `json:"links,omitempty"` Links *[]Link `json:"links,omitempty"`
// TODO docs // When set to true, the dashboard will redraw panels at an interval matching the pixel width.
// This will keep data "moving left" regardless of the query refresh rate. This setting helps
// avoid dashboards presenting stale live data
LiveNow *bool `json:"liveNow,omitempty"` LiveNow *bool `json:"liveNow,omitempty"`
Panels *[]interface{} `json:"panels,omitempty"` Panels *[]interface{} `json:"panels,omitempty"`
// Refresh rate of dashboard. Represented via interval string, e.g. "5s", "1m", "1h", "1d". // Refresh rate of dashboard. Represented via interval string, e.g. "5s", "1m", "1h", "1d".
Refresh *interface{} `json:"refresh,omitempty"` Refresh *interface{} `json:"refresh,omitempty"`
// Version of the current dashboard data // This property should only be used in dashboards defined by plugins. It is a quick check
Revision int `json:"revision"` // to see if the version has changed since the last time. Unclear why using the version property
// is insufficient.
Revision *int64 `json:"revision,omitempty"`
// Version of the JSON schema, incremented each time a Grafana update brings // Version of the JSON schema, incremented each time a Grafana update brings
// changes to said schema. // changes to said schema.

Loading…
Cancel
Save