From 09bbdfe8ab41c38b1d0111c4eefd3fdc98cbac10 Mon Sep 17 00:00:00 2001 From: Ivan Ortega Alba Date: Tue, 17 Jun 2025 10:38:48 +0200 Subject: [PATCH] Dashboard Migrations: V35 ensures X-axis visibility in timeseries (#106633) * Add datasource info provider * Dashboards: Support schemaVersion v35 migration in backend * update go mods --------- Co-authored-by: Todd Treece <360020+toddtreece@users.noreply.github.com> Co-authored-by: Haris Rozajac Co-authored-by: Stephanie Hingtgen --- apps/dashboard/pkg/apis/dashboard_manifest.go | 2 - .../pkg/migration/schemaversion/migrations.go | 3 +- .../pkg/migration/schemaversion/v35.go | 80 +++++ .../pkg/migration/schemaversion/v35_test.go | 340 ++++++++++++++++++ .../input/34.ensure_x_axis_visibility.json | 251 +++++++++++++ .../34.ensure_x_axis_visibility.35.json | 273 ++++++++++++++ .../34.ensure_x_axis_visibility.36.json | 322 +++++++++++++++++ .../34.ensure_x_axis_visibility.37.json | 331 +++++++++++++++++ .../34.ensure_x_axis_visibility.38.json | 331 +++++++++++++++++ .../34.ensure_x_axis_visibility.39.json | 331 +++++++++++++++++ .../34.ensure_x_axis_visibility.40.json | 331 +++++++++++++++++ .../34.ensure_x_axis_visibility.41.json | 319 ++++++++++++++++ go.mod | 2 +- go.sum | 4 +- go.work.sum | 8 +- 15 files changed, 2917 insertions(+), 11 deletions(-) create mode 100644 apps/dashboard/pkg/migration/schemaversion/v35.go create mode 100644 apps/dashboard/pkg/migration/schemaversion/v35_test.go create mode 100644 apps/dashboard/pkg/migration/testdata/input/34.ensure_x_axis_visibility.json create mode 100644 apps/dashboard/pkg/migration/testdata/output/34.ensure_x_axis_visibility.35.json create mode 100644 apps/dashboard/pkg/migration/testdata/output/34.ensure_x_axis_visibility.36.json create mode 100644 apps/dashboard/pkg/migration/testdata/output/34.ensure_x_axis_visibility.37.json create mode 100644 apps/dashboard/pkg/migration/testdata/output/34.ensure_x_axis_visibility.38.json create mode 100644 apps/dashboard/pkg/migration/testdata/output/34.ensure_x_axis_visibility.39.json create mode 100644 apps/dashboard/pkg/migration/testdata/output/34.ensure_x_axis_visibility.40.json create mode 100644 apps/dashboard/pkg/migration/testdata/output/34.ensure_x_axis_visibility.41.json diff --git a/apps/dashboard/pkg/apis/dashboard_manifest.go b/apps/dashboard/pkg/apis/dashboard_manifest.go index 7a4552f5e0a..568e229d09d 100644 --- a/apps/dashboard/pkg/apis/dashboard_manifest.go +++ b/apps/dashboard/pkg/apis/dashboard_manifest.go @@ -16,8 +16,6 @@ import ( v2alpha1 "github.com/grafana/grafana/apps/dashboard/pkg/apis/dashboard/v2alpha1" ) -var () - var appManifestData = app.ManifestData{ AppName: "dashboard", Group: "dashboard.grafana.app", diff --git a/apps/dashboard/pkg/migration/schemaversion/migrations.go b/apps/dashboard/pkg/migration/schemaversion/migrations.go index bafa640698c..6f078f90e26 100644 --- a/apps/dashboard/pkg/migration/schemaversion/migrations.go +++ b/apps/dashboard/pkg/migration/schemaversion/migrations.go @@ -5,7 +5,7 @@ import ( ) const ( - MIN_VERSION = 35 + MIN_VERSION = 34 LATEST_VERSION = 41 ) @@ -26,6 +26,7 @@ type DataSourceInfoProvider interface { func GetMigrations(dsInfoProvider DataSourceInfoProvider) map[int]SchemaVersionMigrationFunc { return map[int]SchemaVersionMigrationFunc{ + 35: V35, 36: V36(dsInfoProvider), 37: V37, 38: V38, diff --git a/apps/dashboard/pkg/migration/schemaversion/v35.go b/apps/dashboard/pkg/migration/schemaversion/v35.go new file mode 100644 index 00000000000..1c96b496d72 --- /dev/null +++ b/apps/dashboard/pkg/migration/schemaversion/v35.go @@ -0,0 +1,80 @@ +package schemaversion + +// V35 ensures x-axis visibility in timeseries panels to prevent dashboard breakage. +// +// This migration addresses a specific issue where timeseries panels with all axes +// configured as hidden (axisPlacement: "hidden") would result in completely unusable +// visualizations, as users would lose the ability to see time progression along the x-axis. +// +// The migration works by: +// 1. Identifying timeseries panels where the default axis placement is set to "hidden" +// 2. Adding a field override that specifically targets time-type fields (x-axis) +// 3. Setting the axis placement for time fields to "auto" to ensure x-axis visibility +// +// This preserves the original intent of hiding other axes while maintaining the critical +// time axis that makes timeseries data comprehensible. The override uses field matching +// by type ("time") to selectively restore visibility only for temporal data. +// +// Example transformation: +// +// Before migration: +// +// fieldConfig: { +// defaults: { custom: { axisPlacement: "hidden" } }, +// overrides: [] +// } +// +// After migration: +// +// fieldConfig: { +// defaults: { custom: { axisPlacement: "hidden" } }, +// overrides: [{ +// matcher: { id: "byType", options: "time" }, +// properties: [{ id: "custom.axisPlacement", value: "auto" }] +// }] +// } +func V35(dashboard map[string]interface{}) error { + dashboard["schemaVersion"] = int(35) + + panels, ok := dashboard["panels"].([]interface{}) + if !ok { + return nil + } + + for _, panel := range panels { + p, ok := panel.(map[string]interface{}) + if !ok || p["type"] != "timeseries" { + continue + } + + applyXAxisVisibilityOverride(p) + } + + return nil +} + +// applyXAxisVisibilityOverride adds a field override to ensure x-axis visibility +// when the panel's default axis placement is set to hidden. +func applyXAxisVisibilityOverride(panel map[string]interface{}) { + fieldConfig, _ := panel["fieldConfig"].(map[string]interface{}) + defaults, _ := fieldConfig["defaults"].(map[string]interface{}) + custom, _ := defaults["custom"].(map[string]interface{}) + + if custom["axisPlacement"] != "hidden" { + return + } + + overrides, _ := fieldConfig["overrides"].([]interface{}) + fieldConfig["overrides"] = append(overrides, map[string]interface{}{ + "matcher": map[string]interface{}{ + "id": "byType", + "options": "time", + }, + "properties": []interface{}{ + map[string]interface{}{ + "id": "custom.axisPlacement", + "value": "auto", + }, + }, + }) +} diff --git a/apps/dashboard/pkg/migration/schemaversion/v35_test.go b/apps/dashboard/pkg/migration/schemaversion/v35_test.go new file mode 100644 index 00000000000..c4150ac4dc0 --- /dev/null +++ b/apps/dashboard/pkg/migration/schemaversion/v35_test.go @@ -0,0 +1,340 @@ +package schemaversion_test + +import ( + "testing" + + "github.com/grafana/grafana/apps/dashboard/pkg/migration/schemaversion" +) + +func TestV35(t *testing.T) { + tests := []migrationTestCase{ + { + name: "preserves x axis visibility for timeseries with hidden axes", + input: map[string]interface{}{ + "panels": []interface{}{ + map[string]interface{}{ + "type": "timeseries", + "fieldConfig": map[string]interface{}{ + "defaults": map[string]interface{}{ + "custom": map[string]interface{}{ + "axisPlacement": "hidden", + }, + }, + "overrides": []interface{}{}, + }, + }, + }, + }, + expected: map[string]interface{}{ + "schemaVersion": int(35), + "panels": []interface{}{ + map[string]interface{}{ + "type": "timeseries", + "fieldConfig": map[string]interface{}{ + "defaults": map[string]interface{}{ + "custom": map[string]interface{}{ + "axisPlacement": "hidden", + }, + }, + "overrides": []interface{}{ + map[string]interface{}{ + "matcher": map[string]interface{}{ + "id": "byType", + "options": "time", + }, + "properties": []interface{}{ + map[string]interface{}{ + "id": "custom.axisPlacement", + "value": "auto", + }, + }, + }, + }, + }, + }, + }, + }, + }, + { + name: "appends to existing overrides for timeseries with hidden axes", + input: map[string]interface{}{ + "panels": []interface{}{ + map[string]interface{}{ + "type": "timeseries", + "fieldConfig": map[string]interface{}{ + "defaults": map[string]interface{}{ + "custom": map[string]interface{}{ + "axisPlacement": "hidden", + }, + }, + "overrides": []interface{}{ + map[string]interface{}{ + "matcher": map[string]interface{}{ + "id": "byName", + "options": "Series A", + }, + "properties": []interface{}{ + map[string]interface{}{ + "id": "color.mode", + "value": "palette-classic", + }, + }, + }, + }, + }, + }, + }, + }, + expected: map[string]interface{}{ + "schemaVersion": int(35), + "panels": []interface{}{ + map[string]interface{}{ + "type": "timeseries", + "fieldConfig": map[string]interface{}{ + "defaults": map[string]interface{}{ + "custom": map[string]interface{}{ + "axisPlacement": "hidden", + }, + }, + "overrides": []interface{}{ + map[string]interface{}{ + "matcher": map[string]interface{}{ + "id": "byName", + "options": "Series A", + }, + "properties": []interface{}{ + map[string]interface{}{ + "id": "color.mode", + "value": "palette-classic", + }, + }, + }, + map[string]interface{}{ + "matcher": map[string]interface{}{ + "id": "byType", + "options": "time", + }, + "properties": []interface{}{ + map[string]interface{}{ + "id": "custom.axisPlacement", + "value": "auto", + }, + }, + }, + }, + }, + }, + }, + }, + }, + { + name: "does not migrate timeseries with non-hidden axis placement", + input: map[string]interface{}{ + "panels": []interface{}{ + map[string]interface{}{ + "type": "timeseries", + "fieldConfig": map[string]interface{}{ + "defaults": map[string]interface{}{ + "custom": map[string]interface{}{ + "axisPlacement": "auto", + }, + }, + "overrides": []interface{}{}, + }, + }, + }, + }, + expected: map[string]interface{}{ + "schemaVersion": int(35), + "panels": []interface{}{ + map[string]interface{}{ + "type": "timeseries", + "fieldConfig": map[string]interface{}{ + "defaults": map[string]interface{}{ + "custom": map[string]interface{}{ + "axisPlacement": "auto", + }, + }, + "overrides": []interface{}{}, + }, + }, + }, + }, + }, + { + name: "does not migrate non-timeseries panels", + input: map[string]interface{}{ + "panels": []interface{}{ + map[string]interface{}{ + "type": "stat", + "fieldConfig": map[string]interface{}{ + "defaults": map[string]interface{}{ + "custom": map[string]interface{}{ + "axisPlacement": "hidden", + }, + }, + "overrides": []interface{}{}, + }, + }, + }, + }, + expected: map[string]interface{}{ + "schemaVersion": int(35), + "panels": []interface{}{ + map[string]interface{}{ + "type": "stat", + "fieldConfig": map[string]interface{}{ + "defaults": map[string]interface{}{ + "custom": map[string]interface{}{ + "axisPlacement": "hidden", + }, + }, + "overrides": []interface{}{}, + }, + }, + }, + }, + }, + { + name: "handles missing fieldConfig gracefully", + input: map[string]interface{}{ + "panels": []interface{}{ + map[string]interface{}{ + "type": "timeseries", + "id": 1, + }, + }, + }, + expected: map[string]interface{}{ + "schemaVersion": int(35), + "panels": []interface{}{ + map[string]interface{}{ + "type": "timeseries", + "id": 1, + }, + }, + }, + }, + { + name: "handles missing defaults gracefully", + input: map[string]interface{}{ + "panels": []interface{}{ + map[string]interface{}{ + "type": "timeseries", + "fieldConfig": map[string]interface{}{ + "overrides": []interface{}{}, + }, + }, + }, + }, + expected: map[string]interface{}{ + "schemaVersion": int(35), + "panels": []interface{}{ + map[string]interface{}{ + "type": "timeseries", + "fieldConfig": map[string]interface{}{ + "overrides": []interface{}{}, + }, + }, + }, + }, + }, + { + name: "handles missing custom config gracefully", + input: map[string]interface{}{ + "panels": []interface{}{ + map[string]interface{}{ + "type": "timeseries", + "fieldConfig": map[string]interface{}{ + "defaults": map[string]interface{}{ + "unit": "bytes", + }, + "overrides": []interface{}{}, + }, + }, + }, + }, + expected: map[string]interface{}{ + "schemaVersion": int(35), + "panels": []interface{}{ + map[string]interface{}{ + "type": "timeseries", + "fieldConfig": map[string]interface{}{ + "defaults": map[string]interface{}{ + "unit": "bytes", + }, + "overrides": []interface{}{}, + }, + }, + }, + }, + }, + { + name: "handles missing overrides array", + input: map[string]interface{}{ + "panels": []interface{}{ + map[string]interface{}{ + "type": "timeseries", + "fieldConfig": map[string]interface{}{ + "defaults": map[string]interface{}{ + "custom": map[string]interface{}{ + "axisPlacement": "hidden", + }, + }, + }, + }, + }, + }, + expected: map[string]interface{}{ + "schemaVersion": int(35), + "panels": []interface{}{ + map[string]interface{}{ + "type": "timeseries", + "fieldConfig": map[string]interface{}{ + "defaults": map[string]interface{}{ + "custom": map[string]interface{}{ + "axisPlacement": "hidden", + }, + }, + "overrides": []interface{}{ + map[string]interface{}{ + "matcher": map[string]interface{}{ + "id": "byType", + "options": "time", + }, + "properties": []interface{}{ + map[string]interface{}{ + "id": "custom.axisPlacement", + "value": "auto", + }, + }, + }, + }, + }, + }, + }, + }, + }, + { + name: "handles empty panels array", + input: map[string]interface{}{ + "panels": []interface{}{}, + }, + expected: map[string]interface{}{ + "schemaVersion": int(35), + "panels": []interface{}{}, + }, + }, + { + name: "handles missing panels", + input: map[string]interface{}{ + "title": "Test Dashboard", + }, + expected: map[string]interface{}{ + "schemaVersion": int(35), + "title": "Test Dashboard", + }, + }, + } + runMigrationTests(t, tests, schemaversion.V35) +} diff --git a/apps/dashboard/pkg/migration/testdata/input/34.ensure_x_axis_visibility.json b/apps/dashboard/pkg/migration/testdata/input/34.ensure_x_axis_visibility.json new file mode 100644 index 00000000000..76e96197459 --- /dev/null +++ b/apps/dashboard/pkg/migration/testdata/input/34.ensure_x_axis_visibility.json @@ -0,0 +1,251 @@ +{ + "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" + }, + { + "datasource": "Non Default Test Datasource", + "enable": true, + "name": "Test Annotation by Name", + "type": "dashboard" + }, + { + "datasource": "non-default-test-ds-uid", + "enable": true, + "name": "Test Annotation by UID", + "type": "dashboard" + }, + { + "datasource": "default", + "enable": true, + "name": "Test Default Annotation", + "type": "dashboard" + }, + { + "datasource": "non-existing-ds", + "enable": true, + "name": "Test Non-existing Annotation", + "type": "dashboard" + } + ] + }, + "editable": true, + "fiscalYearStartMonth": 0, + "graphTooltip": 0, + "links": [], + "panels": [ + { + "type": "graph", + "options": {}, + "title": "No Legend Config", + "id": 1, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 0 + } + }, + { + "options": { + "legend": true + }, + "title": "Boolean Legend True", + "id": 2, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 0 + } + }, + { + "options": { + "legend": false + }, + "title": "Boolean Legend False", + "id": 3, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 8 + } + }, + { + "options": { + "legend": { + "displayMode": "hidden" + } + }, + "title": "Hidden DisplayMode", + "id": 4, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 8 + } + }, + { + "options": { + "legend": { + "showLegend": false + } + }, + "title": "ShowLegend False", + "id": 5, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 16 + } + }, + { + "options": { + "legend": { + "displayMode": "table" + } + }, + "title": "Visible Legend", + "id": 6, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 16 + } + }, + { + "datasource": "default", + "title": "Mixed Datasources Panel", + "id": 7, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 24 + }, + "targets": [ + { + "datasource": "non-default-test-ds-uid" + }, + { + "datasource": "Non Default Test Datasource" + } + ] + }, + { + "datasource": { + "uid": "-- Mixed --" + }, + "title": "Mixed Panel with Mixed Targets", + "id": 8, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 24 + }, + "targets": [ + { + "datasource": "non-default-test-ds-uid" + }, + { + "datasource": "Non Default Test Datasource" + } + ] + }, + { + "datasource": "non-existing-ds", + "title": "Non-existing Datasource Panel", + "id": 9, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 32 + }, + "targets": [ + { + "datasource": "non-existing-ds" + } + ] + }, + { + "type": "timeseries", + "title": "Timeseries Panel with Hidden Axes", + "id": 10, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 40 + }, + "fieldConfig": { + "defaults": { + "custom": { + "axisPlacement": "hidden" + } + }, + "overrides": [] + } + } + + ], + "preload": false, + "refresh": true, + "schemaVersion": 34, + "tags": [], + "templating": { + "list": [ + { + "type": "query", + "datasource": "default", + "name": "default_var" + }, + { + "type": "query", + "datasource": "Non Default Test Datasource", + "name": "es_var_by_name" + }, + { + "type": "query", + "datasource": "non-default-test-ds-uid", + "name": "es_var_by_uid" + }, + { + "type": "query", + "datasource": null, + "name": "null_var" + }, + { + "type": "query", + "datasource": "non-existing-ds", + "name": "non_existing_var" + } + ] + }, + "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": "" +} \ No newline at end of file diff --git a/apps/dashboard/pkg/migration/testdata/output/34.ensure_x_axis_visibility.35.json b/apps/dashboard/pkg/migration/testdata/output/34.ensure_x_axis_visibility.35.json new file mode 100644 index 00000000000..def2752a794 --- /dev/null +++ b/apps/dashboard/pkg/migration/testdata/output/34.ensure_x_axis_visibility.35.json @@ -0,0 +1,273 @@ +{ + "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" + }, + { + "datasource": "Non Default Test Datasource", + "enable": true, + "name": "Test Annotation by Name", + "type": "dashboard" + }, + { + "datasource": "non-default-test-ds-uid", + "enable": true, + "name": "Test Annotation by UID", + "type": "dashboard" + }, + { + "datasource": "default", + "enable": true, + "name": "Test Default Annotation", + "type": "dashboard" + }, + { + "datasource": "non-existing-ds", + "enable": true, + "name": "Test Non-existing Annotation", + "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": true + }, + "title": "Boolean Legend True" + }, + { + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 8 + }, + "id": 3, + "options": { + "legend": false + }, + "title": "Boolean Legend False" + }, + { + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 8 + }, + "id": 4, + "options": { + "legend": { + "displayMode": "hidden" + } + }, + "title": "Hidden DisplayMode" + }, + { + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 16 + }, + "id": 5, + "options": { + "legend": { + "showLegend": false + } + }, + "title": "ShowLegend False" + }, + { + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 16 + }, + "id": 6, + "options": { + "legend": { + "displayMode": "table" + } + }, + "title": "Visible Legend" + }, + { + "datasource": "default", + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 24 + }, + "id": 7, + "targets": [ + { + "datasource": "non-default-test-ds-uid" + }, + { + "datasource": "Non Default Test Datasource" + } + ], + "title": "Mixed Datasources Panel" + }, + { + "datasource": { + "uid": "-- Mixed --" + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 24 + }, + "id": 8, + "targets": [ + { + "datasource": "non-default-test-ds-uid" + }, + { + "datasource": "Non Default Test Datasource" + } + ], + "title": "Mixed Panel with Mixed Targets" + }, + { + "datasource": "non-existing-ds", + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 32 + }, + "id": 9, + "targets": [ + { + "datasource": "non-existing-ds" + } + ], + "title": "Non-existing Datasource Panel" + }, + { + "fieldConfig": { + "defaults": { + "custom": { + "axisPlacement": "hidden" + } + }, + "overrides": [ + { + "matcher": { + "id": "byType", + "options": "time" + }, + "properties": [ + { + "id": "custom.axisPlacement", + "value": "auto" + } + ] + } + ] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 40 + }, + "id": 10, + "title": "Timeseries Panel with Hidden Axes", + "type": "timeseries" + } + ], + "preload": false, + "refresh": true, + "schemaVersion": 35, + "tags": [], + "templating": { + "list": [ + { + "datasource": "default", + "name": "default_var", + "type": "query" + }, + { + "datasource": "Non Default Test Datasource", + "name": "es_var_by_name", + "type": "query" + }, + { + "datasource": "non-default-test-ds-uid", + "name": "es_var_by_uid", + "type": "query" + }, + { + "datasource": null, + "name": "null_var", + "type": "query" + }, + { + "datasource": "non-existing-ds", + "name": "non_existing_var", + "type": "query" + } + ] + }, + "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": "" +} \ No newline at end of file diff --git a/apps/dashboard/pkg/migration/testdata/output/34.ensure_x_axis_visibility.36.json b/apps/dashboard/pkg/migration/testdata/output/34.ensure_x_axis_visibility.36.json new file mode 100644 index 00000000000..fd100004fe5 --- /dev/null +++ b/apps/dashboard/pkg/migration/testdata/output/34.ensure_x_axis_visibility.36.json @@ -0,0 +1,322 @@ +{ + "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" + }, + { + "datasource": { + "apiVersion": "1", + "type": "loki", + "uid": "non-default-test-ds-uid" + }, + "enable": true, + "name": "Test Annotation by Name", + "type": "dashboard" + }, + { + "datasource": { + "apiVersion": "1", + "type": "loki", + "uid": "non-default-test-ds-uid" + }, + "enable": true, + "name": "Test Annotation by UID", + "type": "dashboard" + }, + { + "datasource": { + "type": "prometheus", + "uid": "default-ds-uid" + }, + "enable": true, + "name": "Test Default Annotation", + "type": "dashboard" + }, + { + "datasource": { + "uid": "non-existing-ds" + }, + "enable": true, + "name": "Test Non-existing Annotation", + "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": true + }, + "title": "Boolean Legend True" + }, + { + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 8 + }, + "id": 3, + "options": { + "legend": false + }, + "title": "Boolean Legend False" + }, + { + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 8 + }, + "id": 4, + "options": { + "legend": { + "displayMode": "hidden" + } + }, + "title": "Hidden DisplayMode" + }, + { + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 16 + }, + "id": 5, + "options": { + "legend": { + "showLegend": false + } + }, + "title": "ShowLegend False" + }, + { + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 16 + }, + "id": 6, + "options": { + "legend": { + "displayMode": "table" + } + }, + "title": "Visible Legend" + }, + { + "datasource": null, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 24 + }, + "id": 7, + "targets": [ + { + "datasource": { + "apiVersion": "1", + "type": "loki", + "uid": "non-default-test-ds-uid" + } + }, + { + "datasource": { + "apiVersion": "1", + "type": "loki", + "uid": "non-default-test-ds-uid" + } + } + ], + "title": "Mixed Datasources Panel" + }, + { + "datasource": { + "uid": "-- Mixed --" + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 24 + }, + "id": 8, + "targets": [ + { + "datasource": { + "apiVersion": "1", + "type": "loki", + "uid": "non-default-test-ds-uid" + } + }, + { + "datasource": { + "apiVersion": "1", + "type": "loki", + "uid": "non-default-test-ds-uid" + } + } + ], + "title": "Mixed Panel with Mixed Targets" + }, + { + "datasource": { + "uid": "non-existing-ds" + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 32 + }, + "id": 9, + "targets": [ + { + "datasource": { + "uid": "non-existing-ds" + } + } + ], + "title": "Non-existing Datasource Panel" + }, + { + "fieldConfig": { + "defaults": { + "custom": { + "axisPlacement": "hidden" + } + }, + "overrides": [ + { + "matcher": { + "id": "byType", + "options": "time" + }, + "properties": [ + { + "id": "custom.axisPlacement", + "value": "auto" + } + ] + } + ] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 40 + }, + "id": 10, + "title": "Timeseries Panel with Hidden Axes", + "type": "timeseries" + } + ], + "preload": false, + "refresh": true, + "schemaVersion": 36, + "tags": [], + "templating": { + "list": [ + { + "datasource": { + "type": "prometheus", + "uid": "default-ds-uid" + }, + "name": "default_var", + "type": "query" + }, + { + "datasource": { + "apiVersion": "1", + "type": "loki", + "uid": "non-default-test-ds-uid" + }, + "name": "es_var_by_name", + "type": "query" + }, + { + "datasource": { + "apiVersion": "1", + "type": "loki", + "uid": "non-default-test-ds-uid" + }, + "name": "es_var_by_uid", + "type": "query" + }, + { + "datasource": { + "type": "prometheus", + "uid": "default-ds-uid" + }, + "name": "null_var", + "type": "query" + }, + { + "datasource": { + "uid": "non-existing-ds" + }, + "name": "non_existing_var", + "type": "query" + } + ] + }, + "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": "" +} \ No newline at end of file diff --git a/apps/dashboard/pkg/migration/testdata/output/34.ensure_x_axis_visibility.37.json b/apps/dashboard/pkg/migration/testdata/output/34.ensure_x_axis_visibility.37.json new file mode 100644 index 00000000000..f385e3e8e04 --- /dev/null +++ b/apps/dashboard/pkg/migration/testdata/output/34.ensure_x_axis_visibility.37.json @@ -0,0 +1,331 @@ +{ + "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" + }, + { + "datasource": { + "apiVersion": "1", + "type": "loki", + "uid": "non-default-test-ds-uid" + }, + "enable": true, + "name": "Test Annotation by Name", + "type": "dashboard" + }, + { + "datasource": { + "apiVersion": "1", + "type": "loki", + "uid": "non-default-test-ds-uid" + }, + "enable": true, + "name": "Test Annotation by UID", + "type": "dashboard" + }, + { + "datasource": { + "type": "prometheus", + "uid": "default-ds-uid" + }, + "enable": true, + "name": "Test Default Annotation", + "type": "dashboard" + }, + { + "datasource": { + "uid": "non-existing-ds" + }, + "enable": true, + "name": "Test Non-existing Annotation", + "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" + }, + { + "datasource": null, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 24 + }, + "id": 7, + "targets": [ + { + "datasource": { + "apiVersion": "1", + "type": "loki", + "uid": "non-default-test-ds-uid" + } + }, + { + "datasource": { + "apiVersion": "1", + "type": "loki", + "uid": "non-default-test-ds-uid" + } + } + ], + "title": "Mixed Datasources Panel" + }, + { + "datasource": { + "uid": "-- Mixed --" + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 24 + }, + "id": 8, + "targets": [ + { + "datasource": { + "apiVersion": "1", + "type": "loki", + "uid": "non-default-test-ds-uid" + } + }, + { + "datasource": { + "apiVersion": "1", + "type": "loki", + "uid": "non-default-test-ds-uid" + } + } + ], + "title": "Mixed Panel with Mixed Targets" + }, + { + "datasource": { + "uid": "non-existing-ds" + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 32 + }, + "id": 9, + "targets": [ + { + "datasource": { + "uid": "non-existing-ds" + } + } + ], + "title": "Non-existing Datasource Panel" + }, + { + "fieldConfig": { + "defaults": { + "custom": { + "axisPlacement": "hidden" + } + }, + "overrides": [ + { + "matcher": { + "id": "byType", + "options": "time" + }, + "properties": [ + { + "id": "custom.axisPlacement", + "value": "auto" + } + ] + } + ] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 40 + }, + "id": 10, + "title": "Timeseries Panel with Hidden Axes", + "type": "timeseries" + } + ], + "preload": false, + "refresh": true, + "schemaVersion": 37, + "tags": [], + "templating": { + "list": [ + { + "datasource": { + "type": "prometheus", + "uid": "default-ds-uid" + }, + "name": "default_var", + "type": "query" + }, + { + "datasource": { + "apiVersion": "1", + "type": "loki", + "uid": "non-default-test-ds-uid" + }, + "name": "es_var_by_name", + "type": "query" + }, + { + "datasource": { + "apiVersion": "1", + "type": "loki", + "uid": "non-default-test-ds-uid" + }, + "name": "es_var_by_uid", + "type": "query" + }, + { + "datasource": { + "type": "prometheus", + "uid": "default-ds-uid" + }, + "name": "null_var", + "type": "query" + }, + { + "datasource": { + "uid": "non-existing-ds" + }, + "name": "non_existing_var", + "type": "query" + } + ] + }, + "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": "" +} \ No newline at end of file diff --git a/apps/dashboard/pkg/migration/testdata/output/34.ensure_x_axis_visibility.38.json b/apps/dashboard/pkg/migration/testdata/output/34.ensure_x_axis_visibility.38.json new file mode 100644 index 00000000000..338505298b7 --- /dev/null +++ b/apps/dashboard/pkg/migration/testdata/output/34.ensure_x_axis_visibility.38.json @@ -0,0 +1,331 @@ +{ + "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" + }, + { + "datasource": { + "apiVersion": "1", + "type": "loki", + "uid": "non-default-test-ds-uid" + }, + "enable": true, + "name": "Test Annotation by Name", + "type": "dashboard" + }, + { + "datasource": { + "apiVersion": "1", + "type": "loki", + "uid": "non-default-test-ds-uid" + }, + "enable": true, + "name": "Test Annotation by UID", + "type": "dashboard" + }, + { + "datasource": { + "type": "prometheus", + "uid": "default-ds-uid" + }, + "enable": true, + "name": "Test Default Annotation", + "type": "dashboard" + }, + { + "datasource": { + "uid": "non-existing-ds" + }, + "enable": true, + "name": "Test Non-existing Annotation", + "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" + }, + { + "datasource": null, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 24 + }, + "id": 7, + "targets": [ + { + "datasource": { + "apiVersion": "1", + "type": "loki", + "uid": "non-default-test-ds-uid" + } + }, + { + "datasource": { + "apiVersion": "1", + "type": "loki", + "uid": "non-default-test-ds-uid" + } + } + ], + "title": "Mixed Datasources Panel" + }, + { + "datasource": { + "uid": "-- Mixed --" + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 24 + }, + "id": 8, + "targets": [ + { + "datasource": { + "apiVersion": "1", + "type": "loki", + "uid": "non-default-test-ds-uid" + } + }, + { + "datasource": { + "apiVersion": "1", + "type": "loki", + "uid": "non-default-test-ds-uid" + } + } + ], + "title": "Mixed Panel with Mixed Targets" + }, + { + "datasource": { + "uid": "non-existing-ds" + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 32 + }, + "id": 9, + "targets": [ + { + "datasource": { + "uid": "non-existing-ds" + } + } + ], + "title": "Non-existing Datasource Panel" + }, + { + "fieldConfig": { + "defaults": { + "custom": { + "axisPlacement": "hidden" + } + }, + "overrides": [ + { + "matcher": { + "id": "byType", + "options": "time" + }, + "properties": [ + { + "id": "custom.axisPlacement", + "value": "auto" + } + ] + } + ] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 40 + }, + "id": 10, + "title": "Timeseries Panel with Hidden Axes", + "type": "timeseries" + } + ], + "preload": false, + "refresh": true, + "schemaVersion": 38, + "tags": [], + "templating": { + "list": [ + { + "datasource": { + "type": "prometheus", + "uid": "default-ds-uid" + }, + "name": "default_var", + "type": "query" + }, + { + "datasource": { + "apiVersion": "1", + "type": "loki", + "uid": "non-default-test-ds-uid" + }, + "name": "es_var_by_name", + "type": "query" + }, + { + "datasource": { + "apiVersion": "1", + "type": "loki", + "uid": "non-default-test-ds-uid" + }, + "name": "es_var_by_uid", + "type": "query" + }, + { + "datasource": { + "type": "prometheus", + "uid": "default-ds-uid" + }, + "name": "null_var", + "type": "query" + }, + { + "datasource": { + "uid": "non-existing-ds" + }, + "name": "non_existing_var", + "type": "query" + } + ] + }, + "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": "" +} \ No newline at end of file diff --git a/apps/dashboard/pkg/migration/testdata/output/34.ensure_x_axis_visibility.39.json b/apps/dashboard/pkg/migration/testdata/output/34.ensure_x_axis_visibility.39.json new file mode 100644 index 00000000000..f6db499d579 --- /dev/null +++ b/apps/dashboard/pkg/migration/testdata/output/34.ensure_x_axis_visibility.39.json @@ -0,0 +1,331 @@ +{ + "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" + }, + { + "datasource": { + "apiVersion": "1", + "type": "loki", + "uid": "non-default-test-ds-uid" + }, + "enable": true, + "name": "Test Annotation by Name", + "type": "dashboard" + }, + { + "datasource": { + "apiVersion": "1", + "type": "loki", + "uid": "non-default-test-ds-uid" + }, + "enable": true, + "name": "Test Annotation by UID", + "type": "dashboard" + }, + { + "datasource": { + "type": "prometheus", + "uid": "default-ds-uid" + }, + "enable": true, + "name": "Test Default Annotation", + "type": "dashboard" + }, + { + "datasource": { + "uid": "non-existing-ds" + }, + "enable": true, + "name": "Test Non-existing Annotation", + "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" + }, + { + "datasource": null, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 24 + }, + "id": 7, + "targets": [ + { + "datasource": { + "apiVersion": "1", + "type": "loki", + "uid": "non-default-test-ds-uid" + } + }, + { + "datasource": { + "apiVersion": "1", + "type": "loki", + "uid": "non-default-test-ds-uid" + } + } + ], + "title": "Mixed Datasources Panel" + }, + { + "datasource": { + "uid": "-- Mixed --" + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 24 + }, + "id": 8, + "targets": [ + { + "datasource": { + "apiVersion": "1", + "type": "loki", + "uid": "non-default-test-ds-uid" + } + }, + { + "datasource": { + "apiVersion": "1", + "type": "loki", + "uid": "non-default-test-ds-uid" + } + } + ], + "title": "Mixed Panel with Mixed Targets" + }, + { + "datasource": { + "uid": "non-existing-ds" + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 32 + }, + "id": 9, + "targets": [ + { + "datasource": { + "uid": "non-existing-ds" + } + } + ], + "title": "Non-existing Datasource Panel" + }, + { + "fieldConfig": { + "defaults": { + "custom": { + "axisPlacement": "hidden" + } + }, + "overrides": [ + { + "matcher": { + "id": "byType", + "options": "time" + }, + "properties": [ + { + "id": "custom.axisPlacement", + "value": "auto" + } + ] + } + ] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 40 + }, + "id": 10, + "title": "Timeseries Panel with Hidden Axes", + "type": "timeseries" + } + ], + "preload": false, + "refresh": true, + "schemaVersion": 39, + "tags": [], + "templating": { + "list": [ + { + "datasource": { + "type": "prometheus", + "uid": "default-ds-uid" + }, + "name": "default_var", + "type": "query" + }, + { + "datasource": { + "apiVersion": "1", + "type": "loki", + "uid": "non-default-test-ds-uid" + }, + "name": "es_var_by_name", + "type": "query" + }, + { + "datasource": { + "apiVersion": "1", + "type": "loki", + "uid": "non-default-test-ds-uid" + }, + "name": "es_var_by_uid", + "type": "query" + }, + { + "datasource": { + "type": "prometheus", + "uid": "default-ds-uid" + }, + "name": "null_var", + "type": "query" + }, + { + "datasource": { + "uid": "non-existing-ds" + }, + "name": "non_existing_var", + "type": "query" + } + ] + }, + "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": "" +} \ No newline at end of file diff --git a/apps/dashboard/pkg/migration/testdata/output/34.ensure_x_axis_visibility.40.json b/apps/dashboard/pkg/migration/testdata/output/34.ensure_x_axis_visibility.40.json new file mode 100644 index 00000000000..65cc3424eac --- /dev/null +++ b/apps/dashboard/pkg/migration/testdata/output/34.ensure_x_axis_visibility.40.json @@ -0,0 +1,331 @@ +{ + "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" + }, + { + "datasource": { + "apiVersion": "1", + "type": "loki", + "uid": "non-default-test-ds-uid" + }, + "enable": true, + "name": "Test Annotation by Name", + "type": "dashboard" + }, + { + "datasource": { + "apiVersion": "1", + "type": "loki", + "uid": "non-default-test-ds-uid" + }, + "enable": true, + "name": "Test Annotation by UID", + "type": "dashboard" + }, + { + "datasource": { + "type": "prometheus", + "uid": "default-ds-uid" + }, + "enable": true, + "name": "Test Default Annotation", + "type": "dashboard" + }, + { + "datasource": { + "uid": "non-existing-ds" + }, + "enable": true, + "name": "Test Non-existing Annotation", + "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" + }, + { + "datasource": null, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 24 + }, + "id": 7, + "targets": [ + { + "datasource": { + "apiVersion": "1", + "type": "loki", + "uid": "non-default-test-ds-uid" + } + }, + { + "datasource": { + "apiVersion": "1", + "type": "loki", + "uid": "non-default-test-ds-uid" + } + } + ], + "title": "Mixed Datasources Panel" + }, + { + "datasource": { + "uid": "-- Mixed --" + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 24 + }, + "id": 8, + "targets": [ + { + "datasource": { + "apiVersion": "1", + "type": "loki", + "uid": "non-default-test-ds-uid" + } + }, + { + "datasource": { + "apiVersion": "1", + "type": "loki", + "uid": "non-default-test-ds-uid" + } + } + ], + "title": "Mixed Panel with Mixed Targets" + }, + { + "datasource": { + "uid": "non-existing-ds" + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 32 + }, + "id": 9, + "targets": [ + { + "datasource": { + "uid": "non-existing-ds" + } + } + ], + "title": "Non-existing Datasource Panel" + }, + { + "fieldConfig": { + "defaults": { + "custom": { + "axisPlacement": "hidden" + } + }, + "overrides": [ + { + "matcher": { + "id": "byType", + "options": "time" + }, + "properties": [ + { + "id": "custom.axisPlacement", + "value": "auto" + } + ] + } + ] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 40 + }, + "id": 10, + "title": "Timeseries Panel with Hidden Axes", + "type": "timeseries" + } + ], + "preload": false, + "refresh": "", + "schemaVersion": 40, + "tags": [], + "templating": { + "list": [ + { + "datasource": { + "type": "prometheus", + "uid": "default-ds-uid" + }, + "name": "default_var", + "type": "query" + }, + { + "datasource": { + "apiVersion": "1", + "type": "loki", + "uid": "non-default-test-ds-uid" + }, + "name": "es_var_by_name", + "type": "query" + }, + { + "datasource": { + "apiVersion": "1", + "type": "loki", + "uid": "non-default-test-ds-uid" + }, + "name": "es_var_by_uid", + "type": "query" + }, + { + "datasource": { + "type": "prometheus", + "uid": "default-ds-uid" + }, + "name": "null_var", + "type": "query" + }, + { + "datasource": { + "uid": "non-existing-ds" + }, + "name": "non_existing_var", + "type": "query" + } + ] + }, + "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": "" +} \ No newline at end of file diff --git a/apps/dashboard/pkg/migration/testdata/output/34.ensure_x_axis_visibility.41.json b/apps/dashboard/pkg/migration/testdata/output/34.ensure_x_axis_visibility.41.json new file mode 100644 index 00000000000..e057c26580b --- /dev/null +++ b/apps/dashboard/pkg/migration/testdata/output/34.ensure_x_axis_visibility.41.json @@ -0,0 +1,319 @@ +{ + "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" + }, + { + "datasource": { + "apiVersion": "1", + "type": "loki", + "uid": "non-default-test-ds-uid" + }, + "enable": true, + "name": "Test Annotation by Name", + "type": "dashboard" + }, + { + "datasource": { + "apiVersion": "1", + "type": "loki", + "uid": "non-default-test-ds-uid" + }, + "enable": true, + "name": "Test Annotation by UID", + "type": "dashboard" + }, + { + "datasource": { + "type": "prometheus", + "uid": "default-ds-uid" + }, + "enable": true, + "name": "Test Default Annotation", + "type": "dashboard" + }, + { + "datasource": { + "uid": "non-existing-ds" + }, + "enable": true, + "name": "Test Non-existing Annotation", + "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" + }, + { + "datasource": null, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 24 + }, + "id": 7, + "targets": [ + { + "datasource": { + "apiVersion": "1", + "type": "loki", + "uid": "non-default-test-ds-uid" + } + }, + { + "datasource": { + "apiVersion": "1", + "type": "loki", + "uid": "non-default-test-ds-uid" + } + } + ], + "title": "Mixed Datasources Panel" + }, + { + "datasource": { + "uid": "-- Mixed --" + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 24 + }, + "id": 8, + "targets": [ + { + "datasource": { + "apiVersion": "1", + "type": "loki", + "uid": "non-default-test-ds-uid" + } + }, + { + "datasource": { + "apiVersion": "1", + "type": "loki", + "uid": "non-default-test-ds-uid" + } + } + ], + "title": "Mixed Panel with Mixed Targets" + }, + { + "datasource": { + "uid": "non-existing-ds" + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 32 + }, + "id": 9, + "targets": [ + { + "datasource": { + "uid": "non-existing-ds" + } + } + ], + "title": "Non-existing Datasource Panel" + }, + { + "fieldConfig": { + "defaults": { + "custom": { + "axisPlacement": "hidden" + } + }, + "overrides": [ + { + "matcher": { + "id": "byType", + "options": "time" + }, + "properties": [ + { + "id": "custom.axisPlacement", + "value": "auto" + } + ] + } + ] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 40 + }, + "id": 10, + "title": "Timeseries Panel with Hidden Axes", + "type": "timeseries" + } + ], + "preload": false, + "refresh": "", + "schemaVersion": 41, + "tags": [], + "templating": { + "list": [ + { + "datasource": { + "type": "prometheus", + "uid": "default-ds-uid" + }, + "name": "default_var", + "type": "query" + }, + { + "datasource": { + "apiVersion": "1", + "type": "loki", + "uid": "non-default-test-ds-uid" + }, + "name": "es_var_by_name", + "type": "query" + }, + { + "datasource": { + "apiVersion": "1", + "type": "loki", + "uid": "non-default-test-ds-uid" + }, + "name": "es_var_by_uid", + "type": "query" + }, + { + "datasource": { + "type": "prometheus", + "uid": "default-ds-uid" + }, + "name": "null_var", + "type": "query" + }, + { + "datasource": { + "uid": "non-existing-ds" + }, + "name": "non_existing_var", + "type": "query" + } + ] + }, + "time": { + "from": "now-6h", + "to": "now" + }, + "timepicker": {}, + "timezone": "utc", + "title": "New dashboard", + "version": 0, + "weekStart": "" +} \ No newline at end of file diff --git a/go.mod b/go.mod index 8d20ea18336..c2642f989dd 100644 --- a/go.mod +++ b/go.mod @@ -210,7 +210,7 @@ require ( require ( github.com/grafana/grafana/apps/advisor v0.0.0-20250527064921-326081cdb7a1 // @grafana/plugins-platform-backend github.com/grafana/grafana/apps/alerting/notifications v0.0.0-20250527064921-326081cdb7a1 // @grafana/alerting-backend - github.com/grafana/grafana/apps/dashboard v0.0.0-20250616135341-59c2f154336b // @grafana/grafana-app-platform-squad @grafana/dashboards-squad + github.com/grafana/grafana/apps/dashboard v0.0.0-20250616215703-eb4de388c3cf // @grafana/grafana-app-platform-squad @grafana/dashboards-squad github.com/grafana/grafana/apps/folder v0.0.0-20250527064921-326081cdb7a1 // @grafana/grafana-search-and-storage github.com/grafana/grafana/apps/investigations v0.0.0-20250527064921-326081cdb7a1 // @fcjack @matryer github.com/grafana/grafana/apps/playlist v0.0.0-20250527064921-326081cdb7a1 // @grafana/grafana-app-platform-squad diff --git a/go.sum b/go.sum index d3c2623e5cf..fc1cef1d8a9 100644 --- a/go.sum +++ b/go.sum @@ -1611,8 +1611,8 @@ github.com/grafana/grafana/apps/advisor v0.0.0-20250527064921-326081cdb7a1 h1:k7 github.com/grafana/grafana/apps/advisor v0.0.0-20250527064921-326081cdb7a1/go.mod h1:T4eaJioKjG8GQJS6sf8xMrzWV1QZrcOjxrSf4hbBiXM= github.com/grafana/grafana/apps/alerting/notifications v0.0.0-20250527064921-326081cdb7a1 h1:aE74WuajAAxB3FwMlIDjpsGoGLRsk4OOMvEDBLd+fmk= github.com/grafana/grafana/apps/alerting/notifications v0.0.0-20250527064921-326081cdb7a1/go.mod h1:u5uyB/n3LAUJzQyvacslofKbqpmaJlbNhf5D5DuqqfQ= -github.com/grafana/grafana/apps/dashboard v0.0.0-20250616135341-59c2f154336b h1:uCxmMbnpar9Q5uQO5mcMyL1B0ya/jvUgkSc4PNqRTCE= -github.com/grafana/grafana/apps/dashboard v0.0.0-20250616135341-59c2f154336b/go.mod h1:OIlvNnUufYDhBXa4xK4CyzPI2C69ZJkHy5+aFDyPtXw= +github.com/grafana/grafana/apps/dashboard v0.0.0-20250616215703-eb4de388c3cf h1:4dylGFxAO/B2up1n5x4smAVdfTYkStSExS3WaLD5jXY= +github.com/grafana/grafana/apps/dashboard v0.0.0-20250616215703-eb4de388c3cf/go.mod h1:XcJIUxPfKAhDb9mx9jHeV9U2xVA2WgE93ukd4Bx8U/M= github.com/grafana/grafana/apps/folder v0.0.0-20250527064921-326081cdb7a1 h1:SkVUcSlXIUi46gSGfe5/Xqn2p51c/unmkZRDX+274Os= github.com/grafana/grafana/apps/folder v0.0.0-20250527064921-326081cdb7a1/go.mod h1:z9u5VFG9q1CcIt62c9RIP8dEWHX81NdiPCjtpKKeuFU= github.com/grafana/grafana/apps/investigations v0.0.0-20250527064921-326081cdb7a1 h1:IN+KiBwtvJ3JCLdsPyAmGKJupWckH3h5iXpELd78rPo= diff --git a/go.work.sum b/go.work.sum index 0db31a4c1e5..b6cf635b677 100644 --- a/go.work.sum +++ b/go.work.sum @@ -640,6 +640,7 @@ github.com/DmitriyVTitov/size v1.5.0/go.mod h1:le6rNI4CoLQV1b9gzp1+3d7hMAD/uu2Qc github.com/GoogleCloudPlatform/cloudsql-proxy v1.36.0 h1:kAtNAWwvTt5+iew6baV0kbOrtjYTXPtWNSyOFlcxkBU= github.com/GoogleCloudPlatform/cloudsql-proxy v1.36.0/go.mod h1:VRKXU8C7Y/aUKjRBTGfw0Ndv4YqNxlB8zAPJJDxbASE= github.com/GoogleCloudPlatform/grpc-gcp-go/grpcgcp v1.5.0/go.mod h1:dppbR7CwXD4pgtV9t3wD1812RaLDcBjtblcDF5f1vI0= +github.com/GoogleCloudPlatform/grpc-gcp-go/grpcgcp v1.5.2 h1:DBjmt6/otSdULyJdVg2BlG0qGZO5tKL4VzOs0jpvw5Q= github.com/GoogleCloudPlatform/grpc-gcp-go/grpcgcp v1.5.2/go.mod h1:dppbR7CwXD4pgtV9t3wD1812RaLDcBjtblcDF5f1vI0= github.com/GoogleCloudPlatform/opentelemetry-operations-go/detectors/gcp v1.25.0/go.mod h1:obipzmGjfSjam60XLwGfqUkJsfiheAl+TUjG+4yzyPM= github.com/GoogleCloudPlatform/opentelemetry-operations-go/detectors/gcp v1.26.0/go.mod h1:2bIszWvQRlJVmJLiuLhukLImRjKPcYdzzsx6darK02A= @@ -848,8 +849,6 @@ github.com/casbin/casbin/v2 v2.37.0/go.mod h1:vByNa/Fchek0KZUgG5wEsl7iFsiviAYKRt github.com/cenkalti/backoff v2.2.1+incompatible h1:tNowT99t7UNflLxfYYSlKYsBpXdEet03Pg2g16Swow4= github.com/cenkalti/backoff v2.2.1+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QHaoyV4aDUVVkXQJJJ3NXXM= github.com/cenkalti/backoff/v4 v4.1.1/go.mod h1:scbssz8iZGpm3xbr14ovlUdkxfGXNInqkPWOWmG2CLw= -github.com/cenkalti/backoff/v5 v5.0.2 h1:rIfFVxEf1QsI7E1ZHfp/B4DF/6QBAUhmgkxc0H7Zss8= -github.com/cenkalti/backoff/v5 v5.0.2/go.mod h1:rkhZdG3JZukswDf7f0cwqPNk4K0sa+F97BxZthm/crw= github.com/census-instrumentation/opencensus-proto v0.4.1 h1:iKLQ0xPNFxR/2hzXZMrBo8f1j86j5WHzznCCQxV/b8g= github.com/centrifugal/centrifuge v0.36.0 h1:FLjOysPb0o8I6VT0FiR73CMXRY7lmZLlLJBt12hisFs= github.com/centrifugal/centrifuge v0.36.0/go.mod h1:X+rNLSNG81u4kZBPbkMMz3mxXTcc7bUSYpR3bbzwkkA= @@ -1238,6 +1237,7 @@ github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 h1:El6M4kTTCOh6aBiKaU github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510/go.mod h1:pupxD2MaaD3pAXIBCelhxNneeOaAeabZDe5s4K6zSpQ= github.com/googleapis/cloud-bigtable-clients-test v0.0.2 h1:S+sCHWAiAc+urcEnvg5JYJUOdlQEm/SEzQ/c/IdAH5M= github.com/googleapis/cloud-bigtable-clients-test v0.0.2/go.mod h1:mk3CrkrouRgtnhID6UZQDK3DrFFa7cYCAJcEmNsHYrY= +github.com/googleapis/cloud-bigtable-clients-test v0.0.3 h1:afMKTvA/jc6jSTMkeHBZGFDTt8Cc+kb1ATFzqMK85hw= github.com/googleapis/cloud-bigtable-clients-test v0.0.3/go.mod h1:TWtDzrrAI70C3dNLDY+nZN3gxHtFdZIbpL9rCTFyxE0= github.com/googleapis/enterprise-certificate-proxy v0.3.2/go.mod h1:VLSiSSBs/ksPL8kq3OBOQ6WRI2QnaFynd1DCjZ62+V0= github.com/googleapis/enterprise-certificate-proxy v0.3.4/go.mod h1:YKe7cfqYXjKGpGvmSg28/fFvhNzinZQm8DGnaburhGA= @@ -1555,8 +1555,6 @@ github.com/mitchellh/osext v0.0.0-20151018003038-5e2d6d41470f h1:2+myh5ml7lgEU/5 github.com/mithrandie/readline-csvq v1.3.0 h1:VTJEOGouJ8j27jJCD4kBBbNTxM0OdBvE1aY1tMhlqE8= github.com/mithrandie/readline-csvq v1.3.0/go.mod h1:FKyYqDgf/G4SNov7SMFXRWO6LQLXIOeTog/NB97FZl0= github.com/moby/locker v1.0.1 h1:fOXqR41zeveg4fFODix+1Ch4mj/gT0NE1XJbp/epuBg= -github.com/moby/spdystream v0.5.0 h1:7r0J1Si3QO/kjRitvSLVVFUjxMEb/YLj6S9FF62JBCU= -github.com/moby/spdystream v0.5.0/go.mod h1:xBAYlnt/ay+11ShkdFKNAG7LsyK/tmNBVvVOwrfMgdI= github.com/moby/sys/atomicwriter v0.1.0 h1:kw5D/EqkBwsBFi0ss9v1VG3wIkVhzGvLklJ+w3A14Sw= github.com/moby/sys/atomicwriter v0.1.0/go.mod h1:Ul8oqv2ZMNHOceF643P6FKPXeCmYtlQMvpizfsSoaWs= github.com/moby/sys/mountinfo v0.5.0 h1:2Ks8/r6lopsxWi9m58nlwjaeSzUX9iiL1vj5qB/9ObI= @@ -1578,7 +1576,6 @@ github.com/mozilla/tls-observatory v0.0.0-20210609171429-7bc42856d2e5/go.mod h1: github.com/mrunalp/fileutils v0.5.0 h1:NKzVxiH7eSk+OQ4M+ZYW1K6h27RUV3MI6NUTsHhU6Z4= github.com/muesli/reflow v0.3.0 h1:IFsN6K9NfGtjeggFP+68I4chLZV2yIKsXJFNZ+eWh6s= github.com/muesli/reflow v0.3.0/go.mod h1:pbwTDkVPibjO2kyvBQRBxTWEEGDGq0FlB1BIKtnHY/8= -github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f h1:y5//uYreIhSUg3J1GEMiLbxo1LJaP8RfCpH6pymGZus= github.com/nakagami/firebirdsql v0.0.0-20190310045651-3c02a58cfed8 h1:P48LjvUQpTReR3TQRbxSeSBsMXzfK0uol7eRcr7VBYQ= github.com/natessilva/dag v0.0.0-20180124060714-7194b8dcc5c4 h1:dnMxwus89s86tI8rcGVp2HwZzlz7c5o92VOy7dSckBQ= github.com/nats-io/jwt v0.3.0/go.mod h1:fRYCDE99xlTsqUzISS1Bi75UBJ6ljOJQOAAu5VglpSg= @@ -2004,6 +2001,7 @@ github.com/ziutek/mymysql v1.5.4/go.mod h1:LMSpPZ6DbqWFxNCHW77HeMg9I646SAhApZ/wK gitlab.com/nyarla/go-crypt v0.0.0-20160106005555-d9a5dc2b789b h1:7gd+rd8P3bqcn/96gOZa3F5dpJr/vEiDQYlNb/y2uNs= go.einride.tech/aip v0.68.0 h1:4seM66oLzTpz50u4K1zlJyOXQ3tCzcJN7I22tKkjipw= go.einride.tech/aip v0.68.0/go.mod h1:7y9FF8VtPWqpxuAxl0KQWqaULxW4zFIesD6zF5RIHHg= +go.einride.tech/aip v0.68.1 h1:16/AfSxcQISGN5z9C5lM+0mLYXihrHbQ1onvYTr93aQ= go.einride.tech/aip v0.68.1/go.mod h1:XaFtaj4HuA3Zwk9xoBtTWgNubZ0ZZXv9BZJCkuKuWbg= go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= go.etcd.io/bbolt v1.3.7/go.mod h1:N9Mkw9X8x5fupy0IKsmuqVtoGDyxsaDlbk4Rd05IAQw=