Skip to content

Commit c2c7250

Browse files
authored
[BE] Set up new HUD strucutre with nextjs app structure (#6881)
Inital setup for new pytorch HUD UI strucutre using nextjs app route. Currently this co-exists with the old pages/ approach, all navigation to /v2/* will route to the new app structure, meanwhile the existing routes still exist. Official Guidance from vercel: https://nextjs.org/docs/app ## Migration Plan We will gradually migrate all pages into v2 HUD, eventually we will depreacte v1 [Migration Plan](https://docs.google.com/document/d/1gO9xbzcvTCdHrGQd2gNg4jw4NEDMDw4ccnra8u69x_k/edit?tab=t.0) ## Benefits for page specific component, now we can: - Nested & Shared Layout Rendering - put under the route to have more clear structures, this also give us a chance to reformat our hud code - have main nav bar + subnav bar, this also able to override the main nav bar if it's necessary too - Able to render multiple pages in parallel, and can persist nav bars, sidebars, or headers across page changes.These layouts don't unmount — only the nested route content updates. ## Details - create a simple navigation bar rendered with pytorch orange and black - create a benchmark v3 dashboard sub page # preview https://torchci-git-benchmark-explore1-fbopensource.vercel.app/v2 ![image](https://github.com/user-attachments/assets/dedc7619-9401-4d22-87a6-e034203f69b8) --------- Signed-off-by: Yang Wang <[email protected]>
1 parent 1c5e341 commit c2c7250

File tree

11 files changed

+221
-5
lines changed

11 files changed

+221
-5
lines changed

torchci/app/v2/README.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# V2 HUD
2+
3+
Used for HUD V2 UI. This approach offers several benefits, including improved performance, scalability, and developer experience. For more details on the advantages of the Next.js app approach, please refer to the [Next.js documentation](https://nextjs.org/docs/app).
4+
5+
# Migration Plan
6+
7+
We plan migrate exisiting page-based routes to the new V2 structure using Next.js app structure in H2 2025.
8+
9+
## July
10+
11+
- Setup: Establish the V2 app structure, including the navbar, GitHub signup functionality.
12+
- Guidance: Provide comprehensive guidance to developers on the new structure, including tests, structure, and etc
13+
- Implementation: Post-July, all new features should be implemented in the V2 structure.
14+
15+
## August - September
16+
17+
- Transition the majority of routes from the pages/ directory to the new V2 HUD structure.
18+
- Applies Dark/Light mode to the v2 structure
19+
20+
## October
21+
22+
- Deprecation: Officially deprecate the legacy HUD (v1) system.
23+
24+
# Affected Areas
25+
26+
## Affected Folders
27+
28+
- app/v2/: This folder will house the new app structure.
29+
- pages/: This folder contains all file-based navigation elements.
30+
- dark/light settings
31+
32+
## Affected Users
33+
34+
- Developers within the Dev Infra Team.
35+
36+
# Changes Tracking
37+
38+
- `2025-07-02`: Initial setup of the V2 app structure.
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import { Box } from "@mui/material";
2+
import { ReactNode } from "react";
3+
4+
const drawerWidth = 200;
5+
6+
export default function BenchmarkV3Layout({
7+
children,
8+
}: {
9+
children: ReactNode;
10+
}) {
11+
return (
12+
<Box sx={{ display: "flex" }}>
13+
{/* Main content */}
14+
<Box component="main" sx={{ flexGrow: 1, p: 3, ml: `${drawerWidth}px` }}>
15+
{children}
16+
</Box>
17+
</Box>
18+
);
19+
}

