Skip to content

Commit 37fa9cc

Browse files
committed
test
1 parent 8d9f763 commit 37fa9cc

File tree

5 files changed

+88
-59
lines changed

5 files changed

+88
-59
lines changed

torchci/components/benchmark/BranchAndCommitPicker.tsx

Lines changed: 29 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,24 @@
1+
import InfoOutlinedIcon from "@mui/icons-material/InfoOutlined";
12
import {
23
FormControl,
3-
IconButton,
44
InputLabel,
55
MenuItem,
66
Select,
77
SelectChangeEvent,
88
Skeleton,
99
Tooltip,
1010
} from "@mui/material";
11-
import InfoOutlinedIcon from '@mui/icons-material/InfoOutlined';
1211
import { MAIN_BRANCH, SHA_DISPLAY_LENGTH } from "components/benchmark/common";
1312
import dayjs from "dayjs";
1413
import { fetcher } from "lib/GeneralUtils";
1514
import { useEffect } from "react";
1615
import useSWR from "swr";
17-
import { DEFAULT_HIGHLIGHT_MENU_ITEM_COLOR, HighlightMenuItem, isCommitHighlight, isCommitStringHighlight } from "./compilers/HighlightMenu";
16+
import {
17+
DEFAULT_HIGHLIGHT_MENU_ITEM_COLOR,
18+
HighlightMenuItem,
19+
isCommitHighlight,
20+
isCommitStringHighlight,
21+
} from "./compilers/HighlightMenu";
1822

1923
// Keep the mapping from workflow ID to commit, so that we can use it to
2024
// zoom in and out of the graph. NB: this is to avoid sending commit sha
@@ -41,7 +45,9 @@ function groupCommitByBranch(data: any) {
4145
}
4246

4347
if (dedups[b].has(r.head_sha)) {
44-
branches[b]?.find((c: any) => c.head_sha === r.head_sha).filenames.push(r.filename);
48+
branches[b]
49+
?.find((c: any) => c.head_sha === r.head_sha)
50+
.filenames.push(r.filename);
4551
return;
4652
}
4753

