mirror of
https://github.com/grafana/grafana.git
synced 2024-11-22 08:56:43 -06:00
DashboardScene: Include url params when switching from old dashboard arch to new (#74969)
* DashboardScene: Include url params when switching from old dashboard arch to new * remove imports * fix
This commit is contained in:
parent
28b4d7fa0c
commit
3529b7413d
@ -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(),
|
||||
});
|
||||
|
||||
|
@ -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,
|
||||
|
@ -10,7 +10,6 @@ import {
|
||||
SceneGridLayout,
|
||||
SceneObject,
|
||||
SceneObjectBase,
|
||||
SceneObjectRef,
|
||||
SceneObjectState,
|
||||
SceneObjectStateChangedEvent,
|
||||
sceneUtils,
|
||||
@ -129,7 +128,7 @@ export class DashboardScene extends SceneObjectBase<DashboardSceneState> {
|
||||
};
|
||||
|
||||
public onSave = () => {
|
||||
this.setState({ overlay: new SaveDashboardDrawer({ dashboardRef: new SceneObjectRef(this) }) });
|
||||
this.setState({ overlay: new SaveDashboardDrawer({ dashboardRef: this.getRef() }) });
|
||||
};
|
||||
|
||||
public getPageNav(location: H.Location) {
|
||||
|
@ -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;
|
||||
|
@ -202,7 +202,10 @@ export const DashNav = React.memo<Props>((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}`);
|
||||
}}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user