keycloak-scim/js/apps/admin-ui/src/realm-settings/routes/RealmSettings.tsx

51 lines
1.2 KiB
TypeScript
Raw Normal View History

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 { generateEncodedPath } from "../../utils/generateEncodedPath";
import type { AppRouteObject } from "../../routes";
export type RealmSettingsTab =
| "general"
| "login"
| "email"
| "themes"
| "keys"
| "events"
| "localization"
2022-06-22 11:35:10 +00:00
| "security-defenses"
| "sessions"
| "tokens"
2022-06-22 11:35:10 +00:00
| "client-policies"
| "user-profile"
| "user-registration";
export type RealmSettingsParams = {
realm: string;
tab?: RealmSettingsTab;
};
const RealmSettingsSection = lazy(() => import("../RealmSettingsSection"));
export const RealmSettingsRoute: AppRouteObject = {
path: "/:realm/realm-settings",
element: <RealmSettingsSection />,
breadcrumb: (t) => t("realmSettings"),
handle: {
access: "view-realm",
},
};
export const RealmSettingsRouteWithTab: AppRouteObject = {
...RealmSettingsRoute,
path: "/:realm/realm-settings/:tab",
};
export const toRealmSettings = (params: RealmSettingsParams): Partial<Path> => {
const path = params.tab
? RealmSettingsRouteWithTab.path
: RealmSettingsRoute.path;
return {
pathname: generateEncodedPath(path, params),
};
};