Skip to content

Commit

Permalink
Enable footer for the DataGrid widget to enable paging (#4745)
Browse files Browse the repository at this point in the history
When the number of metrics exceeds a threshold (100), enable paging and
DataGrid footer to view all metrics.

<img width="1880" alt="image"
src="https://github.com/pytorch/test-infra/assets/502017/2f2a2817-95d8-440d-99a6-443e80f06070">
  • Loading branch information
xuzhao9 authored Feb 13, 2024
1 parent 3751549 commit a06fd6c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion torchci/components/metrics/panels/TablePanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ export function TablePanelWithData({
density={"compact"}
rows={data}
columns={columns}
hideFooter
autoPageSize
components={{
Toolbar: Header,
}}
Expand Down
11 changes: 9 additions & 2 deletions torchci/pages/torchbench/userbenchmark.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ const queryCollection = "torchbench";
const ROW_GAP = 30;
const ROW_HEIGHT = 48;
const MIN_ENTRIES = 10;
const MAX_ENTRIES = 100;
const MAX_PYTORCH_VERSIONS = 30;
const SHA_DISPLAY_LENGTH = 10;

Expand Down Expand Up @@ -329,7 +330,11 @@ function Report({
tMetrics = tMetrics === undefined ? {} : tMetrics[0];
const metrics: Record<string, any>[] = genABMetrics(cMetrics, tMetrics);
const minEntries =
metrics.length > MIN_ENTRIES ? Object.keys(metrics).length : MIN_ENTRIES;
metrics.length > MIN_ENTRIES
? Object.keys(metrics).length > MAX_ENTRIES
? MAX_ENTRIES
: Object.keys(metrics).length
: MIN_ENTRIES;

return (
<div>
Expand Down Expand Up @@ -406,7 +411,9 @@ function Report({
},
},
]}
dataGridProps={{ getRowId: (el: any) => el.name }}
dataGridProps={{
getRowId: (el: any) => el.name,
}}
/>
</Grid>
</Grid>
Expand Down

0 comments on commit a06fd6c

Please sign in to comment.