mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Explore: Update table min height (#67321)
* Set table min content height to 300px * Cleanup code that changes height of table component
This commit is contained in:
parent
81792a8dce
commit
fb45cb6237
@ -43,7 +43,6 @@ export const Table = memo((props: Props) => {
|
|||||||
data,
|
data,
|
||||||
subData,
|
subData,
|
||||||
height,
|
height,
|
||||||
maxHeight,
|
|
||||||
onCellFilterAdded,
|
onCellFilterAdded,
|
||||||
width,
|
width,
|
||||||
columnMinWidth = COLUMN_MIN_WIDTH,
|
columnMinWidth = COLUMN_MIN_WIDTH,
|
||||||
@ -195,18 +194,6 @@ export const Table = memo((props: Props) => {
|
|||||||
|
|
||||||
const pageSize = Math.round(listHeight / tableStyles.rowHeight) - 1;
|
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(() => {
|
useEffect(() => {
|
||||||
// Don't update the page size if it is less than 1
|
// Don't update the page size if it is less than 1
|
||||||
if (pageSize <= 0) {
|
if (pageSize <= 0) {
|
||||||
|
@ -46,7 +46,7 @@ export class TableContainer extends PureComponent<Props> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// tries to estimate table height
|
// tries to estimate table height
|
||||||
return Math.max(Math.min(600, mainFrame.length * 36) + 40 + 46);
|
return Math.min(600, Math.max(mainFrame.length * 36, 300) + 40 + 46);
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
@ -103,7 +103,6 @@ export class TableContainer extends PureComponent<Props> {
|
|||||||
subData={subFrames}
|
subData={subFrames}
|
||||||
width={innerWidth}
|
width={innerWidth}
|
||||||
height={innerHeight}
|
height={innerHeight}
|
||||||
maxHeight={600}
|
|
||||||
onCellFilterAdded={onCellFilterAdded}
|
onCellFilterAdded={onCellFilterAdded}
|
||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
|
Loading…
Reference in New Issue
Block a user