Dashboard schema: Review and mature refresh property (#62104)

* Review and mature refresh property

* Update type

* Update report
pull/62182/head
Dominik Prokop 2 years ago committed by GitHub
parent 1423f15b0d
commit b9a1d8e5f9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 7
      .betterer.results
  2. 2
      docs/sources/developers/kinds/core/dashboard/schema-reference.md
  3. 4
      kinds/dashboard/dashboard_kind.cue
  4. 2
      packages/grafana-schema/src/raw/dashboard/x/dashboard_types.gen.ts
  5. 2
      pkg/kinds/dashboard/dashboard_types_gen.go
  6. 2
      pkg/kindsys/report.json
  7. 3
      public/app/features/dashboard/components/DashboardPrompt/DashboardPrompt.test.tsx
  8. 2
      public/app/features/dashboard/components/DashboardPrompt/DashboardPrompt.tsx
  9. 4
      public/app/features/dashboard/state/DashboardModel.ts

@ -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"],

@ -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 |

@ -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

@ -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);
/**

@ -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

@ -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",

@ -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);
});

@ -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;

@ -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;

Loading…
Cancel
Save