diff --git a/src/route-config.ts b/src/route-config.ts index af02540cf7..5b94285521 100644 --- a/src/route-config.ts +++ b/src/route-config.ts @@ -15,10 +15,7 @@ import realmRoleRoutes from "./realm-roles/routes"; import realmSettingRoutes from "./realm-settings/routes"; import realmRoutes from "./realm/routes"; import sessionRoutes from "./sessions/routes"; -import { LdapMapperDetails } from "./user-federation/ldap/mappers/LdapMapperDetails"; -import { UserFederationKerberosSettings } from "./user-federation/UserFederationKerberosSettings"; -import { UserFederationLdapSettings } from "./user-federation/UserFederationLdapSettings"; -import { UserFederationSection } from "./user-federation/UserFederationSection"; +import userFederationRoutes from "./user-federation/routes"; import userRoutes from "./user/routes"; export type RouteDef = { @@ -39,53 +36,8 @@ export const routes: RouteDef[] = [ ...realmRoutes, ...realmSettingRoutes, ...sessionRoutes, + ...userFederationRoutes, ...userRoutes, - { - path: "/:realm/user-federation", - component: UserFederationSection, - breadcrumb: (t) => t("userFederation"), - access: "view-realm", - }, - { - path: "/:realm/user-federation/kerberos", - component: UserFederationSection, - access: "view-realm", - }, - { - path: "/:realm/user-federation/kerberos/:id", - component: UserFederationKerberosSettings, - breadcrumb: (t) => t("common:settings"), - access: "view-realm", - }, - { - path: "/:realm/user-federation/kerberos/new", - component: UserFederationKerberosSettings, - breadcrumb: (t) => t("common:settings"), - access: "view-realm", - }, - { - path: "/:realm/user-federation/ldap", - component: UserFederationSection, - access: "view-realm", - }, - { - path: "/:realm/user-federation/ldap/new", - component: UserFederationLdapSettings, - breadcrumb: (t) => t("user-federation:addOneLdap"), - access: "view-realm", - }, - { - path: "/:realm/user-federation/ldap/:id/:tab?", - component: UserFederationLdapSettings, - breadcrumb: (t) => t("common:settings"), - access: "view-realm", - }, - { - path: "/:realm/user-federation/ldap/:id/:tab/:mapperId", - component: LdapMapperDetails, - breadcrumb: (t) => t("common:mappingDetails"), - access: "view-realm", - }, { path: "/:realm/", component: DashboardSection, diff --git a/src/user-federation/routes.ts b/src/user-federation/routes.ts new file mode 100644 index 0000000000..64b3e961b1 --- /dev/null +++ b/src/user-federation/routes.ts @@ -0,0 +1,22 @@ +import type { RouteDef } from "../route-config"; +import { NewKerberosUserFederationRoute } from "./routes/NewKerberosUserFederation"; +import { NewLdapUserFederationRoute } from "./routes/NewLdapUserFederation"; +import { UserFederationRoute } from "./routes/UserFederation"; +import { UserFederationKerberosRoute } from "./routes/UserFederationKerberos"; +import { UserFederationLdapRoute } from "./routes/UserFederationLdap"; +import { UserFederationLdapMapperRoute } from "./routes/UserFederationLdapMapper"; +import { UserFederationsKerberosRoute } from "./routes/UserFederationsKerberos"; +import { UserFederationsLdapRoute } from "./routes/UserFederationsLdap"; + +const routes: RouteDef[] = [ + UserFederationRoute, + UserFederationsKerberosRoute, + UserFederationKerberosRoute, + NewKerberosUserFederationRoute, + UserFederationsLdapRoute, + NewLdapUserFederationRoute, + UserFederationLdapRoute, + UserFederationLdapMapperRoute, +]; + +export default routes; diff --git a/src/user-federation/routes/NewKerberosUserFederation.ts b/src/user-federation/routes/NewKerberosUserFederation.ts new file mode 100644 index 0000000000..c7f2b2d28b --- /dev/null +++ b/src/user-federation/routes/NewKerberosUserFederation.ts @@ -0,0 +1,19 @@ +import type { LocationDescriptorObject } from "history"; +import { generatePath } from "react-router-dom"; +import type { RouteDef } from "../../route-config"; +import { UserFederationKerberosSettings } from "../UserFederationKerberosSettings"; + +export type NewKerberosUserFederationParams = { realm: string }; + +export const NewKerberosUserFederationRoute: RouteDef = { + path: "/:realm/user-federation/kerberos/new", + component: UserFederationKerberosSettings, + breadcrumb: (t) => t("common:settings"), + access: "view-realm", +}; + +export const toNewKerberosUserFederation = ( + params: NewKerberosUserFederationParams +): LocationDescriptorObject => ({ + pathname: generatePath(NewKerberosUserFederationRoute.path, params), +}); diff --git a/src/user-federation/routes/NewLdapUserFederation.ts b/src/user-federation/routes/NewLdapUserFederation.ts new file mode 100644 index 0000000000..05a786382a --- /dev/null +++ b/src/user-federation/routes/NewLdapUserFederation.ts @@ -0,0 +1,19 @@ +import type { LocationDescriptorObject } from "history"; +import { generatePath } from "react-router-dom"; +import type { RouteDef } from "../../route-config"; +import { UserFederationLdapSettings } from "../UserFederationLdapSettings"; + +export type NewLdapUserFederationParams = { realm: string }; + +export const NewLdapUserFederationRoute: RouteDef = { + path: "/:realm/user-federation/ldap/new", + component: UserFederationLdapSettings, + breadcrumb: (t) => t("user-federation:addOneLdap"), + access: "view-realm", +}; + +export const toNewLdapUserFederation = ( + params: NewLdapUserFederationParams +): LocationDescriptorObject => ({ + pathname: generatePath(NewLdapUserFederationRoute.path, params), +}); diff --git a/src/user-federation/routes/UserFederation.ts b/src/user-federation/routes/UserFederation.ts new file mode 100644 index 0000000000..dbccd1eb68 --- /dev/null +++ b/src/user-federation/routes/UserFederation.ts @@ -0,0 +1,19 @@ +import type { LocationDescriptorObject } from "history"; +import { generatePath } from "react-router-dom"; +import type { RouteDef } from "../../route-config"; +import { UserFederationSection } from "../UserFederationSection"; + +export type UserFederationParams = { realm: string }; + +export const UserFederationRoute: RouteDef = { + path: "/:realm/user-federation", + component: UserFederationSection, + breadcrumb: (t) => t("userFederation"), + access: "view-realm", +}; + +export const toUserFederation = ( + params: UserFederationParams +): LocationDescriptorObject => ({ + pathname: generatePath(UserFederationRoute.path, params), +}); diff --git a/src/user-federation/routes/UserFederationKerberos.ts b/src/user-federation/routes/UserFederationKerberos.ts new file mode 100644 index 0000000000..f3379d62c7 --- /dev/null +++ b/src/user-federation/routes/UserFederationKerberos.ts @@ -0,0 +1,22 @@ +import type { LocationDescriptorObject } from "history"; +import { generatePath } from "react-router-dom"; +import type { RouteDef } from "../../route-config"; +import { UserFederationKerberosSettings } from "../UserFederationKerberosSettings"; + +export type UserFederationKerberosParams = { + realm: string; + id: string; +}; + +export const UserFederationKerberosRoute: RouteDef = { + path: "/:realm/user-federation/kerberos/:id", + component: UserFederationKerberosSettings, + breadcrumb: (t) => t("common:settings"), + access: "view-realm", +}; + +export const toUserFederationKerberos = ( + params: UserFederationKerberosParams +): LocationDescriptorObject => ({ + pathname: generatePath(UserFederationKerberosRoute.path, params), +}); diff --git a/src/user-federation/routes/UserFederationLdap.ts b/src/user-federation/routes/UserFederationLdap.ts new file mode 100644 index 0000000000..3539f34eb9 --- /dev/null +++ b/src/user-federation/routes/UserFederationLdap.ts @@ -0,0 +1,23 @@ +import type { LocationDescriptorObject } from "history"; +import { generatePath } from "react-router-dom"; +import type { RouteDef } from "../../route-config"; +import { UserFederationLdapSettings } from "../UserFederationLdapSettings"; + +export type UserFederationLdapParams = { + realm: string; + id: string; + tab?: string; +}; + +export const UserFederationLdapRoute: RouteDef = { + path: "/:realm/user-federation/ldap/:id/:tab?", + component: UserFederationLdapSettings, + breadcrumb: (t) => t("common:settings"), + access: "view-realm", +}; + +export const toUserFederationLdap = ( + params: UserFederationLdapParams +): LocationDescriptorObject => ({ + pathname: generatePath(UserFederationLdapRoute.path, params), +}); diff --git a/src/user-federation/routes/UserFederationLdapMapper.ts b/src/user-federation/routes/UserFederationLdapMapper.ts new file mode 100644 index 0000000000..314dfc2af4 --- /dev/null +++ b/src/user-federation/routes/UserFederationLdapMapper.ts @@ -0,0 +1,24 @@ +import type { LocationDescriptorObject } from "history"; +import { generatePath } from "react-router-dom"; +import type { RouteDef } from "../../route-config"; +import { LdapMapperDetails } from "../ldap/mappers/LdapMapperDetails"; + +export type UserFederationLdapMapperParams = { + realm: string; + id: string; + tab: string; + mapperId: string; +}; + +export const UserFederationLdapMapperRoute: RouteDef = { + path: "/:realm/user-federation/ldap/:id/:tab/:mapperId", + component: LdapMapperDetails, + breadcrumb: (t) => t("common:mappingDetails"), + access: "view-realm", +}; + +export const toUserFederationLdapMapper = ( + params: UserFederationLdapMapperParams +): LocationDescriptorObject => ({ + pathname: generatePath(UserFederationLdapMapperRoute.path, params), +}); diff --git a/src/user-federation/routes/UserFederationsKerberos.ts b/src/user-federation/routes/UserFederationsKerberos.ts new file mode 100644 index 0000000000..b2f8a6731f --- /dev/null +++ b/src/user-federation/routes/UserFederationsKerberos.ts @@ -0,0 +1,18 @@ +import type { LocationDescriptorObject } from "history"; +import { generatePath } from "react-router-dom"; +import type { RouteDef } from "../../route-config"; +import { UserFederationSection } from "../UserFederationSection"; + +export type UserFederationsKerberosParams = { realm: string }; + +export const UserFederationsKerberosRoute: RouteDef = { + path: "/:realm/user-federation/kerberos", + component: UserFederationSection, + access: "view-realm", +}; + +export const toUserFederationsKerberos = ( + params: UserFederationsKerberosParams +): LocationDescriptorObject => ({ + pathname: generatePath(UserFederationsKerberosRoute.path, params), +}); diff --git a/src/user-federation/routes/UserFederationsLdap.ts b/src/user-federation/routes/UserFederationsLdap.ts new file mode 100644 index 0000000000..eebf091df5 --- /dev/null +++ b/src/user-federation/routes/UserFederationsLdap.ts @@ -0,0 +1,18 @@ +import type { LocationDescriptorObject } from "history"; +import { generatePath } from "react-router-dom"; +import type { RouteDef } from "../../route-config"; +import { UserFederationSection } from "../UserFederationSection"; + +export type UserFederationsLdapParams = { realm: string }; + +export const UserFederationsLdapRoute: RouteDef = { + path: "/:realm/user-federation/ldap", + component: UserFederationSection, + access: "view-realm", +}; + +export const toUserFederationsLdap = ( + params: UserFederationsLdapParams +): LocationDescriptorObject => ({ + pathname: generatePath(UserFederationsLdapRoute.path, params), +});