Dashboard Migrations: V30 value mappings and tooltip options (#107970)

* Dashboard Migrations: V30 value mappings and tooltip options
This commit is contained in:
Ivan Ortega Alba
2025-07-15 16:44:11 +00:00
committed by GitHub
parent b839090de5
commit 1200b684c6
5 changed files with 1481 additions and 1 deletions
@@ -0,0 +1,214 @@
{
"title": "V30 Value Mappings and Tooltip Options Migration Test Dashboard",
"schemaVersion": 29,
"panels": [
{
"type": "timeseries",
"title": "Panel with legacy value mappings and tooltip options",
"id": 1,
"fieldConfig": {
"defaults": {
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
},
"mappings": [
{
"id": 0,
"text": "Up",
"type": 1,
"value": "1"
},
{
"id": 1,
"text": "Down",
"type": 1,
"value": "0"
},
{
"from": "10",
"to": "20",
"text": "Medium",
"type": 2
},
{
"type": 1,
"value": "null",
"text": "Null Value"
}
]
},
"overrides": [
{
"matcher": {
"id": "byName",
"options": "test-field"
},
"properties": [
{
"id": "mappings",
"value": [
{
"id": 0,
"text": "Override Up",
"type": 1,
"value": "1"
}
]
}
]
}
]
},
"options": {
"tooltipOptions": {
"mode": "multi"
}
}
},
{
"type": "xychart",
"title": "XY Chart with tooltip options only",
"id": 2,
"options": {
"tooltipOptions": {
"mode": "single"
}
}
},
{
"type": "xychart2",
"title": "XY Chart2 with tooltip options",
"id": 3,
"options": {
"tooltipOptions": {
"mode": "single",
"sort": "none"
}
}
},
{
"type": "graph",
"title": "Graph panel gets migrated to timeseries and tooltip",
"id": 4,
"options": {
"tooltip": {
"mode": "single"
}
}
},
{
"type": "stat",
"title": "Panel with complex value mappings",
"id": 5,
"fieldConfig": {
"defaults": {
"mappings": [
{
"id": 0,
"text": "Critical",
"type": 1,
"value": "100"
},
{
"from": "50",
"to": "99",
"text": "Warning",
"type": 2
},
{
"from": "0",
"to": "49",
"text": "OK",
"type": 2
}
]
}
}
},
{
"type": "row",
"title": "Collapsed Row with nested panels",
"id": 6,
"collapsed": true,
"panels": [
{
"type": "timeseries",
"title": "Nested panel with both migrations",
"id": 7,
"fieldConfig": {
"defaults": {
"mappings": [
{
"id": 0,
"text": "On",
"type": 1,
"value": "1"
},
{
"id": 1,
"text": "Off",
"type": 1,
"value": "0"
}
]
}
},
"options": {
"tooltipOptions": {
"mode": "multi"
}
}
}
]
},
{
"type": "timeseries",
"title": "Panel with no relevant configurations",
"id": 8,
"fieldConfig": {
"defaults": {
"unit": "bytes"
}
},
"options": {
"legend": {
"displayMode": "list"
}
}
},
{
"type": "stat",
"title": "Panel with empty mappings array - should return null",
"id": 9,
"fieldConfig": {
"defaults": {
"mappings": []
},
"overrides": [
{
"matcher": {
"id": "byName",
"options": "empty-field"
},
"properties": [
{
"id": "mappings",
"value": []
}
]
}
]
}
}
]
}
@@ -0,0 +1,373 @@
{
"panels": [
{
"datasource": {
"apiVersion": "v1",
"type": "prometheus",
"uid": "default-ds-uid"
},
"fieldConfig": {
"defaults": {
"mappings": [
{
"options": {
"0": {
"color": "green",
"text": "Down"
},
"1": {
"color": "green",
"text": "Up"
}
},
"type": "value"
},
{
"options": {
"from": 10,
"result": {
"color": "green",
"text": "Medium"
},
"to": 20
},
"type": "range"
},
{
"options": {
"match": "null",
"result": {
"color": "green",
"text": "Null Value"
}
},
"type": "special"
}
],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
}
},
"overrides": [
{
"matcher": {
"id": "byName",
"options": "test-field"
},
"properties": [
{
"id": "mappings",
"value": [
{
"options": {
"1": {
"text": "Override Up"
}
},
"type": "value"
}
]
}
]
}
]
},
"id": 1,
"options": {
"tooltip": {
"mode": "multi"
}
},
"targets": [
{
"datasource": {
"apiVersion": "v1",
"type": "prometheus",
"uid": "default-ds-uid"
},
"refId": "A"
}
],
"title": "Panel with legacy value mappings and tooltip options",
"type": "timeseries"
},
{
"datasource": {
"apiVersion": "v1",
"type": "prometheus",
"uid": "default-ds-uid"
},
"id": 2,
"options": {
"tooltip": {
"mode": "single"
}
},
"targets": [
{
"datasource": {
"apiVersion": "v1",
"type": "prometheus",
"uid": "default-ds-uid"
},
"refId": "A"
}
],
"title": "XY Chart with tooltip options only",
"type": "xychart"
},
{
"datasource": {
"apiVersion": "v1",
"type": "prometheus",
"uid": "default-ds-uid"
},
"id": 3,
"options": {
"tooltip": {
"mode": "single",
"sort": "none"
}
},
"targets": [
{
"datasource": {
"apiVersion": "v1",
"type": "prometheus",
"uid": "default-ds-uid"
},
"refId": "A"
}
],
"title": "XY Chart2 with tooltip options",
"type": "xychart2"
},
{
"datasource": {
"apiVersion": "v1",
"type": "prometheus",
"uid": "default-ds-uid"
},
"id": 4,
"options": {
"tooltip": {
"mode": "single"
}
},
"targets": [
{
"datasource": {
"apiVersion": "v1",
"type": "prometheus",
"uid": "default-ds-uid"
},
"refId": "A"
}
],
"title": "Graph panel gets migrated to timeseries and tooltip",
"type": "graph"
},
{
"datasource": {
"apiVersion": "v1",
"type": "prometheus",
"uid": "default-ds-uid"
},
"fieldConfig": {
"defaults": {
"mappings": [
{
"options": {
"100": {
"text": "Critical"
}
},
"type": "value"
},
{
"options": {
"from": 50,
"result": {
"text": "Warning"
},
"to": 99
},
"type": "range"
},
{
"options": {
"from": 0,
"result": {
"text": "OK"
},
"to": 49
},
"type": "range"
}
]
}
},
"id": 5,
"targets": [
{
"datasource": {
"apiVersion": "v1",
"type": "prometheus",
"uid": "default-ds-uid"
},
"refId": "A"
}
],
"title": "Panel with complex value mappings",
"type": "stat"
},
{
"collapsed": true,
"datasource": {
"apiVersion": "v1",
"type": "prometheus",
"uid": "default-ds-uid"
},
"id": 6,
"panels": [
{
"datasource": {
"apiVersion": "v1",
"type": "prometheus",
"uid": "default-ds-uid"
},
"fieldConfig": {
"defaults": {
"mappings": [
{
"options": {
"0": {
"text": "Off"
},
"1": {
"text": "On"
}
},
"type": "value"
}
]
}
},
"id": 7,
"options": {
"tooltip": {
"mode": "multi"
}
},
"targets": [
{
"datasource": {
"apiVersion": "v1",
"type": "prometheus",
"uid": "default-ds-uid"
},
"refId": "A"
}
],
"title": "Nested panel with both migrations",
"type": "timeseries"
}
],
"targets": [
{
"datasource": {
"apiVersion": "v1",
"type": "prometheus",
"uid": "default-ds-uid"
},
"refId": "A"
}
],
"title": "Collapsed Row with nested panels",
"type": "row"
},
{
"datasource": {
"apiVersion": "v1",
"type": "prometheus",
"uid": "default-ds-uid"
},
"fieldConfig": {
"defaults": {
"unit": "bytes"
}
},
"id": 8,
"options": {
"legend": {
"displayMode": "list",
"showLegend": true
}
},
"targets": [
{
"datasource": {
"apiVersion": "v1",
"type": "prometheus",
"uid": "default-ds-uid"
},
"refId": "A"
}
],
"title": "Panel with no relevant configurations",
"type": "timeseries"
},
{
"datasource": {
"apiVersion": "v1",
"type": "prometheus",
"uid": "default-ds-uid"
},
"fieldConfig": {
"defaults": {
"mappings": []
},
"overrides": [
{
"matcher": {
"id": "byName",
"options": "empty-field"
},
"properties": [
{
"id": "mappings",
"value": []
}
]
}
]
},
"id": 9,
"targets": [
{
"datasource": {
"apiVersion": "v1",
"type": "prometheus",
"uid": "default-ds-uid"
},
"refId": "A"
}
],
"title": "Panel with empty mappings array - should return null",
"type": "stat"
}
],
"refresh": "",
"schemaVersion": 41,
"title": "V30 Value Mappings and Tooltip Options Migration Test Dashboard"
}