Files
grafana/apps/dashboard/pkg/migration/conversion/testdata/input/v1beta1.variable-conversions.json
Kristina Demeshchik 533ee1f078 Dashboard : Allow applying variable regex to display text (#114426)
* Ability to apply regex to display text

* Frontend tests

* scenes-react version

* lock file

* adjust tests input

* adjust inputs

* unused variable

* change data type

* unit tests

* bump scenes

* bump scenes

* Update docs

* V2->V1 conversion

* re-generate files

* update openai snapshots
2025-12-09 10:55:51 -05:00

360 lines
9.2 KiB
JSON

{
"kind": "Dashboard",
"apiVersion": "dashboard.grafana.app/v1beta1",
"metadata": {
"name": "variable-conversions-test",
"labels": {
"test": "variable-conversions"
}
},
"spec": {
"title": "Variable Conversions Test Dashboard",
"description": "Testing all variable types and transformations",
"tags": ["test", "variables"],
"templating": {
"list": [
{
"name": "datasource_var",
"type": "datasource",
"label": "Data Source",
"description": "Select a data source",
"query": "prometheus",
"current": {
"selected": false,
"text": "Prometheus",
"value": "prometheus-uid"
},
"options": [
{
"selected": true,
"text": "Prometheus",
"value": "prometheus-uid"
},
{
"selected": false,
"text": "InfluxDB",
"value": "influx-uid"
}
],
"hide": 0,
"includeAll": false,
"multi": false,
"regex": "",
"skipUrlSync": false,
"refresh": 1
},
{
"name": "query_var",
"type": "query",
"label": "Instance",
"description": "Available instances",
"datasource": {
"type": "prometheus",
"uid": "existing-ref-uid"
},
"definition": "label_values(up, instance)",
"query": "label_values(up, instance)",
"current": {
"selected": true,
"text": ["All", "localhost:9090"],
"value": ["$__all", "localhost:9090"]
},
"options": [
{
"selected": false,
"text": "All",
"value": "$__all"
},
{
"selected": true,
"text": "localhost:9090",
"value": "localhost:9090"
},
{
"selected": false,
"text": "localhost:9091",
"value": "localhost:9091"
}
],
"hide": 1,
"includeAll": true,
"allValue": ".*",
"multi": true,
"regex": "/.*9090.*/",
"regexApplyTo": "text",
"skipUrlSync": false,
"refresh": 2,
"sort": 1,
"tagValuesQuery": "",
"tagsQuery": "",
"useTags": false
},
{
"name": "custom_var",
"type": "custom",
"label": "Environment",
"description": "Deployment environment",
"query": "prod,staging,dev",
"current": {
"selected": false,
"text": "prod",
"value": "prod"
},
"options": [
{
"selected": true,
"text": "prod",
"value": "prod"
},
{
"selected": false,
"text": "staging",
"value": "staging"
},
{
"selected": false,
"text": "dev",
"value": "dev"
}
],
"hide": 0,
"includeAll": true,
"allValue": null,
"multi": false,
"skipUrlSync": false
},
{
"name": "adhoc_var",
"type": "adhoc",
"label": "Filters",
"description": "Add filters",
"datasource": {
"type": "prometheus",
"uid": "existing-ref-uid"
},
"filters": [
{
"key": "job",
"operator": "=",
"value": "prometheus"
}
],
"baseFilters": [
{
"key": "environment",
"operator": "=",
"value": "production"
}
],
"hide": 0,
"skipUrlSync": false,
"defaultKeys": [
{
"text": "job",
"value": "job"
},
{
"text": "instance",
"value": "instance"
}
],
"allowCustomValue": true
},
{
"name": "constant_var",
"type": "constant",
"label": "App Name",
"description": "Application name constant",
"query": "my-application",
"current": {
"selected": false,
"text": "my-application",
"value": "my-application"
},
"hide": 2,
"skipUrlSync": true
},
{
"name": "interval_var",
"type": "interval",
"label": "Interval",
"description": "Time interval for queries",
"query": "1m,5m,10m,30m,1h,6h,12h,1d,7d,14d,30d",
"current": {
"selected": false,
"text": "5m",
"value": "5m"
},
"options": [
{
"selected": false,
"text": "1m",
"value": "1m"
},
{
"selected": true,
"text": "5m",
"value": "5m"
},
{
"selected": false,
"text": "10m",
"value": "10m"
}
],
"hide": 0,
"auto": true,
"auto_count": 30,
"auto_min": "10s",
"skipUrlSync": false,
"refresh": 2
},
{
"name": "textbox_var",
"type": "textbox",
"label": "Search Term",
"description": "Enter search term",
"query": "default_search",
"current": {
"selected": false,
"text": "error",
"value": "error"
},
"hide": 0,
"skipUrlSync": false
},
{
"name": "groupby_var",
"type": "groupby",
"label": "Group By",
"description": "Group results by field",
"datasource": {
"type": "prometheus",
"uid": "existing-ref-uid"
},
"query": "",
"current": {
"selected": true,
"text": ["job", "instance"],
"value": ["job", "instance"]
},
"options": [
{
"selected": true,
"text": "job",
"value": "job"
},
{
"selected": true,
"text": "instance",
"value": "instance"
},
{
"selected": false,
"text": "region",
"value": "region"
}
],
"hide": 0,
"multi": true,
"skipUrlSync": false
},
{
"name": "switch_var",
"type": "switch",
"label": "Enable Feature",
"description": "Toggle feature on/off",
"query": "",
"current": {
"selected": false,
"text": "false",
"value": "false"
},
"options": [
{
"selected": false,
"text": "true",
"value": "true"
},
{
"selected": true,
"text": "false",
"value": "false"
}
],
"hide": 0,
"skipUrlSync": false
},
{
"name": "legacy_string_var",
"type": "query",
"label": "Legacy Variable",
"description": "Variable with legacy string value",
"datasource": {
"type": "prometheus",
"uid": "existing-ref-uid"
},
"query": "up",
"current": {
"selected": false,
"text": "legacy_value",
"value": "legacy_string_content"
},
"hide": 0,
"refresh": 1,
"skipUrlSync": false
},
{
"name": "complex_query_var",
"type": "query",
"label": "Complex Query Variable",
"description": "Variable with complex query and all features",
"datasource": {
"type": "elasticsearch",
"uid": "existing-target-uid"
},
"definition": "terms field:@host size:100",
"query": {
"query": "*",
"size": 100,
"bucketAggs": [
{
"field": "@host",
"id": "2",
"type": "terms"
}
]
},
"current": {
"selected": true,
"text": ["All", "host1", "host2"],
"value": ["$__all", "host1", "host2"]
},
"options": [],
"hide": 0,
"includeAll": true,
"allValue": "*",
"multi": true,
"regex": "/host[0-9]+/",
"regexApplyTo": "value",
"skipUrlSync": false,
"refresh": 1,
"sort": 2,
"tagValuesQuery": "",
"tagsQuery": "",
"useTags": true
}
]
},
"panels": [],
"time": {
"from": "now-6h",
"to": "now"
},
"annotations": {
"list": []
},
"links": []
}
}