Files
grafana/apps/dashboard/pkg/migration/testdata/output/latest_version/v24.table-angular.v42.json
Ivan Ortega Alba a72e02f88a Fix dashboard migration discrepancies between backend and frontend implementations (use toEqual) (#110268)
**Highlights**

* **Single-version migrations**: add `targetVersion` to migrator & model, separate outputs, enforce exact version.
* **Datasource fixes**: include `apiVersion` in tests, empty-string → `{}`, preserve `{}` refs, drop unwanted defaults.
* **Panel defaults & nesting**: only top-level panels get defaults; preserve empty `transformations` context-aware; filter repeated panels.

* **Migration parity**

  * V16: collapsed rows, grid height parsing (`px`).
  * V17: omit `maxPerRow` when `minSpan=1`.
  * V19–V20: cleanup defaults (`targetBlank`, style).
  * V23–V24: template vars + table panel consistency.
  * V28: full singlestat/stat parity, mappings & color.
  * V30–V36: threshold logic, empty refs, nested targets.
* **Save-model cleanup**: replicate frontend defaults/filtering, drop null IDs, metadata, unused props.
* **Testing**: unified suites, dev dashboards (v42), full unit coverage for major migrations.

Co-authored-by: Ivan Ortega [ivanortegaalba@gmail.com](mailto:ivanortegaalba@gmail.com)
Co-authored-by: Dominik Prokop [dominik.prokop@grafana.com](mailto:dominik.prokop@grafana.com)
2025-09-24 12:20:25 +02:00

1301 lines
30 KiB
JSON

{
"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": {
"apiVersion": "v1",
"type": "prometheus",
"uid": "default-ds-uid"
},
"description": "Tests basic migration with default style pattern (/.*/) containing thresholds and colors. Should convert styles to fieldConfig.defaults with threshold steps.",
"fieldConfig": {
"defaults": {
"custom": {
"align": "auto",
"cellOptions": {
"type": "auto"
},
"footer": {
"reducers": []
},
"inspect": false
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "red",
"value": null
},
{
"color": "yellow",
"value": 10
},
{
"color": "green",
"value": 20
},
{
"value": 30
}
]
}
},
"overrides": []
},
"id": 1,
"options": {
"cellHeight": "sm",
"showHeader": true
},
"pluginVersion": "12.1.0",
"targets": [
{
"datasource": {
"apiVersion": "v1",
"type": "prometheus",
"uid": "default-ds-uid"
},
"refId": "A"
},
{
"datasource": {
"apiVersion": "v1",
"type": "prometheus",
"uid": "default-ds-uid"
},
"refId": "B"
}
],
"title": "Basic Angular Table with Defaults",
"type": "table"
},
{
"datasource": {
"apiVersion": "v1",
"type": "prometheus",
"uid": "default-ds-uid"
},
"description": "Tests comprehensive migration including: default style with thresholds/colors/unit/decimals/align/colorMode, column overrides with exact name and regex patterns, date formatting, hidden columns, and links with tooltips.",
"fieldConfig": {
"defaults": {
"custom": {
"align": "center",
"cellOptions": {
"type": "color-background"
},
"footer": {
"reducers": []
},
"inspect": false
},
"decimals": 2,
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "yellow",
"value": 100
},
{
"color": "red",
"value": 500
}
]
},
"unit": "bytes"
},
"overrides": [
{
"matcher": {
"id": "byName",
"options": "Status"
},
"properties": [
{
"id": "displayName",
"value": "Current Status"
},
{
"id": "unit",
"value": "short"
},
{
"id": "decimals",
"value": 0
},
{
"id": "custom.cellOptions",
"value": {
"type": "color-text"
}
},
{
"id": "custom.align",
"value": "left"
}
]
},
{
"matcher": {
"id": "byRegexp",
"options": "/Error.*/"
},
"properties": [
{
"id": "links",
"value": [
{
"targetBlank": true,
"title": "View error details",
"url": "http://example.com/errors"
}
]
},
{
"id": "custom.cellOptions",
"value": {
"type": "color-background"
}
}
]
},
{
"matcher": {
"id": "byName",
"options": "Time"
},
"properties": [
{
"id": "displayName",
"value": "Timestamp"
},
{
"id": "unit",
"value": "time: YYYY-MM-DD HH:mm:ss"
}
]
},
{
"matcher": {
"id": "byName",
"options": "Hidden"
},
"properties": [
{
"id": "custom.hideFrom.viz",
"value": true
}
]
}
]
},
"id": 2,
"options": {
"cellHeight": "sm",
"showHeader": true
},
"pluginVersion": "12.1.0",
"targets": [
{
"datasource": {
"apiVersion": "v1",
"type": "prometheus",
"uid": "default-ds-uid"
},
"refId": "A"
}
],
"title": "Complex Table with All Style Features",
"type": "table"
},
{
"datasource": {
"apiVersion": "v1",
"type": "prometheus",
"uid": "default-ds-uid"
},
"description": "Tests migration of timeseries_aggregations transform to reduce transformation with column mappings (avg-\u003emean, max-\u003emax, min-\u003emin, total-\u003esum, current-\u003elastNotNull, count-\u003ecount).",
"fieldConfig": {
"defaults": {
"custom": {
"align": "auto",
"cellOptions": {
"type": "auto"
},
"footer": {
"reducers": []
},
"inspect": false
},
"decimals": 1,
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
},
"unit": "percent"
},
"overrides": []
},
"id": 3,
"options": {
"cellHeight": "sm",
"showHeader": true
},
"pluginVersion": "12.1.0",
"targets": [
{
"datasource": {
"apiVersion": "v1",
"type": "prometheus",
"uid": "default-ds-uid"
},
"refId": "A"
}
],
"title": "Table with Timeseries Aggregations Transform",
"transformations": [
{
"id": "reduce",
"options": {
"includeTimeField": false,
"reducers": [
"mean",
"max",
"min",
"sum",
"lastNotNull",
"count"
]
}
}
],
"type": "table"
},
{
"datasource": {
"apiVersion": "v1",
"type": "prometheus",
"uid": "default-ds-uid"
},
"description": "Tests migration of timeseries_to_rows transform to seriesToRows transformation.",
"fieldConfig": {
"defaults": {
"custom": {
"align": "auto",
"cellOptions": {
"type": "auto"
},
"footer": {
"reducers": []
},
"inspect": false
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
},
"unit": "short"
},
"overrides": []
},
"id": 4,
"options": {
"cellHeight": "sm",
"showHeader": true
},
"pluginVersion": "12.1.0",
"targets": [
{
"datasource": {
"apiVersion": "v1",
"type": "prometheus",
"uid": "default-ds-uid"
},
"refId": "A"
}
],
"title": "Table with Timeseries to Rows Transform",
"transformations": [
{
"id": "seriesToRows",
"options": {
"reducers": []
}
}
],
"type": "table"
},
{
"datasource": {
"apiVersion": "v1",
"type": "prometheus",
"uid": "default-ds-uid"
},
"description": "Tests migration of timeseries_to_columns transform to seriesToColumns transformation.",
"fieldConfig": {
"defaults": {
"custom": {
"align": "auto",
"cellOptions": {
"type": "auto"
},
"footer": {
"reducers": []
},
"inspect": false
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
},
"unit": "bytes"
},
"overrides": []
},
"id": 5,
"options": {
"cellHeight": "sm",
"showHeader": true
},
"pluginVersion": "12.1.0",
"targets": [
{
"datasource": {
"apiVersion": "v1",
"type": "prometheus",
"uid": "default-ds-uid"
},
"refId": "A"
}
],
"title": "Table with Timeseries to Columns Transform",
"transformations": [
{
"id": "seriesToColumns",
"options": {
"reducers": []
}
}
],
"type": "table"
},
{
"datasource": {
"apiVersion": "v1",
"type": "prometheus",
"uid": "default-ds-uid"
},
"description": "Tests migration of table transform to merge transformation. Also tests auto alignment conversion to empty string.",
"fieldConfig": {
"defaults": {
"custom": {
"cellOptions": {
"type": "auto"
},
"footer": {
"reducers": []
},
"inspect": false
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
}
},
"overrides": []
},
"id": 6,
"options": {
"cellHeight": "sm",
"showHeader": true
},
"pluginVersion": "12.1.0",
"targets": [
{
"datasource": {
"apiVersion": "v1",
"type": "prometheus",
"uid": "default-ds-uid"
},
"refId": "A"
}
],
"title": "Table with Merge Transform",
"transformations": [
{
"id": "merge",
"options": {
"reducers": []
}
}
],
"type": "table"
},
{
"datasource": {
"apiVersion": "v1",
"type": "prometheus",
"uid": "default-ds-uid"
},
"description": "Tests that existing transformations are preserved and new transformation from old format is appended to the list.",
"fieldConfig": {
"defaults": {
"custom": {
"align": "auto",
"cellOptions": {
"type": "auto"
},
"footer": {
"reducers": []
},
"inspect": false
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
},
"unit": "short"
},
"overrides": []
},
"id": 7,
"options": {
"cellHeight": "sm",
"showHeader": true
},
"pluginVersion": "12.1.0",
"targets": [
{
"datasource": {
"apiVersion": "v1",
"type": "prometheus",
"uid": "default-ds-uid"
},
"refId": "A"
}
],
"title": "Table with Existing Transformations",
"transformations": [
{
"id": "filterFieldsByName",
"options": {
"include": {
"names": [
"field1",
"field2"
]
}
}
},
{
"id": "seriesToRows",
"options": {
"reducers": []
}
}
],
"type": "table"
},
{
"datasource": {
"apiVersion": "v1",
"type": "prometheus",
"uid": "default-ds-uid"
},
"description": "Tests handling of mixed numeric and string threshold values (int, string, float) with proper type conversion.",
"fieldConfig": {
"defaults": {
"custom": {
"align": "auto",
"cellOptions": {
"type": "auto"
},
"footer": {
"reducers": []
},
"inspect": false
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "yellow",
"value": 10
},
{
"color": "orange",
"value": 20
},
{
"color": "red",
"value": 30.5
}
]
}
},
"overrides": []
},
"id": 8,
"options": {
"cellHeight": "sm",
"showHeader": true
},
"pluginVersion": "12.1.0",
"targets": [
{
"datasource": {
"apiVersion": "v1",
"type": "prometheus",
"uid": "default-ds-uid"
},
"refId": "A"
}
],
"title": "Mixed Threshold Types",
"type": "table"
},
{
"datasource": {
"apiVersion": "v1",
"type": "prometheus",
"uid": "default-ds-uid"
},
"description": "Tests all color mode mappings: cell-\u003ecolor-background, row-\u003ecolor-background, value-\u003ecolor-text.",
"fieldConfig": {
"defaults": {
"custom": {
"align": "auto",
"cellOptions": {
"type": "color-background"
},
"footer": {
"reducers": []
},
"inspect": false
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
}
},
"overrides": [
{
"matcher": {
"id": "byName",
"options": "CellColumn"
},
"properties": [
{
"id": "custom.cellOptions",
"value": {
"type": "color-background"
}
}
]
},
{
"matcher": {
"id": "byName",
"options": "RowColumn"
},
"properties": [
{
"id": "custom.cellOptions",
"value": {
"type": "color-background"
}
}
]
},
{
"matcher": {
"id": "byName",
"options": "ValueColumn"
},
"properties": [
{
"id": "custom.cellOptions",
"value": {
"type": "color-text"
}
}
]
}
]
},
"id": 9,
"options": {
"cellHeight": "sm",
"showHeader": true
},
"pluginVersion": "12.1.0",
"targets": [
{
"datasource": {
"apiVersion": "v1",
"type": "prometheus",
"uid": "default-ds-uid"
},
"refId": "A"
}
],
"title": "All Color Modes Test",
"type": "table"
},
{
"datasource": {
"apiVersion": "v1",
"type": "prometheus",
"uid": "default-ds-uid"
},
"description": "Tests all alignment options: left, center, right, and auto (should convert to empty string).",
"fieldConfig": {
"defaults": {
"custom": {
"align": "center",
"cellOptions": {
"type": "auto"
},
"footer": {
"reducers": []
},
"inspect": false
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
}
},
"overrides": [
{
"matcher": {
"id": "byName",
"options": "LeftColumn"
},
"properties": [
{
"id": "custom.align",
"value": "left"
}
]
},
{
"matcher": {
"id": "byName",
"options": "RightColumn"
},
"properties": [
{
"id": "custom.align",
"value": "right"
}
]
},
{
"matcher": {
"id": "byName",
"options": "AutoColumn"
},
"properties": [
{
"id": "custom.align"
}
]
}
]
},
"id": 10,
"options": {
"cellHeight": "sm",
"showHeader": true
},
"pluginVersion": "12.1.0",
"targets": [
{
"datasource": {
"apiVersion": "v1",
"type": "prometheus",
"uid": "default-ds-uid"
},
"refId": "A"
}
],
"title": "All Alignment Options",
"type": "table"
},
{
"datasource": {
"apiVersion": "v1",
"type": "prometheus",
"uid": "default-ds-uid"
},
"description": "Tests both field matcher types: byName for exact matches and byRegexp for regex patterns.",
"fieldConfig": {
"defaults": {
"custom": {
"align": "auto",
"cellOptions": {
"type": "auto"
},
"footer": {
"reducers": []
},
"inspect": false
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
},
"unit": "short"
},
"overrides": [
{
"matcher": {
"id": "byName",
"options": "ExactColumnName"
},
"properties": [
{
"id": "displayName",
"value": "Exact Match"
}
]
},
{
"matcher": {
"id": "byRegexp",
"options": "/Regex.*Pattern/"
},
"properties": [
{
"id": "displayName",
"value": "Regex Match"
}
]
},
{
"matcher": {
"id": "byRegexp",
"options": "/^Start/"
},
"properties": [
{
"id": "displayName",
"value": "Start Pattern"
}
]
},
{
"matcher": {
"id": "byRegexp",
"options": "/End$/"
},
"properties": [
{
"id": "displayName",
"value": "End Pattern"
}
]
}
]
},
"id": 11,
"options": {
"cellHeight": "sm",
"showHeader": true
},
"pluginVersion": "12.1.0",
"targets": [
{
"datasource": {
"apiVersion": "v1",
"type": "prometheus",
"uid": "default-ds-uid"
},
"refId": "A"
}
],
"title": "Field Matcher Types Test",
"type": "table"
},
{
"datasource": {
"apiVersion": "v1",
"type": "prometheus",
"uid": "default-ds-uid"
},
"description": "Tests various link configurations: with and without tooltip, with and without target blank.",
"fieldConfig": {
"defaults": {
"custom": {
"align": "auto",
"cellOptions": {
"type": "auto"
},
"footer": {
"reducers": []
},
"inspect": false
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
},
"unit": "short"
},
"overrides": [
{
"matcher": {
"id": "byName",
"options": "LinkWithTooltip"
},
"properties": [
{
"id": "links",
"value": [
{
"targetBlank": true,
"title": "Click to view details",
"url": "http://example.com/with-tooltip"
}
]
}
]
},
{
"matcher": {
"id": "byName",
"options": "LinkWithoutTooltip"
},
"properties": [
{
"id": "links",
"value": [
{
"targetBlank": false,
"title": "",
"url": "http://example.com/no-tooltip"
}
]
}
]
},
{
"matcher": {
"id": "byName",
"options": "LinkMinimal"
},
"properties": [
{
"id": "links",
"value": [
{
"targetBlank": false,
"title": "",
"url": "http://example.com/minimal"
}
]
}
]
}
]
},
"id": 12,
"options": {
"cellHeight": "sm",
"showHeader": true
},
"pluginVersion": "12.1.0",
"targets": [
{
"datasource": {
"apiVersion": "v1",
"type": "prometheus",
"uid": "default-ds-uid"
},
"refId": "A"
}
],
"title": "Link Configuration Test",
"type": "table"
},
{
"datasource": {
"apiVersion": "v1",
"type": "prometheus",
"uid": "default-ds-uid"
},
"description": "Tests various date format patterns and aliases.",
"fieldConfig": {
"defaults": {
"custom": {
"align": "auto",
"cellOptions": {
"type": "auto"
},
"footer": {
"reducers": []
},
"inspect": false
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
},
"unit": "short"
},
"overrides": [
{
"matcher": {
"id": "byName",
"options": "DateISO"
},
"properties": [
{
"id": "displayName",
"value": "ISO Date"
},
{
"id": "unit",
"value": "time: YYYY-MM-DD"
}
]
},
{
"matcher": {
"id": "byName",
"options": "DateTime"
},
"properties": [
{
"id": "displayName",
"value": "Full DateTime"
},
{
"id": "unit",
"value": "time: YYYY-MM-DD HH:mm:ss"
}
]
},
{
"matcher": {
"id": "byName",
"options": "TimeOnly"
},
"properties": [
{
"id": "displayName",
"value": "Time Only"
},
{
"id": "unit",
"value": "time: HH:mm:ss"
}
]
}
]
},
"id": 13,
"options": {
"cellHeight": "sm",
"showHeader": true
},
"pluginVersion": "12.1.0",
"targets": [
{
"datasource": {
"apiVersion": "v1",
"type": "prometheus",
"uid": "default-ds-uid"
},
"refId": "A"
}
],
"title": "Date Format Variations",
"type": "table"
},
{
"datasource": {
"apiVersion": "v1",
"type": "prometheus",
"uid": "default-ds-uid"
},
"description": "React table (table2) should not be migrated. Properties should remain unchanged.",
"id": 14,
"styles": [
{
"colors": [
"red",
"yellow",
"green"
],
"pattern": "/.*/",
"thresholds": [
"10",
"20"
],
"unit": "short"
}
],
"table": "table2",
"targets": [
{
"datasource": {
"apiVersion": "v1",
"type": "prometheus",
"uid": "default-ds-uid"
},
"refId": "A"
}
],
"title": "React Table - Should NOT Migrate",
"type": "table"
},
{
"datasource": {
"apiVersion": "v1",
"type": "prometheus",
"uid": "default-ds-uid"
},
"description": "Angular table without styles property should not be migrated.",
"id": 15,
"targets": [
{
"datasource": {
"apiVersion": "v1",
"type": "prometheus",
"uid": "default-ds-uid"
},
"refId": "A"
}
],
"title": "Angular Table without Styles - Should NOT Migrate",
"type": "table"
},
{
"autoMigrateFrom": "graph",
"datasource": {
"apiVersion": "v1",
"type": "prometheus",
"uid": "default-ds-uid"
},
"description": "Non-table panels should remain completely unchanged.",
"id": 16,
"targets": [
{
"datasource": {
"apiVersion": "v1",
"type": "prometheus",
"uid": "default-ds-uid"
},
"refId": "A"
}
],
"title": "Non-Table Panel - Should NOT Migrate",
"type": "timeseries"
},
{
"datasource": {
"apiVersion": "v1",
"type": "prometheus",
"uid": "default-ds-uid"
},
"description": "Other panel types should not be affected by table migration.",
"fieldConfig": {
"defaults": {
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
}
},
"overrides": []
},
"id": 17,
"options": {
"colorMode": "none",
"graphMode": "none",
"justifyMode": "auto",
"orientation": "horizontal",
"percentChangeColorMode": "standard",
"reduceOptions": {
"calcs": [
"mean"
],
"fields": "",
"values": false
},
"showPercentChange": false,
"textMode": "auto",
"wideLayout": true
},
"pluginVersion": "12.1.0",
"targets": [
{
"datasource": {
"apiVersion": "v1",
"type": "prometheus",
"uid": "default-ds-uid"
},
"refId": "A"
}
],
"title": "Singlestat Panel - Should NOT Migrate",
"type": "stat"
}
],
"refresh": "",
"schemaVersion": 42,
"tags": [],
"templating": {
"list": []
},
"time": {
"from": "now-6h",
"to": "now"
},
"timepicker": {},
"timezone": "",
"title": "No Title",
"weekStart": ""
}