mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
DashboardScene: prevent panel hovel header crop with scenes (#85780)
* 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 --------- 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>
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
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();
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user