mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-09-03 06:03:12 +00:00
* Fix #8204 UI : While login just show the loader in login button. * Addressing review comment
This commit is contained in:
parent
16619dbd5b
commit
a0f44c5ac2
@ -82,12 +82,10 @@ const BasicAuthProvider = ({
|
|||||||
}: BasicAuthProps) => {
|
}: BasicAuthProps) => {
|
||||||
const { setLoadingIndicator } = useAuthContext();
|
const { setLoadingIndicator } = useAuthContext();
|
||||||
const [loginError, setLoginError] = useState<string | null>(null);
|
const [loginError, setLoginError] = useState<string | null>(null);
|
||||||
|
|
||||||
const history = useHistory();
|
const history = useHistory();
|
||||||
|
|
||||||
const handleLogin = async (email: string, password: string) => {
|
const handleLogin = async (email: string, password: string) => {
|
||||||
try {
|
try {
|
||||||
setLoadingIndicator(true);
|
|
||||||
setLoginError(null);
|
setLoginError(null);
|
||||||
try {
|
try {
|
||||||
const response = await basicAuthSignIn({ email, password });
|
const response = await basicAuthSignIn({ email, password });
|
||||||
@ -118,8 +116,6 @@ const BasicAuthProvider = ({
|
|||||||
err as AxiosError,
|
err as AxiosError,
|
||||||
jsonData['api-error-messages']['unauthorized-user']
|
jsonData['api-error-messages']['unauthorized-user']
|
||||||
);
|
);
|
||||||
} finally {
|
|
||||||
setLoadingIndicator(false);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -10,6 +10,14 @@
|
|||||||
"tags": "Tags",
|
"tags": "Tags",
|
||||||
"settings": "Settings",
|
"settings": "Settings",
|
||||||
"search-global": "Search for Tables, Topics, Dashboards, Pipelines and ML Models",
|
"search-global": "Search for Tables, Topics, Dashboards, Pipelines and ML Models",
|
||||||
|
"om-description": "Centralized Metadata Store, Discover, Collaborate and get your Data Right",
|
||||||
|
"login": "Login",
|
||||||
|
"forgot-password": "Forgot Password",
|
||||||
|
"or-lowercase": "or",
|
||||||
|
"new-to-the-platform": "New to the platform?",
|
||||||
|
"create-account": "Create Account",
|
||||||
|
"username-or-email": "Username or Email",
|
||||||
|
"password": "Password",
|
||||||
"success": "Success",
|
"success": "Success",
|
||||||
"aborted": "Aborted",
|
"aborted": "Aborted",
|
||||||
"failed": "Failed",
|
"failed": "Failed",
|
||||||
|
@ -15,7 +15,8 @@ import { Button, Divider, Form, Input, Typography } from 'antd';
|
|||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
import jwtDecode, { JwtPayload } from 'jwt-decode';
|
import jwtDecode, { JwtPayload } from 'jwt-decode';
|
||||||
import { observer } from 'mobx-react';
|
import { observer } from 'mobx-react';
|
||||||
import React, { useEffect, useMemo } from 'react';
|
import React, { useEffect, useMemo, useState } from 'react';
|
||||||
|
import { useTranslation } from 'react-i18next';
|
||||||
import { useHistory } from 'react-router-dom';
|
import { useHistory } from 'react-router-dom';
|
||||||
import loginBG from '../../assets/img/login-bg.png';
|
import loginBG from '../../assets/img/login-bg.png';
|
||||||
import { useAuthContext } from '../../authentication/auth-provider/AuthProvider';
|
import { useAuthContext } from '../../authentication/auth-provider/AuthProvider';
|
||||||
@ -31,6 +32,7 @@ import './login.style.less';
|
|||||||
import LoginCarousel from './LoginCarousel';
|
import LoginCarousel from './LoginCarousel';
|
||||||
|
|
||||||
const SigninPage = () => {
|
const SigninPage = () => {
|
||||||
|
const [loading, setLoading] = useState(false);
|
||||||
const [form] = Form.useForm();
|
const [form] = Form.useForm();
|
||||||
|
|
||||||
const history = useHistory();
|
const history = useHistory();
|
||||||
@ -42,6 +44,8 @@ const SigninPage = () => {
|
|||||||
isAuthenticated,
|
isAuthenticated,
|
||||||
} = useAuthContext();
|
} = useAuthContext();
|
||||||
|
|
||||||
|
const { t } = useTranslation();
|
||||||
|
|
||||||
const { isAuthProviderBasic } = useMemo(() => {
|
const { isAuthProviderBasic } = useMemo(() => {
|
||||||
return {
|
return {
|
||||||
isAuthProviderBasic: authConfig?.provider === AuthTypes.BASIC,
|
isAuthProviderBasic: authConfig?.provider === AuthTypes.BASIC,
|
||||||
@ -160,7 +164,9 @@ const SigninPage = () => {
|
|||||||
email: string;
|
email: string;
|
||||||
password: string;
|
password: string;
|
||||||
}) => {
|
}) => {
|
||||||
handleLogin(email, password);
|
setLoading(true);
|
||||||
|
await Promise.resolve(handleLogin(email, password));
|
||||||
|
setLoading(false);
|
||||||
};
|
};
|
||||||
|
|
||||||
const onClickSignUp = () => history.push(ROUTES.REGISTER);
|
const onClickSignUp = () => history.push(ROUTES.REGISTER);
|
||||||
@ -179,8 +185,7 @@ const SigninPage = () => {
|
|||||||
})}>
|
})}>
|
||||||
<SVGIcons alt="OpenMetadata Logo" icon={Icons.LOGO} width="152" />
|
<SVGIcons alt="OpenMetadata Logo" icon={Icons.LOGO} width="152" />
|
||||||
<Typography.Text className="mt-8 w-80 tw-text-xl text-semi-bold tw-text-grey-muted">
|
<Typography.Text className="mt-8 w-80 tw-text-xl text-semi-bold tw-text-grey-muted">
|
||||||
Centralized Metadata Store, Discover, Collaborate and get your
|
{t('label.om-description')}{' '}
|
||||||
Data Right
|
|
||||||
</Typography.Text>
|
</Typography.Text>
|
||||||
|
|
||||||
{isAuthProviderBasic ? (
|
{isAuthProviderBasic ? (
|
||||||
@ -193,27 +198,29 @@ const SigninPage = () => {
|
|||||||
onFinish={handleSubmit}>
|
onFinish={handleSubmit}>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
data-testid="email"
|
data-testid="email"
|
||||||
label="Username or Email"
|
label={t('label.username-or-email')}
|
||||||
name="email"
|
name="email"
|
||||||
requiredMark={false}
|
requiredMark={false}
|
||||||
rules={[{ required: true }]}>
|
rules={[{ required: true }]}>
|
||||||
<Input placeholder="Email or Username" />
|
<Input placeholder={t('label.username-or-email')} />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
data-testid="password"
|
data-testid="password"
|
||||||
label="Password"
|
label={t('label.password')}
|
||||||
name="password"
|
name="password"
|
||||||
requiredMark={false}
|
requiredMark={false}
|
||||||
rules={[{ required: true }]}>
|
rules={[{ required: true }]}>
|
||||||
<Input.Password placeholder="Password" />
|
<Input.Password placeholder={t('label.password')} />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
className="w-full"
|
className="w-full"
|
||||||
data-testid="login"
|
data-testid="login"
|
||||||
|
disabled={loading}
|
||||||
htmlType="submit"
|
htmlType="submit"
|
||||||
|
loading={loading}
|
||||||
type="primary">
|
type="primary">
|
||||||
Login
|
{t('label.login')}
|
||||||
</Button>
|
</Button>
|
||||||
</Form>
|
</Form>
|
||||||
{loginError && (
|
{loginError && (
|
||||||
@ -237,7 +244,7 @@ const SigninPage = () => {
|
|||||||
)}
|
)}
|
||||||
<div className="mt-8" onClick={onClickForgotPassword}>
|
<div className="mt-8" onClick={onClickForgotPassword}>
|
||||||
<Typography.Link underline data-testid="forgot-password">
|
<Typography.Link underline data-testid="forgot-password">
|
||||||
Forgot Password
|
{t('label.forgot-password')}
|
||||||
</Typography.Link>
|
</Typography.Link>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -245,20 +252,20 @@ const SigninPage = () => {
|
|||||||
<>
|
<>
|
||||||
<Divider className="w-min-0 mt-8 mb-12 justify-center">
|
<Divider className="w-min-0 mt-8 mb-12 justify-center">
|
||||||
<Typography.Text className="text-sm" type="secondary">
|
<Typography.Text className="text-sm" type="secondary">
|
||||||
or
|
{t('label.or-lowercase')}
|
||||||
</Typography.Text>
|
</Typography.Text>
|
||||||
</Divider>
|
</Divider>
|
||||||
|
|
||||||
<div className="mt-4 flex flex-center">
|
<div className="mt-4 flex flex-center">
|
||||||
<Typography.Text className="mr-4">
|
<Typography.Text className="mr-4">
|
||||||
New to the platform?
|
{t('label.new-to-the-platform')}
|
||||||
</Typography.Text>
|
</Typography.Text>
|
||||||
<Button
|
<Button
|
||||||
ghost
|
ghost
|
||||||
data-testid="signup"
|
data-testid="signup"
|
||||||
type="link"
|
type="link"
|
||||||
onClick={onClickSignUp}>
|
onClick={onClickSignUp}>
|
||||||
Create Account
|
{t('label.create-account')}
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user