mirror of
https://github.com/grafana/grafana.git
synced 2025-09-20 21:26:46 +08:00
Variables: Adding dashboard to test updating variables from data link (#25192)
This commit is contained in:
@ -15,12 +15,18 @@
|
|||||||
"editable": true,
|
"editable": true,
|
||||||
"gnetId": null,
|
"gnetId": null,
|
||||||
"graphTooltip": 0,
|
"graphTooltip": 0,
|
||||||
"id": 13844,
|
"iteration": 1590677937026,
|
||||||
"iteration": 1566896059256,
|
|
||||||
"links": [],
|
"links": [],
|
||||||
"panels": [
|
"panels": [
|
||||||
{
|
{
|
||||||
"content": "## Data center = $datacenter\n\n### server = $server\n\n#### pod = $pod",
|
"content": "## Data center = $datacenter\n\n### server = $server\n\n#### pod = $pod",
|
||||||
|
"datasource": null,
|
||||||
|
"fieldConfig": {
|
||||||
|
"defaults": {
|
||||||
|
"custom": {}
|
||||||
|
},
|
||||||
|
"overrides": []
|
||||||
|
},
|
||||||
"gridPos": {
|
"gridPos": {
|
||||||
"h": 9,
|
"h": 9,
|
||||||
"w": 12,
|
"w": 12,
|
||||||
@ -29,7 +35,6 @@
|
|||||||
},
|
},
|
||||||
"id": 4,
|
"id": 4,
|
||||||
"mode": "markdown",
|
"mode": "markdown",
|
||||||
"options": {},
|
|
||||||
"targets": [
|
"targets": [
|
||||||
{
|
{
|
||||||
"refId": "A",
|
"refId": "A",
|
||||||
@ -47,6 +52,12 @@
|
|||||||
"colorValue": false,
|
"colorValue": false,
|
||||||
"colors": ["#299c46", "rgba(237, 129, 40, 0.89)", "#d44a3a"],
|
"colors": ["#299c46", "rgba(237, 129, 40, 0.89)", "#d44a3a"],
|
||||||
"datasource": "gdev-testdata",
|
"datasource": "gdev-testdata",
|
||||||
|
"fieldConfig": {
|
||||||
|
"defaults": {
|
||||||
|
"custom": {}
|
||||||
|
},
|
||||||
|
"overrides": []
|
||||||
|
},
|
||||||
"format": "none",
|
"format": "none",
|
||||||
"gauge": {
|
"gauge": {
|
||||||
"maxValue": 100,
|
"maxValue": 100,
|
||||||
@ -75,7 +86,6 @@
|
|||||||
"maxDataPoints": 100,
|
"maxDataPoints": 100,
|
||||||
"nullPointMode": "connected",
|
"nullPointMode": "connected",
|
||||||
"nullText": null,
|
"nullText": null,
|
||||||
"options": {},
|
|
||||||
"postfix": "",
|
"postfix": "",
|
||||||
"postfixFontSize": "50%",
|
"postfixFontSize": "50%",
|
||||||
"prefix": "",
|
"prefix": "",
|
||||||
@ -119,6 +129,41 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cacheTimeout": null,
|
"cacheTimeout": null,
|
||||||
|
"datasource": null,
|
||||||
|
"fieldConfig": {
|
||||||
|
"defaults": {
|
||||||
|
"color": {
|
||||||
|
"mode": "thresholds"
|
||||||
|
},
|
||||||
|
"custom": {},
|
||||||
|
"links": [
|
||||||
|
{
|
||||||
|
"targetBlank": true,
|
||||||
|
"title": "Go to drilldown",
|
||||||
|
"url": "/d/O6GmNPvWk/dashboard-tests-nested-template-variables-drilldown?orgId=1&${__all_variables}&${__url_time_range}"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"mappings": [],
|
||||||
|
"max": 100,
|
||||||
|
"min": 0,
|
||||||
|
"nullValueMode": "connected",
|
||||||
|
"thresholds": {
|
||||||
|
"mode": "absolute",
|
||||||
|
"steps": [
|
||||||
|
{
|
||||||
|
"color": "green",
|
||||||
|
"value": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"color": "red",
|
||||||
|
"value": 80
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"unit": "none"
|
||||||
|
},
|
||||||
|
"overrides": []
|
||||||
|
},
|
||||||
"gridPos": {
|
"gridPos": {
|
||||||
"h": 9,
|
"h": 9,
|
||||||
"w": 4,
|
"w": 4,
|
||||||
@ -128,40 +173,15 @@
|
|||||||
"id": 8,
|
"id": 8,
|
||||||
"links": [],
|
"links": [],
|
||||||
"options": {
|
"options": {
|
||||||
"fieldOptions": {
|
"orientation": "horizontal",
|
||||||
|
"reduceOptions": {
|
||||||
"calcs": ["mean"],
|
"calcs": ["mean"],
|
||||||
"defaults": {
|
|
||||||
"links": [
|
|
||||||
{
|
|
||||||
"targetBlank": true,
|
|
||||||
"title": "Go to drilldown",
|
|
||||||
"url": "/d/O6GmNPvWk/dashboard-tests-nested-template-variables-drilldown?orgId=1&${__all_variables}&${__url_time_range}"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"mappings": [],
|
|
||||||
"max": 100,
|
|
||||||
"min": 0,
|
|
||||||
"nullValueMode": "connected",
|
|
||||||
"thresholds": [
|
|
||||||
{
|
|
||||||
"color": "green",
|
|
||||||
"value": null
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"color": "red",
|
|
||||||
"value": 80
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"unit": "none"
|
|
||||||
},
|
|
||||||
"override": {},
|
|
||||||
"values": false
|
"values": false
|
||||||
},
|
},
|
||||||
"orientation": "horizontal",
|
|
||||||
"showThresholdLabels": false,
|
"showThresholdLabels": false,
|
||||||
"showThresholdMarkers": true
|
"showThresholdMarkers": true
|
||||||
},
|
},
|
||||||
"pluginVersion": "6.4.0-pre",
|
"pluginVersion": "7.1.0-pre",
|
||||||
"targets": [
|
"targets": [
|
||||||
{
|
{
|
||||||
"refId": "A",
|
"refId": "A",
|
||||||
@ -175,6 +195,41 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cacheTimeout": null,
|
"cacheTimeout": null,
|
||||||
|
"datasource": null,
|
||||||
|
"fieldConfig": {
|
||||||
|
"defaults": {
|
||||||
|
"color": {
|
||||||
|
"mode": "thresholds"
|
||||||
|
},
|
||||||
|
"custom": {},
|
||||||
|
"links": [
|
||||||
|
{
|
||||||
|
"targetBlank": true,
|
||||||
|
"title": "Go to drilldown",
|
||||||
|
"url": "/d/O6GmNPvWk/dashboard-tests-nested-template-variables-drilldown?orgId=1&${__all_variables}&${__url_time_range}"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"mappings": [],
|
||||||
|
"max": 100,
|
||||||
|
"min": 0,
|
||||||
|
"nullValueMode": "connected",
|
||||||
|
"thresholds": {
|
||||||
|
"mode": "absolute",
|
||||||
|
"steps": [
|
||||||
|
{
|
||||||
|
"color": "green",
|
||||||
|
"value": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"color": "red",
|
||||||
|
"value": 80
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"unit": "none"
|
||||||
|
},
|
||||||
|
"overrides": []
|
||||||
|
},
|
||||||
"gridPos": {
|
"gridPos": {
|
||||||
"h": 9,
|
"h": 9,
|
||||||
"w": 4,
|
"w": 4,
|
||||||
@ -185,38 +240,14 @@
|
|||||||
"links": [],
|
"links": [],
|
||||||
"options": {
|
"options": {
|
||||||
"displayMode": "basic",
|
"displayMode": "basic",
|
||||||
"fieldOptions": {
|
"orientation": "vertical",
|
||||||
|
"reduceOptions": {
|
||||||
"calcs": ["mean"],
|
"calcs": ["mean"],
|
||||||
"defaults": {
|
|
||||||
"links": [
|
|
||||||
{
|
|
||||||
"targetBlank": true,
|
|
||||||
"title": "Go to drilldown",
|
|
||||||
"url": "/d/O6GmNPvWk/dashboard-tests-nested-template-variables-drilldown?orgId=1&${__all_variables}&${__url_time_range}"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"mappings": [],
|
|
||||||
"max": 100,
|
|
||||||
"min": 0,
|
|
||||||
"nullValueMode": "connected",
|
|
||||||
"thresholds": [
|
|
||||||
{
|
|
||||||
"color": "green",
|
|
||||||
"value": null
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"color": "red",
|
|
||||||
"value": 80
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"unit": "none"
|
|
||||||
},
|
|
||||||
"override": {},
|
|
||||||
"values": false
|
"values": false
|
||||||
},
|
},
|
||||||
"orientation": "vertical"
|
"showUnfilled": true
|
||||||
},
|
},
|
||||||
"pluginVersion": "6.4.0-pre",
|
"pluginVersion": "7.1.0-pre",
|
||||||
"targets": [
|
"targets": [
|
||||||
{
|
{
|
||||||
"refId": "A",
|
"refId": "A",
|
||||||
@ -228,20 +259,108 @@
|
|||||||
"title": "React gauge datalink",
|
"title": "React gauge datalink",
|
||||||
"type": "bargauge"
|
"type": "bargauge"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"datasource": "CsvData",
|
||||||
|
"fieldConfig": {
|
||||||
|
"defaults": {
|
||||||
|
"custom": {
|
||||||
|
"align": null
|
||||||
|
},
|
||||||
|
"mappings": [],
|
||||||
|
"thresholds": {
|
||||||
|
"mode": "absolute",
|
||||||
|
"steps": [
|
||||||
|
{
|
||||||
|
"color": "green",
|
||||||
|
"value": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"color": "red",
|
||||||
|
"value": 80
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"overrides": [
|
||||||
|
{
|
||||||
|
"matcher": {
|
||||||
|
"id": "byName",
|
||||||
|
"options": "server"
|
||||||
|
},
|
||||||
|
"properties": [
|
||||||
|
{
|
||||||
|
"id": "links",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"title": "filter",
|
||||||
|
"url": "http://localhost:3000/d/-Y-tnEDWk/templating-nested-template-variables?var-datacenter=${__data.fields[datacenter]}&var-server=${__value.raw}"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"gridPos": {
|
||||||
|
"h": 6,
|
||||||
|
"w": 24,
|
||||||
|
"x": 0,
|
||||||
|
"y": 9
|
||||||
|
},
|
||||||
|
"id": 11,
|
||||||
|
"options": {
|
||||||
|
"showHeader": true
|
||||||
|
},
|
||||||
|
"pluginVersion": "7.1.0-pre",
|
||||||
|
"targets": [
|
||||||
|
{
|
||||||
|
"data": [
|
||||||
|
{
|
||||||
|
"fields": [
|
||||||
|
{
|
||||||
|
"config": {},
|
||||||
|
"name": "datacenter",
|
||||||
|
"type": "string",
|
||||||
|
"values": ["A", "B", "C"]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"config": {},
|
||||||
|
"name": "server",
|
||||||
|
"type": "string",
|
||||||
|
"values": ["AA", "BB", "CC"]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"refId": "A"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"timeFrom": null,
|
||||||
|
"timeShift": null,
|
||||||
|
"title": "Data links that filter update variables on current dashboard",
|
||||||
|
"type": "table"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"aliasColors": {},
|
"aliasColors": {},
|
||||||
"bars": false,
|
"bars": false,
|
||||||
"dashLength": 10,
|
"dashLength": 10,
|
||||||
"dashes": false,
|
"dashes": false,
|
||||||
"datasource": "gdev-testdata",
|
"datasource": "gdev-testdata",
|
||||||
|
"fieldConfig": {
|
||||||
|
"defaults": {
|
||||||
|
"custom": {}
|
||||||
|
},
|
||||||
|
"overrides": []
|
||||||
|
},
|
||||||
"fill": 1,
|
"fill": 1,
|
||||||
"fillGradient": 0,
|
"fillGradient": 0,
|
||||||
"gridPos": {
|
"gridPos": {
|
||||||
"h": 13,
|
"h": 13,
|
||||||
"w": 24,
|
"w": 24,
|
||||||
"x": 0,
|
"x": 0,
|
||||||
"y": 9
|
"y": 15
|
||||||
},
|
},
|
||||||
|
"hiddenSeries": false,
|
||||||
"id": 2,
|
"id": 2,
|
||||||
"legend": {
|
"legend": {
|
||||||
"avg": false,
|
"avg": false,
|
||||||
@ -316,7 +435,7 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"refresh": false,
|
"refresh": false,
|
||||||
"schemaVersion": 19,
|
"schemaVersion": 25,
|
||||||
"style": "dark",
|
"style": "dark",
|
||||||
"tags": ["gdev", "templating"],
|
"tags": ["gdev", "templating"],
|
||||||
"templating": {
|
"templating": {
|
||||||
@ -324,6 +443,7 @@
|
|||||||
{
|
{
|
||||||
"allValue": null,
|
"allValue": null,
|
||||||
"current": {
|
"current": {
|
||||||
|
"selected": true,
|
||||||
"text": "A",
|
"text": "A",
|
||||||
"value": ["A"]
|
"value": ["A"]
|
||||||
},
|
},
|
||||||
@ -349,6 +469,7 @@
|
|||||||
{
|
{
|
||||||
"allValue": null,
|
"allValue": null,
|
||||||
"current": {
|
"current": {
|
||||||
|
"selected": true,
|
||||||
"text": "AA",
|
"text": "AA",
|
||||||
"value": ["AA"]
|
"value": ["AA"]
|
||||||
},
|
},
|
||||||
@ -374,6 +495,7 @@
|
|||||||
{
|
{
|
||||||
"allValue": null,
|
"allValue": null,
|
||||||
"current": {
|
"current": {
|
||||||
|
"selected": true,
|
||||||
"text": "All",
|
"text": "All",
|
||||||
"value": ["$__all"]
|
"value": ["$__all"]
|
||||||
},
|
},
|
||||||
@ -403,7 +525,7 @@
|
|||||||
"to": "now"
|
"to": "now"
|
||||||
},
|
},
|
||||||
"timepicker": {
|
"timepicker": {
|
||||||
"refresh_intervals": ["5s", "10s", "30s", "1m", "5m", "15m", "30m", "1h", "2h", "1d"]
|
"refresh_intervals": ["10s", "30s", "1m", "5m", "15m", "30m", "1h", "2h", "1d"]
|
||||||
},
|
},
|
||||||
"timezone": "",
|
"timezone": "",
|
||||||
"title": "Templating - Nested Template Variables",
|
"title": "Templating - Nested Template Variables",
|
||||||
|
@ -367,7 +367,7 @@ export const getLinksSupplier = (
|
|||||||
const info: LinkModel<Field> = {
|
const info: LinkModel<Field> = {
|
||||||
href: locationUtil.assureBaseUrl(href.replace(/\n/g, '')),
|
href: locationUtil.assureBaseUrl(href.replace(/\n/g, '')),
|
||||||
title: link.title || '',
|
title: link.title || '',
|
||||||
target: link.targetBlank ? '_blank' : '_self',
|
target: link.targetBlank ? '_blank' : undefined,
|
||||||
origin: field,
|
origin: field,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ export interface DataLink {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export type LinkTarget = '_blank' | '_self';
|
export type LinkTarget = '_blank' | '_self' | undefined;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Processed Link Model. The values are ready to use
|
* Processed Link Model. The values are ready to use
|
||||||
|
Reference in New Issue
Block a user