Search: support datasource template variables when parsing dashboard JSON models (#51587)
* init * support template variables * support variables without curly braces * add todo for `__all` case * fix `$__all` case for non-multivalue * extract some functions * fix flakinesss * support `$__all` and `default` template variables * add todo * compilation fix Co-authored-by: Ryan McKinley <ryantxu@gmail.com>
This commit is contained in:
109
pkg/services/searchV2/extract/testdata/string-datasource-variable.json
vendored
Normal file
109
pkg/services/searchV2/extract/testdata/string-datasource-variable.json
vendored
Normal file
@@ -0,0 +1,109 @@
|
||||
{
|
||||
"editable": true,
|
||||
"fiscalYearStartMonth": 0,
|
||||
"graphTooltip": 0,
|
||||
"id": 209,
|
||||
"iteration": 1656508852566,
|
||||
"links": [],
|
||||
"liveNow": false,
|
||||
"panels": [
|
||||
{
|
||||
"datasource": "${sqllite}",
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"custom": {
|
||||
"align": "auto",
|
||||
"displayMode": "auto",
|
||||
"inspect": false
|
||||
},
|
||||
"mappings": [],
|
||||
"thresholds": {
|
||||
"mode": "absolute",
|
||||
"steps": [
|
||||
{
|
||||
"color": "green",
|
||||
"value": null
|
||||
},
|
||||
{
|
||||
"color": "red",
|
||||
"value": 80
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"overrides": []
|
||||
},
|
||||
"gridPos": {
|
||||
"h": 8,
|
||||
"w": 12,
|
||||
"x": 0,
|
||||
"y": 0
|
||||
},
|
||||
"id": 1,
|
||||
"options": {
|
||||
"footer": {
|
||||
"fields": "",
|
||||
"reducer": [
|
||||
"sum"
|
||||
],
|
||||
"show": false
|
||||
},
|
||||
"showHeader": true
|
||||
},
|
||||
"pluginVersion": "9.1.0-pre",
|
||||
"targets": [
|
||||
{
|
||||
"datasource": {
|
||||
"type": "sqlite-datasource",
|
||||
"uid": "${sqllite}"
|
||||
},
|
||||
"queryText": "select * from user",
|
||||
"queryType": "table",
|
||||
"rawQueryText": "select * from user",
|
||||
"refId": "A",
|
||||
"timeColumns": [
|
||||
"time",
|
||||
"ts"
|
||||
]
|
||||
}
|
||||
],
|
||||
"title": "usersss!",
|
||||
"type": "table"
|
||||
}
|
||||
],
|
||||
"schemaVersion": 36,
|
||||
"style": "dark",
|
||||
"tags": [],
|
||||
"templating": {
|
||||
"list": [
|
||||
{
|
||||
"current": {
|
||||
"selected": false,
|
||||
"text": "SQLite Grafana",
|
||||
"value": "SQLite Grafana"
|
||||
},
|
||||
"hide": 0,
|
||||
"includeAll": false,
|
||||
"multi": false,
|
||||
"name": "sqllite",
|
||||
"options": [],
|
||||
"query": "sqlite-datasource",
|
||||
"queryValue": "",
|
||||
"refresh": 1,
|
||||
"regex": "",
|
||||
"skipUrlSync": false,
|
||||
"type": "datasource"
|
||||
}
|
||||
]
|
||||
},
|
||||
"time": {
|
||||
"from": "now-6h",
|
||||
"to": "now"
|
||||
},
|
||||
"timepicker": {},
|
||||
"timezone": "",
|
||||
"title": "ds-variables",
|
||||
"uid": "7BzWolqnk",
|
||||
"version": 13,
|
||||
"weekStart": ""
|
||||
}
|
||||
Reference in New Issue
Block a user