From 503a654dc5de536b5a43cc816906577da5baaf7c Mon Sep 17 00:00:00 2001 From: Andre Pereira Date: Thu, 27 Apr 2023 08:30:42 +0100 Subject: [PATCH] [v9.5.x] Explore: Update table min height (#67321) (#67332) Explore: Update table min height (#67321) * Set table min content height to 300px * Cleanup code that changes height of table component (cherry picked from commit fb45cb6237b7653e78f14f780455974939380fab) --- packages/grafana-ui/src/components/Table/Table.tsx | 13 ------------- public/app/features/explore/TableContainer.tsx | 3 +-- 2 files changed, 1 insertion(+), 15 deletions(-) diff --git a/packages/grafana-ui/src/components/Table/Table.tsx b/packages/grafana-ui/src/components/Table/Table.tsx index 20ed1419989..2f59657fbd4 100644 --- a/packages/grafana-ui/src/components/Table/Table.tsx +++ b/packages/grafana-ui/src/components/Table/Table.tsx @@ -43,7 +43,6 @@ export const Table = memo((props: Props) => { data, subData, height, - maxHeight, onCellFilterAdded, width, columnMinWidth = COLUMN_MIN_WIDTH, @@ -195,18 +194,6 @@ export const Table = memo((props: Props) => { const pageSize = Math.round(listHeight / tableStyles.rowHeight) - 1; - // Make sure we have room to show the sub-table - const expandedIndices = Object.keys(extendedState.expanded); - if (expandedIndices.length) { - const subTablesHeight = expandedIndices.reduce((sum, index) => { - const subLength = subData?.find((frame) => frame.meta?.custom?.parentRowIndex === parseInt(index, 10))?.length; - return subLength ? sum + tableStyles.rowHeight * (subLength + 1) : sum; - }, 0); - if (listHeight < subTablesHeight) { - listHeight = Math.min(listHeight + subTablesHeight, maxHeight || Number.MAX_SAFE_INTEGER); - } - } - useEffect(() => { // Don't update the page size if it is less than 1 if (pageSize <= 0) { diff --git a/public/app/features/explore/TableContainer.tsx b/public/app/features/explore/TableContainer.tsx index affe1bb0a6e..8aaaf5706dd 100644 --- a/public/app/features/explore/TableContainer.tsx +++ b/public/app/features/explore/TableContainer.tsx @@ -47,7 +47,7 @@ export class TableContainer extends PureComponent { } // tries to estimate table height - return Math.max(Math.min(600, mainFrame.length * 35) + 35); + return Math.min(600, Math.max(mainFrame.length * 35, 300) + 35); } render() { @@ -98,7 +98,6 @@ export class TableContainer extends PureComponent { subData={subFrames} width={tableWidth} height={height} - maxHeight={600} onCellFilterAdded={onCellFilterAdded} /> ) : (