Skip to content

File tree

2 files changed

+26
-22
lines changed

2 files changed

+26
-22
lines changed

torchci/components/benchmark/llms/components/LLMsSummaryPanel.tsx

+6-12
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,6 @@ import {
1313
} from "lib/benchmark/llms/common";
1414
import { combineLeftAndRight } from "lib/benchmark/llms/utils/llmUtils";
1515

16-
const ROW_GAP = 100;
17-
const ROW_HEIGHT = 38;
18-
1916
const getDeviceArch = (
2017
device: string | undefined,
2118
arch: string | undefined
@@ -345,21 +342,18 @@ export default function LLMsSummaryPanel({
345342

346343
// TODO (huydhn): Table bigger than 100 rows requires x-data-grid-pro
347344
return (
348-
<Grid2 container spacing={2} style={{ height: "100%" }}>
349-
<Grid2
350-
size={{ xs: 12, lg: 12 }}
351-
height={
352-
data.length > 90
353-
? 90 * ROW_HEIGHT
354-
: (data.length + 1) * ROW_HEIGHT + ROW_GAP
355-
}
356-
>
345+
<Grid2 container spacing={10}>
346+
<Grid2 size={{ xs: 12, lg: 11.8 }}>
357347
<TablePanelWithData
358348
title={"Models"}
359349
data={data}
360350
columns={columns}
361351
dataGridProps={{ getRowId: (el: any) => el.name }}
362352
showFooter={true}
353+
disableAutoPageSize={true}
354+
customStyle={{
355+
maxHeight: 1200,
356+
}}
363357
/>
364358
</Grid2>
365359
</Grid2>

torchci/components/metrics/panels/TablePanel.tsx

+20-10
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import HelpIcon from "@mui/icons-material/Help";
22
import { Skeleton, Typography } from "@mui/material";
33
import IconButton from "@mui/material/IconButton";
44
import { DataGrid, GridColDef } from "@mui/x-data-grid";
5+
import { CSSProperties } from "react";
56
import useSWR from "swr";
67

78
const fetcher = (url: string) => fetch(url).then((res) => res.json());
@@ -64,13 +65,17 @@ export function TablePanelWithData({
6465
// An optional flag to show the table footer
6566
showFooter,
6667
pageSize,
68+
disableAutoPageSize,
69+
customStyle,
6770
}: {
6871
title: string;
6972
data: any;
7073
columns: GridColDef[];
7174
dataGridProps: any;
7275
helpLink?: string;
7376
showFooter?: boolean;
77+
disableAutoPageSize?: boolean;
78+
customStyle?: CSSProperties;
7479
pageSize?: number;
7580
}) {
7681
if (data === undefined) {
@@ -95,15 +100,20 @@ export function TablePanelWithData({
95100
}
96101

97102
return (
98-
<DataGrid
99-
{...dataGridProps}
100-
density={"compact"}
101-
rows={data}
102-
columns={columns}
103-
hideFooter={!showFooter}
104-
autoPageSize={showFooter && pageSize === undefined}
105-
pageSize={pageSize}
106-
slots={{ toolbar: Header }}
107-
/>
103+
<>
104+
<DataGrid
105+
style={customStyle}
106+
{...dataGridProps}
107+
density={"compact"}
108+
rows={data}
109+
columns={columns}
110+
hideFooter={!showFooter}
111+
autoPageSize={
112+
showFooter && pageSize === undefined && !disableAutoPageSize
113+
}
114+
pageSize={pageSize}
115+
slots={{ toolbar: Header }}
116+
/>
117+
</>
108118
);
109119
}

0 commit comments

Comments
 (0)