Skip to content

Commit aea2d8f

Browse files
Style tweaks
1 parent 458887d commit aea2d8f

File tree

5 files changed

+37
-18
lines changed

5 files changed

+37
-18
lines changed

Diff for: locust/webui/src/components/Layout/Navbar/Navbar.tsx

+17-2
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,30 @@
1-
import { useState } from 'react';
1+
import { useEffect, useState } from 'react';
22
import MenuIcon from '@mui/icons-material/Menu';
3-
import { AppBar, Box, Container, Drawer, IconButton, Link, Toolbar } from '@mui/material';
3+
import { AppBar, Box, Container, Drawer, IconButton, Link, Toolbar, useTheme } from '@mui/material';
44

55
import Logo from 'assets/Logo';
66
import DarkLightToggle from 'components/Layout/Navbar/DarkLightToggle';
77
import SwarmMonitor from 'components/Layout/Navbar/SwarmMonitor';
88
import StateButtons from 'components/StateButtons/StateButtons';
99

1010
export default function Navbar() {
11+
const theme = useTheme();
1112
const [drawerOpen, setDrawerOpen] = useState(false);
1213

14+
useEffect(() => {
15+
const handleResize = () => {
16+
if (window.innerWidth >= theme.breakpoints.values.md) {
17+
setDrawerOpen(false);
18+
}
19+
};
20+
21+
window.addEventListener('resize', handleResize);
22+
23+
return () => {
24+
window.removeEventListener('resize', handleResize);
25+
};
26+
}, []);
27+
1328
const toggleDrawer = (open: boolean) => () => {
1429
setDrawerOpen(open);
1530
};

Diff for: locust/webui/src/components/Layout/Navbar/SwarmMonitor.tsx

+7-6
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,14 @@ function SwarmMonitor({
2424
sx={{ display: 'flex', columnGap: 2, rowGap: 1, flexDirection: { xs: 'column', md: 'row' } }}
2525
>
2626
<Box sx={{ display: 'flex', flexDirection: 'column' }}>
27-
<Typography variant='button'>Host</Typography>
27+
<Typography sx={{ fontWeight: 'bold' }}>Host</Typography>
2828
<Tooltip title={host}>
2929
<Typography
3030
noWrap
3131
sx={{
3232
overflow: 'hidden',
3333
textOverflow: 'ellipsis',
34+
3435
maxWidth: { xs: '180px', lg: '400px' },
3536
}}
3637
>
@@ -40,14 +41,14 @@ function SwarmMonitor({
4041
</Box>
4142
<Divider flexItem orientation='vertical' />
4243
<Box sx={{ display: 'flex', flexDirection: 'column' }}>
43-
<Typography variant='button'>Status</Typography>
44+
<Typography sx={{ fontWeight: 'bold' }}>Status</Typography>
4445
<Typography variant='button'>{state}</Typography>
4546
</Box>
4647
{(state === SWARM_STATE.RUNNING || state === SWARM_STATE.SPAWNING) && (
4748
<>
4849
<Divider flexItem orientation='vertical' />
4950
<Box sx={{ display: 'flex', flexDirection: 'column', alignItems: { md: 'center' } }}>
50-
<Typography variant='button'>Users</Typography>
51+
<Typography sx={{ fontWeight: 'bold' }}>Users</Typography>
5152
<Typography noWrap variant='button'>
5253
{userCount}
5354
</Typography>
@@ -58,7 +59,7 @@ function SwarmMonitor({
5859
<>
5960
<Divider flexItem orientation='vertical' />
6061
<Box sx={{ display: 'flex', flexDirection: 'column', alignItems: { md: 'center' } }}>
61-
<Typography variant='button'>Workers</Typography>
62+
<Typography sx={{ fontWeight: 'bold' }}>Workers</Typography>
6263
<Typography noWrap variant='button'>
6364
{workerCount}
6465
</Typography>
@@ -67,14 +68,14 @@ function SwarmMonitor({
6768
)}
6869
<Divider flexItem orientation='vertical' />
6970
<Box sx={{ display: 'flex', flexDirection: 'column', alignItems: { md: 'center' } }}>
70-
<Typography variant='button'>RPS</Typography>
71+
<Typography sx={{ fontWeight: 'bold' }}>RPS</Typography>
7172
<Typography noWrap variant='button'>
7273
{totalRps}
7374
</Typography>
7475
</Box>
7576
<Divider flexItem orientation='vertical' />
7677
<Box sx={{ display: 'flex', flexDirection: 'column', alignItems: { md: 'center' } }}>
77-
<Typography variant='button'>Failures</Typography>
78+
<Typography sx={{ fontWeight: 'bold' }}>Failures</Typography>
7879
<Typography noWrap variant='button'>{`${failRatio}%`}</Typography>
7980
</Box>
8081
</Box>

Diff for: locust/webui/src/components/StatsTable/StatsTable.tsx

+9-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { Box } from '@mui/material';
12
import { connect } from 'react-redux';
23

34
import Table from 'components/Table/Table';
@@ -40,15 +41,21 @@ export function StatsTable({ stats, tableStructure = baseTableStructure }: IStat
4041
useSelectViewColumns(tableStructure);
4142

4243
return (
43-
<>
44+
<Box
45+
sx={{
46+
display: 'flex',
47+
flexDirection: { xs: 'column', lg: 'row-reverse', alignItems: 'flex-start' },
48+
columnGap: 1,
49+
}}
50+
>
4451
<ViewColumnSelector
4552
addColumn={addColumn}
4653
removeColumn={removeColumn}
4754
selectedColumns={selectedColumns}
4855
structure={tableStructure}
4956
/>
5057
<Table<ISwarmStat> hasTotalRow rows={stats} structure={filteredStructure} />
51-
</>
58+
</Box>
5259
);
5360
}
5461

Diff for: locust/webui/src/components/SwarmCharts/SwarmCharts.tsx

+3-7
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,9 @@ const availableSwarmCharts: Omit<ILineChart<ICharts>, 'charts'>[] = [
4545
];
4646

4747
export function SwarmCharts({ charts }: { charts: ICharts }) {
48-
return (
49-
<div>
50-
{availableSwarmCharts.map((lineChartProps, index) => (
51-
<LineChart<ICharts> key={`swarm-chart-${index}`} {...lineChartProps} charts={charts} />
52-
))}
53-
</div>
54-
);
48+
return availableSwarmCharts.map((lineChartProps, index) => (
49+
<LineChart<ICharts> key={`swarm-chart-${index}`} {...lineChartProps} charts={charts} />
50+
));
5551
}
5652

5753
const storeConnector = ({ ui: { charts } }: IRootState) => ({ charts });

Diff for: locust/webui/src/components/ViewColumnSelector/ViewColumnSelector.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ function ViewColumnSelector({
2020
const [anchorEl, setAnchorEl] = useState(null as HTMLButtonElement | null);
2121

2222
return (
23-
<Stack direction='row' justifyContent='end' my={2} spacing={1}>
23+
<Stack sx={{ alignSelf: { xs: 'end', lg: 'start' }, my: 2 }}>
2424
<Button onClick={event => setAnchorEl(event.currentTarget)} variant='outlined'>
2525
<ViewColumnIcon />
2626
</Button>

0 commit comments

Comments
 (0)