From 2b2b19478a45bfaaea748fa04ad99121216072ed Mon Sep 17 00:00:00 2001 From: Ivan Ortega Alba Date: Thu, 13 Feb 2025 08:19:51 +0100 Subject: [PATCH] Dashboard V0->V1 Migration: Schema migration v41 (#100554) --- .../migration/schemaversion/migrations.go | 3 +- .../dashboard/migration/schemaversion/v41.go | 11 ++ .../migration/schemaversion/v41_test.go | 38 +++++ .../input/36.legend_normalization.json | 4 +- .../37.timeseries_table_display_mode.json | 4 +- .../input/38.transform_timeseries_table.json | 4 +- .../testdata/input/39.refresh_true.json | 4 +- .../input/40.time_picker_time_options.json | 136 ++++++++++++++++++ .../output/36.legend_normalization.37.json | 14 +- .../output/36.legend_normalization.38.json | 14 +- .../output/36.legend_normalization.39.json | 14 +- .../output/36.legend_normalization.40.json | 14 +- .../output/36.legend_normalization.41.json | 132 +++++++++++++++++ .../37.timeseries_table_display_mode.38.json | 14 +- .../37.timeseries_table_display_mode.39.json | 14 +- .../37.timeseries_table_display_mode.40.json | 14 +- ... 37.timeseries_table_display_mode.41.json} | 33 +++-- .../38.transform_timeseries_table.39.json | 14 +- .../38.transform_timeseries_table.40.json | 14 +- ... => 38.transform_timeseries_table.41.json} | 12 +- .../testdata/output/39.refresh_true.40.json | 14 +- ...h_true.39.json => 39.refresh_true.41.json} | 4 +- .../40.time_picker_time_options.41.json | 134 +++++++++++++++++ 23 files changed, 629 insertions(+), 30 deletions(-) create mode 100644 pkg/apis/dashboard/migration/schemaversion/v41.go create mode 100644 pkg/apis/dashboard/migration/schemaversion/v41_test.go create mode 100644 pkg/apis/dashboard/migration/testdata/input/40.time_picker_time_options.json create mode 100644 pkg/apis/dashboard/migration/testdata/output/36.legend_normalization.41.json rename pkg/apis/dashboard/migration/testdata/output/{37.timeseries_table_display_mode.37.json => 37.timeseries_table_display_mode.41.json} (91%) rename pkg/apis/dashboard/migration/testdata/output/{38.transform_timeseries_table.38.json => 38.transform_timeseries_table.41.json} (95%) rename pkg/apis/dashboard/migration/testdata/output/{39.refresh_true.39.json => 39.refresh_true.41.json} (98%) create mode 100644 pkg/apis/dashboard/migration/testdata/output/40.time_picker_time_options.41.json diff --git a/pkg/apis/dashboard/migration/schemaversion/migrations.go b/pkg/apis/dashboard/migration/schemaversion/migrations.go index 6d3955c329f..ef46439a591 100644 --- a/pkg/apis/dashboard/migration/schemaversion/migrations.go +++ b/pkg/apis/dashboard/migration/schemaversion/migrations.go @@ -6,7 +6,7 @@ type SchemaVersionMigrationFunc func(map[string]interface{}) error const ( MINIUM_VERSION = 36 - LATEST_VERSION = 40 + LATEST_VERSION = 41 ) var Migrations = map[int]SchemaVersionMigrationFunc{ @@ -14,6 +14,7 @@ var Migrations = map[int]SchemaVersionMigrationFunc{ 38: V38, 39: V39, 40: V40, + 41: V41, } func GetSchemaVersion(dash map[string]interface{}) int { diff --git a/pkg/apis/dashboard/migration/schemaversion/v41.go b/pkg/apis/dashboard/migration/schemaversion/v41.go new file mode 100644 index 00000000000..1faafea8285 --- /dev/null +++ b/pkg/apis/dashboard/migration/schemaversion/v41.go @@ -0,0 +1,11 @@ +package schemaversion + +func V41(dash map[string]interface{}) error { + dash["schemaVersion"] = int(41) + if timepicker, ok := dash["timepicker"].(map[string]interface{}); ok { + // time_options is a legacy property that was not used since grafana version 5 + // therefore deprecating this property from the schema + delete(timepicker, "time_options") + } + return nil +} diff --git a/pkg/apis/dashboard/migration/schemaversion/v41_test.go b/pkg/apis/dashboard/migration/schemaversion/v41_test.go new file mode 100644 index 00000000000..d0f11d227f3 --- /dev/null +++ b/pkg/apis/dashboard/migration/schemaversion/v41_test.go @@ -0,0 +1,38 @@ +package schemaversion_test + +import ( + "testing" + + "github.com/grafana/grafana/pkg/apis/dashboard/migration/schemaversion" +) + +func TestV41(t *testing.T) { + tests := []migrationTestCase{ + { + name: "time_options is removed", + input: map[string]interface{}{ + "title": "Test Dashboard", + "timepicker": map[string]interface{}{ + "time_options": []string{"1m", "5m", "15m", "1h", "6h", "12h", "24h"}, + }, + }, + expected: map[string]interface{}{ + "title": "Test Dashboard", + "schemaVersion": 41, + "timepicker": map[string]interface{}{}, + }, + }, + { + name: "timepicker is not set", + input: map[string]interface{}{ + "title": "Test Dashboard", + }, + expected: map[string]interface{}{ + "title": "Test Dashboard", + "schemaVersion": 41, + }, + }, + } + + runMigrationTests(t, tests, schemaversion.V41) +} diff --git a/pkg/apis/dashboard/migration/testdata/input/36.legend_normalization.json b/pkg/apis/dashboard/migration/testdata/input/36.legend_normalization.json index 93ddfecb078..7776ccdf0cb 100644 --- a/pkg/apis/dashboard/migration/testdata/input/36.legend_normalization.json +++ b/pkg/apis/dashboard/migration/testdata/input/36.legend_normalization.json @@ -115,7 +115,9 @@ "from": "now-6h", "to": "now" }, - "timepicker": {}, + "timepicker": { + "time_options": ["5m", "15m", "1h", "6h", "12h", "24h", "2d", "7d", "30d"] + }, "timezone": "utc", "title": "New dashboard", "version": 0, diff --git a/pkg/apis/dashboard/migration/testdata/input/37.timeseries_table_display_mode.json b/pkg/apis/dashboard/migration/testdata/input/37.timeseries_table_display_mode.json index e800450fd51..20fa6fc0371 100644 --- a/pkg/apis/dashboard/migration/testdata/input/37.timeseries_table_display_mode.json +++ b/pkg/apis/dashboard/migration/testdata/input/37.timeseries_table_display_mode.json @@ -352,7 +352,9 @@ "from": "now-6h", "to": "now" }, - "timepicker": {}, + "timepicker": { + "time_options": ["5m", "15m", "1h", "6h", "12h", "24h", "2d", "7d", "30d"] + }, "timezone": "utc", "title": "New dashboard", "version": 0, diff --git a/pkg/apis/dashboard/migration/testdata/input/38.transform_timeseries_table.json b/pkg/apis/dashboard/migration/testdata/input/38.transform_timeseries_table.json index e5f08f17c69..9afbe33c607 100644 --- a/pkg/apis/dashboard/migration/testdata/input/38.transform_timeseries_table.json +++ b/pkg/apis/dashboard/migration/testdata/input/38.transform_timeseries_table.json @@ -145,7 +145,9 @@ "from": "now-6h", "to": "now" }, - "timepicker": {}, + "timepicker": { + "time_options": ["5m", "15m", "1h", "6h", "12h", "24h", "2d", "7d", "30d"] + }, "timezone": "utc", "title": "New dashboard", "version": 0, diff --git a/pkg/apis/dashboard/migration/testdata/input/39.refresh_true.json b/pkg/apis/dashboard/migration/testdata/input/39.refresh_true.json index 4ea2be531f9..844bd81eb23 100644 --- a/pkg/apis/dashboard/migration/testdata/input/39.refresh_true.json +++ b/pkg/apis/dashboard/migration/testdata/input/39.refresh_true.json @@ -124,7 +124,9 @@ "from": "now-6h", "to": "now" }, - "timepicker": {}, + "timepicker": { + "time_options": ["5m", "15m", "1h", "6h", "12h", "24h", "2d", "7d", "30d"] + }, "timezone": "utc", "title": "New dashboard", "version": 0, diff --git a/pkg/apis/dashboard/migration/testdata/input/40.time_picker_time_options.json b/pkg/apis/dashboard/migration/testdata/input/40.time_picker_time_options.json new file mode 100644 index 00000000000..5b6071de054 --- /dev/null +++ b/pkg/apis/dashboard/migration/testdata/input/40.time_picker_time_options.json @@ -0,0 +1,136 @@ +{ + "annotations": { + "list": [ + { + "builtIn": 1, + "datasource": { + "type": "grafana", + "uid": "-- Grafana --" + }, + "enable": true, + "hide": true, + "iconColor": "rgba(0, 211, 255, 1)", + "name": "Annotations & Alerts", + "type": "dashboard" + } + ] + }, + "editable": true, + "fiscalYearStartMonth": 0, + "graphTooltip": 0, + "links": [], + "panels": [ + { + "datasource": { + "type": "datasource", + "uid": "grafana" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 0 + }, + "id": 1, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "hideZeros": false, + "mode": "single", + "sort": "none" + } + }, + "pluginVersion": "11.5.0-81438", + "targets": [ + { + "datasource": { + "type": "datasource", + "uid": "grafana" + }, + "queryType": "randomWalk", + "refId": "A" + } + ], + "title": "Panel Title", + "type": "timeseries" + } + ], + "preload": false, + "tags": [], + "templating": { + "list": [] + }, + "time": { + "from": "now-6h", + "to": "now" + }, + "timepicker": { + "time_options": ["5m", "15m", "1h", "6h", "12h", "24h", "2d", "7d", "30d"] + }, + "timezone": "utc", + "title": "New dashboard", + "version": 0, + "weekStart": "", + "refresh": "", + "schemaVersion": 40 + } \ No newline at end of file diff --git a/pkg/apis/dashboard/migration/testdata/output/36.legend_normalization.37.json b/pkg/apis/dashboard/migration/testdata/output/36.legend_normalization.37.json index 1e6e0484aad..27e61667230 100644 --- a/pkg/apis/dashboard/migration/testdata/output/36.legend_normalization.37.json +++ b/pkg/apis/dashboard/migration/testdata/output/36.legend_normalization.37.json @@ -124,7 +124,19 @@ "from": "now-6h", "to": "now" }, - "timepicker": {}, + "timepicker": { + "time_options": [ + "5m", + "15m", + "1h", + "6h", + "12h", + "24h", + "2d", + "7d", + "30d" + ] + }, "timezone": "utc", "title": "New dashboard", "version": 0, diff --git a/pkg/apis/dashboard/migration/testdata/output/36.legend_normalization.38.json b/pkg/apis/dashboard/migration/testdata/output/36.legend_normalization.38.json index 14c5c32071f..de4220f3b61 100644 --- a/pkg/apis/dashboard/migration/testdata/output/36.legend_normalization.38.json +++ b/pkg/apis/dashboard/migration/testdata/output/36.legend_normalization.38.json @@ -124,7 +124,19 @@ "from": "now-6h", "to": "now" }, - "timepicker": {}, + "timepicker": { + "time_options": [ + "5m", + "15m", + "1h", + "6h", + "12h", + "24h", + "2d", + "7d", + "30d" + ] + }, "timezone": "utc", "title": "New dashboard", "version": 0, diff --git a/pkg/apis/dashboard/migration/testdata/output/36.legend_normalization.39.json b/pkg/apis/dashboard/migration/testdata/output/36.legend_normalization.39.json index 5e3239e89fa..472dbdd70a7 100644 --- a/pkg/apis/dashboard/migration/testdata/output/36.legend_normalization.39.json +++ b/pkg/apis/dashboard/migration/testdata/output/36.legend_normalization.39.json @@ -124,7 +124,19 @@ "from": "now-6h", "to": "now" }, - "timepicker": {}, + "timepicker": { + "time_options": [ + "5m", + "15m", + "1h", + "6h", + "12h", + "24h", + "2d", + "7d", + "30d" + ] + }, "timezone": "utc", "title": "New dashboard", "version": 0, diff --git a/pkg/apis/dashboard/migration/testdata/output/36.legend_normalization.40.json b/pkg/apis/dashboard/migration/testdata/output/36.legend_normalization.40.json index 91d625264b0..e097b1e8402 100644 --- a/pkg/apis/dashboard/migration/testdata/output/36.legend_normalization.40.json +++ b/pkg/apis/dashboard/migration/testdata/output/36.legend_normalization.40.json @@ -124,7 +124,19 @@ "from": "now-6h", "to": "now" }, - "timepicker": {}, + "timepicker": { + "time_options": [ + "5m", + "15m", + "1h", + "6h", + "12h", + "24h", + "2d", + "7d", + "30d" + ] + }, "timezone": "utc", "title": "New dashboard", "version": 0, diff --git a/pkg/apis/dashboard/migration/testdata/output/36.legend_normalization.41.json b/pkg/apis/dashboard/migration/testdata/output/36.legend_normalization.41.json new file mode 100644 index 00000000000..fda6883a462 --- /dev/null +++ b/pkg/apis/dashboard/migration/testdata/output/36.legend_normalization.41.json @@ -0,0 +1,132 @@ +{ + "annotations": { + "list": [ + { + "builtIn": 1, + "datasource": { + "type": "grafana", + "uid": "-- Grafana --" + }, + "enable": true, + "hide": true, + "iconColor": "rgba(0, 211, 255, 1)", + "name": "Annotations \u0026 Alerts", + "type": "dashboard" + } + ] + }, + "editable": true, + "fiscalYearStartMonth": 0, + "graphTooltip": 0, + "links": [], + "panels": [ + { + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 0 + }, + "id": 1, + "options": {}, + "title": "No Legend Config", + "type": "graph" + }, + { + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 0 + }, + "id": 2, + "options": { + "legend": { + "displayMode": "list", + "showLegend": true + } + }, + "title": "Boolean Legend True" + }, + { + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 8 + }, + "id": 3, + "options": { + "legend": { + "displayMode": "list", + "showLegend": false + } + }, + "title": "Boolean Legend False" + }, + { + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 8 + }, + "id": 4, + "options": { + "legend": { + "displayMode": "list", + "showLegend": false + } + }, + "title": "Hidden DisplayMode" + }, + { + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 16 + }, + "id": 5, + "options": { + "legend": { + "displayMode": "list", + "showLegend": false + } + }, + "title": "ShowLegend False" + }, + { + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 16 + }, + "id": 6, + "options": { + "legend": { + "displayMode": "table", + "showLegend": true + } + }, + "title": "Visible Legend" + } + ], + "preload": false, + "refresh": "", + "schemaVersion": 41, + "tags": [], + "templating": { + "list": [] + }, + "time": { + "from": "now-6h", + "to": "now" + }, + "timepicker": {}, + "timezone": "utc", + "title": "New dashboard", + "version": 0, + "weekStart": "" +} \ No newline at end of file diff --git a/pkg/apis/dashboard/migration/testdata/output/37.timeseries_table_display_mode.38.json b/pkg/apis/dashboard/migration/testdata/output/37.timeseries_table_display_mode.38.json index 30f64b0bc8e..5a17d602e82 100644 --- a/pkg/apis/dashboard/migration/testdata/output/37.timeseries_table_display_mode.38.json +++ b/pkg/apis/dashboard/migration/testdata/output/37.timeseries_table_display_mode.38.json @@ -367,7 +367,19 @@ "from": "now-6h", "to": "now" }, - "timepicker": {}, + "timepicker": { + "time_options": [ + "5m", + "15m", + "1h", + "6h", + "12h", + "24h", + "2d", + "7d", + "30d" + ] + }, "timezone": "utc", "title": "New dashboard", "version": 0, diff --git a/pkg/apis/dashboard/migration/testdata/output/37.timeseries_table_display_mode.39.json b/pkg/apis/dashboard/migration/testdata/output/37.timeseries_table_display_mode.39.json index 1173963dc58..dee3d62af57 100644 --- a/pkg/apis/dashboard/migration/testdata/output/37.timeseries_table_display_mode.39.json +++ b/pkg/apis/dashboard/migration/testdata/output/37.timeseries_table_display_mode.39.json @@ -367,7 +367,19 @@ "from": "now-6h", "to": "now" }, - "timepicker": {}, + "timepicker": { + "time_options": [ + "5m", + "15m", + "1h", + "6h", + "12h", + "24h", + "2d", + "7d", + "30d" + ] + }, "timezone": "utc", "title": "New dashboard", "version": 0, diff --git a/pkg/apis/dashboard/migration/testdata/output/37.timeseries_table_display_mode.40.json b/pkg/apis/dashboard/migration/testdata/output/37.timeseries_table_display_mode.40.json index 843cc6284f7..d5ddc2a55a8 100644 --- a/pkg/apis/dashboard/migration/testdata/output/37.timeseries_table_display_mode.40.json +++ b/pkg/apis/dashboard/migration/testdata/output/37.timeseries_table_display_mode.40.json @@ -367,7 +367,19 @@ "from": "now-6h", "to": "now" }, - "timepicker": {}, + "timepicker": { + "time_options": [ + "5m", + "15m", + "1h", + "6h", + "12h", + "24h", + "2d", + "7d", + "30d" + ] + }, "timezone": "utc", "title": "New dashboard", "version": 0, diff --git a/pkg/apis/dashboard/migration/testdata/output/37.timeseries_table_display_mode.37.json b/pkg/apis/dashboard/migration/testdata/output/37.timeseries_table_display_mode.41.json similarity index 91% rename from pkg/apis/dashboard/migration/testdata/output/37.timeseries_table_display_mode.37.json rename to pkg/apis/dashboard/migration/testdata/output/37.timeseries_table_display_mode.41.json index 4b7c2fa4572..2d1d083a874 100644 --- a/pkg/apis/dashboard/migration/testdata/output/37.timeseries_table_display_mode.37.json +++ b/pkg/apis/dashboard/migration/testdata/output/37.timeseries_table_display_mode.41.json @@ -31,7 +31,10 @@ "mode": "palette-classic" }, "custom": { - "displayMode": "basic" + "cellOptions": { + "mode": "basic", + "type": "gauge" + } }, "mappings": [], "thresholds": { @@ -84,7 +87,10 @@ "mode": "palette-classic" }, "custom": { - "displayMode": "gradient-gauge" + "cellOptions": { + "mode": "gradient", + "type": "gauge" + } }, "mappings": [], "thresholds": { @@ -137,7 +143,10 @@ "mode": "palette-classic" }, "custom": { - "displayMode": "lcd-gauge" + "cellOptions": { + "mode": "lcd", + "type": "gauge" + } }, "mappings": [], "thresholds": { @@ -190,7 +199,10 @@ "mode": "palette-classic" }, "custom": { - "displayMode": "color-background" + "cellOptions": { + "mode": "gradient", + "type": "color-background" + } }, "mappings": [], "thresholds": { @@ -243,7 +255,10 @@ "mode": "palette-classic" }, "custom": { - "displayMode": "color-background-solid" + "cellOptions": { + "mode": "basic", + "type": "color-background" + } }, "mappings": [], "thresholds": { @@ -296,7 +311,9 @@ "mode": "palette-classic" }, "custom": { - "displayMode": "some-other-mode" + "cellOptions": { + "type": "some-other-mode" + } }, "mappings": [], "thresholds": { @@ -340,8 +357,8 @@ } ], "preload": false, - "refresh": true, - "schemaVersion": 37, + "refresh": "", + "schemaVersion": 41, "tags": [], "templating": { "list": [] diff --git a/pkg/apis/dashboard/migration/testdata/output/38.transform_timeseries_table.39.json b/pkg/apis/dashboard/migration/testdata/output/38.transform_timeseries_table.39.json index 136a2fb9d40..19b3b5d79f8 100644 --- a/pkg/apis/dashboard/migration/testdata/output/38.transform_timeseries_table.39.json +++ b/pkg/apis/dashboard/migration/testdata/output/38.transform_timeseries_table.39.json @@ -147,7 +147,19 @@ "from": "now-6h", "to": "now" }, - "timepicker": {}, + "timepicker": { + "time_options": [ + "5m", + "15m", + "1h", + "6h", + "12h", + "24h", + "2d", + "7d", + "30d" + ] + }, "timezone": "utc", "title": "New dashboard", "version": 0, diff --git a/pkg/apis/dashboard/migration/testdata/output/38.transform_timeseries_table.40.json b/pkg/apis/dashboard/migration/testdata/output/38.transform_timeseries_table.40.json index 4217f847e8c..63b0959daa1 100644 --- a/pkg/apis/dashboard/migration/testdata/output/38.transform_timeseries_table.40.json +++ b/pkg/apis/dashboard/migration/testdata/output/38.transform_timeseries_table.40.json @@ -147,7 +147,19 @@ "from": "now-6h", "to": "now" }, - "timepicker": {}, + "timepicker": { + "time_options": [ + "5m", + "15m", + "1h", + "6h", + "12h", + "24h", + "2d", + "7d", + "30d" + ] + }, "timezone": "utc", "title": "New dashboard", "version": 0, diff --git a/pkg/apis/dashboard/migration/testdata/output/38.transform_timeseries_table.38.json b/pkg/apis/dashboard/migration/testdata/output/38.transform_timeseries_table.41.json similarity index 95% rename from pkg/apis/dashboard/migration/testdata/output/38.transform_timeseries_table.38.json rename to pkg/apis/dashboard/migration/testdata/output/38.transform_timeseries_table.41.json index 081cb14634f..be300a117c6 100644 --- a/pkg/apis/dashboard/migration/testdata/output/38.transform_timeseries_table.38.json +++ b/pkg/apis/dashboard/migration/testdata/output/38.transform_timeseries_table.41.json @@ -124,9 +124,11 @@ { "id": "timeSeriesTable", "options": { - "refIdToStat": { - "A": "mean", - "B": "max" + "A": { + "stat": "mean" + }, + "B": { + "stat": "max" } } } @@ -135,8 +137,8 @@ } ], "preload": false, - "refresh": true, - "schemaVersion": 38, + "refresh": "", + "schemaVersion": 41, "tags": [], "templating": { "list": [] diff --git a/pkg/apis/dashboard/migration/testdata/output/39.refresh_true.40.json b/pkg/apis/dashboard/migration/testdata/output/39.refresh_true.40.json index a8c67a1e80d..5c4ad99f35c 100644 --- a/pkg/apis/dashboard/migration/testdata/output/39.refresh_true.40.json +++ b/pkg/apis/dashboard/migration/testdata/output/39.refresh_true.40.json @@ -126,7 +126,19 @@ "from": "now-6h", "to": "now" }, - "timepicker": {}, + "timepicker": { + "time_options": [ + "5m", + "15m", + "1h", + "6h", + "12h", + "24h", + "2d", + "7d", + "30d" + ] + }, "timezone": "utc", "title": "New dashboard", "version": 0, diff --git a/pkg/apis/dashboard/migration/testdata/output/39.refresh_true.39.json b/pkg/apis/dashboard/migration/testdata/output/39.refresh_true.41.json similarity index 98% rename from pkg/apis/dashboard/migration/testdata/output/39.refresh_true.39.json rename to pkg/apis/dashboard/migration/testdata/output/39.refresh_true.41.json index 6c0cb4d1974..8c6dfe8ba06 100644 --- a/pkg/apis/dashboard/migration/testdata/output/39.refresh_true.39.json +++ b/pkg/apis/dashboard/migration/testdata/output/39.refresh_true.41.json @@ -116,8 +116,8 @@ } ], "preload": false, - "refresh": true, - "schemaVersion": 39, + "refresh": "", + "schemaVersion": 41, "tags": [], "templating": { "list": [] diff --git a/pkg/apis/dashboard/migration/testdata/output/40.time_picker_time_options.41.json b/pkg/apis/dashboard/migration/testdata/output/40.time_picker_time_options.41.json new file mode 100644 index 00000000000..8c6dfe8ba06 --- /dev/null +++ b/pkg/apis/dashboard/migration/testdata/output/40.time_picker_time_options.41.json @@ -0,0 +1,134 @@ +{ + "annotations": { + "list": [ + { + "builtIn": 1, + "datasource": { + "type": "grafana", + "uid": "-- Grafana --" + }, + "enable": true, + "hide": true, + "iconColor": "rgba(0, 211, 255, 1)", + "name": "Annotations \u0026 Alerts", + "type": "dashboard" + } + ] + }, + "editable": true, + "fiscalYearStartMonth": 0, + "graphTooltip": 0, + "links": [], + "panels": [ + { + "datasource": { + "type": "datasource", + "uid": "grafana" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 0 + }, + "id": 1, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "hideZeros": false, + "mode": "single", + "sort": "none" + } + }, + "pluginVersion": "11.5.0-81438", + "targets": [ + { + "datasource": { + "type": "datasource", + "uid": "grafana" + }, + "queryType": "randomWalk", + "refId": "A" + } + ], + "title": "Panel Title", + "type": "timeseries" + } + ], + "preload": false, + "refresh": "", + "schemaVersion": 41, + "tags": [], + "templating": { + "list": [] + }, + "time": { + "from": "now-6h", + "to": "now" + }, + "timepicker": {}, + "timezone": "utc", + "title": "New dashboard", + "version": 0, + "weekStart": "" +} \ No newline at end of file