mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
* add behaviour that adjusts hoverHeaderOffset
* clean up behaviour logic
* optimise and extract behaviour to separate file
* fix hoverHeaderOffsetBehavior unsubscribe
* update to latest scenes version
* Fix PanelOptionsTest
* fix: test value for adhoc filter url param
* Fix transformation tab tests
* bump scenes version
* Revert "Fix transformation tab tests"
This reverts commit 3ec9f5b226.
---------
Co-authored-by: Dominik Prokop <dominik.prokop@grafana.com>
Co-authored-by: Darren Janeczek <darren.janeczek@grafana.com>
Co-authored-by: oscarkilhed <oscar.kilhed@grafana.com>
19 lines
587 B
TypeScript
19 lines
587 B
TypeScript
import { VizPanel } from '@grafana/scenes';
|
|
|
|
import { DashboardGridItem } from './DashboardGridItem';
|
|
|
|
export const hoverHeaderOffsetBehavior = (grid: DashboardGridItem) => {
|
|
const sub = grid.subscribeToState((newState, prevState) => {
|
|
if ([newState.y, prevState.y].includes(0) && newState.y !== prevState.y) {
|
|
grid.forEachChild((child) => {
|
|
if (child instanceof VizPanel && child.state.hoverHeader) {
|
|
child.setState({ hoverHeaderOffset: grid.state.y === 0 ? 0 : undefined });
|
|
}
|
|
});
|
|
}
|
|
});
|
|
return () => {
|
|
sub.unsubscribe();
|
|
};
|
|
};
|