Skip to content

Commit 12a1870

Browse files
committed
ui: add switch to not render mailboxes
1 parent 91d712e commit 12a1870

File tree

3 files changed

+23
-5
lines changed

3 files changed

+23
-5
lines changed

webui/app/page.tsx

+14-1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import {
1616
Group,
1717
ScrollArea,
1818
Stack,
19+
Switch,
1920
Title,
2021
} from "@mantine/core";
2122
import { useLocalStorage } from "@mantine/hooks";
@@ -43,6 +44,11 @@ export default function Home() {
4344

4445
const mode = useGetMode();
4546

47+
const [showMailboxes, setShowMailboxes] = useLocalStorage<boolean>({
48+
key: "byzzbench/showMailboxes",
49+
defaultValue: true,
50+
});
51+
4652
if (mode.data?.data === "RUNNING") {
4753
return (
4854
<Container fluid p="xl">
@@ -63,6 +69,13 @@ export default function Home() {
6369
<Group wrap="nowrap" gap="xs" align="center">
6470
<Title order={3}>{schedule?.data.scenarioId}</Title>
6571
<PredicateList />
72+
<Switch
73+
label="Show mailboxes"
74+
checked={showMailboxes}
75+
onChange={(event) => {
76+
setShowMailboxes(event.currentTarget.checked);
77+
}}
78+
/>
6679
</Group>
6780
<Accordion.Item key="clients" value="clients">
6881
<Accordion.Control>Clients</Accordion.Control>
@@ -73,7 +86,7 @@ export default function Home() {
7386
<Accordion.Item key="nodes" value="nodes">
7487
<Accordion.Control>Nodes</Accordion.Control>
7588
<Accordion.Panel>
76-
<NodeList />
89+
<NodeList showMailboxes={showMailboxes} />
7790
</Accordion.Panel>
7891
</Accordion.Item>
7992
{/*<Accordion.Item key="adob" value="adob">

webui/components/NodeCard.tsx

+3-2
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,10 @@ import React from "react";
2121

2222
export type NodeCardProps = {
2323
nodeId: string;
24+
showMailboxes?: boolean;
2425
};
2526

26-
export const NodeCard = ({ nodeId }: NodeCardProps) => {
27+
export const NodeCard = ({ nodeId, showMailboxes = true }: NodeCardProps) => {
2728
const { data, isLoading } = useGetNode(nodeId);
2829
const faultyReplicasQuery = useGetFaultyReplicas();
2930
const partitionsQuery = useGetPartitions();
@@ -69,7 +70,7 @@ export const NodeCard = ({ nodeId }: NodeCardProps) => {
6970
/>
7071
)}
7172
<Space h="xs" />
72-
<NodeMailbox nodeId={nodeId} />
73+
{showMailboxes && <NodeMailbox nodeId={nodeId} />}
7374
</Card>
7475
);
7576
};

webui/components/NodeList.tsx

+6-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,11 @@ import { Grid, Loader } from "@mantine/core";
55
import React from "react";
66
import { NodeCard } from "./NodeCard";
77

8-
export const NodeList = () => {
8+
export type NodeListProps = {
9+
showMailboxes?: boolean;
10+
};
11+
12+
export const NodeList = ({ showMailboxes = true }: NodeListProps) => {
913
const { data: nodeIds, isLoading } = useGetReplicas({
1014
query: { retry: true },
1115
});
@@ -18,7 +22,7 @@ export const NodeList = () => {
1822
<Grid gutter="md">
1923
{nodeIds?.data.map((nodeId) => (
2024
<Grid.Col span="content" key={nodeId}>
21-
<NodeCard nodeId={nodeId} />
25+
<NodeCard nodeId={nodeId} showMailboxes={showMailboxes} />
2226
</Grid.Col>
2327
))}
2428
</Grid>

0 commit comments

Comments
 (0)