From 2599f9985f33cc4d3d8f13f8ac5f9e70a1464b2c Mon Sep 17 00:00:00 2001 From: "grafana-delivery-bot[bot]" <132647405+grafana-delivery-bot[bot]@users.noreply.github.com> Date: Wed, 10 Apr 2024 08:25:36 +0200 Subject: [PATCH] [v11.0.x] Dashboard scenes: Fix export tab not including variables when exporting externally (#85824) Dashboard scenes: Fix export tab not including variables when exporting externally (#85807) Fix export tab not including variables when exporting externally (cherry picked from commit 96abe65fe4cc6961fdbc52793e23fcff3d9661c7) Co-authored-by: Oscar Kilhed --- .../dashboard-scene/sharing/ShareExportTab.tsx | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/public/app/features/dashboard-scene/sharing/ShareExportTab.tsx b/public/app/features/dashboard-scene/sharing/ShareExportTab.tsx index 979ad00acec..f1e669d4ac1 100644 --- a/public/app/features/dashboard-scene/sharing/ShareExportTab.tsx +++ b/public/app/features/dashboard-scene/sharing/ShareExportTab.tsx @@ -11,12 +11,11 @@ import { shareDashboardType } from 'app/features/dashboard/components/ShareModal import { DashboardModel } from 'app/features/dashboard/state'; import { transformSceneToSaveModel } from '../serialization/transformSceneToSaveModel'; +import { getVariablesCompatibility } from '../utils/getVariablesCompatibility'; import { DashboardInteractions } from '../utils/interactions'; import { SceneShareTabState } from './types'; -const exportExternallyTranslation = t('share-modal.export.share-externally-label', `Export for sharing externally`); - interface ShareExportTabState extends SceneShareTabState { isSharingExternally?: boolean; isViewingJSON?: boolean; @@ -61,7 +60,13 @@ export class ShareExportTab extends SceneObjectBase { const saveModel = transformSceneToSaveModel(dashboardRef.resolve()); const exportable = isSharingExternally - ? await this._exporter.makeExportable(new DashboardModel(saveModel)) + ? await this._exporter.makeExportable( + new DashboardModel(saveModel, undefined, { + getVariablesFromState: () => { + return getVariablesCompatibility(window.__grafanaSceneContext); + }, + }) + ) : saveModel; return exportable; @@ -100,6 +105,8 @@ function ShareExportTabRenderer({ model }: SceneComponentProps) return ''; }, [isViewingJSON]); + const exportExternallyTranslation = t('share-modal.export.share-externally-label', `Export for sharing externally`); + return ( <> {!isViewingJSON && (