diff --git a/docs/sources/developers/kinds/core/dashboard/schema-reference.md b/docs/sources/developers/kinds/core/dashboard/schema-reference.md
index edb577ff4ba..d8c585fbae3 100644
--- a/docs/sources/developers/kinds/core/dashboard/schema-reference.md
+++ b/docs/sources/developers/kinds/core/dashboard/schema-reference.md
@@ -450,7 +450,6 @@ Dashboard panels are the basic visualization building blocks.
| `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`. |
| `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. |
| `timeFrom` | string | No | | Overrides the relative time range for individual panels,
which causes them to be different than what is selected in
the dashboard time picker in the top-right corner of the dashboard. You can use this to show metrics from different
time periods or days on the same dashboard.
The value is formatted as time operation like: `now-5m` (Last 5 minutes), `now/d` (the day so far),
`now-5d/d`(Last 5 days), `now/w` (This week so far), `now-2y/y` (Last 2 years).
Note: Panel time overrides have no effect when the dashboard’s time range is absolute.
See: https://grafana.com/docs/grafana/latest/panels-visualizations/query-transform-data/#query-options |
| `timeShift` | string | No | | Overrides the time range for individual panels by shifting its start and end relative to the time picker.
For example, you can shift the time range for the panel to be two hours earlier than the dashboard time picker setting `2h`.
Note: Panel time overrides have no effect when the dashboard’s time range is absolute.
See: https://grafana.com/docs/grafana/latest/panels-visualizations/query-transform-data/#query-options |
@@ -515,7 +514,6 @@ Dashboard panels are the basic visualization building blocks.
| `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`. |
| `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. |
| `timeFrom` | string | No | | Overrides the relative time range for individual panels,
which causes them to be different than what is selected in
the dashboard time picker in the top-right corner of the dashboard. You can use this to show metrics from different
time periods or days on the same dashboard.
The value is formatted as time operation like: `now-5m` (Last 5 minutes), `now/d` (the day so far),
`now-5d/d`(Last 5 days), `now/w` (This week so far), `now-2y/y` (Last 2 years).
Note: Panel time overrides have no effect when the dashboard’s time range is absolute.
See: https://grafana.com/docs/grafana/latest/panels-visualizations/query-transform-data/#query-options |
| `timeShift` | string | No | | Overrides the time range for individual panels by shifting its start and end relative to the time picker.
For example, you can shift the time range for the panel to be two hours earlier than the dashboard time picker setting `2h`.
Note: Panel time overrides have no effect when the dashboard’s time range is absolute.
See: https://grafana.com/docs/grafana/latest/panels-visualizations/query-transform-data/#query-options |
diff --git a/kinds/dashboard/dashboard_kind.cue b/kinds/dashboard/dashboard_kind.cue
index c3f2d8df778..e2e76e4d66f 100644
--- a/kinds/dashboard/dashboard_kind.cue
+++ b/kinds/dashboard/dashboard_kind.cue
@@ -521,9 +521,6 @@ lineage: schemas: [{
// 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.
pluginVersion?: string
- // Tags for the panel.
- tags?: [...string]
-
// Depends on the panel plugin. See the plugin documentation for details.
targets?: [...#Target]
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 13be7bf93dd..2a58b2f1b55 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
@@ -757,10 +757,6 @@ export interface Panel {
* `h` for horizontal, `v` for vertical.
*/
repeatDirection?: ('h' | 'v');
- /**
- * Tags for the panel.
- */
- tags?: Array;
/**
* Depends on the panel plugin. See the plugin documentation for details.
*/
@@ -806,7 +802,6 @@ export interface Panel {
export const defaultPanel: Partial = {
links: [],
repeatDirection: 'h',
- tags: [],
targets: [],
transformations: [],
transparent: false,
diff --git a/pkg/kinds/dashboard/dashboard_spec_gen.go b/pkg/kinds/dashboard/dashboard_spec_gen.go
index d5a6b08a74e..4f9d9dcad48 100644
--- a/pkg/kinds/dashboard/dashboard_spec_gen.go
+++ b/pkg/kinds/dashboard/dashboard_spec_gen.go
@@ -558,9 +558,6 @@ type Panel struct {
// `h` for horizontal, `v` for vertical.
RepeatDirection *PanelRepeatDirection `json:"repeatDirection,omitempty"`
- // Tags for the panel.
- Tags []string `json:"tags,omitempty"`
-
// Depends on the panel plugin. See the plugin documentation for details.
Targets []Target `json:"targets,omitempty"`
diff --git a/public/app/features/dashboard-scene/serialization/__snapshots__/transformSceneToSaveModel.test.ts.snap b/public/app/features/dashboard-scene/serialization/__snapshots__/transformSceneToSaveModel.test.ts.snap
index 312b0161df7..e1e73f86f7d 100644
--- a/public/app/features/dashboard-scene/serialization/__snapshots__/transformSceneToSaveModel.test.ts.snap
+++ b/public/app/features/dashboard-scene/serialization/__snapshots__/transformSceneToSaveModel.test.ts.snap
@@ -110,7 +110,6 @@ exports[`transformSceneToSaveModel Given a scene with rows Should transform back
"y": 1,
},
"id": 15,
- "links": [],
"options": {
"code": {
"language": "plaintext",
@@ -124,9 +123,8 @@ exports[`transformSceneToSaveModel Given a scene with rows Should transform back
",
"mode": "markdown",
},
+ "pluginVersion": "10.2.0-pre",
"title": "",
- "transformations": [],
- "transparent": false,
"type": "text",
},
{
@@ -165,7 +163,6 @@ exports[`transformSceneToSaveModel Given a scene with rows Should transform back
"y": 26,
},
"id": 30,
- "links": [],
"options": {
"code": {
"language": "plaintext",
@@ -177,9 +174,8 @@ exports[`transformSceneToSaveModel Given a scene with rows Should transform back
",
"mode": "markdown",
},
+ "pluginVersion": "10.2.0-pre",
"title": "Text panel in collapsed row",
- "transformations": [],
- "transparent": false,
"type": "text",
},
],
@@ -378,7 +374,6 @@ exports[`transformSceneToSaveModel Given a simple scene with custom settings Sho
"y": 0,
},
"id": 28,
- "links": [],
"options": {
"legend": {
"calcs": [],
@@ -404,8 +399,6 @@ exports[`transformSceneToSaveModel Given a simple scene with custom settings Sho
},
],
"title": "Simple time series graph ",
- "transformations": [],
- "transparent": false,
"type": "timeseries",
},
{
@@ -437,7 +430,6 @@ exports[`transformSceneToSaveModel Given a simple scene with custom settings Sho
"y": 9,
},
"id": 29,
- "links": [],
"options": {},
"targets": [
{
@@ -452,8 +444,6 @@ exports[`transformSceneToSaveModel Given a simple scene with custom settings Sho
},
],
"title": "panel inside row",
- "transformations": [],
- "transparent": false,
"type": "timeseries",
},
{
@@ -468,7 +458,6 @@ exports[`transformSceneToSaveModel Given a simple scene with custom settings Sho
"y": 9,
},
"id": 25,
- "links": [],
"options": {
"code": {
"language": "plaintext",
@@ -478,8 +467,8 @@ exports[`transformSceneToSaveModel Given a simple scene with custom settings Sho
"content": "content",
"mode": "markdown",
},
+ "pluginVersion": "10.2.0-pre",
"title": "Transparent text panel",
- "transformations": [],
"transparent": true,
"type": "text",
},
@@ -697,7 +686,6 @@ exports[`transformSceneToSaveModel Given a simple scene with variables Should tr
"y": 0,
},
"id": 28,
- "links": [],
"options": {
"legend": {
"calcs": [],
@@ -723,8 +711,6 @@ exports[`transformSceneToSaveModel Given a simple scene with variables Should tr
},
],
"title": "Simple time series graph ",
- "transformations": [],
- "transparent": false,
"type": "timeseries",
},
{
@@ -756,7 +742,6 @@ exports[`transformSceneToSaveModel Given a simple scene with variables Should tr
"y": 9,
},
"id": 29,
- "links": [],
"options": {},
"targets": [
{
@@ -771,8 +756,6 @@ exports[`transformSceneToSaveModel Given a simple scene with variables Should tr
},
],
"title": "panel inside row",
- "transformations": [],
- "transparent": false,
"type": "timeseries",
},
{
@@ -787,7 +770,6 @@ exports[`transformSceneToSaveModel Given a simple scene with variables Should tr
"y": 9,
},
"id": 25,
- "links": [],
"options": {
"code": {
"language": "plaintext",
@@ -797,8 +779,8 @@ exports[`transformSceneToSaveModel Given a simple scene with variables Should tr
"content": "content",
"mode": "markdown",
},
+ "pluginVersion": "10.2.0-pre",
"title": "Transparent text panel",
- "transformations": [],
"transparent": true,
"type": "text",
},
diff --git a/public/app/features/dashboard-scene/serialization/transformSceneToSaveModel.ts b/public/app/features/dashboard-scene/serialization/transformSceneToSaveModel.ts
index 8639b905295..e4b5d8799f1 100644
--- a/public/app/features/dashboard-scene/serialization/transformSceneToSaveModel.ts
+++ b/public/app/features/dashboard-scene/serialization/transformSceneToSaveModel.ts
@@ -7,7 +7,6 @@ import {
SceneGridLayout,
SceneGridRow,
VizPanel,
- SceneQueryRunner,
SceneDataTransformer,
SceneVariableSet,
AdHocFilterSet,
@@ -39,7 +38,7 @@ import { PanelRepeaterGridItem } from '../scene/PanelRepeaterGridItem';
import { PanelTimeRange } from '../scene/PanelTimeRange';
import { RowRepeaterBehavior } from '../scene/RowRepeaterBehavior';
import { dashboardSceneGraph } from '../utils/dashboardSceneGraph';
-import { getPanelIdForVizPanel } from '../utils/utils';
+import { getPanelIdForVizPanel, getQueryRunnerFor } from '../utils/utils';
import { GRAFANA_DATASOURCE_REF } from './const';
import { dataLayersToAnnotations } from './dataLayersToAnnotations';
@@ -208,6 +207,7 @@ export function gridItemToPanel(gridItem: SceneGridItemLike, isSnapshot = false)
fieldConfig: (vizPanel.state.fieldConfig as FieldConfigSource) ?? { defaults: {}, overrides: [] },
transformations: [],
transparent: vizPanel.state.displayMode === 'transparent',
+ pluginVersion: vizPanel.state.pluginVersion,
...vizPanelDataToPanel(vizPanel, isSnapshot),
};
@@ -228,6 +228,18 @@ export function gridItemToPanel(gridItem: SceneGridItemLike, isSnapshot = false)
const panelLinks = dashboardSceneGraph.getPanelLinks(vizPanel);
panel.links = (panelLinks.state.rawLinks as DashboardLink[]) ?? [];
+ if (panel.links.length === 0) {
+ delete panel.links;
+ }
+
+ if (panel.transformations?.length === 0) {
+ delete panel.transformations;
+ }
+
+ if (!panel.transparent) {
+ delete panel.transparent;
+ }
+
return panel;
}
@@ -238,24 +250,15 @@ function vizPanelDataToPanel(
const dataProvider = vizPanel.state.$data;
const panel: Pick = {};
+ const queryRunner = getQueryRunnerFor(vizPanel);
- // Regular queries handling
- if (dataProvider instanceof SceneQueryRunner) {
- panel.targets = dataProvider.state.queries;
- panel.maxDataPoints = dataProvider.state.maxDataPoints;
- panel.datasource = dataProvider.state.datasource;
+ if (queryRunner) {
+ panel.targets = queryRunner.state.queries;
+ panel.maxDataPoints = queryRunner.state.maxDataPoints;
+ panel.datasource = queryRunner.state.datasource;
}
- // Transformations handling
if (dataProvider instanceof SceneDataTransformer) {
- const panelData = dataProvider.state.$data;
-
- if (panelData instanceof SceneQueryRunner) {
- panel.targets = panelData.state.queries;
- panel.maxDataPoints = panelData.state.maxDataPoints;
- panel.datasource = panelData.state.datasource;
- }
-
panel.transformations = dataProvider.state.transformations as DataTransformerConfig[];
}
diff --git a/public/app/features/dashboard/state/PanelModel.ts b/public/app/features/dashboard/state/PanelModel.ts
index 5a91423ec81..be6821aabe3 100644
--- a/public/app/features/dashboard/state/PanelModel.ts
+++ b/public/app/features/dashboard/state/PanelModel.ts
@@ -121,6 +121,8 @@ const defaults: any = {
cachedPluginOptions: {},
transparent: false,
options: {},
+ links: [],
+ transformations: [],
fieldConfig: {
defaults: {},
overrides: [],