From 6811b0ae63b7573e0a644a7a2e909b6e71bd607e Mon Sep 17 00:00:00 2001 From: Leon Sorokin Date: Mon, 25 Sep 2023 06:46:11 -0500 Subject: [PATCH] Dashboard: Set descending z-index of panels in a dashboard (v2) (#75328) Co-authored-by: Adela Almasan --- public/app/features/dashboard/dashgrid/DashboardGrid.tsx | 9 +++++++-- public/sass/components/_dashboard_grid.scss | 9 +++++++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/public/app/features/dashboard/dashgrid/DashboardGrid.tsx b/public/app/features/dashboard/dashgrid/DashboardGrid.tsx index a452b09a09c..2460cc5059a 100644 --- a/public/app/features/dashboard/dashgrid/DashboardGrid.tsx +++ b/public/app/features/dashboard/dashgrid/DashboardGrid.tsx @@ -152,10 +152,14 @@ export class DashboardGrid extends PureComponent { for (const panel of this.props.dashboard.panels) { const panelClasses = classNames({ 'react-grid-item--fullscreen': panel.isViewing }); + // used to allow overflowing content to show on top of the next panel + const descIndex = this.props.dashboard.panels.length - panelElements.length; + panelElements.push( { interface GrafanaGridItemProps extends React.HTMLAttributes { gridWidth?: number; gridPos?: GridPos; + descendingOrderIndex?: number; isViewing: boolean; windowHeight: number; windowWidth: number; @@ -291,7 +296,7 @@ const GrafanaGridItem = React.forwardRef(( let width = 100; let height = 100; - const { gridWidth, gridPos, isViewing, windowHeight, windowWidth, ...divProps } = props; + const { gridWidth, gridPos, isViewing, windowHeight, windowWidth, descendingOrderIndex, ...divProps } = props; const style: CSSProperties = props.style ?? {}; if (isViewing) { @@ -321,7 +326,7 @@ const GrafanaGridItem = React.forwardRef(( // props.children[0] is our main children. RGL adds the drag handle at props.children[1] return ( -
+
{/* Pass width and height to children as render props */} {[props.children[0](width, height), props.children.slice(1)]}
diff --git a/public/sass/components/_dashboard_grid.scss b/public/sass/components/_dashboard_grid.scss index 66d501a8489..30f6415ee12 100644 --- a/public/sass/components/_dashboard_grid.scss +++ b/public/sass/components/_dashboard_grid.scss @@ -85,6 +85,15 @@ } } +// Hack to prevent panel overlap during drag/hover (due to descending z-index assignment) +.react-grid-item { + &:hover, + &:active, + &:focus { + z-index: 100 !important; + } +} + // Hack for preventing panel menu overlapping. .react-grid-item.resizing.panel, .react-grid-item.panel.dropdown-menu-open,