mirror of
https://github.com/grafana/grafana.git
synced 2024-11-25 18:30:41 -06:00
DashboardsLoader: Enable cursor sync in scenes based dashboard (#73383)
* Bump scenes * Enable cursor sync in scene dashboard
This commit is contained in:
parent
3245e25273
commit
30393459df
@ -244,7 +244,7 @@
|
||||
"@grafana/lezer-traceql": "0.0.4",
|
||||
"@grafana/monaco-logql": "^0.0.7",
|
||||
"@grafana/runtime": "workspace:*",
|
||||
"@grafana/scenes": "0.22.0",
|
||||
"@grafana/scenes": "0.24.0",
|
||||
"@grafana/schema": "workspace:*",
|
||||
"@grafana/ui": "workspace:*",
|
||||
"@kusto/monaco-kusto": "^7.4.0",
|
||||
|
@ -1,6 +1,7 @@
|
||||
import { getPanelPlugin } from '@grafana/data/test/__mocks__/pluginMocks';
|
||||
import { config, locationService } from '@grafana/runtime';
|
||||
import {
|
||||
behaviors,
|
||||
CustomVariable,
|
||||
DataSourceVariable,
|
||||
getUrlSyncManager,
|
||||
@ -12,7 +13,7 @@ import {
|
||||
SceneQueryRunner,
|
||||
VizPanel,
|
||||
} from '@grafana/scenes';
|
||||
import { defaultDashboard, LoadingState, Panel, RowPanel, VariableType } from '@grafana/schema';
|
||||
import { DashboardCursorSync, defaultDashboard, LoadingState, Panel, RowPanel, VariableType } from '@grafana/schema';
|
||||
import { DashboardModel, PanelModel } from 'app/features/dashboard/state';
|
||||
import { createPanelJSONFixture } from 'app/features/dashboard/state/__fixtures__/dashboardFixtures';
|
||||
import { SHARED_DASHBOARD_QUERY } from 'app/plugins/datasource/dashboard';
|
||||
@ -139,6 +140,20 @@ describe('DashboardLoader', () => {
|
||||
expect(scene.state?.$variables?.state.variables).toHaveLength(1);
|
||||
expect(scene.state.controls).toBeDefined();
|
||||
});
|
||||
|
||||
it('should apply cursor sync behavior', () => {
|
||||
const dash = {
|
||||
...defaultDashboard,
|
||||
graphTooltip: DashboardCursorSync.Crosshair,
|
||||
};
|
||||
const oldModel = new DashboardModel(dash);
|
||||
|
||||
const scene = createDashboardSceneFromDashboardModel(oldModel);
|
||||
|
||||
expect(scene.state.$behaviors).toHaveLength(1);
|
||||
expect(scene.state.$behaviors![0]).toBeInstanceOf(behaviors.CursorSync);
|
||||
expect((scene.state.$behaviors![0] as behaviors.CursorSync).state.sync).toEqual(DashboardCursorSync.Crosshair);
|
||||
});
|
||||
});
|
||||
|
||||
describe('when organizing panels as scene children', () => {
|
||||
|
@ -27,6 +27,7 @@ import {
|
||||
SceneObject,
|
||||
SceneControlsSpacer,
|
||||
VizPanelMenu,
|
||||
behaviors,
|
||||
} from '@grafana/scenes';
|
||||
import { StateManagerBase } from 'app/core/services/StateManagerBase';
|
||||
import { dashboardLoaderSrv } from 'app/features/dashboard/services/DashboardLoaderSrv';
|
||||
@ -194,6 +195,12 @@ export function createDashboardSceneFromDashboardModel(oldModel: DashboardModel)
|
||||
}),
|
||||
$timeRange: new SceneTimeRange(oldModel.time),
|
||||
$variables: variables,
|
||||
$behaviors: [
|
||||
new behaviors.CursorSync({
|
||||
key: 'dashboard',
|
||||
sync: oldModel.graphTooltip,
|
||||
}),
|
||||
],
|
||||
controls: controls,
|
||||
});
|
||||
}
|
||||
|
18
yarn.lock
18
yarn.lock
@ -3929,9 +3929,9 @@ __metadata:
|
||||
languageName: unknown
|
||||
linkType: soft
|
||||
|
||||
"@grafana/scenes@npm:0.22.0":
|
||||
version: 0.22.0
|
||||
resolution: "@grafana/scenes@npm:0.22.0"
|
||||
"@grafana/scenes@npm:0.24.0":
|
||||
version: 0.24.0
|
||||
resolution: "@grafana/scenes@npm:0.24.0"
|
||||
dependencies:
|
||||
"@grafana/e2e-selectors": 10.0.2
|
||||
react-grid-layout: 1.3.4
|
||||
@ -3939,11 +3939,11 @@ __metadata:
|
||||
react-virtualized-auto-sizer: 1.0.7
|
||||
uuid: ^9.0.0
|
||||
peerDependencies:
|
||||
"@grafana/data": 10.0.2
|
||||
"@grafana/runtime": 10.0.2
|
||||
"@grafana/schema": 10.0.2
|
||||
"@grafana/ui": 10.0.2
|
||||
checksum: 94eac2f9ba92722a9d1a23c43d48f3ee8300f0c3cd8631c38770438debc8a8c874a00ba8f2901db634cd1c0bd57f4c9366a7a8d2b060023e4635e839142566b7
|
||||
"@grafana/data": 10.0.3
|
||||
"@grafana/runtime": 10.0.3
|
||||
"@grafana/schema": 10.0.3
|
||||
"@grafana/ui": 10.0.3
|
||||
checksum: b9cfc535228f0426ee4e422d3e8872f56212f9785acfcdb86aefe6e9c2ff5c98ef750eef0d72cd0ebc2feb67719fac86877b2eae6d376bdd45691da9068b5194
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
@ -19248,7 +19248,7 @@ __metadata:
|
||||
"@grafana/lezer-traceql": 0.0.4
|
||||
"@grafana/monaco-logql": ^0.0.7
|
||||
"@grafana/runtime": "workspace:*"
|
||||
"@grafana/scenes": 0.22.0
|
||||
"@grafana/scenes": 0.24.0
|
||||
"@grafana/schema": "workspace:*"
|
||||
"@grafana/toolkit": "workspace:*"
|
||||
"@grafana/tsconfig": ^1.3.0-rc1
|
||||
|
Loading…
Reference in New Issue
Block a user