diff --git a/go.mod b/go.mod index dbe0b9614b2..f917f800292 100644 --- a/go.mod +++ b/go.mod @@ -50,7 +50,7 @@ require ( github.com/google/wire v0.5.0 github.com/gorilla/websocket v1.4.2 github.com/gosimple/slug v1.9.0 - github.com/grafana/cuetsy v0.0.2 + github.com/grafana/cuetsy v0.0.3 github.com/grafana/grafana-aws-sdk v0.10.3 github.com/grafana/grafana-azure-sdk-go v1.2.0 github.com/grafana/grafana-plugin-sdk-go v0.135.0 diff --git a/go.sum b/go.sum index 43e56497008..e5c7dba781a 100644 --- a/go.sum +++ b/go.sum @@ -1450,6 +1450,8 @@ github.com/gosimple/slug v1.9.0 h1:r5vDcYrFz9BmfIAMC829un9hq7hKM4cHUrsv36LbEqs= github.com/gosimple/slug v1.9.0/go.mod h1:AMZ+sOVe65uByN3kgEyf9WEBKBCSS+dJjMX9x4vDJbg= github.com/grafana/cuetsy v0.0.2 h1:0vbU+MNznzxFyaUtbqZ6UGiOrm4HotPQGLyc121xGC8= github.com/grafana/cuetsy v0.0.2/go.mod h1:7OoEYb42s7PbSYtNUTy1DoCeJ3LAOTafsZbndvikTj8= +github.com/grafana/cuetsy v0.0.3 h1:jQLkHOpfDjZiTXknv35iCOTFFK504lgsUapKuOnnNy4= +github.com/grafana/cuetsy v0.0.3/go.mod h1:7OoEYb42s7PbSYtNUTy1DoCeJ3LAOTafsZbndvikTj8= github.com/grafana/dskit v0.0.0-20211011144203-3a88ec0b675f h1:FvvSVEbnGeM2bUivGmsiXTi8URJyBU7TcFEEoRe5wWI= github.com/grafana/dskit v0.0.0-20211011144203-3a88ec0b675f/go.mod h1:uPG2nyK4CtgNDmWv7qyzYcdI+S90kHHRWvHnBtEMBXM= github.com/grafana/go-mssqldb v0.0.0-20210326084033-d0ce3c521036 h1:GplhUk6Xes5JIhUUrggPcPBhOn+eT8+WsHiebvq7GgA= diff --git a/packages/grafana-schema/src/schema/dashboard/dashboard_experimental.gen.ts b/packages/grafana-schema/src/schema/dashboard/dashboard_experimental.gen.ts index 7a81453e012..c571876691e 100644 --- a/packages/grafana-schema/src/schema/dashboard/dashboard_experimental.gen.ts +++ b/packages/grafana-schema/src/schema/dashboard/dashboard_experimental.gen.ts @@ -56,9 +56,9 @@ const defaultDashboardLink: Partial = { targetBlank: false, }; -type DashboardLinkType = 'link' | 'dashboards'; +type DashboardLinkType = ('link' | 'dashboards'); -type VariableType = 'query' | 'adhoc' | 'constant' | 'datasource' | 'interval' | 'textbox' | 'custom' | 'system'; +type VariableType = ('query' | 'adhoc' | 'constant' | 'datasource' | 'interval' | 'textbox' | 'custom' | 'system'); enum FieldColorModeId { ContinuousGrYlRd = 'continuous-GrYlRd', @@ -68,11 +68,11 @@ enum FieldColorModeId { Thresholds = 'thresholds', } -type FieldColorSeriesByMode = 'min' | 'max' | 'last'; +type FieldColorSeriesByMode = ('min' | 'max' | 'last'); interface FieldColor { fixedColor?: string; - mode: FieldColorModeId | string; + mode: (FieldColorModeId | string); seriesBy?: FieldColorSeriesByMode; } @@ -146,7 +146,7 @@ interface Panel { options: {}; pluginVersion?: string; repeat?: string; - repeatDirection: 'h' | 'v'; + repeatDirection: ('h' | 'v'); tags?: string[]; targets?: {}[]; thresholds?: any[]; @@ -170,6 +170,26 @@ const defaultPanel: Partial = { transparent: false, }; +interface RowPanel { + collapsed: boolean; + datasource?: {}; + gridPos?: GridPos; + id: number; + panels: (Panel | { + type: 'graph'; + } | { + type: 'heatmap'; + })[]; + repeat?: string; + title?: string; + type: 'row'; +} + +const defaultRowPanel: Partial = { + collapsed: false, + panels: [], +}; + interface Dashboard { annotations?: { list: AnnotationQuery[]; @@ -182,23 +202,14 @@ interface Dashboard { id?: number; links?: DashboardLink[]; liveNow?: boolean; - panels?: Panel | { + panels?: (Panel | RowPanel | { type: 'graph'; } | { type: 'heatmap'; - } | { - type: 'row'; - collapsed: boolean; - id: number; - panels: Panel | { - type: 'graph'; - } | { - type: 'heatmap'; - }[]; - }[]; - refresh?: string | false; + })[]; + refresh?: (string | false); schemaVersion: number; - style: 'light' | 'dark'; + style: ('light' | 'dark'); tags?: string[]; templating?: { list: VariableModel[]; @@ -213,7 +224,7 @@ interface Dashboard { hidden: boolean; refresh_intervals: string[]; }; - timezone?: 'browser' | 'utc' | ''; + timezone?: ('browser' | 'utc' | ''); title?: string; uid?: string; version?: number; diff --git a/packages/grafana-schema/src/schema/mudball.gen.ts b/packages/grafana-schema/src/schema/mudball.gen.ts index 95f51678386..589d8606d39 100644 --- a/packages/grafana-schema/src/schema/mudball.gen.ts +++ b/packages/grafana-schema/src/schema/mudball.gen.ts @@ -78,7 +78,7 @@ export enum ScaleDirection { export interface LineStyle { dash?: number[]; - fill?: 'solid' | 'dash' | 'dot' | 'square'; + fill?: ('solid' | 'dash' | 'dot' | 'square'); } export const defaultLineStyle: Partial = { @@ -90,7 +90,7 @@ export interface LineConfig { lineInterpolation?: LineInterpolation; lineStyle?: LineStyle; lineWidth?: number; - spanNulls?: boolean | number; + spanNulls?: (boolean | number); } export interface BarConfig { @@ -158,7 +158,7 @@ export interface GraphThresholdsStyleConfig { mode: GraphTresholdsStyleMode; } -export type LegendPlacement = 'bottom' | 'right'; +export type LegendPlacement = ('bottom' | 'right'); export enum LegendDisplayMode { Hidden = 'hidden', @@ -230,7 +230,7 @@ export enum BigValueTextMode { ValueAndName = 'value_and_name', } -export type FieldTextAlignment = 'auto' | 'left' | 'right' | 'center'; +export type FieldTextAlignment = ('auto' | 'left' | 'right' | 'center'); export enum TableCellDisplayMode { Auto = 'auto', diff --git a/pkg/coremodel/dashboard/lineage.cue b/pkg/coremodel/dashboard/lineage.cue index f0f45bdf4de..fa5853ef96e 100644 --- a/pkg/coremodel/dashboard/lineage.cue +++ b/pkg/coremodel/dashboard/lineage.cue @@ -65,7 +65,7 @@ seqs: [ schemaVersion: uint16 | *36 @reviewme() // Version of the dashboard, incremented each time the dashboard is updated. version?: uint32 @reviewme() - panels?: [...(#Panel | #GraphPanel | #HeatmapPanel | #RowPanel)] @reviewme() + panels?: [...(#Panel | #RowPanel | #GraphPanel | #HeatmapPanel)] @reviewme() // TODO docs templating?: list: [...#VariableModel] @reviewme() // TODO docs @@ -370,7 +370,7 @@ seqs: [ panels: [...(#Panel | #GraphPanel | #HeatmapPanel)] @reviewme() // Name of template variable to repeat for. repeat?: string @reviewme() - } @reviewme() + } @cuetsy(kind="interface") @reviewme() // Support for legacy graph and heatmap panels. #GraphPanel: {