2022-09-17 00:35:10 -05:00
|
|
|
import { UserScope } from '@logto/core-kit';
|
2022-05-17 08:37:30 -05:00
|
|
|
import { LogtoProvider } from '@logto/react';
|
2023-01-16 02:11:40 -05:00
|
|
|
import {
|
|
|
|
adminConsoleApplicationId,
|
|
|
|
managementResource,
|
|
|
|
managementResourceScope,
|
|
|
|
} from '@logto/schemas';
|
2022-05-17 08:37:30 -05:00
|
|
|
import { BrowserRouter, Navigate, Route, Routes } from 'react-router-dom';
|
|
|
|
import { SWRConfig } from 'swr';
|
2022-06-07 08:33:53 -05:00
|
|
|
|
2023-01-30 22:47:30 -05:00
|
|
|
import 'overlayscrollbars/styles/overlayscrollbars.css';
|
2022-02-27 21:35:14 -05:00
|
|
|
import './scss/normalized.scss';
|
2023-01-30 22:47:30 -05:00
|
|
|
import './scss/overlayscrollbars.scss';
|
|
|
|
|
2022-05-14 07:51:55 -05:00
|
|
|
// eslint-disable-next-line import/no-unassigned-import
|
|
|
|
import '@fontsource/roboto-mono';
|
2022-06-07 08:33:53 -05:00
|
|
|
import Toast from '@/components/Toast';
|
2023-02-07 04:59:22 -05:00
|
|
|
import AppBoundary from '@/containers/AppBoundary';
|
|
|
|
import AppLayout from '@/containers/AppLayout';
|
|
|
|
import ErrorBoundary from '@/containers/ErrorBoundary';
|
2022-06-07 08:33:53 -05:00
|
|
|
import useSwrOptions from '@/hooks/use-swr-options';
|
|
|
|
import initI18n from '@/i18n/init';
|
2022-06-10 05:06:53 -05:00
|
|
|
import ApiResourceDetails from '@/pages/ApiResourceDetails';
|
|
|
|
import ApiResources from '@/pages/ApiResources';
|
|
|
|
import ApplicationDetails from '@/pages/ApplicationDetails';
|
|
|
|
import Applications from '@/pages/Applications';
|
|
|
|
import AuditLogDetails from '@/pages/AuditLogDetails';
|
|
|
|
import AuditLogs from '@/pages/AuditLogs';
|
|
|
|
import Callback from '@/pages/Callback';
|
|
|
|
import ConnectorDetails from '@/pages/ConnectorDetails';
|
|
|
|
import Connectors from '@/pages/Connectors';
|
|
|
|
import Dashboard from '@/pages/Dashboard';
|
|
|
|
import GetStarted from '@/pages/GetStarted';
|
|
|
|
import NotFound from '@/pages/NotFound';
|
2023-01-05 03:34:01 -05:00
|
|
|
import RoleDetails from '@/pages/RoleDetails';
|
2023-01-05 03:22:45 -05:00
|
|
|
import Roles from '@/pages/Roles';
|
2022-06-10 05:06:53 -05:00
|
|
|
import Settings from '@/pages/Settings';
|
|
|
|
import SignInExperience from '@/pages/SignInExperience';
|
|
|
|
import UserDetails from '@/pages/UserDetails';
|
|
|
|
import Users from '@/pages/Users';
|
2022-06-19 21:58:27 -05:00
|
|
|
import Welcome from '@/pages/Welcome';
|
2022-03-03 02:44:42 -05:00
|
|
|
|
2023-01-09 01:10:57 -05:00
|
|
|
import {
|
|
|
|
ApiResourceDetailsTabs,
|
|
|
|
ConnectorsTabs,
|
|
|
|
RoleDetailsTabs,
|
|
|
|
SignInExperiencePage,
|
2023-01-09 02:25:50 -05:00
|
|
|
UserDetailsTabs,
|
2023-01-09 01:10:57 -05:00
|
|
|
} from './consts/page-tabs';
|
2023-02-07 04:59:22 -05:00
|
|
|
import AppContent from './containers/AppContent';
|
2023-01-06 01:45:51 -05:00
|
|
|
import ApiResourcePermissions from './pages/ApiResourceDetails/ApiResourcePermissions';
|
|
|
|
import ApiResourceSettings from './pages/ApiResourceDetails/ApiResourceSettings';
|
2023-02-07 04:59:22 -05:00
|
|
|
import CloudPreview from './pages/CloudPreview';
|
2023-01-09 01:10:57 -05:00
|
|
|
import RolePermissions from './pages/RoleDetails/RolePermissions';
|
|
|
|
import RoleSettings from './pages/RoleDetails/RoleSettings';
|
2023-01-09 02:39:31 -05:00
|
|
|
import RoleUsers from './pages/RoleDetails/RoleUsers';
|
2023-01-09 02:25:50 -05:00
|
|
|
import UserLogs from './pages/UserDetails/UserLogs';
|
2023-01-09 02:34:22 -05:00
|
|
|
import UserRoles from './pages/UserDetails/UserRoles';
|
2023-01-09 02:25:50 -05:00
|
|
|
import UserSettings from './pages/UserDetails/UserSettings';
|
2022-09-17 00:35:10 -05:00
|
|
|
import { getBasename } from './utilities/router';
|
|
|
|
|
2022-02-28 09:18:01 -05:00
|
|
|
void initI18n();
|
2022-02-16 02:04:34 -05:00
|
|
|
|
2022-03-03 02:02:30 -05:00
|
|
|
const Main = () => {
|
2022-06-06 22:59:17 -05:00
|
|
|
const swrOptions = useSwrOptions();
|
2022-05-05 05:42:10 -05:00
|
|
|
|
2022-02-27 21:35:14 -05:00
|
|
|
return (
|
2022-05-05 00:24:01 -05:00
|
|
|
<ErrorBoundary>
|
2022-06-06 22:59:17 -05:00
|
|
|
<SWRConfig value={swrOptions}>
|
2022-06-01 02:13:48 -05:00
|
|
|
<AppBoundary>
|
|
|
|
<Toast />
|
2022-06-10 05:06:53 -05:00
|
|
|
<Routes>
|
|
|
|
<Route path="callback" element={<Callback />} />
|
2022-06-19 21:58:27 -05:00
|
|
|
<Route path="welcome" element={<Welcome />} />
|
2023-02-07 04:59:22 -05:00
|
|
|
<Route element={<AppLayout />}>
|
|
|
|
<Route path="/cloud-preview" element={<CloudPreview />} />
|
|
|
|
<Route element={<AppContent />}>
|
|
|
|
<Route path="*" element={<NotFound />} />
|
|
|
|
<Route path="get-started" element={<GetStarted />} />
|
|
|
|
<Route path="dashboard" element={<Dashboard />} />
|
|
|
|
<Route path="applications">
|
|
|
|
<Route index element={<Applications />} />
|
|
|
|
<Route path="create" element={<Applications />} />
|
|
|
|
<Route path=":id" element={<ApplicationDetails />} />
|
|
|
|
</Route>
|
|
|
|
<Route path="api-resources">
|
|
|
|
<Route index element={<ApiResources />} />
|
|
|
|
<Route path="create" element={<ApiResources />} />
|
|
|
|
<Route path=":id" element={<ApiResourceDetails />}>
|
|
|
|
<Route
|
|
|
|
index
|
|
|
|
element={<Navigate replace to={ApiResourceDetailsTabs.Settings} />}
|
|
|
|
/>
|
|
|
|
<Route
|
|
|
|
path={ApiResourceDetailsTabs.Settings}
|
|
|
|
element={<ApiResourceSettings />}
|
|
|
|
/>
|
|
|
|
<Route
|
|
|
|
path={ApiResourceDetailsTabs.Permissions}
|
|
|
|
element={<ApiResourcePermissions />}
|
|
|
|
/>
|
|
|
|
</Route>
|
|
|
|
</Route>
|
|
|
|
<Route path="sign-in-experience">
|
2023-01-06 01:45:51 -05:00
|
|
|
<Route
|
|
|
|
index
|
2023-02-07 04:59:22 -05:00
|
|
|
element={<Navigate replace to={SignInExperiencePage.BrandingTab} />}
|
2023-01-06 01:45:51 -05:00
|
|
|
/>
|
2023-02-07 04:59:22 -05:00
|
|
|
<Route path=":tab" element={<SignInExperience />} />
|
|
|
|
</Route>
|
|
|
|
<Route path="connectors">
|
|
|
|
<Route index element={<Navigate replace to={ConnectorsTabs.Passwordless} />} />
|
|
|
|
<Route path=":tab" element={<Connectors />} />
|
|
|
|
<Route path=":tab/create/:createType" element={<Connectors />} />
|
|
|
|
<Route path=":tab/:connectorId" element={<ConnectorDetails />} />
|
|
|
|
</Route>
|
|
|
|
<Route path="users">
|
|
|
|
<Route index element={<Users />} />
|
|
|
|
<Route path="create" element={<Users />} />
|
|
|
|
<Route path=":id" element={<UserDetails />}>
|
|
|
|
<Route index element={<Navigate replace to={UserDetailsTabs.Settings} />} />
|
|
|
|
<Route path={UserDetailsTabs.Settings} element={<UserSettings />} />
|
|
|
|
<Route path={UserDetailsTabs.Roles} element={<UserRoles />} />
|
|
|
|
<Route path={UserDetailsTabs.Logs} element={<UserLogs />} />
|
|
|
|
</Route>
|
2023-01-06 01:45:51 -05:00
|
|
|
<Route
|
2023-02-07 04:59:22 -05:00
|
|
|
path={`:id/${UserDetailsTabs.Logs}/:logId`}
|
|
|
|
element={<AuditLogDetails />}
|
2023-01-06 01:45:51 -05:00
|
|
|
/>
|
|
|
|
</Route>
|
2023-02-07 04:59:22 -05:00
|
|
|
<Route path="audit-logs">
|
|
|
|
<Route index element={<AuditLogs />} />
|
|
|
|
<Route path=":logId" element={<AuditLogDetails />} />
|
2023-01-09 02:25:50 -05:00
|
|
|
</Route>
|
2023-02-07 04:59:22 -05:00
|
|
|
<Route path="roles">
|
|
|
|
<Route index element={<Roles />} />
|
|
|
|
<Route path="create" element={<Roles />} />
|
|
|
|
<Route path=":id" element={<RoleDetails />}>
|
|
|
|
<Route index element={<Navigate replace to={RoleDetailsTabs.Settings} />} />
|
|
|
|
<Route path={RoleDetailsTabs.Settings} element={<RoleSettings />} />
|
|
|
|
<Route path={RoleDetailsTabs.Permissions} element={<RolePermissions />} />
|
|
|
|
<Route path={RoleDetailsTabs.Users} element={<RoleUsers />} />
|
|
|
|
</Route>
|
2023-01-09 01:10:57 -05:00
|
|
|
</Route>
|
2023-02-07 04:59:22 -05:00
|
|
|
<Route path="settings" element={<Settings />} />
|
2023-01-05 03:22:45 -05:00
|
|
|
</Route>
|
2022-06-10 05:06:53 -05:00
|
|
|
</Route>
|
|
|
|
</Routes>
|
2022-06-01 02:13:48 -05:00
|
|
|
</AppBoundary>
|
2022-05-05 00:24:01 -05:00
|
|
|
</SWRConfig>
|
|
|
|
</ErrorBoundary>
|
2022-02-27 21:35:14 -05:00
|
|
|
);
|
2022-02-16 02:04:34 -05:00
|
|
|
};
|
2022-03-03 02:02:30 -05:00
|
|
|
|
|
|
|
const App = () => (
|
2022-05-30 23:39:03 -05:00
|
|
|
<BrowserRouter basename={getBasename('console', '5002')}>
|
2022-03-16 02:34:03 -05:00
|
|
|
<LogtoProvider
|
2022-05-23 06:18:48 -05:00
|
|
|
config={{
|
|
|
|
endpoint: window.location.origin,
|
|
|
|
appId: adminConsoleApplicationId,
|
2022-06-02 02:32:46 -05:00
|
|
|
resources: [managementResource.indicator],
|
2023-01-16 02:11:40 -05:00
|
|
|
scopes: [UserScope.Identities, UserScope.CustomData, managementResourceScope.name],
|
2022-05-23 06:18:48 -05:00
|
|
|
}}
|
2022-03-16 02:34:03 -05:00
|
|
|
>
|
|
|
|
<Main />
|
|
|
|
</LogtoProvider>
|
2022-03-03 02:02:30 -05:00
|
|
|
</BrowserRouter>
|
|
|
|
);
|
|
|
|
|
|
|
|
export default App;
|