Merge pull request #2196 from automatisch/AUT-1364
feat: inline login form error and unify Alert font weight
This commit is contained in:
@@ -112,7 +112,7 @@ export default function ResetPasswordForm() {
|
|||||||
<Alert
|
<Alert
|
||||||
data-test="accept-invitation-form-error"
|
data-test="accept-invitation-form-error"
|
||||||
severity="error"
|
severity="error"
|
||||||
sx={{ mt: 1, fontWeight: 500 }}
|
sx={{ mt: 1 }}
|
||||||
>
|
>
|
||||||
{formatMessage('acceptInvitationForm.invalidToken')}
|
{formatMessage('acceptInvitationForm.invalidToken')}
|
||||||
</Alert>
|
</Alert>
|
||||||
|
@@ -126,7 +126,7 @@ function AddAppConnection(props) {
|
|||||||
</DialogTitle>
|
</DialogTitle>
|
||||||
|
|
||||||
{authDocUrl && (
|
{authDocUrl && (
|
||||||
<Alert severity="info" sx={{ fontWeight: 300 }}>
|
<Alert severity="info">
|
||||||
{formatMessage('addAppConnection.callToDocs', {
|
{formatMessage('addAppConnection.callToDocs', {
|
||||||
appName: name,
|
appName: name,
|
||||||
docsLink: generateExternalLink(authDocUrl),
|
docsLink: generateExternalLink(authDocUrl),
|
||||||
@@ -138,7 +138,7 @@ function AddAppConnection(props) {
|
|||||||
<Alert
|
<Alert
|
||||||
data-test="add-connection-error"
|
data-test="add-connection-error"
|
||||||
severity="error"
|
severity="error"
|
||||||
sx={{ mt: 1, fontWeight: 500, wordBreak: 'break-all' }}
|
sx={{ mt: 1, wordBreak: 'break-all' }}
|
||||||
>
|
>
|
||||||
{!errorDetails && errorMessage}
|
{!errorDetails && errorMessage}
|
||||||
{errorDetails && (
|
{errorDetails && (
|
||||||
|
@@ -32,10 +32,7 @@ function AdminApplicationAuthClientDialog(props) {
|
|||||||
<Dialog open={true} onClose={onClose}>
|
<Dialog open={true} onClose={onClose}>
|
||||||
<DialogTitle>{title}</DialogTitle>
|
<DialogTitle>{title}</DialogTitle>
|
||||||
{error && (
|
{error && (
|
||||||
<Alert
|
<Alert severity="error" sx={{ mt: 1, wordBreak: 'break-all' }}>
|
||||||
severity="error"
|
|
||||||
sx={{ mt: 1, fontWeight: 500, wordBreak: 'break-all' }}
|
|
||||||
>
|
|
||||||
{error.message}
|
{error.message}
|
||||||
</Alert>
|
</Alert>
|
||||||
)}
|
)}
|
||||||
|
@@ -188,7 +188,7 @@ function InstallationForm() {
|
|||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
{install.isSuccess && (
|
{install.isSuccess && (
|
||||||
<Alert data-test="success-alert" severity="success" sx={{ mt: 3, fontWeight: 500 }}>
|
<Alert data-test="success-alert" severity="success" sx={{ mt: 3 }}>
|
||||||
{formatMessage('installationForm.success', {
|
{formatMessage('installationForm.success', {
|
||||||
link: (str) => (
|
link: (str) => (
|
||||||
<Link
|
<Link
|
||||||
|
@@ -11,16 +11,19 @@ import Form from 'components/Form';
|
|||||||
import TextField from 'components/TextField';
|
import TextField from 'components/TextField';
|
||||||
import useFormatMessage from 'hooks/useFormatMessage';
|
import useFormatMessage from 'hooks/useFormatMessage';
|
||||||
import useCreateAccessToken from 'hooks/useCreateAccessToken';
|
import useCreateAccessToken from 'hooks/useCreateAccessToken';
|
||||||
import useEnqueueSnackbar from 'hooks/useEnqueueSnackbar';
|
import { Alert } from '@mui/material';
|
||||||
|
|
||||||
function LoginForm() {
|
function LoginForm() {
|
||||||
const isCloud = useCloud();
|
const isCloud = useCloud();
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const formatMessage = useFormatMessage();
|
const formatMessage = useFormatMessage();
|
||||||
const enqueueSnackbar = useEnqueueSnackbar();
|
|
||||||
const authentication = useAuthentication();
|
const authentication = useAuthentication();
|
||||||
const { mutateAsync: createAccessToken, isPending: loading } =
|
const {
|
||||||
useCreateAccessToken();
|
mutateAsync: createAccessToken,
|
||||||
|
isPending: loading,
|
||||||
|
error,
|
||||||
|
isError,
|
||||||
|
} = useCreateAccessToken();
|
||||||
|
|
||||||
React.useEffect(() => {
|
React.useEffect(() => {
|
||||||
if (authentication.isAuthenticated) {
|
if (authentication.isAuthenticated) {
|
||||||
@@ -37,11 +40,19 @@ function LoginForm() {
|
|||||||
});
|
});
|
||||||
const { token } = data;
|
const { token } = data;
|
||||||
authentication.updateToken(token);
|
authentication.updateToken(token);
|
||||||
} catch (error) {
|
} catch {}
|
||||||
enqueueSnackbar(error?.message || formatMessage('loginForm.error'), {
|
};
|
||||||
variant: 'error',
|
|
||||||
});
|
const renderError = () => {
|
||||||
}
|
const errors = error?.response?.data?.errors?.general || [
|
||||||
|
formatMessage('loginForm.error'),
|
||||||
|
];
|
||||||
|
|
||||||
|
return errors.map((error) => (
|
||||||
|
<Alert severity="error" sx={{ mt: 2 }}>
|
||||||
|
{error}
|
||||||
|
</Alert>
|
||||||
|
));
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -94,6 +105,8 @@ function LoginForm() {
|
|||||||
</Link>
|
</Link>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
{isError && renderError()}
|
||||||
|
|
||||||
<LoadingButton
|
<LoadingButton
|
||||||
type="submit"
|
type="submit"
|
||||||
variant="contained"
|
variant="contained"
|
||||||
|
@@ -84,10 +84,7 @@ function TestSubstep(props) {
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{hasError && (
|
{hasError && (
|
||||||
<Alert
|
<Alert severity="error" sx={{ mb: 2, width: '100%' }}>
|
||||||
severity="error"
|
|
||||||
sx={{ mb: 2, fontWeight: 500, width: '100%' }}
|
|
||||||
>
|
|
||||||
<pre style={{ margin: 0, whiteSpace: 'pre-wrap' }}>
|
<pre style={{ margin: 0, whiteSpace: 'pre-wrap' }}>
|
||||||
{JSON.stringify(errorDetails, null, 2)}
|
{JSON.stringify(errorDetails, null, 2)}
|
||||||
</pre>
|
</pre>
|
||||||
@@ -104,13 +101,11 @@ function TestSubstep(props) {
|
|||||||
severity="warning"
|
severity="warning"
|
||||||
sx={{ mb: 1, width: '100%' }}
|
sx={{ mb: 1, width: '100%' }}
|
||||||
>
|
>
|
||||||
<AlertTitle sx={{ fontWeight: 700 }}>
|
<AlertTitle>
|
||||||
{formatMessage('flowEditor.noTestDataTitle')}
|
{formatMessage('flowEditor.noTestDataTitle')}
|
||||||
</AlertTitle>
|
</AlertTitle>
|
||||||
|
|
||||||
<Box sx={{ fontWeight: 400 }}>
|
<Box>{formatMessage('flowEditor.noTestDataMessage')}</Box>
|
||||||
{formatMessage('flowEditor.noTestDataMessage')}
|
|
||||||
</Box>
|
|
||||||
</Alert>
|
</Alert>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
@@ -124,7 +124,6 @@ export default function CreateUser() {
|
|||||||
<Alert
|
<Alert
|
||||||
severity="info"
|
severity="info"
|
||||||
color="primary"
|
color="primary"
|
||||||
sx={{ fontWeight: '500' }}
|
|
||||||
data-test="invitation-email-info-alert"
|
data-test="invitation-email-info-alert"
|
||||||
>
|
>
|
||||||
{formatMessage('createUser.invitationEmailInfo', {
|
{formatMessage('createUser.invitationEmailInfo', {
|
||||||
|
@@ -42,13 +42,9 @@ export default function Execution() {
|
|||||||
<Grid container item sx={{ mt: 2, mb: [2, 5] }} rowGap={3}>
|
<Grid container item sx={{ mt: 2, mb: [2, 5] }} rowGap={3}>
|
||||||
{!isExecutionStepsLoading && !data?.pages?.[0].data.length && (
|
{!isExecutionStepsLoading && !data?.pages?.[0].data.length && (
|
||||||
<Alert severity="warning" sx={{ flex: 1 }}>
|
<Alert severity="warning" sx={{ flex: 1 }}>
|
||||||
<AlertTitle sx={{ fontWeight: 700 }}>
|
<AlertTitle>{formatMessage('execution.noDataTitle')}</AlertTitle>
|
||||||
{formatMessage('execution.noDataTitle')}
|
|
||||||
</AlertTitle>
|
|
||||||
|
|
||||||
<Box sx={{ fontWeight: 400 }}>
|
<Box>{formatMessage('execution.noDataMessage')}</Box>
|
||||||
{formatMessage('execution.noDataMessage')}
|
|
||||||
</Box>
|
|
||||||
</Alert>
|
</Alert>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
@@ -266,8 +266,8 @@ function ProfileSettings() {
|
|||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
<Grid item xs={12} justifyContent="flex-end" sx={{ pt: 5 }}>
|
<Grid item xs={12} justifyContent="flex-end" sx={{ pt: 5 }}>
|
||||||
<Alert variant="outlined" severity="error" sx={{ fontWeight: 500 }}>
|
<Alert variant="outlined" severity="error">
|
||||||
<AlertTitle sx={{ fontWeight: 700 }}>
|
<AlertTitle>
|
||||||
{formatMessage('profileSettings.deleteMyAccount')}
|
{formatMessage('profileSettings.deleteMyAccount')}
|
||||||
</AlertTitle>
|
</AlertTitle>
|
||||||
|
|
||||||
|
@@ -278,6 +278,20 @@ export const defaultTheme = createTheme({
|
|||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
MuiAlert: {
|
||||||
|
styleOverrides: {
|
||||||
|
root: ({ theme }) => ({
|
||||||
|
fontWeight: theme.typography.fontWeightRegular,
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
MuiAlertTitle: {
|
||||||
|
styleOverrides: {
|
||||||
|
root: ({ theme }) => ({
|
||||||
|
fontWeight: theme.typography.fontWeightBold,
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
export const mationTheme = createTheme(
|
export const mationTheme = createTheme(
|
||||||
|
Reference in New Issue
Block a user