Files
grafana/apps/dashboard/pkg/migration/testdata/dev-dashboards-output/panel-table/table_tests.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

981 lines
23 KiB
JSON

{
"annotations": {
"list": [
{
"builtIn": 1,
"datasource": {
"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": "grafana-testdata-datasource"
},
"fieldConfig": {
"defaults": {
"custom": {
"cellOptions": {
"type": "auto"
},
"footer": {
"reducers": []
},
"inspect": false
},
"decimals": 2,
"displayName": "",
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
},
"unit": "short"
},
"overrides": [
{
"matcher": {
"id": "byName",
"options": "Time"
},
"properties": [
{
"id": "displayName",
"value": "Time"
},
{
"id": "unit",
"value": "time: YYYY-MM-DD HH:mm:ss"
},
{
"id": "custom.align"
}
]
},
{
"matcher": {
"id": "byName",
"options": "ColorCell"
},
"properties": [
{
"id": "unit",
"value": "currencyUSD"
},
{
"id": "decimals",
"value": 2
},
{
"id": "custom.cellOptions",
"value": {
"type": "color-background"
}
},
{
"id": "custom.align"
},
{
"id": "thresholds",
"value": {
"mode": "absolute",
"steps": [
{
"color": "rgba(245, 54, 54, 0.9)",
"value": null
},
{
"color": "rgba(237, 129, 40, 0.89)",
"value": 5
},
{
"color": "rgba(50, 172, 45, 0.97)",
"value": 10
}
]
}
}
]
},
{
"matcher": {
"id": "byName",
"options": "ColorValue"
},
"properties": [
{
"id": "unit",
"value": "Bps"
},
{
"id": "decimals",
"value": 2
},
{
"id": "custom.cellOptions",
"value": {
"type": "color-text"
}
},
{
"id": "custom.align"
},
{
"id": "thresholds",
"value": {
"mode": "absolute",
"steps": [
{
"color": "rgba(245, 54, 54, 0.9)",
"value": null
},
{
"color": "rgba(237, 129, 40, 0.89)",
"value": 5
},
{
"color": "rgba(50, 172, 45, 0.97)",
"value": 10
}
]
}
}
]
}
]
},
"gridPos": {
"h": 11,
"w": 12,
"x": 0,
"y": 0
},
"id": 3,
"options": {
"cellHeight": "sm",
"showHeader": true
},
"pluginVersion": "12.1.0",
"targets": [
{
"alias": "server1",
"datasource": {
"type": "grafana-testdata-datasource"
},
"expr": "",
"format": "table",
"intervalFactor": 1,
"refId": "A",
"scenarioId": "csv_metric_values",
"stringInput": "1,20,90,30,5,0,20,10"
},
{
"alias": "server2",
"datasource": {
"type": "grafana-testdata-datasource"
},
"refId": "B",
"scenarioId": "csv_metric_values",
"stringInput": "1,20,90,30,5,0"
}
],
"title": "Time series to rows (2 pages)",
"transformations": [
{
"id": "seriesToRows",
"options": {
"reducers": []
}
}
],
"type": "table"
},
{
"datasource": {
"type": "grafana-testdata-datasource"
},
"fieldConfig": {
"defaults": {
"custom": {
"cellOptions": {
"type": "auto"
},
"footer": {
"reducers": []
},
"inspect": false
},
"decimals": 2,
"displayName": "",
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
},
"unit": "short"
},
"overrides": [
{
"matcher": {
"id": "byName",
"options": "Time"
},
"properties": [
{
"id": "displayName",
"value": "Time"
},
{
"id": "unit",
"value": "time: YYYY-MM-DD HH:mm:ss"
},
{
"id": "custom.align"
}
]
},
{
"matcher": {
"id": "byName",
"options": "ColorCell"
},
"properties": [
{
"id": "unit",
"value": "currencyUSD"
},
{
"id": "decimals",
"value": 2
},
{
"id": "custom.cellOptions",
"value": {
"type": "color-background"
}
},
{
"id": "custom.align"
},
{
"id": "thresholds",
"value": {
"mode": "absolute",
"steps": [
{
"color": "rgba(245, 54, 54, 0.9)",
"value": null
},
{
"color": "rgba(237, 129, 40, 0.89)",
"value": 5
},
{
"color": "rgba(50, 172, 45, 0.97)",
"value": 10
}
]
}
}
]
},
{
"matcher": {
"id": "byName",
"options": "ColorValue"
},
"properties": [
{
"id": "unit",
"value": "Bps"
},
{
"id": "decimals",
"value": 2
},
{
"id": "custom.cellOptions",
"value": {
"type": "color-text"
}
},
{
"id": "custom.align"
},
{
"id": "thresholds",
"value": {
"mode": "absolute",
"steps": [
{
"color": "rgba(245, 54, 54, 0.9)",
"value": null
},
{
"color": "rgba(237, 129, 40, 0.89)",
"value": 5
},
{
"color": "rgba(50, 172, 45, 0.97)",
"value": 10
}
]
}
}
]
}
]
},
"gridPos": {
"h": 11,
"w": 12,
"x": 12,
"y": 0
},
"id": 4,
"options": {
"cellHeight": "sm",
"showHeader": true
},
"pluginVersion": "12.1.0",
"targets": [
{
"alias": "server1",
"datasource": {
"type": "grafana-testdata-datasource"
},
"expr": "",
"format": "table",
"intervalFactor": 1,
"refId": "A",
"scenarioId": "csv_metric_values",
"stringInput": "1,20,90,30,5,0,20,10"
},
{
"alias": "server2",
"datasource": {
"type": "grafana-testdata-datasource"
},
"refId": "B",
"scenarioId": "csv_metric_values",
"stringInput": "1,20,90,30,5,0"
}
],
"title": "Time series aggregations",
"transformations": [
{
"id": "reduce",
"options": {
"includeTimeField": false,
"reducers": [
"mean",
"max",
"lastNotNull"
]
}
}
],
"type": "table"
},
{
"datasource": {
"type": "grafana-testdata-datasource"
},
"fieldConfig": {
"defaults": {
"custom": {
"cellOptions": {
"type": "auto"
},
"footer": {
"reducers": []
},
"inspect": false
},
"decimals": 2,
"displayName": "",
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
},
"unit": "short"
},
"overrides": [
{
"matcher": {
"id": "byName",
"options": "Time"
},
"properties": [
{
"id": "displayName",
"value": "Time"
},
{
"id": "unit",
"value": "time: YYYY-MM-DD HH:mm:ss"
},
{
"id": "custom.align"
}
]
},
{
"matcher": {
"id": "byRegexp",
"options": "/Color/"
},
"properties": [
{
"id": "unit",
"value": "currencyUSD"
},
{
"id": "decimals",
"value": 2
},
{
"id": "custom.cellOptions",
"value": {
"type": "color-background"
}
},
{
"id": "custom.align"
},
{
"id": "thresholds",
"value": {
"mode": "absolute",
"steps": [
{
"color": "rgba(245, 54, 54, 0.9)",
"value": null
},
{
"color": "rgba(237, 129, 40, 0.89)",
"value": 5
},
{
"color": "rgba(50, 172, 45, 0.97)",
"value": 10
}
]
}
}
]
}
]
},
"gridPos": {
"h": 7,
"w": 24,
"x": 0,
"y": 11
},
"id": 5,
"options": {
"cellHeight": "sm",
"showHeader": true
},
"pluginVersion": "12.1.0",
"targets": [
{
"alias": "ColorValue",
"datasource": {
"type": "grafana-testdata-datasource"
},
"expr": "",
"format": "table",
"intervalFactor": 1,
"refId": "A",
"scenarioId": "csv_metric_values",
"stringInput": "1,20,90,30,5,0,20,10"
}
],
"title": "color row by threshold",
"transformations": [
{
"id": "seriesToColumns",
"options": {
"reducers": []
}
}
],
"type": "table"
},
{
"datasource": {
"type": "grafana-testdata-datasource"
},
"fieldConfig": {
"defaults": {
"custom": {
"cellOptions": {
"type": "auto"
},
"footer": {
"reducers": []
},
"inspect": false
},
"decimals": 2,
"displayName": "",
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
},
"unit": "short"
},
"overrides": [
{
"matcher": {
"id": "byName",
"options": "Time"
},
"properties": [
{
"id": "displayName",
"value": "Time"
},
{
"id": "unit",
"value": "time: YYYY-MM-DD HH:mm:ss"
},
{
"id": "custom.align"
}
]
},
{
"matcher": {
"id": "byName",
"options": "ColorCell"
},
"properties": [
{
"id": "unit",
"value": "currencyUSD"
},
{
"id": "decimals",
"value": 2
},
{
"id": "custom.cellOptions",
"value": {
"type": "color-background"
}
},
{
"id": "custom.align"
},
{
"id": "thresholds",
"value": {
"mode": "absolute",
"steps": [
{
"color": "rgba(245, 54, 54, 0.9)",
"value": null
},
{
"color": "rgba(237, 129, 40, 0.89)",
"value": 5
},
{
"color": "rgba(50, 172, 45, 0.97)",
"value": 10
}
]
}
}
]
},
{
"matcher": {
"id": "byName",
"options": "ColorValue"
},
"properties": [
{
"id": "unit",
"value": "Bps"
},
{
"id": "decimals",
"value": 2
},
{
"id": "custom.cellOptions",
"value": {
"type": "color-text"
}
},
{
"id": "custom.align"
},
{
"id": "thresholds",
"value": {
"mode": "absolute",
"steps": [
{
"color": "rgba(245, 54, 54, 0.9)",
"value": null
},
{
"color": "rgba(237, 129, 40, 0.89)",
"value": 5
},
{
"color": "rgba(50, 172, 45, 0.97)",
"value": 10
}
]
}
}
]
}
]
},
"gridPos": {
"h": 8,
"w": 24,
"x": 0,
"y": 18
},
"id": 2,
"options": {
"cellHeight": "sm",
"showHeader": true
},
"pluginVersion": "12.1.0",
"targets": [
{
"alias": "ColorValue",
"datasource": {
"type": "grafana-testdata-datasource"
},
"expr": "",
"format": "table",
"intervalFactor": 1,
"refId": "A",
"scenarioId": "csv_metric_values",
"stringInput": "1,20,90,30,5,0,20,10"
},
{
"alias": "ColorCell",
"datasource": {
"type": "grafana-testdata-datasource"
},
"refId": "B",
"scenarioId": "csv_metric_values",
"stringInput": "5,1,2,3,4,5,10,20"
}
],
"title": "Column style thresholds \u0026 units",
"transformations": [
{
"id": "seriesToColumns",
"options": {
"reducers": []
}
}
],
"type": "table"
},
{
"datasource": {
"type": "grafana-testdata-datasource"
},
"fieldConfig": {
"defaults": {
"custom": {
"cellOptions": {
"type": "auto"
},
"footer": {
"reducers": []
},
"inspect": false
},
"decimals": 2,
"displayName": "",
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
},
"unit": "short"
},
"overrides": [
{
"matcher": {
"id": "byName",
"options": "Time"
},
"properties": [
{
"id": "displayName",
"value": "Time"
},
{
"id": "unit",
"value": "time: YYYY-MM-DD HH:mm:ss"
},
{
"id": "custom.align"
}
]
},
{
"matcher": {
"id": "byName",
"options": "ColorCell"
},
"properties": [
{
"id": "unit",
"value": "currencyUSD"
},
{
"id": "decimals",
"value": 2
},
{
"id": "links",
"value": [
{
"targetBlank": true,
"title": "",
"url": "http://www.grafana.com"
}
]
},
{
"id": "custom.cellOptions",
"value": {
"type": "color-background"
}
},
{
"id": "custom.align"
},
{
"id": "thresholds",
"value": {
"mode": "absolute",
"steps": [
{
"color": "rgba(245, 54, 54, 0.5)",
"value": null
},
{
"color": "rgba(237, 129, 40, 0.5)",
"value": 5
},
{
"color": "rgba(50, 172, 45, 0.5)",
"value": 10
}
]
}
}
]
},
{
"matcher": {
"id": "byName",
"options": "ColorValue"
},
"properties": [
{
"id": "unit",
"value": "Bps"
},
{
"id": "decimals",
"value": 2
},
{
"id": "links",
"value": [
{
"targetBlank": false,
"title": "",
"url": "http://www.grafana.com"
}
]
},
{
"id": "custom.cellOptions",
"value": {
"type": "color-text"
}
},
{
"id": "custom.align"
},
{
"id": "thresholds",
"value": {
"mode": "absolute",
"steps": [
{
"color": "rgba(245, 54, 54, 0.5)",
"value": null
},
{
"color": "rgba(237, 129, 40, 0.5)",
"value": 5
},
{
"color": "rgba(50, 172, 45, 0.5)",
"value": 10
}
]
}
}
]
}
]
},
"gridPos": {
"h": 10,
"w": 24,
"x": 0,
"y": 26
},
"id": 6,
"options": {
"cellHeight": "sm",
"showHeader": true
},
"pluginVersion": "12.1.0",
"targets": [
{
"alias": "ColorValue",
"datasource": {
"type": "grafana-testdata-datasource"
},
"expr": "",
"format": "table",
"intervalFactor": 1,
"refId": "A",
"scenarioId": "csv_metric_values",
"stringInput": "null,1,20,90,30,5,0,20,10"
},
{
"alias": "ColorCell",
"datasource": {
"type": "grafana-testdata-datasource"
},
"refId": "B",
"scenarioId": "csv_metric_values",
"stringInput": "null,5,1,2,3,4,5,10,20"
}
],
"title": "Column style thresholds and links",
"transformations": [
{
"id": "seriesToColumns",
"options": {
"reducers": []
}
}
],
"type": "table"
}
],
"refresh": "",
"schemaVersion": 42,
"tags": [
"gdev",
"panel-tests",
"table"
],
"templating": {
"list": []
},
"time": {
"from": "now-1h",
"to": "now"
},
"timepicker": {
"refresh_intervals": [
"5s",
"10s",
"30s",
"1m",
"5m",
"15m",
"30m",
"1h",
"2h",
"1d"
]
},
"timezone": "browser",
"title": "Panel Tests - Table",
"uid": "pttable",
"weekStart": ""
}