diff --git a/public/app/features/dashboard-scene/panel-edit/PanelEditorRenderer.tsx b/public/app/features/dashboard-scene/panel-edit/PanelEditorRenderer.tsx index e28537eb2bb..13336861001 100644 --- a/public/app/features/dashboard-scene/panel-edit/PanelEditorRenderer.tsx +++ b/public/app/features/dashboard-scene/panel-edit/PanelEditorRenderer.tsx @@ -25,6 +25,11 @@ export function PanelEditorRenderer({ model }: SceneComponentProps) const { optionsPane } = model.useState(); const styles = useStyles2(getWrapperStyles); const [isInitiallyCollapsed, setIsCollapsed] = useEditPaneCollapsed(); + const [containerRef, { height: containerHeight }] = useMeasure(); + + useEffect(() => { + console.log('PanelEditorRenderer containerHeight', containerHeight); + }, [containerHeight]); const isScrollingLayout = useScrollReflowLimit(); @@ -46,7 +51,7 @@ export function PanelEditorRenderer({ model }: SceneComponentProps) }, [splitterState.collapsed, setIsCollapsed]); return ( - <> +
) data-testid={selectors.components.PanelEditor.General.content} >
- +
@@ -77,11 +82,14 @@ export function PanelEditorRenderer({ model }: SceneComponentProps) {!splitterState.collapsed && !optionsPane && }
- +
); } -function VizAndDataPane({ model }: SceneComponentProps) { +function VizAndDataPane({ + model, + containerHeight = 800, +}: SceneComponentProps & { containerHeight?: number }) { const dashboard = getDashboardSceneFor(model); const { dataPane, showLibraryPanelSaveModal, showLibraryPanelUnlinkModal, tableView } = model.useState(); const panel = model.getPanel(); @@ -107,7 +115,6 @@ function VizAndDataPane({ model }: SceneComponentProps) { rows.push(`${vizHeight}px`); if (dataPane) { - // rows.push(`${(containerHeight - vizHeight) + 40}px`); rows.push('auto'); grid.push(['sidebar', 'data-pane']); if (sidebarState.size === SidebarSize.Full) { @@ -118,10 +125,16 @@ function VizAndDataPane({ model }: SceneComponentProps) { } return { + height: containerHeight, + maxHeight: containerHeight, gridTemplateAreas: '\n' + grid.map((row) => `"${row.join(' ')}"`).join('\n'), gridTemplateRows: rows.map((r) => r).join(' '), }; - }, [controls, dataPane, sidebarState.size, vizHeight]); + }, [controls, dataPane, sidebarState.size, vizHeight, containerHeight]); + + if (!containerHeight) { + return null; + } return (
@@ -131,7 +144,11 @@ function VizAndDataPane({ model }: SceneComponentProps) {
)} -
+
{tableView ? : }
@@ -215,9 +232,6 @@ function getStyles(theme: GrafanaTheme2, sidebarState: SidebarState) { display: 'grid', gap: theme.spacing(2), gridTemplateColumns: `auto 1fr`, - height: '100%', - minHeight: '100%', - maxHeight: '100%', overflow: 'hidden', [scrollReflowMediaQuery]: { gridTemplateColumns: `100%`, @@ -238,14 +252,14 @@ function getStyles(theme: GrafanaTheme2, sidebarState: SidebarState) { overflow: 'auto', resize: 'vertical', height: '100%', - minHeight: 200, - maxHeight: 700, // FIXME: needs a dynamic height + minHeight: 100, ...(sidebarState.size === SidebarSize.Mini && { paddingLeft: theme.spacing(2), }), }), dataPane: css({ gridArea: 'data-pane', + overflow: 'hidden', }), controlsWrapper: css({ gridArea: 'controls',