mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-07-27 11:20:07 +00:00
fix: 404 page layout (#16044)
* fix: 404 page layout * Fix 404 page layout issue
This commit is contained in:
parent
a9773b9527
commit
a526aa55e1
@ -19,6 +19,7 @@ import { Redirect, Route, Switch } from 'react-router-dom';
|
|||||||
import { ROUTES } from '../../constants/constants';
|
import { ROUTES } from '../../constants/constants';
|
||||||
import { useApplicationStore } from '../../hooks/useApplicationStore';
|
import { useApplicationStore } from '../../hooks/useApplicationStore';
|
||||||
import { useDomainStore } from '../../hooks/useDomainStore';
|
import { useDomainStore } from '../../hooks/useDomainStore';
|
||||||
|
import PageNotFound from '../../pages/PageNotFound/PageNotFound';
|
||||||
import SignUpPage from '../../pages/SignUp/SignUpPage';
|
import SignUpPage from '../../pages/SignUp/SignUpPage';
|
||||||
import applicationRoutesClass from '../../utils/ApplicationRoutesClassBase';
|
import applicationRoutesClass from '../../utils/ApplicationRoutesClassBase';
|
||||||
import Appbar from '../AppBar/Appbar';
|
import Appbar from '../AppBar/Appbar';
|
||||||
@ -46,6 +47,8 @@ const AppContainer = () => {
|
|||||||
<Route exact component={SignUpPage} path={ROUTES.SIGNUP}>
|
<Route exact component={SignUpPage} path={ROUTES.SIGNUP}>
|
||||||
{!isEmpty(currentUser) && <Redirect to={ROUTES.HOME} />}
|
{!isEmpty(currentUser) && <Redirect to={ROUTES.HOME} />}
|
||||||
</Route>
|
</Route>
|
||||||
|
{/* Do not move this route as we don't want to render the sidebar and header in 404 page */}
|
||||||
|
<Route exact component={PageNotFound} path={ROUTES.NOT_FOUND} />
|
||||||
|
|
||||||
<Layout className="app-container">
|
<Layout className="app-container">
|
||||||
<Sider
|
<Sider
|
||||||
|
@ -13,18 +13,12 @@
|
|||||||
|
|
||||||
import { isNil } from 'lodash';
|
import { isNil } from 'lodash';
|
||||||
import React, { useCallback, useEffect } from 'react';
|
import React, { useCallback, useEffect } from 'react';
|
||||||
import { Route, Switch, useLocation } from 'react-router-dom';
|
import { useLocation } from 'react-router-dom';
|
||||||
import { useAnalytics } from 'use-analytics';
|
import { useAnalytics } from 'use-analytics';
|
||||||
import AppContainer from '../../components/AppContainer/AppContainer';
|
|
||||||
import { ROUTES } from '../../constants/constants';
|
|
||||||
import { CustomEventTypes } from '../../generated/analytics/webAnalyticEventData';
|
import { CustomEventTypes } from '../../generated/analytics/webAnalyticEventData';
|
||||||
import { useApplicationStore } from '../../hooks/useApplicationStore';
|
import { useApplicationStore } from '../../hooks/useApplicationStore';
|
||||||
|
import AppContainer from '../AppContainer/AppContainer';
|
||||||
import { UnAuthenticatedAppRouter } from './UnAuthenticatedAppRouter';
|
import { UnAuthenticatedAppRouter } from './UnAuthenticatedAppRouter';
|
||||||
import withSuspenseFallback from './withSuspenseFallback';
|
|
||||||
|
|
||||||
const PageNotFound = withSuspenseFallback(
|
|
||||||
React.lazy(() => import('../../pages/PageNotFound/PageNotFound'))
|
|
||||||
);
|
|
||||||
|
|
||||||
const AppRouter = () => {
|
const AppRouter = () => {
|
||||||
const location = useLocation();
|
const location = useLocation();
|
||||||
@ -70,12 +64,7 @@ const AppRouter = () => {
|
|||||||
return () => targetNode.removeEventListener('click', handleClickEvent);
|
return () => targetNode.removeEventListener('click', handleClickEvent);
|
||||||
}, [handleClickEvent]);
|
}, [handleClickEvent]);
|
||||||
|
|
||||||
return (
|
return isAuthenticated ? <AppContainer /> : <UnAuthenticatedAppRouter />;
|
||||||
<Switch>
|
|
||||||
{isAuthenticated ? <AppContainer /> : <UnAuthenticatedAppRouter />}
|
|
||||||
<Route exact component={PageNotFound} path={ROUTES.NOT_FOUND} />
|
|
||||||
</Switch>
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export default AppRouter;
|
export default AppRouter;
|
||||||
|
@ -224,10 +224,6 @@ const AddQueryPage = withSuspenseFallback(
|
|||||||
React.lazy(() => import('../../pages/AddQueryPage/AddQueryPage.component'))
|
React.lazy(() => import('../../pages/AddQueryPage/AddQueryPage.component'))
|
||||||
);
|
);
|
||||||
|
|
||||||
const PageNotFound = withSuspenseFallback(
|
|
||||||
React.lazy(() => import('../../pages/PageNotFound/PageNotFound'))
|
|
||||||
);
|
|
||||||
|
|
||||||
const IncidentManagerPage = withSuspenseFallback(
|
const IncidentManagerPage = withSuspenseFallback(
|
||||||
React.lazy(() => import('../../pages/IncidentManager/IncidentManagerPage'))
|
React.lazy(() => import('../../pages/IncidentManager/IncidentManagerPage'))
|
||||||
);
|
);
|
||||||
@ -508,7 +504,7 @@ const AuthenticatedAppRouter: FunctionComponent = () => {
|
|||||||
]}>
|
]}>
|
||||||
<Redirect to={ROUTES.MY_DATA} />
|
<Redirect to={ROUTES.MY_DATA} />
|
||||||
</Route>
|
</Route>
|
||||||
<Route exact component={PageNotFound} path={ROUTES.NOT_FOUND} />
|
|
||||||
<Redirect to={ROUTES.NOT_FOUND} />
|
<Redirect to={ROUTES.NOT_FOUND} />
|
||||||
</Switch>
|
</Switch>
|
||||||
);
|
);
|
||||||
|
@ -16,6 +16,7 @@ import { Redirect, Route, Switch } from 'react-router-dom';
|
|||||||
import { ROUTES } from '../../constants/constants';
|
import { ROUTES } from '../../constants/constants';
|
||||||
import { AuthProvider } from '../../generated/configuration/authenticationConfiguration';
|
import { AuthProvider } from '../../generated/configuration/authenticationConfiguration';
|
||||||
import { useApplicationStore } from '../../hooks/useApplicationStore';
|
import { useApplicationStore } from '../../hooks/useApplicationStore';
|
||||||
|
import PageNotFound from '../../pages/PageNotFound/PageNotFound';
|
||||||
import SamlCallback from '../../pages/SamlCallback';
|
import SamlCallback from '../../pages/SamlCallback';
|
||||||
import AccountActivationConfirmation from '../../pages/SignUp/account-activation-confirmation.component';
|
import AccountActivationConfirmation from '../../pages/SignUp/account-activation-confirmation.component';
|
||||||
import { isProtectedRoute } from '../../utils/AuthProvider.util';
|
import { isProtectedRoute } from '../../utils/AuthProvider.util';
|
||||||
@ -83,6 +84,9 @@ export const UnAuthenticatedAppRouter = () => {
|
|||||||
</Route>
|
</Route>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
{/* keep this route before any conditional JSX.Element rendering */}
|
||||||
|
<Route exact component={PageNotFound} path={ROUTES.NOT_FOUND} />
|
||||||
|
|
||||||
{isBasicAuthProvider && (
|
{isBasicAuthProvider && (
|
||||||
<>
|
<>
|
||||||
<Route exact component={BasicSignupPage} path={ROUTES.REGISTER} />
|
<Route exact component={BasicSignupPage} path={ROUTES.REGISTER} />
|
||||||
|
@ -26,7 +26,6 @@ import { Redirect, Route, Switch, useHistory } from 'react-router-dom';
|
|||||||
import { ROUTES } from '../../../constants/constants';
|
import { ROUTES } from '../../../constants/constants';
|
||||||
import { useApplicationStore } from '../../../hooks/useApplicationStore';
|
import { useApplicationStore } from '../../../hooks/useApplicationStore';
|
||||||
import SignInPage from '../../../pages/LoginPage/SignInPage';
|
import SignInPage from '../../../pages/LoginPage/SignInPage';
|
||||||
import PageNotFound from '../../../pages/PageNotFound/PageNotFound';
|
|
||||||
import { showErrorToast } from '../../../utils/ToastUtils';
|
import { showErrorToast } from '../../../utils/ToastUtils';
|
||||||
import Loader from '../../common/Loader/Loader';
|
import Loader from '../../common/Loader/Loader';
|
||||||
import {
|
import {
|
||||||
@ -121,7 +120,6 @@ const OidcAuthenticator = forwardRef<AuthenticatorRef, Props>(
|
|||||||
<Redirect to={ROUTES.MY_DATA} />
|
<Redirect to={ROUTES.MY_DATA} />
|
||||||
)}
|
)}
|
||||||
</Route>
|
</Route>
|
||||||
<Route exact component={PageNotFound} path={ROUTES.NOT_FOUND} />
|
|
||||||
{!isSigningIn ? (
|
{!isSigningIn ? (
|
||||||
<Route exact component={SignInPage} path={ROUTES.SIGNIN} />
|
<Route exact component={SignInPage} path={ROUTES.SIGNIN} />
|
||||||
) : null}
|
) : null}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user