Skip to content

Commit

Permalink
Merge pull request #2969 from andrewbaldwin44/feature/auth-markdown-s…
Browse files Browse the repository at this point in the history
…upport

Webui Add Markdown Support for Auth Page
  • Loading branch information
cyberw authored Nov 7, 2024
2 parents d6f91d3 + 0c8308f commit bb0efad
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
3 changes: 2 additions & 1 deletion locust/webui/src/components/Form/CustomInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { Checkbox, FormControlLabel, TextField } from '@mui/material';

import PasswordField from 'components/Form/PasswordField';
import Select from 'components/Form/Select';
import Markdown from 'components/Markdown/Markdown';
import { ICustomInput } from 'types/form.types';

export default function CustomInput({
Expand All @@ -27,7 +28,7 @@ export default function CustomInput({
return (
<FormControlLabel
control={<Checkbox defaultChecked={defaultValue} />}
label={label}
label={<Markdown content={label} />}
name={name}
/>
);
Expand Down
5 changes: 3 additions & 2 deletions locust/webui/src/pages/Auth.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import Logo from 'assets/Logo';
import CustomInput from 'components/Form/CustomInput';
import PasswordField from 'components/Form/PasswordField';
import DarkLightToggle from 'components/Layout/Navbar/DarkLightToggle';
import Markdown from 'components/Markdown/Markdown';
import useCreateTheme from 'hooks/useCreateTheme';
import { IAuthArgs } from 'types/auth.types';

Expand Down Expand Up @@ -50,7 +51,7 @@ export default function Auth({
<Box sx={{ display: 'flex', flexDirection: 'column', rowGap: 2 }}>
<TextField label='Username' name='username' />
<PasswordField />
{info && <Alert severity='info'>{info}</Alert>}
{info && <Alert severity='info'>{<Markdown content={info} />}</Alert>}
{error && <Alert severity='error'>{error}</Alert>}
<Button size='large' type='submit' variant='contained'>
Login
Expand All @@ -64,7 +65,7 @@ export default function Auth({
{customForm.inputs.map((inputProps, index) => (
<CustomInput key={`custom-form-input-${index}`} {...inputProps} />
))}
{info && <Alert severity='info'>{info}</Alert>}
{info && <Alert severity='info'>{<Markdown content={info} />}</Alert>}
{error && <Alert severity='error'>{error}</Alert>}
<Button size='large' type='submit' variant='contained'>
{customForm.submitButtonText || 'Login'}
Expand Down
3 changes: 3 additions & 0 deletions locust/webui/src/styles/theme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ const createTheme = (mode: PaletteMode) =>
':root': {
'--footer-height': '40px',
},
p: {
margin: 0,
},
},
},
},
Expand Down

0 comments on commit bb0efad

Please sign in to comment.