{ "kind": "DashboardWithAccessInfo", "apiVersion": "dashboard.grafana.app/v2beta1", "metadata": { "name": "value-mapping-test", "namespace": "default", "uid": "value-mapping-test", "resourceVersion": "1765384157199094", "generation": 2, "creationTimestamp": "2025-11-19T20:09:28Z", "labels": { "grafana.app/deprecatedInternalID": "646372978987008" } }, "spec": { "annotations": [ { "kind": "AnnotationQuery", "spec": { "query": { "kind": "DataQuery", "group": "grafana", "version": "v0", "datasource": { "name": "-- Grafana --" }, "spec": {} }, "enable": true, "hide": true, "iconColor": "rgba(0, 211, 255, 1)", "name": "Annotations \u0026 Alerts", "builtIn": true, "legacyOptions": { "type": "dashboard" } } } ], "cursorSync": "Off", "description": "Test dashboard for all value mapping types and override matcher types", "editable": true, "elements": { "panel-1": { "kind": "Panel", "spec": { "id": 1, "title": "ValueMap Example", "description": "Panel with ValueMap mapping type - maps specific text values to colors and display text", "links": [], "data": { "kind": "QueryGroup", "spec": { "queries": [ { "kind": "PanelQuery", "spec": { "query": { "kind": "DataQuery", "group": "prometheus", "version": "v0", "datasource": { "name": "prometheus-uid" }, "spec": { "expr": "up" } }, "refId": "A", "hidden": false } } ], "transformations": [], "queryOptions": {} } }, "vizConfig": { "kind": "VizConfig", "group": "stat", "version": "", "spec": { "options": {}, "fieldConfig": { "defaults": { "mappings": [ { "type": "value", "options": { "critical": { "text": "Critical!", "color": "red", "index": 0 }, "ok": { "text": "OK", "color": "green", "index": 2 }, "warning": { "text": "Warning", "color": "orange", "index": 1 } } } ] }, "overrides": [ { "matcher": { "id": "byName", "options": "status" }, "properties": [ { "id": "custom.width", "value": 100 }, { "id": "custom.align", "value": "center" } ] } ] } } } } }, "panel-2": { "kind": "Panel", "spec": { "id": 2, "title": "RangeMap Example", "description": "Panel with RangeMap mapping type - maps numerical ranges to colors and display text", "links": [], "data": { "kind": "QueryGroup", "spec": { "queries": [ { "kind": "PanelQuery", "spec": { "query": { "kind": "DataQuery", "group": "prometheus", "version": "v0", "datasource": { "name": "prometheus-uid" }, "spec": { "expr": "cpu_usage_percent" } }, "refId": "A", "hidden": false } } ], "transformations": [], "queryOptions": {} } }, "vizConfig": { "kind": "VizConfig", "group": "gauge", "version": "", "spec": { "options": {}, "fieldConfig": { "defaults": { "mappings": [ { "type": "range", "options": { "from": 0, "to": 50, "result": { "text": "Low", "color": "green", "index": 0 } } }, { "type": "range", "options": { "from": 50, "to": 80, "result": { "text": "Medium", "color": "orange", "index": 1 } } }, { "type": "range", "options": { "from": 80, "to": 100, "result": { "text": "High", "color": "red", "index": 2 } } } ] }, "overrides": [ { "matcher": { "id": "byRegexp", "options": "/^cpu_/" }, "properties": [ { "id": "unit", "value": "percent" }, { "id": "decimals", "value": 2 } ] } ] } } } } }, "panel-3": { "kind": "Panel", "spec": { "id": 3, "title": "RegexMap Example", "description": "Panel with RegexMap mapping type - maps values matching regex patterns to colors", "links": [], "data": { "kind": "QueryGroup", "spec": { "queries": [ { "kind": "PanelQuery", "spec": { "query": { "kind": "DataQuery", "group": "prometheus", "version": "v0", "datasource": { "name": "prometheus-uid" }, "spec": { "expr": "log_level" } }, "refId": "A", "hidden": false } } ], "transformations": [], "queryOptions": {} } }, "vizConfig": { "kind": "VizConfig", "group": "stat", "version": "", "spec": { "options": {}, "fieldConfig": { "defaults": { "mappings": [ { "type": "regex", "options": { "pattern": "/^error.*/", "result": { "text": "Error", "color": "red", "index": 0 } } }, { "type": "regex", "options": { "pattern": "/^warn.*/", "result": { "text": "Warning", "color": "orange", "index": 1 } } }, { "type": "regex", "options": { "pattern": "/^info.*/", "result": { "text": "Info", "color": "blue", "index": 2 } } } ] }, "overrides": [ { "matcher": { "id": "byType", "options": "string" }, "properties": [ { "id": "custom.cellOptions", "value": { "type": "color-text" } } ] } ] } } } } }, "panel-4": { "kind": "Panel", "spec": { "id": 4, "title": "SpecialValueMap Example", "description": "Panel with SpecialValueMap mapping type - maps special values like null, NaN, true, false to display text", "links": [], "data": { "kind": "QueryGroup", "spec": { "queries": [ { "kind": "PanelQuery", "spec": { "query": { "kind": "DataQuery", "group": "prometheus", "version": "v0", "datasource": { "name": "prometheus-uid" }, "spec": { "expr": "some_metric" } }, "refId": "A", "hidden": false } } ], "transformations": [], "queryOptions": {} } }, "vizConfig": { "kind": "VizConfig", "group": "stat", "version": "", "spec": { "options": {}, "fieldConfig": { "defaults": { "mappings": [ { "type": "special", "options": { "match": "null", "result": { "text": "No Data", "color": "gray", "index": 0 } } }, { "type": "special", "options": { "match": "nan", "result": { "text": "Not a Number", "color": "gray", "index": 1 } } }, { "type": "special", "options": { "match": "null+nan", "result": { "text": "N/A", "color": "gray", "index": 2 } } }, { "type": "special", "options": { "match": "true", "result": { "text": "Yes", "color": "green", "index": 3 } } }, { "type": "special", "options": { "match": "false", "result": { "text": "No", "color": "red", "index": 4 } } }, { "type": "special", "options": { "match": "empty", "result": { "text": "Empty", "color": "gray", "index": 5 } } } ] }, "overrides": [ { "matcher": { "id": "byFrameRefID", "options": "A" }, "properties": [ { "id": "color", "value": { "fixedColor": "blue", "mode": "fixed" } } ] } ] } } } } }, "panel-6": { "kind": "Panel", "spec": { "id": 6, "title": "Empty Properties Override Example", "description": "Panel with override that has empty properties array - tests conversion of overrides without any property modifications", "links": [], "data": { "kind": "QueryGroup", "spec": { "queries": [ { "kind": "PanelQuery", "spec": { "query": { "kind": "DataQuery", "group": "prometheus", "version": "v0", "datasource": { "name": "prometheus-uid" }, "spec": { "expr": "empty_override_metric" } }, "refId": "A", "hidden": false } } ], "transformations": [], "queryOptions": {} } }, "vizConfig": { "kind": "VizConfig", "group": "stat", "version": "", "spec": { "options": {}, "fieldConfig": { "defaults": {}, "overrides": [ { "matcher": { "id": "byName", "options": "field_with_empty_override" }, "properties": [] } ] } } } } }, "panel-5": { "kind": "Panel", "spec": { "id": 5, "title": "Combined Mappings and Overrides Example", "description": "Panel with all mapping types combined - demonstrates mixing different mapping types and multiple override matchers", "links": [], "data": { "kind": "QueryGroup", "spec": { "queries": [ { "kind": "PanelQuery", "spec": { "query": { "kind": "DataQuery", "group": "prometheus", "version": "v0", "datasource": { "name": "prometheus-uid" }, "spec": { "expr": "combined_metric" } }, "refId": "A", "hidden": false } }, { "kind": "PanelQuery", "spec": { "query": { "kind": "DataQuery", "group": "prometheus", "version": "v0", "datasource": { "name": "prometheus-uid" }, "spec": { "expr": "secondary_metric" } }, "refId": "B", "hidden": false } } ], "transformations": [], "queryOptions": {} } }, "vizConfig": { "kind": "VizConfig", "group": "table", "version": "", "spec": { "options": {}, "fieldConfig": { "defaults": { "mappings": [ { "type": "value", "options": { "failure": { "text": "Failure", "color": "red", "index": 1 }, "success": { "text": "Success", "color": "green", "index": 0 } } }, { "type": "range", "options": { "from": 0, "to": 100, "result": { "text": "In Range", "color": "blue", "index": 2 } } }, { "type": "regex", "options": { "pattern": "/^[A-Z]{3}-\\d+$/", "result": { "text": "ID Format", "color": "purple", "index": 3 } } }, { "type": "special", "options": { "match": "null", "result": { "text": "Missing", "color": "gray", "index": 4 } } } ] }, "overrides": [ { "matcher": { "id": "byName", "options": "status" }, "properties": [ { "id": "custom.width", "value": 120 }, { "id": "custom.cellOptions", "value": { "type": "color-background" } } ] }, { "matcher": { "id": "byRegexp", "options": "/^value_/" }, "properties": [ { "id": "unit", "value": "short" }, { "id": "min", "value": 0 }, { "id": "max", "value": 100 } ] }, { "matcher": { "id": "byType", "options": "number" }, "properties": [ { "id": "decimals", "value": 2 }, { "id": "thresholds", "value": { "mode": "absolute", "steps": [ { "color": "green", "value": null }, { "color": "yellow", "value": 50 }, { "color": "red", "value": 80 } ] } } ] }, { "matcher": { "id": "byFrameRefID", "options": "B" }, "properties": [ { "id": "displayName", "value": "Secondary Query" } ] }, { "matcher": { "id": "byValue", "options": { "op": "gte", "reducer": "allIsNull", "value": 0 } }, "properties": [ { "id": "custom.hidden", "value": true } ] } ] } } } } } }, "layout": { "kind": "GridLayout", "spec": { "items": [ { "kind": "GridLayoutItem", "spec": { "x": 0, "y": 0, "width": 12, "height": 8, "element": { "kind": "ElementReference", "name": "panel-1" } } }, { "kind": "GridLayoutItem", "spec": { "x": 12, "y": 0, "width": 12, "height": 8, "element": { "kind": "ElementReference", "name": "panel-2" } } }, { "kind": "GridLayoutItem", "spec": { "x": 0, "y": 8, "width": 12, "height": 8, "element": { "kind": "ElementReference", "name": "panel-3" } } }, { "kind": "GridLayoutItem", "spec": { "x": 12, "y": 8, "width": 12, "height": 8, "element": { "kind": "ElementReference", "name": "panel-4" } } }, { "kind": "GridLayoutItem", "spec": { "x": 0, "y": 16, "width": 24, "height": 8, "element": { "kind": "ElementReference", "name": "panel-5" } } }, { "kind": "GridLayoutItem", "spec": { "x": 0, "y": 24, "width": 12, "height": 8, "element": { "kind": "ElementReference", "name": "panel-6" } } } ] } }, "links": [], "liveNow": false, "preload": false, "tags": [ "value-mapping", "overrides", "test" ], "timeSettings": { "timezone": "browser", "from": "now-6h", "to": "now", "autoRefresh": "", "autoRefreshIntervals": [ "5s", "10s", "30s", "1m", "5m", "15m", "30m", "1h", "2h", "1d" ], "hideTimepicker": false, "fiscalYearStartMonth": 0 }, "title": "Value Mapping and Overrides Test", "variables": [] }, "status": { "conversion": { "failed": false, "storedVersion": "v1beta1" } } }