Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Webui Add Markdown Support for Auth Page #2969

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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