@@ -70,7 +76,7 @@ export function BranchAndCommitPicker({
7076
titlePrefix,
7177
fallbackIndex,
7278
timeRange,
73-
highlightConfig
79+
highlightConfig,
7480
}: {
7581
queryName: string;
7682
queryParams: { [k: string]: any };
@@ -187,16 +193,28 @@ export function BranchAndCommitPicker({
187193
labelId={`commit-picker-select-label-${commit}`}
188194
onChange={handleCommitChange}
189195
id={`commit-picker-select-${commit}`}
190-
sx={{...(isCommitStringHighlight(commit,branches[branch],highlightConfig?.key) && { backgroundColor: DEFAULT_HIGHLIGHT_MENU_ITEM_COLOR })}}
196+
sx={{
197+
...(isCommitStringHighlight(
198+
commit,
199+
branches[branch],
200+
highlightConfig?.key
201+
) && { backgroundColor: DEFAULT_HIGHLIGHT_MENU_ITEM_COLOR }),
202+
}}
191203
>
192204
{branches[branch].map((r: any) => (
193-
<HighlightMenuItem key={r.head_sha} value={r.head_sha} condition={isCommitHighlight(highlightConfig?.key,r)} customColor={highlightConfig?.highlightColor}>
205+
<HighlightMenuItem
206+
key={r.head_sha}
207+
value={r.head_sha}
208+
condition={isCommitHighlight(highlightConfig?.key, r)}
209+
customColor={highlightConfig?.highlightColor}
210+
>
194211
{r.head_sha.substring(0, SHA_DISPLAY_LENGTH)} (
195212
{dayjs(r.event_time).format("YYYY/MM/DD")})
196-
{isCommitHighlight(highlightConfig?.key,r) &&
197-
<Tooltip id="button-report" title={highlightConfig?.key}>
198-
<InfoOutlinedIcon />
199-
</Tooltip>}
213+
{isCommitHighlight(highlightConfig?.key, r) && (
214+
<Tooltip id="button-report" title={highlightConfig?.key}>
215+
<InfoOutlinedIcon />
216+
</Tooltip>
217+
)}
200218
</HighlightMenuItem>
201219
))}
202220
</Select>
Lines changed: 48 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,56 @@
1-
import { FormControl, InputLabel, MenuItem, Select } from "@mui/material";
2-
import { match } from "assert";
1+
import { MenuItem } from "@mui/material";
32

4-
interface HighlightMenuItemProps extends React.ComponentProps<typeof MenuItem>{
5-
condition: boolean;
6-
customColor?: string;
7-
}
3+
interface HighlightMenuItemProps extends React.ComponentProps<typeof MenuItem> {
4+
condition: boolean;
5+
customColor?: string;
6+
}
87

9-
export const DEFAULT_HIGHLIGHT_MENU_ITEM_COLOR = 'yellow';
8+
export const DEFAULT_HIGHLIGHT_MENU_ITEM_COLOR = "yellow";
109

11-
export const HighlightMenuItem = ({ condition, children, customColor = DEFAULT_HIGHLIGHT_MENU_ITEM_COLOR, ...props }: HighlightMenuItemProps) => {
12-
const highlightStyle = {
13-
backgroundColor: customColor?customColor:DEFAULT_HIGHLIGHT_MENU_ITEM_COLOR,
14-
};
15-
return (
16-
<MenuItem
17-
{...props}
18-
sx={{
19-
...(condition && highlightStyle),
20-
}}
21-
>
22-
{children}
23-
</MenuItem>
24-
);
10+
export const HighlightMenuItem = ({
11+
condition,
12+
children,
13+
customColor = DEFAULT_HIGHLIGHT_MENU_ITEM_COLOR,
14+
...props
15+
}: HighlightMenuItemProps) => {
16+
const highlightStyle = {
17+
backgroundColor: customColor
18+
? customColor
19+
: DEFAULT_HIGHLIGHT_MENU_ITEM_COLOR,
2520
};
21+
return (
22+
<MenuItem
23+
{...props}
24+
sx={{
25+
...(condition && highlightStyle),
26+
}}
27+
>
28+
{children}
29+
</MenuItem>
30+
);
31+
};
2632

27-
export function isCommitStringHighlight(commit:string,commits: any[],filenameFilter:string|undefined){
28-
const matchedCommit = commits.find((c:any) => c.head_sha === commit);
29-
if (!matchedCommit) {
30-
return false;
31-
}
32-
return isCommitHighlight(filenameFilter,matchedCommit);
33+
export function isCommitStringHighlight(
34+
commit: string,
35+
commits: any[],
36+
filenameFilter: string | undefined
37+
) {
38+
const matchedCommit = commits.find((c: any) => c.head_sha === commit);
39+
if (!matchedCommit) {
40+
return false;
3341
}
42+
return isCommitHighlight(filenameFilter, matchedCommit);
43+
}
3444

35-
export function isCommitHighlight(filenameFilter: string | undefined, commit: any) {
36-
if (filenameFilter === undefined || filenameFilter == "all") {
37-
return false;
38-
}
39-
const found = commit.filenames.filter((f: string) => f.includes(filenameFilter));
40-
return found.length > 0;
45+
export function isCommitHighlight(
46+
filenameFilter: string | undefined,
47+
commit: any
48+
) {
49+
if (filenameFilter === undefined || filenameFilter == "all") {
50+
return false;
51+
}
52+
const found = commit.filenames.filter((f: string) =>
53+
f.includes(filenameFilter)
54+
);
55+
return found.length > 0;
4156
}

torchci/components/benchmark/compilers/common.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,6 @@ export const DISPLAY_NAMES_TO_WORKFLOW_NAMES: { [k: string]: string } = {
7979

8080
export const DEFAULT_FILTER_NAME = "unselected";
8181
export const DISPLAY_NAMES_TO_FILTER: { [k: string]: string } = {
82-
"Unselected": DEFAULT_FILTER_NAME,
83-
"Max_autotune": "max_autotune",
82+
Unselected: DEFAULT_FILTER_NAME,
83+
Max_autotune: "max_autotune",
8484
};

torchci/pages/benchmark/[suite]/[compiler]/[[...page]].tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,6 @@ export default function Page() {
393393
/>
394394
</Stack>
395395

396-
397396
<Grid2 size={{ xs: 12 }}>
398397
<Report
399398
dashboard={dashboard}

torchci/pages/benchmark/compilers.tsx

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ import {
88
} from "components/benchmark/common";
99
import { BenchmarkLogs } from "components/benchmark/compilers/BenchmarkLogs";
1010
import {
11-
DEFAULT_FILTER_NAME,
1211
DEFAULT_DEVICE_NAME,
12+
DEFAULT_FILTER_NAME,
1313
DISPLAY_NAMES_TO_DEVICE_NAMES,
14+
DISPLAY_NAMES_TO_FILTER,
1415
DISPLAY_NAMES_TO_WORKFLOW_NAMES,
1516
DTYPES,
16-
DISPLAY_NAMES_TO_FILTER,
1717
} from "components/benchmark/compilers/common";
1818
import CompilerGraphGroup from "components/benchmark/compilers/CompilerGraphGroup";
1919
import { SUITES } from "components/benchmark/compilers/SuitePicker";
@@ -36,7 +36,6 @@ import { useEffect, useState } from "react";
3636
import useSWR from "swr";
3737
import { COMPILER_SUITES_MAP } from "../../lib/benchmark/compliers/CompilerSuites";
3838
import { TimeRangePicker } from "../metrics";
39-
import { keyBy } from "lodash";
4039

4140
function Report({
4241
queryParams,
@@ -320,12 +319,10 @@ export default function Page() {
320319
titlePrefix={"Base"}
321320
fallbackIndex={-1} // Default to the next to latest in the window
322321
timeRange={timeRange}
323-
highlightConfig= {
324-
{
325-
key:filter,
326-
highlightColor:"yellow"
327-
}
328-
}
322+
highlightConfig={{
323+
key: filter,
324+
highlightColor: "yellow",
325+
}}
329326
/>
330327
<Divider orientation="vertical" flexItem>
331328
&mdash;Diff→
@@ -340,9 +337,9 @@ export default function Page() {
340337
titlePrefix={"New"}
341338
fallbackIndex={0} // Default to the latest commit
342339
timeRange={timeRange}
343-
highlightConfig= {{
344-
key:filter,
345-
highlightColor:"yellow"
340+
highlightConfig={{
341+
key: filter,
342+
highlightColor: "yellow",
346343
}}
347344
/>
348345
</Stack>

0 commit comments

Comments
 (0)