2021-10-29 16:11:06 +00:00
|
|
|
import { lazy } from "react";
|
2023-01-18 12:09:49 +00:00
|
|
|
import type { Path } from "react-router-dom";
|
|
|
|
import { generatePath } from "react-router-dom";
|
2021-07-23 16:29:10 +00:00
|
|
|
import type { RouteDef } from "../../route-config";
|
|
|
|
|
|
|
|
export type RealmSettingsTab =
|
2022-01-20 15:34:58 +00:00
|
|
|
| "general"
|
2021-07-23 16:29:10 +00:00
|
|
|
| "login"
|
|
|
|
| "email"
|
|
|
|
| "themes"
|
|
|
|
| "keys"
|
|
|
|
| "events"
|
2022-01-14 10:05:50 +00:00
|
|
|
| "localization"
|
2022-06-22 11:35:10 +00:00
|
|
|
| "security-defenses"
|
2021-08-09 19:28:24 +00:00
|
|
|
| "sessions"
|
2021-09-09 10:45:19 +00:00
|
|
|
| "tokens"
|
2022-06-22 11:35:10 +00:00
|
|
|
| "client-policies"
|
|
|
|
| "user-profile"
|
|
|
|
| "user-registration";
|
2021-07-23 16:29:10 +00:00
|
|
|
|
|
|
|
export type RealmSettingsParams = {
|
|
|
|
realm: string;
|
|
|
|
tab?: RealmSettingsTab;
|
|
|
|
};
|
|
|
|
|
2023-03-24 14:37:24 +00:00
|
|
|
const RealmSettingsSection = lazy(() => import("../RealmSettingsSection"));
|
|
|
|
|
2021-07-23 16:29:10 +00:00
|
|
|
export const RealmSettingsRoute: RouteDef = {
|
2022-08-22 14:29:35 +00:00
|
|
|
path: "/:realm/realm-settings",
|
2023-03-24 14:37:24 +00:00
|
|
|
element: <RealmSettingsSection />,
|
2021-07-23 16:29:10 +00:00
|
|
|
breadcrumb: (t) => t("realmSettings"),
|
2023-03-27 00:31:23 +00:00
|
|
|
handle: {
|
|
|
|
access: "view-realm",
|
|
|
|
},
|
2021-07-23 16:29:10 +00:00
|
|
|
};
|
|
|
|
|
2022-08-22 14:29:35 +00:00
|
|
|
export const RealmSettingsRouteWithTab: RouteDef = {
|
|
|
|
...RealmSettingsRoute,
|
|
|
|
path: "/:realm/realm-settings/:tab",
|
|
|
|
};
|
|
|
|
|
|
|
|
export const toRealmSettings = (params: RealmSettingsParams): Partial<Path> => {
|
|
|
|
const path = params.tab
|
|
|
|
? RealmSettingsRouteWithTab.path
|
|
|
|
: RealmSettingsRoute.path;
|
|
|
|
|
|
|
|
return {
|
|
|
|
pathname: generatePath(path, params),
|
|
|
|
};
|
|
|
|
};
|