diff --git a/public/app/features/dashboard-scene/inspect/InspectJsonTab.test.tsx b/public/app/features/dashboard-scene/inspect/InspectJsonTab.test.tsx index cec2bed4924..b1b91bc6ec1 100644 --- a/public/app/features/dashboard-scene/inspect/InspectJsonTab.test.tsx +++ b/public/app/features/dashboard-scene/inspect/InspectJsonTab.test.tsx @@ -7,7 +7,6 @@ import { SceneDataTransformer, SceneGridItem, SceneGridLayout, - SceneObjectRef, VizPanel, } from '@grafana/scenes'; import { getStandardTransformers } from 'app/features/transformers/standardTransformers'; @@ -154,7 +153,7 @@ async function buildTestScene() { await new Promise((r) => setTimeout(r, 1)); const tab = new InspectJsonTab({ - panelRef: new SceneObjectRef(panel), + panelRef: panel.getRef(), onClose: jest.fn(), }); diff --git a/public/app/features/dashboard-scene/panel-edit/PanelEditor.tsx b/public/app/features/dashboard-scene/panel-edit/PanelEditor.tsx index 2a5f0ab299a..ee947819c40 100644 --- a/public/app/features/dashboard-scene/panel-edit/PanelEditor.tsx +++ b/public/app/features/dashboard-scene/panel-edit/PanelEditor.tsx @@ -113,9 +113,9 @@ export function buildPanelEditScene(dashboard: DashboardScene, panel: VizPanel): const dashboardStateCloned = sceneUtils.cloneSceneObjectState(dashboard.state); return new PanelEditor({ - dashboardRef: new SceneObjectRef(dashboard), - sourcePanelRef: new SceneObjectRef(panel), - panelRef: new SceneObjectRef(panelClone), + dashboardRef: dashboard.getRef(), + sourcePanelRef: panel.getRef(), + panelRef: panelClone.getRef(), controls: dashboardStateCloned.controls, $variables: dashboardStateCloned.$variables, $timeRange: dashboardStateCloned.$timeRange, diff --git a/public/app/features/dashboard-scene/scene/DashboardScene.tsx b/public/app/features/dashboard-scene/scene/DashboardScene.tsx index 3d49708827d..3f18deb083f 100644 --- a/public/app/features/dashboard-scene/scene/DashboardScene.tsx +++ b/public/app/features/dashboard-scene/scene/DashboardScene.tsx @@ -10,7 +10,6 @@ import { SceneGridLayout, SceneObject, SceneObjectBase, - SceneObjectRef, SceneObjectState, SceneObjectStateChangedEvent, sceneUtils, @@ -129,7 +128,7 @@ export class DashboardScene extends SceneObjectBase { }; public onSave = () => { - this.setState({ overlay: new SaveDashboardDrawer({ dashboardRef: new SceneObjectRef(this) }) }); + this.setState({ overlay: new SaveDashboardDrawer({ dashboardRef: this.getRef() }) }); }; public getPageNav(location: H.Location) { diff --git a/public/app/features/dashboard-scene/scene/DashboardSceneUrlSync.ts b/public/app/features/dashboard-scene/scene/DashboardSceneUrlSync.ts index f94a248ab65..58ccccc5b94 100644 --- a/public/app/features/dashboard-scene/scene/DashboardSceneUrlSync.ts +++ b/public/app/features/dashboard-scene/scene/DashboardSceneUrlSync.ts @@ -1,6 +1,6 @@ import { AppEvents } from '@grafana/data'; import { locationService } from '@grafana/runtime'; -import { SceneObjectRef, SceneObjectUrlSyncHandler, SceneObjectUrlValues } from '@grafana/scenes'; +import { SceneObjectUrlSyncHandler, SceneObjectUrlValues } from '@grafana/scenes'; import appEvents from 'app/core/app_events'; import { PanelInspectDrawer } from '../inspect/PanelInspectDrawer'; @@ -34,7 +34,7 @@ export class DashboardSceneUrlSync implements SceneObjectUrlSyncHandler { } update.inspectPanelKey = values.inspect; - update.overlay = new PanelInspectDrawer({ panelRef: new SceneObjectRef(panel) }); + update.overlay = new PanelInspectDrawer({ panelRef: panel.getRef() }); } else if (inspectPanelId) { update.inspectPanelKey = undefined; update.overlay = undefined; diff --git a/public/app/features/dashboard/components/DashNav/DashNav.tsx b/public/app/features/dashboard/components/DashNav/DashNav.tsx index 05dc6a57c1e..1030d84cf29 100644 --- a/public/app/features/dashboard/components/DashNav/DashNav.tsx +++ b/public/app/features/dashboard/components/DashNav/DashNav.tsx @@ -202,7 +202,10 @@ export const DashNav = React.memo((props) => { key="button-scenes" tooltip={'View as Scene'} icon="apps" - onClick={() => locationService.push(`/scenes/dashboard/${dashboard.uid}`)} + onClick={() => { + const location = locationService.getLocation(); + locationService.push(`/scenes/dashboard/${dashboard.uid}${location.search}`); + }} /> ); }