diff --git a/public/app/features/dashboard-scene/sharing/ShareExportTab.tsx b/public/app/features/dashboard-scene/sharing/ShareExportTab.tsx index 9833c33fc67..eca7426b9ff 100644 --- a/public/app/features/dashboard-scene/sharing/ShareExportTab.tsx +++ b/public/app/features/dashboard-scene/sharing/ShareExportTab.tsx @@ -2,7 +2,6 @@ import saveAs from 'file-saver'; import { useAsync } from 'react-use'; import AutoSizer from 'react-virtualized-auto-sizer'; -import { config } from '@grafana/runtime'; import { SceneComponentProps, SceneObjectBase } from '@grafana/scenes'; import { Button, ClipboardButton, CodeEditor, Field, Modal, Stack, Switch } from '@grafana/ui'; import { t, Trans } from 'app/core/internationalization'; @@ -11,7 +10,6 @@ import { shareDashboardType } from 'app/features/dashboard/components/ShareModal import { DashboardModel } from 'app/features/dashboard/state'; import { transformSceneToSaveModel } from '../serialization/transformSceneToSaveModel'; -import { transformSceneToSaveModelSchemaV2 } from '../serialization/transformSceneToSaveModelSchemaV2'; import { getVariablesCompatibility } from '../utils/getVariablesCompatibility'; import { DashboardInteractions } from '../utils/interactions'; import { getDashboardSceneFor } from '../utils/utils'; @@ -21,7 +19,6 @@ import { SceneShareTabState, ShareView } from './types'; export interface ShareExportTabState extends SceneShareTabState { isSharingExternally?: boolean; isViewingJSON?: boolean; - isViewingJSONSchemaV2?: boolean; } export class ShareExportTab extends SceneObjectBase implements ShareView { @@ -54,12 +51,6 @@ export class ShareExportTab extends SceneObjectBase impleme }); }; - public onViewJSONSchemaV2 = () => { - this.setState({ - isViewingJSONSchemaV2: !this.state.isViewingJSONSchemaV2, - }); - }; - public getClipboardText() { return; } @@ -81,23 +72,6 @@ export class ShareExportTab extends SceneObjectBase impleme return exportable; }; - public getExportableDashboardJsonSchemaV2 = async () => { - // const { isSharingExternally } = this.state; - const saveModel = transformSceneToSaveModelSchemaV2(getDashboardSceneFor(this)); - - // const exportable = isSharingExternally - // ? await this._exporter.makeExportable( - // new DashboardModel(saveModel, undefined, { - // getVariablesFromState: () => { - // return getVariablesCompatibility(window.__grafanaSceneContext); - // }, - // }) - // ) - // : saveModel; - - return saveModel; - }; - public onSaveAsFile = async () => { const dashboardJson = await this.getExportableDashboardJson(); const dashboardJsonPretty = JSON.stringify(dashboardJson, null, 2); @@ -120,9 +94,7 @@ export class ShareExportTab extends SceneObjectBase impleme } function ShareExportTabRenderer({ model }: SceneComponentProps) { - const { isSharingExternally, isViewingJSON, modalRef, isViewingJSONSchemaV2 } = model.useState(); - // use dashboardSchemaV2 to show new button, this is for internal testing - const shouldShowNewSchemaV2Button = config.featureToggles.dashboardSchemaV2 ?? false; + const { isSharingExternally, isViewingJSON, modalRef } = model.useState(); const dashboardJson = useAsync(async () => { if (isViewingJSON) { const json = await model.getExportableDashboardJson(); @@ -132,20 +104,11 @@ function ShareExportTabRenderer({ model }: SceneComponentProps) return ''; }, [isViewingJSON]); - const dashboardJsonSchemaV2 = useAsync(async () => { - if (isViewingJSONSchemaV2) { - const json = await model.getExportableDashboardJsonSchemaV2(); - console.log('json v2', json); - return JSON.stringify(json, null, 2); - } - return ''; - }, [isViewingJSONSchemaV2]); - const exportExternallyTranslation = t('share-modal.export.share-externally-label', `Export for sharing externally`); return ( <> - {!isViewingJSON && !isViewingJSONSchemaV2 && ( + {!isViewingJSON && ( <>

Export this dashboard. @@ -173,11 +136,6 @@ function ShareExportTabRenderer({ model }: SceneComponentProps) - {shouldShowNewSchemaV2Button && ( - - )} @@ -231,52 +189,6 @@ function ShareExportTabRenderer({ model }: SceneComponentProps) )} - {isViewingJSONSchemaV2 && ( - <> - - {({ width }) => { - if (dashboardJsonSchemaV2.value) { - return ( - - ); - } - - if (dashboardJsonSchemaV2.loading) { - return ( -

- Loading... -
- ); - } - - return null; - }} - - - - - dashboardJson.value ?? ''} - > - Copy to Clipboard - - - - - )} ); } diff --git a/public/locales/en-US/grafana.json b/public/locales/en-US/grafana.json index 919d3af863d..ff385eca064 100644 --- a/public/locales/en-US/grafana.json +++ b/public/locales/en-US/grafana.json @@ -2937,8 +2937,7 @@ "loading": "Loading...", "save-button": "Save to file", "share-externally-label": "Export for sharing externally", - "view-button": "View JSON", - "view-button-schemav2": "View JSON SchemaV2" + "view-button": "View JSON" }, "library": { "info": "Create library panel." diff --git a/public/locales/pseudo-LOCALE/grafana.json b/public/locales/pseudo-LOCALE/grafana.json index bf2ea270830..e642ff56ecb 100644 --- a/public/locales/pseudo-LOCALE/grafana.json +++ b/public/locales/pseudo-LOCALE/grafana.json @@ -2937,8 +2937,7 @@ "loading": "Ŀőäđįʼnģ...", "save-button": "Ŝävę ŧő ƒįľę", "share-externally-label": "Ēχpőřŧ ƒőř şĥäřįʼnģ ęχŧęřʼnäľľy", - "view-button": "Vįęŵ ĴŜØŃ", - "view-button-schemav2": "Vįęŵ ĴŜØŃ ŜčĥęmäV2" + "view-button": "Vįęŵ ĴŜØŃ" }, "library": { "info": "Cřęäŧę ľįþřäřy päʼnęľ."