torchci/app/v2/benchmark/v3/page.tsx

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import { Card, CardContent, Grid2, Typography } from "@mui/material";
2+
3+
export default function Page() {
4+
const list = ["torhchAo", "vllm", "torch compiler"];
5+
return (
6+
<div style={{ padding: 20 }}>
7+
<Typography variant="h4" gutterBottom>
8+
Benchmarks
9+
</Typography>
10+
<Grid2 container spacing={2}>
11+
{list.map((item, index) => (
12+
<Grid2 key={index}>
13+
<Card variant="outlined">
14+
<CardContent>
15+
<Typography variant="h6" component="div">
16+
{item}
17+
</Typography>
18+
<Typography color="text.secondary">
19+
Benchmark description for {item}
20+
</Typography>
21+
</CardContent>
22+
</Card>
23+
</Grid2>
24+
))}
25+
</Grid2>
26+
</div>
27+
);
28+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import { Box } from "@mui/material";
2+
import { ReactNode } from "react";
3+
4+
const drawerWidth = 200;
5+
6+
export default function BenchmarkV3Layout({
7+
children,
8+
}: {
9+
children: ReactNode;
10+
}) {
11+
return (
12+
<Box sx={{ display: "flex" }}>
13+
{/* Main content */}
14+
<Box component="main" sx={{ flexGrow: 1, p: 3, ml: `${drawerWidth}px` }}>
15+
{children}
16+
</Box>
17+
</Box>
18+
);
19+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import { Card, CardContent, Grid2, Typography } from "@mui/material";
2+
3+
export default function Page() {
4+
return (
5+
<div style={{ padding: 20 }}>
6+
<Card>
7+
<CardContent>
8+
<Grid2 container spacing={2}>
9+
<Grid2>
10+
<Typography variant="h4" gutterBottom>
11+
Benchmark Regression Page Rendering Custommized Component
12+
Dynamically
13+
</Typography>
14+
</Grid2>
15+
</Grid2>
16+
</CardContent>
17+
</Card>
18+
<br />
19+
</div>
20+
);
21+
}
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
import { Link as MuiLink, Toolbar, Typography } from "@mui/material";
2+
import Link from "next/link";
3+
4+
const pytorchHudAppBarTitleStyles = {
5+
flexGrow: 1,
6+
color: "#EE4C2C", // PyTorch orange
7+
fontWeight: "bold",
8+
};
9+
10+
export default function HudNavToolBar() {
11+
return (
12+
<Toolbar>
13+
<Typography variant="h6" sx={pytorchHudAppBarTitleStyles}>
14+
Pytorch CI Hud
15+
</Typography>
16+
{HudNavToolBarElement("Home(legacy)", "/", "home_nav_link")}
17+
{HudNavToolBarElement("Home", "/v2", "home_nav_link")}
18+
{HudNavToolBarElement(
19+
"Benchmarks",
20+
"/v2/benchmark/v3",
21+
"benchmark_v3_nav_link"
22+
)}
23+
</Toolbar>
24+
);
25+
}
26+
27+
export function HudNavToolBarElement(
28+
displayname: string,
29+
navRoute: string,
30+
id: string = ""
31+
) {
32+
return (
33+
<MuiLink
34+
component={Link}
35+
href={navRoute}
36+
color="inherit"
37+
underline="none"
38+
sx={{ mr: 2 }}
39+
id={id}
40+
>
41+
{displayname}
42+
</MuiLink>
43+
);
44+
}

torchci/app/v2/layout.tsx

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import { AppBar, CssBaseline } from "@mui/material";
2+
import HudNavToolBar from "./components/rootUxComponents/hudNavToolBar";
3+
4+
const appBarStyles = {
5+
backgroundColor: "#202124", // Similar dark tone as PyTorch navbar
6+
boxShadow: "none",
7+
borderBottom: "1px solid #333", // Subtle border like PyTorch's
8+
};
9+
10+
export default function RootLayout({
11+
children,
12+
}: {
13+
children: React.ReactNode;
14+
}) {
15+
return (
16+
<html lang="en">
17+
<body>
18+
<CssBaseline />
19+
<AppBar position="fixed" sx={appBarStyles}>
20+
<HudNavToolBar />
21+
</AppBar>
22+
{/* Offset AppBar height */}
23+
<div style={{ marginTop: "64px" }}>{children}</div>
24+
</body>
25+
</html>
26+
);
27+
}

torchci/app/v2/page.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export default function Page() {
2+
return <h1> Hud Page 2.0</h1>;
3+
}

torchci/components/uiModules/UMComparisonTable.tsx

Whitespace-only changes.

torchci/next-env.d.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/// <reference types="next" />
22
/// <reference types="next/image-types/global" />
3+
/// <reference types="next/navigation-types/compat/navigation" />
34

45
// NOTE: This file should not be edited
5-
// see https://nextjs.org/docs/pages/building-your-application/configuring/typescript for more information.
6+
// see https://nextjs.org/docs/app/building-your-application/configuring/typescript for more information.

0 commit comments

Comments
 (0)