mirror of https://github.com/grafana/grafana
DashboardScene: prevent panel hovel header crop with scenes (#85869)
* 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>
pull/85900/head
parent
212acb9bc5
commit
79631bdd15
@ -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(); |
||||
}; |
||||
}; |
Loading…
Reference in new issue