Skip to content

Commit efb197a

Browse files
committed
add configuration for using mock data
1 parent 9524bd9 commit efb197a

File tree

2 files changed

+32
-22
lines changed

2 files changed

+32
-22
lines changed

src/ui/.env.local

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
ASSET_PREFIX=http://localhost:3000
22
BASE_PATH=http://localhost:3000
33
NEXT_PUBLIC_USE_MOCK_API=true
4+
USE_MOCK_DATA=true

src/ui/app/layout.tsx

Lines changed: 31 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -31,30 +31,39 @@ export default function RootLayout({
3131
}: Readonly<{
3232
children: React.ReactNode;
3333
}>) {
34+
const emptyDataScript = (
35+
<script
36+
dangerouslySetInnerHTML={{
37+
__html:
38+
'window.run_info = {}; window.workload_details = {}; window.benchmarks = {};',
39+
}}
40+
/>
41+
);
42+
const mockDataScript = (
43+
<>
44+
<script
45+
dangerouslySetInnerHTML={{
46+
__html: runInfoScript,
47+
}}
48+
/>
49+
<script
50+
dangerouslySetInnerHTML={{
51+
__html: workloadDetailsScript,
52+
}}
53+
/>
54+
<script
55+
dangerouslySetInnerHTML={{
56+
__html: benchmarksScript,
57+
}}
58+
/>
59+
</>
60+
);
61+
const dataScript =
62+
process.env.USE_MOCK_DATA === 'true' ? mockDataScript : emptyDataScript;
63+
3464
return (
3565
<html lang="en">
36-
<head>
37-
{/* <script
38-
dangerouslySetInnerHTML={{
39-
__html: 'window.run_info = {}; window.workload_details = {}; window.benchmarks = {};',
40-
}}
41-
/> */}
42-
<script
43-
dangerouslySetInnerHTML={{
44-
__html: runInfoScript,
45-
}}
46-
/>
47-
<script
48-
dangerouslySetInnerHTML={{
49-
__html: workloadDetailsScript,
50-
}}
51-
/>
52-
<script
53-
dangerouslySetInnerHTML={{
54-
__html: benchmarksScript,
55-
}}
56-
/>
57-
</head>
66+
<head>{dataScript}</head>
5867
<body>{children}</body>
5968
</html>
6069
);

0 commit comments

Comments
 (0)