diff --git a/devenv/dev-dashboards/e2e-repeats/Repeating-a-panel-horizontally.json b/devenv/dev-dashboards/e2e-repeats/Repeating-a-panel-horizontally.json index 3c3d97ea68b..2def57915d9 100644 --- a/devenv/dev-dashboards/e2e-repeats/Repeating-a-panel-horizontally.json +++ b/devenv/dev-dashboards/e2e-repeats/Repeating-a-panel-horizontally.json @@ -106,7 +106,7 @@ } ], "schemaVersion": 36, - "tags": [], + "tags": ["gdev", "templating"], "templating": { "list": [ { @@ -199,7 +199,7 @@ }, "timepicker": {}, "timezone": "utc", - "title": "Repeating a panel horizontally", + "title": "Templating - Repeating a panel horizontally", "uid": "WVpf2jp7z", "version": 1, "weekStart": "" diff --git a/devenv/dev-dashboards/e2e-repeats/Repeating-a-panel-vertically.json b/devenv/dev-dashboards/e2e-repeats/Repeating-a-panel-vertically.json index 565365d6bf4..9a450a79b4e 100644 --- a/devenv/dev-dashboards/e2e-repeats/Repeating-a-panel-vertically.json +++ b/devenv/dev-dashboards/e2e-repeats/Repeating-a-panel-vertically.json @@ -102,7 +102,7 @@ } ], "schemaVersion": 34, - "tags": [], + "tags": ["gdev", "templating"], "templating": { "list": [ { diff --git a/devenv/dev-dashboards/feature-templating/templating-repeating-panels.json b/devenv/dev-dashboards/feature-templating/templating-repeating-panels.json new file mode 100644 index 00000000000..bb6cae08253 --- /dev/null +++ b/devenv/dev-dashboards/feature-templating/templating-repeating-panels.json @@ -0,0 +1,423 @@ +{ + "annotations": { + "list": [ + { + "builtIn": 1, + "datasource": { + "type": "grafana", + "uid": "-- Grafana --" + }, + "enable": true, + "hide": true, + "iconColor": "rgba(0, 211, 255, 1)", + "name": "Annotations & Alerts", + "type": "dashboard" + } + ] + }, + "editable": true, + "fiscalYearStartMonth": 0, + "graphTooltip": 0, + "links": [], + "liveNow": false, + "panels": [ + { + "gridPos": { + "h": 2, + "w": 24, + "x": 0, + "y": 0 + }, + "id": 15, + "options": { + "code": { + "language": "plaintext", + "showLineNumbers": false, + "showMiniMap": false + }, + "content": "
\n Horizontally repeated panel below\n
", + "mode": "markdown" + }, + "pluginVersion": "10.2.0-pre", + "type": "text" + }, + { + "datasource": { + "type": "testdata", + "uid": "PD8C576611E62080A" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "axisShow": false, + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 6, + "w": 8, + "x": 0, + "y": 2 + }, + "id": 2, + "maxPerRow": 3, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "repeat": "server", + "repeatDirection": "h", + "targets": [ + { + "alias": "server = $server", + "datasource": { + "type": "testdata", + "uid": "PD8C576611E62080A" + }, + "refId": "A", + "scenarioId": "random_walk", + "seriesCount": 1 + } + ], + "title": "server=$server", + "type": "timeseries" + }, + { + "gridPos": { + "h": 20, + "w": 16, + "x": 0, + "y": 12 + }, + "id": 10, + "options": { + "code": { + "language": "plaintext", + "showLineNumbers": false, + "showMiniMap": false + }, + "content": "### \n\nIt also has a variable with different value and text representations (A=1, B=2, etc). \nTo test that this works for the scoped variable. \n\nIn the title the text representation should be seen (A,B,C, etc). In the legend you\nshould see both the text and value (id). \n\n", + "mode": "markdown" + }, + "pluginVersion": "10.2.0-pre", + "title": "Panel to the right is configured for vertical repeat", + "type": "text" + }, + { + "datasource": { + "type": "testdata", + "uid": "PD8C576611E62080A" + }, + "fieldConfig": { + "defaults": { + "color": { + "fixedColor": "blue", + "mode": "fixed" + }, + "custom": { + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "axisShow": false, + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 25, + "gradientMode": "hue", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "smooth", + "lineWidth": 2, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 4, + "w": 8, + "x": 16, + "y": 12 + }, + "id": 5, + "maxDataPoints": 50, + "maxPerRow": 3, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "repeat": "host", + "repeatDirection": "v", + "targets": [ + { + "alias": "host = ${host:text} / id = $host", + "datasource": { + "type": "testdata", + "uid": "PD8C576611E62080A" + }, + "refId": "A", + "scenarioId": "random_walk", + "seriesCount": 1 + } + ], + "title": "host_name = $host", + "type": "timeseries" + } + ], + "refresh": "", + "schemaVersion": 38, + "tags": ["gdev", "templating"], + "templating": { + "list": [ + { + "current": { + "selected": false, + "text": [ + "A", + "B", + "C" + ], + "value": [ + "A", + "B", + "C" + ] + }, + "hide": 0, + "includeAll": true, + "multi": true, + "name": "server", + "options": [ + { + "selected": false, + "text": "All", + "value": "$__all" + }, + { + "selected": true, + "text": "A", + "value": "A" + }, + { + "selected": true, + "text": "B", + "value": "B" + }, + { + "selected": true, + "text": "C", + "value": "C" + }, + { + "selected": false, + "text": "D", + "value": "D" + }, + { + "selected": false, + "text": "E", + "value": "E" + }, + { + "selected": false, + "text": "F", + "value": "F" + }, + { + "selected": false, + "text": "E", + "value": "E" + }, + { + "selected": false, + "text": "G", + "value": "G" + }, + { + "selected": false, + "text": "H", + "value": "H" + }, + { + "selected": false, + "text": "I", + "value": "I" + }, + { + "selected": false, + "text": "J", + "value": "J" + }, + { + "selected": false, + "text": "K", + "value": "K" + }, + { + "selected": false, + "text": "L", + "value": "L" + } + ], + "query": "A,B,C,D,E,F,E,G,H,I,J,K,L", + "queryValue": "", + "skipUrlSync": false, + "type": "custom" + }, + { + "current": { + "selected": true, + "text": [ + "All" + ], + "value": [ + "$__all" + ] + }, + "hide": 0, + "includeAll": true, + "multi": true, + "name": "host", + "options": [ + { + "selected": true, + "text": "All", + "value": "$__all" + }, + { + "selected": false, + "text": "A", + "value": "1" + }, + { + "selected": false, + "text": "B", + "value": "2" + }, + { + "selected": false, + "text": "C", + "value": "3" + }, + { + "selected": false, + "text": "D", + "value": "4" + }, + { + "selected": false, + "text": "E", + "value": "5" + } + ], + "query": "A : 1, B : 2,C : 3, D : 4, E : 5", + "queryValue": "", + "skipUrlSync": false, + "type": "custom" + } + ] + }, + "time": { + "from": "now-6h", + "to": "now" + }, + "timepicker": {}, + "timezone": "", + "title": "Templating - Repeating Panels", + "uid": "templating-repeating-panels", + "version": 37, + "weekStart": "" +} \ No newline at end of file diff --git a/devenv/dev-dashboards/feature-templating/testdata-repeating.json b/devenv/dev-dashboards/feature-templating/testdata-repeating.json deleted file mode 100644 index 464af782da5..00000000000 --- a/devenv/dev-dashboards/feature-templating/testdata-repeating.json +++ /dev/null @@ -1,1364 +0,0 @@ -{ - "annotations": { - "list": [ - { - "builtIn": 1, - "datasource": "-- Grafana --", - "enable": true, - "hide": true, - "iconColor": "rgba(0, 211, 255, 1)", - "name": "Annotations & Alerts", - "type": "dashboard" - } - ] - }, - "editable": true, - "gnetId": null, - "graphTooltip": 0, - "iteration": 1554990747424, - "links": [], - "panels": [ - { - "cacheTimeout": null, - "colorBackground": false, - "colorValue": false, - "colors": ["#299c46", "rgba(237, 129, 40, 0.89)", "#d44a3a"], - "datasource": "gdev-testdata", - "format": "none", - "gauge": { - "maxValue": 100, - "minValue": 0, - "show": false, - "thresholdLabels": false, - "thresholdMarkers": true - }, - "gridPos": { - "h": 4, - "w": 6, - "x": 0, - "y": 0 - }, - "id": 7, - "interval": null, - "links": [], - "mappingType": 1, - "mappingTypes": [ - { - "name": "value to text", - "value": 1 - }, - { - "name": "range to text", - "value": 2 - } - ], - "maxDataPoints": 100, - "maxPerRow": 4, - "nullPointMode": "connected", - "nullText": null, - "postfix": "", - "postfixFontSize": "50%", - "prefix": "", - "prefixFontSize": "50%", - "rangeMaps": [ - { - "from": "null", - "text": "N/A", - "to": "null" - } - ], - "repeat": "Servers", - "repeatDirection": "h", - "scopedVars": { - "Servers": { - "selected": false, - "text": "server1", - "value": "server1" - } - }, - "sparkline": { - "fillColor": "rgba(31, 118, 189, 0.18)", - "full": false, - "lineColor": "rgb(31, 120, 193)", - "show": true - }, - "tableColumn": "", - "targets": [ - { - "refId": "A", - "scenarioId": "random_walk", - "stringInput": "" - } - ], - "thresholds": "50,90", - "timeFrom": null, - "timeShift": null, - "title": "$Servers", - "type": "singlestat", - "valueFontSize": "80%", - "valueMaps": [ - { - "op": "=", - "text": "N/A", - "value": "null" - } - ], - "valueName": "avg" - }, - { - "cacheTimeout": null, - "colorBackground": false, - "colorValue": false, - "colors": ["#299c46", "rgba(237, 129, 40, 0.89)", "#d44a3a"], - "datasource": "gdev-testdata", - "format": "none", - "gauge": { - "maxValue": 100, - "minValue": 0, - "show": false, - "thresholdLabels": false, - "thresholdMarkers": true - }, - "gridPos": { - "h": 4, - "w": 6, - "x": 6, - "y": 0 - }, - "id": 8, - "interval": null, - "links": [], - "mappingType": 1, - "mappingTypes": [ - { - "name": "value to text", - "value": 1 - }, - { - "name": "range to text", - "value": 2 - } - ], - "maxDataPoints": 100, - "maxPerRow": 4, - "nullPointMode": "connected", - "nullText": null, - "postfix": "", - "postfixFontSize": "50%", - "prefix": "", - "prefixFontSize": "50%", - "rangeMaps": [ - { - "from": "null", - "text": "N/A", - "to": "null" - } - ], - "repeat": null, - "repeatDirection": "h", - "repeatIteration": 1554990747424, - "repeatPanelId": 7, - "scopedVars": { - "Servers": { - "selected": false, - "text": "server2", - "value": "server2" - } - }, - "sparkline": { - "fillColor": "rgba(31, 118, 189, 0.18)", - "full": false, - "lineColor": "rgb(31, 120, 193)", - "show": true - }, - "tableColumn": "", - "targets": [ - { - "refId": "A", - "scenarioId": "random_walk", - "stringInput": "" - } - ], - "thresholds": "50,90", - "timeFrom": null, - "timeShift": null, - "title": "$Servers", - "type": "singlestat", - "valueFontSize": "80%", - "valueMaps": [ - { - "op": "=", - "text": "N/A", - "value": "null" - } - ], - "valueName": "avg" - }, - { - "cacheTimeout": null, - "colorBackground": false, - "colorValue": false, - "colors": ["#299c46", "rgba(237, 129, 40, 0.89)", "#d44a3a"], - "datasource": "gdev-testdata", - "format": "none", - "gauge": { - "maxValue": 100, - "minValue": 0, - "show": false, - "thresholdLabels": false, - "thresholdMarkers": true - }, - "gridPos": { - "h": 4, - "w": 6, - "x": 12, - "y": 0 - }, - "id": 9, - "interval": null, - "links": [], - "mappingType": 1, - "mappingTypes": [ - { - "name": "value to text", - "value": 1 - }, - { - "name": "range to text", - "value": 2 - } - ], - "maxDataPoints": 100, - "maxPerRow": 4, - "nullPointMode": "connected", - "nullText": null, - "postfix": "", - "postfixFontSize": "50%", - "prefix": "", - "prefixFontSize": "50%", - "rangeMaps": [ - { - "from": "null", - "text": "N/A", - "to": "null" - } - ], - "repeat": null, - "repeatDirection": "h", - "repeatIteration": 1554990747424, - "repeatPanelId": 7, - "scopedVars": { - "Servers": { - "selected": false, - "text": "server3", - "value": "server3" - } - }, - "sparkline": { - "fillColor": "rgba(31, 118, 189, 0.18)", - "full": false, - "lineColor": "rgb(31, 120, 193)", - "show": true - }, - "tableColumn": "", - "targets": [ - { - "refId": "A", - "scenarioId": "random_walk", - "stringInput": "" - } - ], - "thresholds": "50,90", - "timeFrom": null, - "timeShift": null, - "title": "$Servers", - "type": "singlestat", - "valueFontSize": "80%", - "valueMaps": [ - { - "op": "=", - "text": "N/A", - "value": "null" - } - ], - "valueName": "avg" - }, - { - "cacheTimeout": null, - "colorBackground": false, - "colorValue": false, - "colors": ["#299c46", "rgba(237, 129, 40, 0.89)", "#d44a3a"], - "datasource": "gdev-testdata", - "format": "none", - "gauge": { - "maxValue": 100, - "minValue": 0, - "show": false, - "thresholdLabels": false, - "thresholdMarkers": true - }, - "gridPos": { - "h": 4, - "w": 6, - "x": 18, - "y": 0 - }, - "id": 10, - "interval": null, - "links": [], - "mappingType": 1, - "mappingTypes": [ - { - "name": "value to text", - "value": 1 - }, - { - "name": "range to text", - "value": 2 - } - ], - "maxDataPoints": 100, - "maxPerRow": 4, - "nullPointMode": "connected", - "nullText": null, - "postfix": "", - "postfixFontSize": "50%", - "prefix": "", - "prefixFontSize": "50%", - "rangeMaps": [ - { - "from": "null", - "text": "N/A", - "to": "null" - } - ], - "repeat": null, - "repeatDirection": "h", - "repeatIteration": 1554990747424, - "repeatPanelId": 7, - "scopedVars": { - "Servers": { - "selected": false, - "text": "server4", - "value": "server4" - } - }, - "sparkline": { - "fillColor": "rgba(31, 118, 189, 0.18)", - "full": false, - "lineColor": "rgb(31, 120, 193)", - "show": true - }, - "tableColumn": "", - "targets": [ - { - "refId": "A", - "scenarioId": "random_walk", - "stringInput": "" - } - ], - "thresholds": "50,90", - "timeFrom": null, - "timeShift": null, - "title": "$Servers", - "type": "singlestat", - "valueFontSize": "80%", - "valueMaps": [ - { - "op": "=", - "text": "N/A", - "value": "null" - } - ], - "valueName": "avg" - }, - { - "cacheTimeout": null, - "colorBackground": false, - "colorValue": false, - "colors": ["#299c46", "rgba(237, 129, 40, 0.89)", "#d44a3a"], - "datasource": "gdev-testdata", - "format": "none", - "gauge": { - "maxValue": 100, - "minValue": 0, - "show": false, - "thresholdLabels": false, - "thresholdMarkers": true - }, - "gridPos": { - "h": 4, - "w": 6, - "x": 0, - "y": 4 - }, - "id": 11, - "interval": null, - "links": [], - "mappingType": 1, - "mappingTypes": [ - { - "name": "value to text", - "value": 1 - }, - { - "name": "range to text", - "value": 2 - } - ], - "maxDataPoints": 100, - "maxPerRow": 4, - "nullPointMode": "connected", - "nullText": null, - "postfix": "", - "postfixFontSize": "50%", - "prefix": "", - "prefixFontSize": "50%", - "rangeMaps": [ - { - "from": "null", - "text": "N/A", - "to": "null" - } - ], - "repeat": null, - "repeatDirection": "h", - "repeatIteration": 1554990747424, - "repeatPanelId": 7, - "scopedVars": { - "Servers": { - "selected": false, - "text": "server5", - "value": "server5" - } - }, - "sparkline": { - "fillColor": "rgba(31, 118, 189, 0.18)", - "full": false, - "lineColor": "rgb(31, 120, 193)", - "show": true - }, - "tableColumn": "", - "targets": [ - { - "refId": "A", - "scenarioId": "random_walk", - "stringInput": "" - } - ], - "thresholds": "50,90", - "timeFrom": null, - "timeShift": null, - "title": "$Servers", - "type": "singlestat", - "valueFontSize": "80%", - "valueMaps": [ - { - "op": "=", - "text": "N/A", - "value": "null" - } - ], - "valueName": "avg" - }, - { - "cacheTimeout": null, - "colorBackground": false, - "colorValue": false, - "colors": ["#299c46", "rgba(237, 129, 40, 0.89)", "#d44a3a"], - "datasource": "gdev-testdata", - "format": "none", - "gauge": { - "maxValue": 100, - "minValue": 0, - "show": false, - "thresholdLabels": false, - "thresholdMarkers": true - }, - "gridPos": { - "h": 4, - "w": 6, - "x": 6, - "y": 4 - }, - "id": 12, - "interval": null, - "links": [], - "mappingType": 1, - "mappingTypes": [ - { - "name": "value to text", - "value": 1 - }, - { - "name": "range to text", - "value": 2 - } - ], - "maxDataPoints": 100, - "maxPerRow": 4, - "nullPointMode": "connected", - "nullText": null, - "postfix": "", - "postfixFontSize": "50%", - "prefix": "", - "prefixFontSize": "50%", - "rangeMaps": [ - { - "from": "null", - "text": "N/A", - "to": "null" - } - ], - "repeat": null, - "repeatDirection": "h", - "repeatIteration": 1554990747424, - "repeatPanelId": 7, - "scopedVars": { - "Servers": { - "selected": false, - "text": "server6", - "value": "server6" - } - }, - "sparkline": { - "fillColor": "rgba(31, 118, 189, 0.18)", - "full": false, - "lineColor": "rgb(31, 120, 193)", - "show": true - }, - "tableColumn": "", - "targets": [ - { - "refId": "A", - "scenarioId": "random_walk", - "stringInput": "" - } - ], - "thresholds": "50,90", - "timeFrom": null, - "timeShift": null, - "title": "$Servers", - "type": "singlestat", - "valueFontSize": "80%", - "valueMaps": [ - { - "op": "=", - "text": "N/A", - "value": "null" - } - ], - "valueName": "avg" - }, - { - "cacheTimeout": null, - "colorBackground": false, - "colorValue": false, - "colors": ["#299c46", "rgba(237, 129, 40, 0.89)", "#d44a3a"], - "datasource": "gdev-testdata", - "format": "none", - "gauge": { - "maxValue": 100, - "minValue": 0, - "show": false, - "thresholdLabels": false, - "thresholdMarkers": true - }, - "gridPos": { - "h": 4, - "w": 6, - "x": 12, - "y": 4 - }, - "id": 13, - "interval": null, - "links": [], - "mappingType": 1, - "mappingTypes": [ - { - "name": "value to text", - "value": 1 - }, - { - "name": "range to text", - "value": 2 - } - ], - "maxDataPoints": 100, - "maxPerRow": 4, - "nullPointMode": "connected", - "nullText": null, - "postfix": "", - "postfixFontSize": "50%", - "prefix": "", - "prefixFontSize": "50%", - "rangeMaps": [ - { - "from": "null", - "text": "N/A", - "to": "null" - } - ], - "repeat": null, - "repeatDirection": "h", - "repeatIteration": 1554990747424, - "repeatPanelId": 7, - "scopedVars": { - "Servers": { - "selected": false, - "text": "server7", - "value": "server7" - } - }, - "sparkline": { - "fillColor": "rgba(31, 118, 189, 0.18)", - "full": false, - "lineColor": "rgb(31, 120, 193)", - "show": true - }, - "tableColumn": "", - "targets": [ - { - "refId": "A", - "scenarioId": "random_walk", - "stringInput": "" - } - ], - "thresholds": "50,90", - "timeFrom": null, - "timeShift": null, - "title": "$Servers", - "type": "singlestat", - "valueFontSize": "80%", - "valueMaps": [ - { - "op": "=", - "text": "N/A", - "value": "null" - } - ], - "valueName": "avg" - }, - { - "cacheTimeout": null, - "colorBackground": false, - "colorValue": false, - "colors": ["#299c46", "rgba(237, 129, 40, 0.89)", "#d44a3a"], - "datasource": "gdev-testdata", - "format": "none", - "gauge": { - "maxValue": 100, - "minValue": 0, - "show": false, - "thresholdLabels": false, - "thresholdMarkers": true - }, - "gridPos": { - "h": 4, - "w": 6, - "x": 18, - "y": 4 - }, - "id": 14, - "interval": null, - "links": [], - "mappingType": 1, - "mappingTypes": [ - { - "name": "value to text", - "value": 1 - }, - { - "name": "range to text", - "value": 2 - } - ], - "maxDataPoints": 100, - "maxPerRow": 4, - "nullPointMode": "connected", - "nullText": null, - "postfix": "", - "postfixFontSize": "50%", - "prefix": "", - "prefixFontSize": "50%", - "rangeMaps": [ - { - "from": "null", - "text": "N/A", - "to": "null" - } - ], - "repeat": null, - "repeatDirection": "h", - "repeatIteration": 1554990747424, - "repeatPanelId": 7, - "scopedVars": { - "Servers": { - "selected": false, - "text": "server8", - "value": "server8" - } - }, - "sparkline": { - "fillColor": "rgba(31, 118, 189, 0.18)", - "full": false, - "lineColor": "rgb(31, 120, 193)", - "show": true - }, - "tableColumn": "", - "targets": [ - { - "refId": "A", - "scenarioId": "random_walk", - "stringInput": "" - } - ], - "thresholds": "50,90", - "timeFrom": null, - "timeShift": null, - "title": "$Servers", - "type": "singlestat", - "valueFontSize": "80%", - "valueMaps": [ - { - "op": "=", - "text": "N/A", - "value": "null" - } - ], - "valueName": "avg" - }, - { - "datasource": "gdev-testdata", - "gridPos": { - "h": 5, - "w": 6, - "x": 0, - "y": 8 - }, - "id": 2, - "links": [], - "maxPerRow": 4, - "nullPointMode": "null", - "options": { - "baseColor": "#299c46", - "maxValue": 100, - "minValue": 0, - "orientation": "auto", - "showThresholdLabels": false, - "showThresholdMarkers": true, - "thresholds": [ - { - "color": "#7EB26D", - "index": 0, - "value": null - }, - { - "color": "#ef843c", - "index": 1, - "value": 75 - }, - { - "color": "#e24d42", - "index": 2, - "value": 90 - } - ], - "valueMappings": [], - "valueOptions": { - "decimals": "2", - "prefix": "", - "stat": "mean", - "suffix": "", - "unit": "ms" - } - }, - "pluginVersion": "6.1.0-pre", - "repeat": "Servers", - "repeatDirection": "h", - "scopedVars": { - "Servers": { - "selected": false, - "text": "server1", - "value": "server1" - } - }, - "targets": [ - { - "refId": "A", - "scenarioId": "csv_metric_values", - "stringInput": "1,20,90,30,5,0" - } - ], - "timeFrom": null, - "timeShift": null, - "title": "$Servers", - "type": "gauge" - }, - { - "datasource": "gdev-testdata", - "gridPos": { - "h": 5, - "w": 6, - "x": 6, - "y": 8 - }, - "id": 15, - "links": [], - "maxPerRow": 4, - "nullPointMode": "null", - "options": { - "baseColor": "#299c46", - "maxValue": 100, - "minValue": 0, - "orientation": "auto", - "showThresholdLabels": false, - "showThresholdMarkers": true, - "thresholds": [ - { - "color": "#7EB26D", - "index": 0, - "value": null - }, - { - "color": "#ef843c", - "index": 1, - "value": 75 - }, - { - "color": "#e24d42", - "index": 2, - "value": 90 - } - ], - "valueMappings": [], - "valueOptions": { - "decimals": "2", - "prefix": "", - "stat": "mean", - "suffix": "", - "unit": "ms" - } - }, - "pluginVersion": "6.1.0-pre", - "repeat": null, - "repeatDirection": "h", - "repeatIteration": 1554990747424, - "repeatPanelId": 2, - "scopedVars": { - "Servers": { - "selected": false, - "text": "server2", - "value": "server2" - } - }, - "targets": [ - { - "refId": "A", - "scenarioId": "csv_metric_values", - "stringInput": "1,20,90,30,5,0" - } - ], - "timeFrom": null, - "timeShift": null, - "title": "$Servers", - "type": "gauge" - }, - { - "datasource": "gdev-testdata", - "gridPos": { - "h": 5, - "w": 6, - "x": 12, - "y": 8 - }, - "id": 16, - "links": [], - "maxPerRow": 4, - "nullPointMode": "null", - "options": { - "baseColor": "#299c46", - "maxValue": 100, - "minValue": 0, - "orientation": "auto", - "showThresholdLabels": false, - "showThresholdMarkers": true, - "thresholds": [ - { - "color": "#7EB26D", - "index": 0, - "value": null - }, - { - "color": "#ef843c", - "index": 1, - "value": 75 - }, - { - "color": "#e24d42", - "index": 2, - "value": 90 - } - ], - "valueMappings": [], - "valueOptions": { - "decimals": "2", - "prefix": "", - "stat": "mean", - "suffix": "", - "unit": "ms" - } - }, - "pluginVersion": "6.1.0-pre", - "repeat": null, - "repeatDirection": "h", - "repeatIteration": 1554990747424, - "repeatPanelId": 2, - "scopedVars": { - "Servers": { - "selected": false, - "text": "server3", - "value": "server3" - } - }, - "targets": [ - { - "refId": "A", - "scenarioId": "csv_metric_values", - "stringInput": "1,20,90,30,5,0" - } - ], - "timeFrom": null, - "timeShift": null, - "title": "$Servers", - "type": "gauge" - }, - { - "datasource": "gdev-testdata", - "gridPos": { - "h": 5, - "w": 6, - "x": 18, - "y": 8 - }, - "id": 17, - "links": [], - "maxPerRow": 4, - "nullPointMode": "null", - "options": { - "baseColor": "#299c46", - "maxValue": 100, - "minValue": 0, - "orientation": "auto", - "showThresholdLabels": false, - "showThresholdMarkers": true, - "thresholds": [ - { - "color": "#7EB26D", - "index": 0, - "value": null - }, - { - "color": "#ef843c", - "index": 1, - "value": 75 - }, - { - "color": "#e24d42", - "index": 2, - "value": 90 - } - ], - "valueMappings": [], - "valueOptions": { - "decimals": "2", - "prefix": "", - "stat": "mean", - "suffix": "", - "unit": "ms" - } - }, - "pluginVersion": "6.1.0-pre", - "repeat": null, - "repeatDirection": "h", - "repeatIteration": 1554990747424, - "repeatPanelId": 2, - "scopedVars": { - "Servers": { - "selected": false, - "text": "server4", - "value": "server4" - } - }, - "targets": [ - { - "refId": "A", - "scenarioId": "csv_metric_values", - "stringInput": "1,20,90,30,5,0" - } - ], - "timeFrom": null, - "timeShift": null, - "title": "$Servers", - "type": "gauge" - }, - { - "datasource": "gdev-testdata", - "gridPos": { - "h": 5, - "w": 6, - "x": 0, - "y": 13 - }, - "id": 18, - "links": [], - "maxPerRow": 4, - "nullPointMode": "null", - "options": { - "baseColor": "#299c46", - "maxValue": 100, - "minValue": 0, - "orientation": "auto", - "showThresholdLabels": false, - "showThresholdMarkers": true, - "thresholds": [ - { - "color": "#7EB26D", - "index": 0, - "value": null - }, - { - "color": "#ef843c", - "index": 1, - "value": 75 - }, - { - "color": "#e24d42", - "index": 2, - "value": 90 - } - ], - "valueMappings": [], - "valueOptions": { - "decimals": "2", - "prefix": "", - "stat": "mean", - "suffix": "", - "unit": "ms" - } - }, - "pluginVersion": "6.1.0-pre", - "repeat": null, - "repeatDirection": "h", - "repeatIteration": 1554990747424, - "repeatPanelId": 2, - "scopedVars": { - "Servers": { - "selected": false, - "text": "server5", - "value": "server5" - } - }, - "targets": [ - { - "refId": "A", - "scenarioId": "csv_metric_values", - "stringInput": "1,20,90,30,5,0" - } - ], - "timeFrom": null, - "timeShift": null, - "title": "$Servers", - "type": "gauge" - }, - { - "datasource": "gdev-testdata", - "gridPos": { - "h": 5, - "w": 6, - "x": 6, - "y": 13 - }, - "id": 19, - "links": [], - "maxPerRow": 4, - "nullPointMode": "null", - "options": { - "baseColor": "#299c46", - "maxValue": 100, - "minValue": 0, - "orientation": "auto", - "showThresholdLabels": false, - "showThresholdMarkers": true, - "thresholds": [ - { - "color": "#7EB26D", - "index": 0, - "value": null - }, - { - "color": "#ef843c", - "index": 1, - "value": 75 - }, - { - "color": "#e24d42", - "index": 2, - "value": 90 - } - ], - "valueMappings": [], - "valueOptions": { - "decimals": "2", - "prefix": "", - "stat": "mean", - "suffix": "", - "unit": "ms" - } - }, - "pluginVersion": "6.1.0-pre", - "repeat": null, - "repeatDirection": "h", - "repeatIteration": 1554990747424, - "repeatPanelId": 2, - "scopedVars": { - "Servers": { - "selected": false, - "text": "server6", - "value": "server6" - } - }, - "targets": [ - { - "refId": "A", - "scenarioId": "csv_metric_values", - "stringInput": "1,20,90,30,5,0" - } - ], - "timeFrom": null, - "timeShift": null, - "title": "$Servers", - "type": "gauge" - }, - { - "datasource": "gdev-testdata", - "gridPos": { - "h": 5, - "w": 6, - "x": 12, - "y": 13 - }, - "id": 20, - "links": [], - "maxPerRow": 4, - "nullPointMode": "null", - "options": { - "baseColor": "#299c46", - "maxValue": 100, - "minValue": 0, - "orientation": "auto", - "showThresholdLabels": false, - "showThresholdMarkers": true, - "thresholds": [ - { - "color": "#7EB26D", - "index": 0, - "value": null - }, - { - "color": "#ef843c", - "index": 1, - "value": 75 - }, - { - "color": "#e24d42", - "index": 2, - "value": 90 - } - ], - "valueMappings": [], - "valueOptions": { - "decimals": "2", - "prefix": "", - "stat": "mean", - "suffix": "", - "unit": "ms" - } - }, - "pluginVersion": "6.1.0-pre", - "repeat": null, - "repeatDirection": "h", - "repeatIteration": 1554990747424, - "repeatPanelId": 2, - "scopedVars": { - "Servers": { - "selected": false, - "text": "server7", - "value": "server7" - } - }, - "targets": [ - { - "refId": "A", - "scenarioId": "csv_metric_values", - "stringInput": "1,20,90,30,5,0" - } - ], - "timeFrom": null, - "timeShift": null, - "title": "$Servers", - "type": "gauge" - }, - { - "datasource": "gdev-testdata", - "gridPos": { - "h": 5, - "w": 6, - "x": 18, - "y": 13 - }, - "id": 21, - "links": [], - "maxPerRow": 4, - "nullPointMode": "null", - "options": { - "baseColor": "#299c46", - "maxValue": 100, - "minValue": 0, - "orientation": "auto", - "showThresholdLabels": false, - "showThresholdMarkers": true, - "thresholds": [ - { - "color": "#7EB26D", - "index": 0, - "value": null - }, - { - "color": "#ef843c", - "index": 1, - "value": 75 - }, - { - "color": "#e24d42", - "index": 2, - "value": 90 - } - ], - "valueMappings": [], - "valueOptions": { - "decimals": "2", - "prefix": "", - "stat": "mean", - "suffix": "", - "unit": "ms" - } - }, - "pluginVersion": "6.1.0-pre", - "repeat": null, - "repeatDirection": "h", - "repeatIteration": 1554990747424, - "repeatPanelId": 2, - "scopedVars": { - "Servers": { - "selected": false, - "text": "server8", - "value": "server8" - } - }, - "targets": [ - { - "refId": "A", - "scenarioId": "csv_metric_values", - "stringInput": "1,20,90,30,5,0" - } - ], - "timeFrom": null, - "timeShift": null, - "title": "$Servers", - "type": "gauge" - } - ], - "refresh": false, - "schemaVersion": 18, - "tags": ["gdev", "templating"], - "templating": { - "list": [ - { - "allValue": null, - "current": { - "tags": [], - "text": "All", - "value": ["$__all"] - }, - "hide": 0, - "includeAll": true, - "label": null, - "multi": true, - "name": "Servers", - "options": [ - { - "selected": true, - "text": "All", - "value": "$__all" - }, - { - "selected": false, - "text": "server1", - "value": "server1" - }, - { - "selected": false, - "text": "server2", - "value": "server2" - }, - { - "selected": false, - "text": "server3", - "value": "server3" - }, - { - "selected": false, - "text": "server4", - "value": "server4" - }, - { - "selected": false, - "text": "server5", - "value": "server5" - }, - { - "selected": false, - "text": "server6", - "value": "server6" - }, - { - "selected": false, - "text": "server7", - "value": "server7" - }, - { - "selected": false, - "text": "server8", - "value": "server8" - } - ], - "query": "server1,server2,server3,server4,server5,server6,server7,server8", - "skipUrlSync": false, - "type": "custom" - } - ] - }, - "time": { - "from": "now-1h", - "to": "now" - }, - "timepicker": { - "refresh_intervals": ["5s", "10s", "30s", "1m", "5m", "15m", "30m", "1h", "2h", "1d"], - "time_options": ["5m", "15m", "1h", "6h", "12h", "24h", "2d", "7d", "30d"] - }, - "timezone": "", - "title": "TestData Repeating Panels", - "uid": "Ei74RD9mz", - "version": 1 -} diff --git a/devenv/jsonnet/dev-dashboards.libsonnet b/devenv/jsonnet/dev-dashboards.libsonnet index 56259f979bf..69a1666fc23 100644 --- a/devenv/jsonnet/dev-dashboards.libsonnet +++ b/devenv/jsonnet/dev-dashboards.libsonnet @@ -618,6 +618,13 @@ local dashboard = grafana.dashboard; id: 0, } }, + dashboard.new('templating-repeating-panels', import '../dev-dashboards/feature-templating/templating-repeating-panels.json') + + resource.addMetadata('folder', 'dev-dashboards') + + { + spec+: { + id: 0, + } + }, dashboard.new('templating-textbox-e2e-scenarios', import '../dev-dashboards/feature-templating/templating-textbox-e2e-scenarios.json') + resource.addMetadata('folder', 'dev-dashboards') + { @@ -646,13 +653,6 @@ local dashboard = grafana.dashboard; id: 0, } }, - dashboard.new('testdata-repeating', import '../dev-dashboards/feature-templating/testdata-repeating.json') + - resource.addMetadata('folder', 'dev-dashboards') + - { - spec+: { - id: 0, - } - }, dashboard.new('testdata-test-variable-output', import '../dev-dashboards/feature-templating/testdata-test-variable-output.json') + resource.addMetadata('folder', 'dev-dashboards') + { diff --git a/docs/sources/developers/kinds/core/dashboard/schema-reference.md b/docs/sources/developers/kinds/core/dashboard/schema-reference.md index afd60ee06bb..ef5c05b63fc 100644 --- a/docs/sources/developers/kinds/core/dashboard/schema-reference.md +++ b/docs/sources/developers/kinds/core/dashboard/schema-reference.md @@ -463,9 +463,9 @@ Dashboard panels are the basic visualization building blocks. | `libraryPanel` | [LibraryPanelRef](#librarypanelref) | No | | A library panel is a reusable panel that you can use in any dashboard.
When you make a change to a library panel, that change propagates to all instances of where the panel is used.
Library panels streamline reuse of panels across multiple dashboards. | | `links` | [DashboardLink](#dashboardlink)[] | No | | Panel links. | | `maxDataPoints` | number | No | | The maximum number of data points that the panel queries are retrieving. | +| `maxPerRow` | number | No | | Option for repeated panels that controls max items per row
Only relevant for horizontally repeated panels | | `pluginVersion` | string | No | | The version of the plugin that is used for this panel. This is used to find the plugin to display the panel and to migrate old panel configs. | | `repeatDirection` | string | No | `h` | Direction to repeat in if 'repeat' is set.
`h` for horizontal, `v` for vertical.
Possible values are: `h`, `v`. | -| `repeatPanelId` | integer | No | | Id of the repeating panel. | | `repeat` | string | No | | Name of template variable to repeat for. | | `tags` | string[] | No | | Tags for the panel. | | `targets` | [Target](#target)[] | No | | Depends on the panel plugin. See the plugin documentation for details. | @@ -611,9 +611,9 @@ Dashboard panels are the basic visualization building blocks. | `libraryPanel` | [LibraryPanelRef](#librarypanelref) | No | | A library panel is a reusable panel that you can use in any dashboard.
When you make a change to a library panel, that change propagates to all instances of where the panel is used.
Library panels streamline reuse of panels across multiple dashboards. | | `links` | [DashboardLink](#dashboardlink)[] | No | | Panel links. | | `maxDataPoints` | number | No | | The maximum number of data points that the panel queries are retrieving. | +| `maxPerRow` | number | No | | Option for repeated panels that controls max items per row
Only relevant for horizontally repeated panels | | `pluginVersion` | string | No | | The version of the plugin that is used for this panel. This is used to find the plugin to display the panel and to migrate old panel configs. | | `repeatDirection` | string | No | `h` | Direction to repeat in if 'repeat' is set.
`h` for horizontal, `v` for vertical.
Possible values are: `h`, `v`. | -| `repeatPanelId` | integer | No | | Id of the repeating panel. | | `repeat` | string | No | | Name of template variable to repeat for. | | `tags` | string[] | No | | Tags for the panel. | | `targets` | [Target](#target)[] | No | | Depends on the panel plugin. See the plugin documentation for details. | diff --git a/kinds/dashboard/dashboard_kind.cue b/kinds/dashboard/dashboard_kind.cue index e5a857f2223..2ea9137b538 100644 --- a/kinds/dashboard/dashboard_kind.cue +++ b/kinds/dashboard/dashboard_kind.cue @@ -539,8 +539,9 @@ lineage: schemas: [{ // `h` for horizontal, `v` for vertical. repeatDirection?: *"h" | "v" - // Id of the repeating panel. - repeatPanelId?: int64 + // Option for repeated panels that controls max items per row + // Only relevant for horizontally repeated panels + maxPerRow?: number // The maximum number of data points that the panel queries are retrieving. maxDataPoints?: number diff --git a/package.json b/package.json index 24bef121a69..55cc1a72a05 100644 --- a/package.json +++ b/package.json @@ -245,7 +245,7 @@ "@grafana/lezer-traceql": "0.0.4", "@grafana/monaco-logql": "^0.0.7", "@grafana/runtime": "workspace:*", - "@grafana/scenes": "^0.27.0", + "@grafana/scenes": "^0.29.0", "@grafana/schema": "workspace:*", "@grafana/ui": "workspace:*", "@kusto/monaco-kusto": "^7.4.0", diff --git a/packages/grafana-schema/src/raw/dashboard/x/dashboard_types.gen.ts b/packages/grafana-schema/src/raw/dashboard/x/dashboard_types.gen.ts index 72aead958dd..915757e5cd9 100644 --- a/packages/grafana-schema/src/raw/dashboard/x/dashboard_types.gen.ts +++ b/packages/grafana-schema/src/raw/dashboard/x/dashboard_types.gen.ts @@ -693,6 +693,11 @@ export interface Panel { * The maximum number of data points that the panel queries are retrieving. */ maxDataPoints?: number; + /** + * Option for repeated panels that controls max items per row + * Only relevant for horizontally repeated panels + */ + maxPerRow?: number; /** * It depends on the panel plugin. They are specified by the Options field in panel plugin schemas. */ @@ -710,10 +715,6 @@ export interface Panel { * `h` for horizontal, `v` for vertical. */ repeatDirection?: ('h' | 'v'); - /** - * Id of the repeating panel. - */ - repeatPanelId?: number; /** * Tags for the panel. */ diff --git a/pkg/kinds/dashboard/dashboard_spec_gen.go b/pkg/kinds/dashboard/dashboard_spec_gen.go index be217d196b9..867ae14949e 100644 --- a/pkg/kinds/dashboard/dashboard_spec_gen.go +++ b/pkg/kinds/dashboard/dashboard_spec_gen.go @@ -546,6 +546,10 @@ type Panel struct { // The maximum number of data points that the panel queries are retrieving. MaxDataPoints *float32 `json:"maxDataPoints,omitempty"` + // Option for repeated panels that controls max items per row + // Only relevant for horizontally repeated panels + MaxPerRow *float32 `json:"maxPerRow,omitempty"` + // It depends on the panel plugin. They are specified by the Options field in panel plugin schemas. Options map[string]any `json:"options"` @@ -559,9 +563,6 @@ type Panel struct { // `h` for horizontal, `v` for vertical. RepeatDirection *PanelRepeatDirection `json:"repeatDirection,omitempty"` - // Id of the repeating panel. - RepeatPanelId *int64 `json:"repeatPanelId,omitempty"` - // Tags for the panel. Tags []string `json:"tags,omitempty"` diff --git a/public/app/features/dashboard-scene/scene/DashboardScene.test.tsx b/public/app/features/dashboard-scene/scene/DashboardScene.test.tsx index 450799e0b79..b4cad393c7a 100644 --- a/public/app/features/dashboard-scene/scene/DashboardScene.test.tsx +++ b/public/app/features/dashboard-scene/scene/DashboardScene.test.tsx @@ -7,19 +7,19 @@ describe('DashboardScene', () => { it('Should set inspectPanelKey when url has inspect key', () => { const scene = buildTestScene(); scene.urlSync?.updateFromUrl({ inspect: '2' }); - expect(scene.state.inspectPanelId).toBe('2'); + expect(scene.state.inspectPanelKey).toBe('2'); }); it('Should handle inspect key that is not found', () => { const scene = buildTestScene(); scene.urlSync?.updateFromUrl({ inspect: '12321' }); - expect(scene.state.inspectPanelId).toBe(undefined); + expect(scene.state.inspectPanelKey).toBe(undefined); }); it('Should set viewPanelKey when url has viewPanel', () => { const scene = buildTestScene(); scene.urlSync?.updateFromUrl({ viewPanel: '2' }); - expect(scene.state.viewPanelId).toBe('2'); + expect(scene.state.viewPanelKey).toBe('2'); }); }); diff --git a/public/app/features/dashboard-scene/scene/DashboardScene.tsx b/public/app/features/dashboard-scene/scene/DashboardScene.tsx index c4b08c197f4..882cdca0d96 100644 --- a/public/app/features/dashboard-scene/scene/DashboardScene.tsx +++ b/public/app/features/dashboard-scene/scene/DashboardScene.tsx @@ -16,7 +16,7 @@ import { import { DashboardSceneRenderer } from '../scene/DashboardSceneRenderer'; import { SaveDashboardDrawer } from '../serialization/SaveDashboardDrawer'; -import { findVizPanelById, forceRenderChildren } from '../utils/utils'; +import { findVizPanelByKey, forceRenderChildren } from '../utils/utils'; import { DashboardSceneUrlSync } from './DashboardSceneUrlSync'; @@ -29,9 +29,9 @@ export interface DashboardSceneState extends SceneObjectState { isEditing?: boolean; isDirty?: boolean; /** Panel to inspect */ - inspectPanelId?: string; + inspectPanelKey?: string; /** Panel to view in full screen */ - viewPanelId?: string; + viewPanelKey?: string; /** Scene object that handles the current drawer */ drawer?: SceneObject; } @@ -128,7 +128,7 @@ export class DashboardScene extends SceneObjectBase { url: locationUtil.getUrlForPartial(location, { viewPanel: null, inspect: null }), }; - if (this.state.viewPanelId) { + if (this.state.viewPanelKey) { pageNav = { text: 'View panel', parentItem: pageNav, @@ -141,8 +141,8 @@ export class DashboardScene extends SceneObjectBase { /** * Returns the body (layout) or the full view panel */ - public getBodyToRender(viewPanelId?: string): SceneObject { - const viewPanel = findVizPanelById(this, viewPanelId); + public getBodyToRender(viewPanelKey?: string): SceneObject { + const viewPanel = findVizPanelByKey(this, viewPanelKey); return viewPanel ?? this.state.body; } diff --git a/public/app/features/dashboard-scene/scene/DashboardSceneRenderer.tsx b/public/app/features/dashboard-scene/scene/DashboardSceneRenderer.tsx index 0940fb1ee85..e02344c6938 100644 --- a/public/app/features/dashboard-scene/scene/DashboardSceneRenderer.tsx +++ b/public/app/features/dashboard-scene/scene/DashboardSceneRenderer.tsx @@ -3,7 +3,7 @@ import React from 'react'; import { useLocation } from 'react-router-dom'; import { GrafanaTheme2, PageLayoutType } from '@grafana/data'; -import { SceneComponentProps } from '@grafana/scenes'; +import { SceneComponentProps, SceneDebugger } from '@grafana/scenes'; import { CustomScrollbar, useStyles2 } from '@grafana/ui'; import { Page } from 'app/core/components/Page/Page'; @@ -11,7 +11,7 @@ import { DashboardScene } from './DashboardScene'; import { NavToolbarActions } from './NavToolbarActions'; export function DashboardSceneRenderer({ model }: SceneComponentProps) { - const { controls, viewPanelId, drawer } = model.useState(); + const { controls, viewPanelKey: viewPanelId, drawer } = model.useState(); const styles = useStyles2(getStyles); const location = useLocation(); const pageNav = model.getPageNav(location); @@ -27,6 +27,7 @@ export function DashboardSceneRenderer({ model }: SceneComponentProps ( ))} + )}
diff --git a/public/app/features/dashboard-scene/scene/DashboardSceneUrlSync.ts b/public/app/features/dashboard-scene/scene/DashboardSceneUrlSync.ts index 0dc7f3c3054..23aa21e68e4 100644 --- a/public/app/features/dashboard-scene/scene/DashboardSceneUrlSync.ts +++ b/public/app/features/dashboard-scene/scene/DashboardSceneUrlSync.ts @@ -4,7 +4,7 @@ import { SceneObjectUrlSyncHandler, SceneObjectUrlValues } from '@grafana/scenes import appEvents from 'app/core/app_events'; import { PanelInspectDrawer } from '../inspect/PanelInspectDrawer'; -import { findVizPanelById } from '../utils/utils'; +import { findVizPanelByKey } from '../utils/utils'; import { DashboardScene, DashboardSceneState } from './DashboardScene'; @@ -17,41 +17,41 @@ export class DashboardSceneUrlSync implements SceneObjectUrlSyncHandler { getUrlState(): SceneObjectUrlValues { const state = this._scene.state; - return { inspect: state.inspectPanelId, viewPanel: state.viewPanelId }; + return { inspect: state.inspectPanelKey, viewPanel: state.viewPanelKey }; } updateFromUrl(values: SceneObjectUrlValues): void { - const { inspectPanelId, viewPanelId } = this._scene.state; + const { inspectPanelKey: inspectPanelId, viewPanelKey: viewPanelId } = this._scene.state; const update: Partial = {}; // Handle inspect object state if (typeof values.inspect === 'string') { - const panel = findVizPanelById(this._scene, values.inspect); + const panel = findVizPanelByKey(this._scene, values.inspect); if (!panel) { appEvents.emit(AppEvents.alertError, ['Panel not found']); locationService.partial({ inspect: null }); return; } - update.inspectPanelId = values.inspect; + update.inspectPanelKey = values.inspect; update.drawer = new PanelInspectDrawer(panel); } else if (inspectPanelId) { - update.inspectPanelId = undefined; + update.inspectPanelKey = undefined; update.drawer = undefined; } // Handle view panel state if (typeof values.viewPanel === 'string') { - const panel = findVizPanelById(this._scene, values.viewPanel); + const panel = findVizPanelByKey(this._scene, values.viewPanel); if (!panel) { appEvents.emit(AppEvents.alertError, ['Panel not found']); locationService.partial({ viewPanel: null }); return; } - update.viewPanelId = values.viewPanel; + update.viewPanelKey = values.viewPanel; } else if (viewPanelId) { - update.viewPanelId = undefined; + update.viewPanelKey = undefined; } if (Object.keys(update).length > 0) { diff --git a/public/app/features/dashboard-scene/scene/NavToolbarActions.tsx b/public/app/features/dashboard-scene/scene/NavToolbarActions.tsx index 6156fe733c2..85c3e32a480 100644 --- a/public/app/features/dashboard-scene/scene/NavToolbarActions.tsx +++ b/public/app/features/dashboard-scene/scene/NavToolbarActions.tsx @@ -13,7 +13,7 @@ interface Props { } export const NavToolbarActions = React.memo(({ dashboard }) => { - const { actions = [], isEditing, viewPanelId, isDirty, uid } = dashboard.useState(); + const { actions = [], isEditing, viewPanelKey, isDirty, uid } = dashboard.useState(); const toolbarActions = (actions ?? []).map((action) => ); if (uid) { @@ -29,7 +29,7 @@ export const NavToolbarActions = React.memo(({ dashboard }) => { toolbarActions.push(); - if (viewPanelId) { + if (viewPanelKey) { toolbarActions.push(