diff --git a/.betterer.results b/.betterer.results index 05de8a35f8a..536fe3b854c 100644 --- a/.betterer.results +++ b/.betterer.results @@ -3615,15 +3615,14 @@ exports[`better eslint`] = { [0, 0, 0, "Unexpected any. Specify a different type.", "25"], [0, 0, 0, "Unexpected any. Specify a different type.", "26"], [0, 0, 0, "Unexpected any. Specify a different type.", "27"], - [0, 0, 0, "Unexpected any. Specify a different type.", "28"], - [0, 0, 0, "Do not use any type assertions.", "29"], + [0, 0, 0, "Do not use any type assertions.", "28"], + [0, 0, 0, "Unexpected any. Specify a different type.", "29"], [0, 0, 0, "Unexpected any. Specify a different type.", "30"], [0, 0, 0, "Unexpected any. Specify a different type.", "31"], [0, 0, 0, "Unexpected any. Specify a different type.", "32"], [0, 0, 0, "Unexpected any. Specify a different type.", "33"], [0, 0, 0, "Unexpected any. Specify a different type.", "34"], - [0, 0, 0, "Unexpected any. Specify a different type.", "35"], - [0, 0, 0, "Unexpected any. Specify a different type.", "36"] + [0, 0, 0, "Unexpected any. Specify a different type.", "35"] ], "public/app/features/dashboard/state/PanelModel.test.ts:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"], diff --git a/docs/sources/developers/kinds/core/dashboard/schema-reference.md b/docs/sources/developers/kinds/core/dashboard/schema-reference.md index 772f595b369..5d91eef9451 100644 --- a/docs/sources/developers/kinds/core/dashboard/schema-reference.md +++ b/docs/sources/developers/kinds/core/dashboard/schema-reference.md @@ -28,7 +28,7 @@ title: Dashboard kind | `links` | [DashboardLink](#dashboardlink)[] | No | TODO docs | | `liveNow` | boolean | No | TODO docs | | `panels` | [object](#panels)[] | No | | -| `refresh` | | No | TODO docs | +| `refresh` | | No | Refresh rate of dashboard. Represented via interval string, e.g. "5s", "1m", "1h", "1d". | | `snapshot` | [Snapshot](#snapshot) | No | TODO docs | | `tags` | string[] | No | Tags associated with dashboard. | | `templating` | [object](#templating) | No | TODO docs | diff --git a/kinds/dashboard/dashboard_kind.cue b/kinds/dashboard/dashboard_kind.cue index e27e1364109..8498d08b175 100644 --- a/kinds/dashboard/dashboard_kind.cue +++ b/kinds/dashboard/dashboard_kind.cue @@ -63,8 +63,8 @@ lineage: seqs: [ // TODO docs weekStart?: string @grafanamaturity(NeedsExpertReview) - // TODO docs - refresh?: string | false @grafanamaturity(NeedsExpertReview) + // Refresh rate of dashboard. Represented via interval string, e.g. "5s", "1m", "1h", "1d". + refresh?: string | false // Version of the JSON schema, incremented each time a Grafana update brings // changes to said schema. // TODO this is the existing schema numbering system. It will be replaced by Thema's themaVersion diff --git a/packages/grafana-schema/src/raw/dashboard/x/dashboard_types.gen.ts b/packages/grafana-schema/src/raw/dashboard/x/dashboard_types.gen.ts index d09b8ab7c0e..bbaaee013f0 100644 --- a/packages/grafana-schema/src/raw/dashboard/x/dashboard_types.gen.ts +++ b/packages/grafana-schema/src/raw/dashboard/x/dashboard_types.gen.ts @@ -670,7 +670,7 @@ export interface Dashboard { liveNow?: boolean; panels?: Array<(Panel | RowPanel | GraphPanel | HeatmapPanel)>; /** - * TODO docs + * Refresh rate of dashboard. Represented via interval string, e.g. "5s", "1m", "1h", "1d". */ refresh?: (string | false); /** diff --git a/pkg/kinds/dashboard/dashboard_types_gen.go b/pkg/kinds/dashboard/dashboard_types_gen.go index d44b14ad79f..6a34f274e31 100644 --- a/pkg/kinds/dashboard/dashboard_types_gen.go +++ b/pkg/kinds/dashboard/dashboard_types_gen.go @@ -240,7 +240,7 @@ type Dashboard struct { LiveNow *bool `json:"liveNow,omitempty"` Panels *[]interface{} `json:"panels,omitempty"` - // TODO docs + // Refresh rate of dashboard. Represented via interval string, e.g. "5s", "1m", "1h", "1d". Refresh *interface{} `json:"refresh,omitempty"` // Version of the current dashboard data diff --git a/pkg/kindsys/report.json b/pkg/kindsys/report.json index f47f85e3a0d..a2db2a60086 100644 --- a/pkg/kindsys/report.json +++ b/pkg/kindsys/report.json @@ -283,7 +283,7 @@ 0, 0 ], - "grafanaMaturityCount": 141, + "grafanaMaturityCount": 140, "lineageIsGroup": false, "links": { "docs": "https://grafana.com/docs/grafana/next/developers/kinds/core/dashboard/schema-reference", diff --git a/public/app/features/dashboard/components/DashboardPrompt/DashboardPrompt.test.tsx b/public/app/features/dashboard/components/DashboardPrompt/DashboardPrompt.test.tsx index 9d30b556fb4..923efa7eb4b 100644 --- a/public/app/features/dashboard/components/DashboardPrompt/DashboardPrompt.test.tsx +++ b/public/app/features/dashboard/components/DashboardPrompt/DashboardPrompt.test.tsx @@ -8,7 +8,6 @@ import { hasChanges, ignoreChanges } from './DashboardPrompt'; function getDefaultDashboardModel() { return createDashboardModelFixture({ - refresh: false, panels: [ createPanelJSONFixture({ id: 1, @@ -56,7 +55,7 @@ describe('DashboardPrompt', () => { it('Should ignore a lot of changes', () => { const { original, dash } = getTestContext(); dash.time = { from: '1h' }; - dash.refresh = true; + dash.refresh = '30s'; dash.schemaVersion = 10; expect(hasChanges(dash, original)).toBe(false); }); diff --git a/public/app/features/dashboard/components/DashboardPrompt/DashboardPrompt.tsx b/public/app/features/dashboard/components/DashboardPrompt/DashboardPrompt.tsx index 42133dd7976..fc3e87a2f30 100644 --- a/public/app/features/dashboard/components/DashboardPrompt/DashboardPrompt.tsx +++ b/public/app/features/dashboard/components/DashboardPrompt/DashboardPrompt.tsx @@ -178,7 +178,7 @@ function cleanDashboardFromIgnoredChanges(dashData: Dashboard) { // ignore time and refresh dash.time = 0; - dash.refresh = 0; + dash.refresh = ''; dash.schemaVersion = 0; dash.timezone = 0; diff --git a/public/app/features/dashboard/state/DashboardModel.ts b/public/app/features/dashboard/state/DashboardModel.ts index 3801ffc85e5..30f52049bb0 100644 --- a/public/app/features/dashboard/state/DashboardModel.ts +++ b/public/app/features/dashboard/state/DashboardModel.ts @@ -86,7 +86,7 @@ export class DashboardModel implements TimeModel { templating: { list: any[] }; private originalTemplating: any; annotations: { list: AnnotationQuery[] }; - refresh: any; + refresh: string; snapshot: any; schemaVersion: number; version: number; @@ -145,7 +145,7 @@ export class DashboardModel implements TimeModel { this.liveNow = Boolean(data.liveNow); this.templating = this.ensureListExist(data.templating); this.annotations = this.ensureListExist(data.annotations); - this.refresh = data.refresh; + this.refresh = data.refresh || ''; this.snapshot = data.snapshot; this.schemaVersion = data.schemaVersion ?? 0; this.fiscalYearStartMonth = data.fiscalYearStartMonth ?? 0;