Dashboard schema: Review and mature timezone property (#62090)

* Review and mature timezone property of Dashboard kind

* Update timezone type
This commit is contained in:
Dominik Prokop
2023-01-27 07:13:33 -08:00
committed by GitHub
parent 5531e22f46
commit 83199c4bf5
7 changed files with 11 additions and 21 deletions
@@ -34,7 +34,7 @@ title: Dashboard kind
| `templating` | [object](#templating) | No | TODO docs |
| `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 |
| `timezone` | string | No | Timezone of dashboard, Possible values are: `browser`, `utc`, ``. Default: `browser`. |
| `timezone` | string | No | Timezone of dashboard. Accepts IANA TZDB zone ID or "browser" or "utc". Default: ``. |
| `title` | string | No | Title of dashboard. |
| `uid` | string | No | Unique dashboard identifier that can be generated by anyone. string (8-40) |
| `version` | integer | No | Version of the dashboard, incremented each time the dashboard is updated. |
+2 -2
View File
@@ -30,8 +30,8 @@ lineage: seqs: [
tags?: [...string] @grafanamaturity(NeedsExpertReview)
// Theme of dashboard.
style: "light" | *"dark" @grafanamaturity(NeedsExpertReview)
// Timezone of dashboard,
timezone?: *"browser" | "utc" | "" @grafanamaturity(NeedsExpertReview)
// Timezone of dashboard. Accepts IANA TZDB zone ID or "browser" or "utc".
timezone?: string | *""
// Whether a dashboard is editable or not.
editable: bool | *true
// Configuration of dashboard cursor sync behavior.
@@ -777,9 +777,9 @@ export interface Dashboard {
time_options: Array<string>;
};
/**
* Timezone of dashboard,
* Timezone of dashboard. Accepts IANA TZDB zone ID or "browser" or "utc".
*/
timezone?: ('browser' | 'utc' | '');
timezone?: string;
/**
* Title of dashboard.
*/
@@ -808,5 +808,5 @@ export const defaultDashboard: Partial<Dashboard> = {
schemaVersion: 36,
style: 'dark',
tags: [],
timezone: 'browser',
timezone: '',
};
+2 -14
View File
@@ -17,15 +17,6 @@ const (
StyleLight Style = "light"
)
// Defines values for Timezone.
const (
TimezoneBrowser Timezone = "browser"
TimezoneEmpty Timezone = ""
TimezoneUtc Timezone = "utc"
)
// Defines values for CursorSync.
const (
CursorSyncN0 CursorSync = 0
@@ -290,8 +281,8 @@ type Dashboard struct {
TimeOptions []string `json:"time_options"`
} `json:"timepicker,omitempty"`
// Timezone of dashboard,
Timezone *Timezone `json:"timezone,omitempty"`
// Timezone of dashboard. Accepts IANA TZDB zone ID or "browser" or "utc".
Timezone *string `json:"timezone,omitempty"`
// Title of dashboard.
Title *string `json:"title,omitempty"`
@@ -309,9 +300,6 @@ type Dashboard struct {
// Theme of dashboard.
type Style string
// Timezone of dashboard,
type Timezone string
// 0 for no shared crosshair or tooltip (default).
// 1 for shared crosshair.
// 2 for shared crosshair AND shared tooltip.
+1 -1
View File
@@ -283,7 +283,7 @@
0,
0
],
"grafanaMaturityCount": 140,
"grafanaMaturityCount": 139,
"lineageIsGroup": false,
"links": {
"docs": "https://grafana.com/docs/grafana/next/developers/kinds/core/dashboard/schema-reference",
@@ -93,6 +93,7 @@ const getTestDashboard = (overrides?: Partial<Dashboard>, metaOverrides?: Partia
schemaVersion: 1,
style: 'dark',
timepicker: { hidden: true },
timezone: '',
panels: [
{
id: 1,
@@ -24,6 +24,7 @@ export function createDashboardModelFixture(
schemaVersion: 1,
revision: 1,
style: 'dark',
timezone: '',
...dashboardInput,
};