mirror of
https://github.com/grafana/grafana.git
synced 2024-12-01 13:09:22 -06:00
DashboardScene: Update tracking behavior (#80057)
This commit is contained in:
parent
99f7110e39
commit
47b986606e
@ -138,7 +138,7 @@ describe('transformSaveModelToScene', () => {
|
||||
|
||||
const scene = createDashboardSceneFromDashboardModel(oldModel);
|
||||
|
||||
expect(scene.state.$behaviors).toHaveLength(3);
|
||||
expect(scene.state.$behaviors).toHaveLength(4);
|
||||
expect(scene.state.$behaviors![1]).toBeInstanceOf(behaviors.CursorSync);
|
||||
expect((scene.state.$behaviors![1] as behaviors.CursorSync).state.sync).toEqual(DashboardCursorSync.Crosshair);
|
||||
});
|
||||
|
@ -68,10 +68,7 @@ export function transformSaveModelToScene(rsp: DashboardDTO): DashboardScene {
|
||||
autoMigrateOldPanels: false,
|
||||
});
|
||||
|
||||
const scene = createDashboardSceneFromDashboardModel(oldModel);
|
||||
scene.state.$behaviors?.push(registerDashboardSceneTracking(oldModel, rsp.dashboard.version));
|
||||
|
||||
return scene;
|
||||
return createDashboardSceneFromDashboardModel(oldModel);
|
||||
}
|
||||
|
||||
export function createSceneObjectsForPanels(oldPanels: PanelModel[]): SceneGridItemLike[] {
|
||||
@ -261,6 +258,7 @@ export function createDashboardSceneFromDashboardModel(oldModel: DashboardModel)
|
||||
new behaviors.CursorSync({
|
||||
sync: oldModel.graphTooltip,
|
||||
}),
|
||||
registerDashboardSceneTracking(oldModel),
|
||||
registerPanelInteractionsReporter,
|
||||
],
|
||||
$data:
|
||||
@ -484,11 +482,11 @@ const getLimitedDescriptionReporter = () => {
|
||||
};
|
||||
};
|
||||
|
||||
function registerDashboardSceneTracking(model: DashboardModel, version?: number) {
|
||||
function registerDashboardSceneTracking(model: DashboardModel) {
|
||||
return () => {
|
||||
const unsetDashboardInteractionsScenesContext = DashboardInteractions.setScenesContext();
|
||||
|
||||
trackDashboardLoaded(model, version);
|
||||
trackDashboardLoaded(model, model.version);
|
||||
|
||||
return () => {
|
||||
unsetDashboardInteractionsScenesContext();
|
||||
|
Loading…
Reference in New Issue
Block a user