diff --git a/src/authentication/routes/Authentication.ts b/src/authentication/routes/Authentication.ts index 25c64f3ad3..ea8410e390 100644 --- a/src/authentication/routes/Authentication.ts +++ b/src/authentication/routes/Authentication.ts @@ -1,6 +1,6 @@ -import type { LocationDescriptorObject } from "history"; import { lazy } from "react"; import { generatePath } from "react-router-dom"; +import type { Path } from "react-router-dom-v5-compat"; import type { RouteDef } from "../../route-config"; export type AuthenticationTab = "flows" | "required-actions" | "policies"; @@ -17,6 +17,6 @@ export const AuthenticationRoute: RouteDef = { export const toAuthentication = ( params: AuthenticationParams -): LocationDescriptorObject => ({ +): Partial => ({ pathname: generatePath(AuthenticationRoute.path, params), }); diff --git a/src/authentication/routes/CreateFlow.ts b/src/authentication/routes/CreateFlow.ts index 46c370bd42..52a1649918 100644 --- a/src/authentication/routes/CreateFlow.ts +++ b/src/authentication/routes/CreateFlow.ts @@ -1,6 +1,6 @@ -import type { LocationDescriptorObject } from "history"; import { lazy } from "react"; -import { generatePath } from "react-router-dom"; +import type { Path } from "react-router-dom-v5-compat"; +import { generatePath } from "react-router-dom-v5-compat"; import type { RouteDef } from "../../route-config"; export type CreateFlowParams = { realm: string }; @@ -12,8 +12,6 @@ export const CreateFlowRoute: RouteDef = { access: "manage-authorization", }; -export const toCreateFlow = ( - params: CreateFlowParams -): LocationDescriptorObject => ({ +export const toCreateFlow = (params: CreateFlowParams): Partial => ({ pathname: generatePath(CreateFlowRoute.path, params), }); diff --git a/src/authentication/routes/Flow.ts b/src/authentication/routes/Flow.ts index 7daeda1555..8d0f9c676e 100644 --- a/src/authentication/routes/Flow.ts +++ b/src/authentication/routes/Flow.ts @@ -1,6 +1,6 @@ -import type { LocationDescriptorObject } from "history"; import { lazy } from "react"; import { generatePath } from "react-router-dom"; +import type { Path } from "react-router-dom-v5-compat"; import type { RouteDef } from "../../route-config"; export type FlowParams = { @@ -18,6 +18,6 @@ export const FlowRoute: RouteDef = { legacy: true, }; -export const toFlow = (params: FlowParams): LocationDescriptorObject => ({ +export const toFlow = (params: FlowParams): Partial => ({ pathname: generatePath(FlowRoute.path, params), }); diff --git a/src/client-scopes/details/MapperList.tsx b/src/client-scopes/details/MapperList.tsx index ed73ddb357..af9a4e2376 100644 --- a/src/client-scopes/details/MapperList.tsx +++ b/src/client-scopes/details/MapperList.tsx @@ -1,6 +1,6 @@ import { useEffect, useState } from "react"; import { useTranslation } from "react-i18next"; -import type { LocationDescriptorObject } from "history"; +import type { Path } from "react-router-dom-v5-compat"; import { Link } from "react-router-dom"; import { Dropdown, DropdownItem, DropdownToggle } from "@patternfly/react-core"; import { CaretDownIcon } from "@patternfly/react-icons"; @@ -21,7 +21,7 @@ type MapperListProps = { mappers: ProtocolMapperTypeRepresentation | ProtocolMapperRepresentation[] ) => void; onDelete: (mapper: ProtocolMapperRepresentation) => void; - detailLink: (id: string) => LocationDescriptorObject; + detailLink: (id: string) => Partial; }; type Row = ProtocolMapperRepresentation & { diff --git a/src/client-scopes/routes/ClientScope.ts b/src/client-scopes/routes/ClientScope.ts index 277ef369d5..d4cba46c7a 100644 --- a/src/client-scopes/routes/ClientScope.ts +++ b/src/client-scopes/routes/ClientScope.ts @@ -1,6 +1,6 @@ -import type { LocationDescriptorObject } from "history"; import { lazy } from "react"; import { generatePath } from "react-router-dom"; +import type { Path } from "react-router-dom-v5-compat"; import type { RouteDef } from "../../route-config"; export type ClientScopeTab = "settings" | "mappers" | "scope"; @@ -20,8 +20,6 @@ export const ClientScopeRoute: RouteDef = { legacy: true, }; -export const toClientScope = ( - params: ClientScopeParams -): LocationDescriptorObject => ({ +export const toClientScope = (params: ClientScopeParams): Partial => ({ pathname: generatePath(ClientScopeRoute.path, params), }); diff --git a/src/client-scopes/routes/ClientScopes.ts b/src/client-scopes/routes/ClientScopes.ts index 61c7b4c02e..e4b0154b3e 100644 --- a/src/client-scopes/routes/ClientScopes.ts +++ b/src/client-scopes/routes/ClientScopes.ts @@ -1,6 +1,6 @@ -import type { LocationDescriptorObject } from "history"; import { lazy } from "react"; -import { generatePath } from "react-router-dom"; +import type { Path } from "react-router-dom-v5-compat"; +import { generatePath } from "react-router-dom-v5-compat"; import type { RouteDef } from "../../route-config"; export type ClientScopesParams = { realm: string }; @@ -12,8 +12,6 @@ export const ClientScopesRoute: RouteDef = { access: "view-clients", }; -export const toClientScopes = ( - params: ClientScopesParams -): LocationDescriptorObject => ({ +export const toClientScopes = (params: ClientScopesParams): Partial => ({ pathname: generatePath(ClientScopesRoute.path, params), }); diff --git a/src/client-scopes/routes/Mapper.ts b/src/client-scopes/routes/Mapper.ts index 348cab033b..6e5ac72d4b 100644 --- a/src/client-scopes/routes/Mapper.ts +++ b/src/client-scopes/routes/Mapper.ts @@ -1,6 +1,6 @@ -import type { LocationDescriptorObject } from "history"; import { lazy } from "react"; -import { generatePath } from "react-router-dom"; +import type { Path } from "react-router-dom-v5-compat"; +import { generatePath } from "react-router-dom-v5-compat"; import type { RouteDef } from "../../route-config"; export type MapperParams = { @@ -17,6 +17,6 @@ export const MapperRoute: RouteDef = { access: "view-clients", }; -export const toMapper = (params: MapperParams): LocationDescriptorObject => ({ +export const toMapper = (params: MapperParams): Partial => ({ pathname: generatePath(MapperRoute.path, params), }); diff --git a/src/client-scopes/routes/NewClientScope.ts b/src/client-scopes/routes/NewClientScope.ts index 8735134cd2..a85ff9a415 100644 --- a/src/client-scopes/routes/NewClientScope.ts +++ b/src/client-scopes/routes/NewClientScope.ts @@ -1,6 +1,6 @@ -import type { LocationDescriptorObject } from "history"; import { lazy } from "react"; -import { generatePath } from "react-router-dom"; +import type { Path } from "react-router-dom-v5-compat"; +import { generatePath } from "react-router-dom-v5-compat"; import type { RouteDef } from "../../route-config"; export type NewClientScopeParams = { realm: string }; @@ -14,6 +14,6 @@ export const NewClientScopeRoute: RouteDef = { export const toNewClientScope = ( params: NewClientScopeParams -): LocationDescriptorObject => ({ +): Partial => ({ pathname: generatePath(NewClientScopeRoute.path, params), }); diff --git a/src/clients/authorization/DetailDescription.tsx b/src/clients/authorization/DetailDescription.tsx index 81422427cc..54979e2244 100644 --- a/src/clients/authorization/DetailDescription.tsx +++ b/src/clients/authorization/DetailDescription.tsx @@ -1,11 +1,11 @@ -import { Link } from "react-router-dom"; -import type { LocationDescriptor } from "history"; -import { useTranslation } from "react-i18next"; import { + DescriptionListDescription, DescriptionListGroup, DescriptionListTerm, - DescriptionListDescription, } from "@patternfly/react-core"; +import { useTranslation } from "react-i18next"; +import { Link } from "react-router-dom"; +import { Path } from "react-router-dom-v5-compat"; type DetailDescriptionProps = { name: string; @@ -18,7 +18,7 @@ export function DetailDescription(props: DetailDescriptionProps) { } type DetailDescriptionLinkProps = DetailDescriptionProps & { - link?: (element: T) => LocationDescriptor; + link?: (element: T) => Partial; }; export function DetailDescriptionLink({ diff --git a/src/clients/routes/AddClient.ts b/src/clients/routes/AddClient.ts index 19f2e4f033..c3e0803234 100644 --- a/src/clients/routes/AddClient.ts +++ b/src/clients/routes/AddClient.ts @@ -1,6 +1,6 @@ -import type { LocationDescriptorObject } from "history"; import { lazy } from "react"; -import { generatePath } from "react-router-dom"; +import type { Path } from "react-router-dom-v5-compat"; +import { generatePath } from "react-router-dom-v5-compat"; import type { RouteDef } from "../../route-config"; export type AddClientParams = { realm: string }; @@ -12,8 +12,6 @@ export const AddClientRoute: RouteDef = { access: "manage-clients", }; -export const toAddClient = ( - params: AddClientParams -): LocationDescriptorObject => ({ +export const toAddClient = (params: AddClientParams): Partial => ({ pathname: generatePath(AddClientRoute.path, params), }); diff --git a/src/clients/routes/AuthenticationTab.ts b/src/clients/routes/AuthenticationTab.ts index 039d1f9734..a99402e98a 100644 --- a/src/clients/routes/AuthenticationTab.ts +++ b/src/clients/routes/AuthenticationTab.ts @@ -1,6 +1,6 @@ -import type { LocationDescriptorObject } from "history"; import { lazy } from "react"; -import { generatePath } from "react-router-dom"; +import type { Path } from "react-router-dom-v5-compat"; +import { generatePath } from "react-router-dom-v5-compat"; import type { RouteDef } from "../../route-config"; export type AuthorizationTab = @@ -26,6 +26,6 @@ export const AuthorizationRoute: RouteDef = { export const toAuthorizationTab = ( params: AuthorizationParams -): LocationDescriptorObject => ({ +): Partial => ({ pathname: generatePath(AuthorizationRoute.path, params), }); diff --git a/src/clients/routes/Client.ts b/src/clients/routes/Client.ts index 070fc6337d..0caba8dd48 100644 --- a/src/clients/routes/Client.ts +++ b/src/clients/routes/Client.ts @@ -1,6 +1,6 @@ -import type { LocationDescriptorObject } from "history"; import { lazy } from "react"; -import { generatePath } from "react-router-dom"; +import type { Path } from "react-router-dom-v5-compat"; +import { generatePath } from "react-router-dom-v5-compat"; import type { RouteDef } from "../../route-config"; export type ClientTab = @@ -29,6 +29,6 @@ export const ClientRoute: RouteDef = { access: "query-clients", }; -export const toClient = (params: ClientParams): LocationDescriptorObject => ({ +export const toClient = (params: ClientParams): Partial => ({ pathname: generatePath(ClientRoute.path, params), }); diff --git a/src/clients/routes/ClientScopeTab.ts b/src/clients/routes/ClientScopeTab.ts index adb9ffa5ef..c5e7bb3743 100644 --- a/src/clients/routes/ClientScopeTab.ts +++ b/src/clients/routes/ClientScopeTab.ts @@ -1,6 +1,6 @@ -import type { LocationDescriptorObject } from "history"; import { lazy } from "react"; -import { generatePath } from "react-router-dom"; +import type { Path } from "react-router-dom-v5-compat"; +import { generatePath } from "react-router-dom-v5-compat"; import type { RouteDef } from "../../route-config"; export type ClientScopesTab = "setup" | "evaluate"; @@ -10,6 +10,7 @@ export type ClientScopesParams = { clientId: string; tab: ClientScopesTab; }; + export const ClientScopesRoute: RouteDef = { path: "/:realm/clients/:clientId/clientScopes/:tab", component: lazy(() => import("../ClientDetails")), @@ -19,6 +20,6 @@ export const ClientScopesRoute: RouteDef = { export const toClientScopesTab = ( params: ClientScopesParams -): LocationDescriptorObject => ({ +): Partial => ({ pathname: generatePath(ClientScopesRoute.path, params), }); diff --git a/src/clients/routes/Clients.ts b/src/clients/routes/Clients.ts index a6a176fcdb..8624f827de 100644 --- a/src/clients/routes/Clients.ts +++ b/src/clients/routes/Clients.ts @@ -1,6 +1,6 @@ -import type { LocationDescriptorObject } from "history"; import { lazy } from "react"; import { generatePath } from "react-router-dom"; +import type { Path } from "react-router-dom-v5-compat"; import type { RouteDef } from "../../route-config"; export type ClientsTab = "list" | "initial-access-token"; @@ -18,6 +18,6 @@ export const ClientsRoute: RouteDef = { legacy: true, }; -export const toClients = (params: ClientsParams): LocationDescriptorObject => ({ +export const toClients = (params: ClientsParams): Partial => ({ pathname: generatePath(ClientsRoute.path, params), }); diff --git a/src/clients/routes/CreateInitialAccessToken.ts b/src/clients/routes/CreateInitialAccessToken.ts index 7d8ecd4e21..3b8efb3a9c 100644 --- a/src/clients/routes/CreateInitialAccessToken.ts +++ b/src/clients/routes/CreateInitialAccessToken.ts @@ -1,6 +1,6 @@ -import type { LocationDescriptorObject } from "history"; import { lazy } from "react"; -import { generatePath } from "react-router-dom"; +import type { Path } from "react-router-dom-v5-compat"; +import { generatePath } from "react-router-dom-v5-compat"; import type { RouteDef } from "../../route-config"; export type CreateInitialAccessTokenParams = { realm: string }; @@ -14,6 +14,6 @@ export const CreateInitialAccessTokenRoute: RouteDef = { export const toCreateInitialAccessToken = ( params: CreateInitialAccessTokenParams -): LocationDescriptorObject => ({ +): Partial => ({ pathname: generatePath(CreateInitialAccessTokenRoute.path, params), }); diff --git a/src/clients/routes/DedicatedScopeDetails.ts b/src/clients/routes/DedicatedScopeDetails.ts index 0a037c87d0..667d0b390b 100644 --- a/src/clients/routes/DedicatedScopeDetails.ts +++ b/src/clients/routes/DedicatedScopeDetails.ts @@ -1,6 +1,6 @@ -import type { LocationDescriptorObject } from "history"; import { lazy } from "react"; import { generatePath } from "react-router-dom"; +import type { Path } from "react-router-dom-v5-compat"; import type { RouteDef } from "../../route-config"; export type DedicatedScopeTab = "mappers" | "scope"; @@ -21,6 +21,6 @@ export const DedicatedScopeDetailsRoute: RouteDef = { export const toDedicatedScope = ( params: DedicatedScopeDetailsParams -): LocationDescriptorObject => ({ +): Partial => ({ pathname: generatePath(DedicatedScopeDetailsRoute.path, params), }); diff --git a/src/clients/routes/ImportClient.ts b/src/clients/routes/ImportClient.ts index b023e6c1c5..56c38777d1 100644 --- a/src/clients/routes/ImportClient.ts +++ b/src/clients/routes/ImportClient.ts @@ -1,6 +1,6 @@ -import type { LocationDescriptorObject } from "history"; import { lazy } from "react"; -import { generatePath } from "react-router-dom"; +import type { Path } from "react-router-dom-v5-compat"; +import { generatePath } from "react-router-dom-v5-compat"; import type { RouteDef } from "../../route-config"; export type ImportClientParams = { realm: string }; @@ -12,8 +12,6 @@ export const ImportClientRoute: RouteDef = { access: "manage-clients", }; -export const toImportClient = ( - params: ImportClientParams -): LocationDescriptorObject => ({ +export const toImportClient = (params: ImportClientParams): Partial => ({ pathname: generatePath(ImportClientRoute.path, params), }); diff --git a/src/clients/routes/Mapper.ts b/src/clients/routes/Mapper.ts index 03e9239554..a9cb6a40e4 100644 --- a/src/clients/routes/Mapper.ts +++ b/src/clients/routes/Mapper.ts @@ -1,7 +1,7 @@ -import type { LocationDescriptorObject } from "history"; -import { generatePath } from "react-router-dom"; -import type { RouteDef } from "../../route-config"; import { lazy } from "react"; +import type { Path } from "react-router-dom-v5-compat"; +import { generatePath } from "react-router-dom-v5-compat"; +import type { RouteDef } from "../../route-config"; export type MapperParams = { realm: string; @@ -16,6 +16,6 @@ export const MapperRoute: RouteDef = { access: "view-clients", }; -export const toMapper = (params: MapperParams): LocationDescriptorObject => ({ +export const toMapper = (params: MapperParams): Partial => ({ pathname: generatePath(MapperRoute.path, params), }); diff --git a/src/clients/routes/NewPermission.ts b/src/clients/routes/NewPermission.ts index ba2ad63290..4387d1ad42 100644 --- a/src/clients/routes/NewPermission.ts +++ b/src/clients/routes/NewPermission.ts @@ -1,7 +1,7 @@ -import type { LocationDescriptorObject } from "history"; -import type { RouteDef } from "../../route-config"; -import { generatePath } from "react-router-dom"; import { lazy } from "react"; +import { generatePath } from "react-router-dom"; +import type { Path } from "react-router-dom-v5-compat"; +import type { RouteDef } from "../../route-config"; export type PermissionType = "resource" | "scope"; @@ -22,6 +22,6 @@ export const NewPermissionRoute: RouteDef = { export const toNewPermission = ( params: NewPermissionParams -): LocationDescriptorObject => ({ +): Partial => ({ pathname: generatePath(NewPermissionRoute.path, params), }); diff --git a/src/clients/routes/NewPolicy.ts b/src/clients/routes/NewPolicy.ts index 28c393bbae..f0c51918bb 100644 --- a/src/clients/routes/NewPolicy.ts +++ b/src/clients/routes/NewPolicy.ts @@ -1,7 +1,7 @@ -import type { LocationDescriptorObject } from "history"; -import type { RouteDef } from "../../route-config"; -import { generatePath } from "react-router-dom"; import { lazy } from "react"; +import type { Path } from "react-router-dom-v5-compat"; +import { generatePath } from "react-router-dom-v5-compat"; +import type { RouteDef } from "../../route-config"; export type NewPolicyParams = { realm: string; id: string; policyType: string }; @@ -12,8 +12,6 @@ export const NewPolicyRoute: RouteDef = { access: "view-clients", }; -export const toCreatePolicy = ( - params: NewPolicyParams -): LocationDescriptorObject => ({ +export const toCreatePolicy = (params: NewPolicyParams): Partial => ({ pathname: generatePath(NewPolicyRoute.path, params), }); diff --git a/src/clients/routes/NewResource.ts b/src/clients/routes/NewResource.ts index 938035dc23..4811b9c18d 100644 --- a/src/clients/routes/NewResource.ts +++ b/src/clients/routes/NewResource.ts @@ -1,7 +1,7 @@ -import type { LocationDescriptorObject } from "history"; -import type { RouteDef } from "../../route-config"; -import { generatePath } from "react-router-dom"; import { lazy } from "react"; +import type { Path } from "react-router-dom-v5-compat"; +import { generatePath } from "react-router-dom-v5-compat"; +import type { RouteDef } from "../../route-config"; export type NewResourceParams = { realm: string; id: string }; @@ -12,8 +12,6 @@ export const NewResourceRoute: RouteDef = { access: "view-clients", }; -export const toCreateResource = ( - params: NewResourceParams -): LocationDescriptorObject => ({ +export const toCreateResource = (params: NewResourceParams): Partial => ({ pathname: generatePath(NewResourceRoute.path, params), }); diff --git a/src/clients/routes/NewScope.ts b/src/clients/routes/NewScope.ts index a97a6002be..82f754e46f 100644 --- a/src/clients/routes/NewScope.ts +++ b/src/clients/routes/NewScope.ts @@ -1,7 +1,7 @@ -import type { LocationDescriptorObject } from "history"; -import type { RouteDef } from "../../route-config"; -import { generatePath } from "react-router-dom"; import { lazy } from "react"; +import type { Path } from "react-router-dom-v5-compat"; +import { generatePath } from "react-router-dom-v5-compat"; +import type { RouteDef } from "../../route-config"; export type NewScopeParams = { realm: string; id: string }; @@ -12,8 +12,6 @@ export const NewScopeRoute: RouteDef = { access: "view-clients", }; -export const toNewScope = ( - params: NewScopeParams -): LocationDescriptorObject => ({ +export const toNewScope = (params: NewScopeParams): Partial => ({ pathname: generatePath(NewScopeRoute.path, params), }); diff --git a/src/clients/routes/PermissionDetails.ts b/src/clients/routes/PermissionDetails.ts index 747f492110..b4acbeec23 100644 --- a/src/clients/routes/PermissionDetails.ts +++ b/src/clients/routes/PermissionDetails.ts @@ -1,7 +1,7 @@ -import type { LocationDescriptorObject } from "history"; -import type { RouteDef } from "../../route-config"; -import { generatePath } from "react-router-dom"; import { lazy } from "react"; +import type { Path } from "react-router-dom-v5-compat"; +import { generatePath } from "react-router-dom-v5-compat"; +import type { RouteDef } from "../../route-config"; import type { PermissionType } from "./NewPermission"; export type PermissionDetailsParams = { @@ -20,6 +20,6 @@ export const PermissionDetailsRoute: RouteDef = { export const toPermissionDetails = ( params: PermissionDetailsParams -): LocationDescriptorObject => ({ +): Partial => ({ pathname: generatePath(PermissionDetailsRoute.path, params), }); diff --git a/src/clients/routes/PolicyDetails.ts b/src/clients/routes/PolicyDetails.ts index e037591457..83452dbb57 100644 --- a/src/clients/routes/PolicyDetails.ts +++ b/src/clients/routes/PolicyDetails.ts @@ -1,7 +1,7 @@ -import type { LocationDescriptorObject } from "history"; -import type { RouteDef } from "../../route-config"; -import { generatePath } from "react-router-dom"; import { lazy } from "react"; +import type { Path } from "react-router-dom-v5-compat"; +import { generatePath } from "react-router-dom-v5-compat"; +import type { RouteDef } from "../../route-config"; export type PolicyDetailsParams = { realm: string; @@ -19,6 +19,6 @@ export const PolicyDetailsRoute: RouteDef = { export const toPolicyDetails = ( params: PolicyDetailsParams -): LocationDescriptorObject => ({ +): Partial => ({ pathname: generatePath(PolicyDetailsRoute.path, params), }); diff --git a/src/clients/routes/Resource.ts b/src/clients/routes/Resource.ts index bf8eb09a0a..cb770c2e49 100644 --- a/src/clients/routes/Resource.ts +++ b/src/clients/routes/Resource.ts @@ -1,7 +1,7 @@ -import type { LocationDescriptorObject } from "history"; -import type { RouteDef } from "../../route-config"; -import { generatePath } from "react-router-dom"; import { lazy } from "react"; +import { generatePath } from "react-router-dom"; +import type { Path } from "react-router-dom-v5-compat"; +import type { RouteDef } from "../../route-config"; export type ResourceDetailsParams = { realm: string; @@ -19,6 +19,6 @@ export const ResourceDetailsRoute: RouteDef = { export const toResourceDetails = ( params: ResourceDetailsParams -): LocationDescriptorObject => ({ +): Partial => ({ pathname: generatePath(ResourceDetailsRoute.path, params), }); diff --git a/src/clients/routes/Scope.ts b/src/clients/routes/Scope.ts index 5bb84a7fdd..7549f76204 100644 --- a/src/clients/routes/Scope.ts +++ b/src/clients/routes/Scope.ts @@ -1,7 +1,7 @@ -import type { LocationDescriptorObject } from "history"; -import type { RouteDef } from "../../route-config"; -import { generatePath } from "react-router-dom"; import { lazy } from "react"; +import { generatePath } from "react-router-dom"; +import type { Path } from "react-router-dom-v5-compat"; +import type { RouteDef } from "../../route-config"; export type ScopeDetailsParams = { realm: string; @@ -17,8 +17,6 @@ export const ScopeDetailsRoute: RouteDef = { legacy: true, }; -export const toScopeDetails = ( - params: ScopeDetailsParams -): LocationDescriptorObject => ({ +export const toScopeDetails = (params: ScopeDetailsParams): Partial => ({ pathname: generatePath(ScopeDetailsRoute.path, params), }); diff --git a/src/components/routable-tabs/RoutableTabs.tsx b/src/components/routable-tabs/RoutableTabs.tsx index 4a4347e03d..a7474d1b8d 100644 --- a/src/components/routable-tabs/RoutableTabs.tsx +++ b/src/components/routable-tabs/RoutableTabs.tsx @@ -4,13 +4,14 @@ import { TabsComponent, TabsProps, } from "@patternfly/react-core"; -import type { History, LocationDescriptorObject } from "history"; +import type { History } from "history"; import { Children, isValidElement, JSXElementConstructor, ReactElement, } from "react"; +import type { Path } from "react-router-dom-v5-compat"; import { useLocation } from "react-router-dom-v5-compat"; // TODO: Remove the custom 'children' props and type once the following issue has been resolved: @@ -21,7 +22,7 @@ type Child = ChildElement | boolean | null | undefined; // TODO: Figure out why we need to omit 'ref' from the props. type RoutableTabsProps = { children: Child | Child[]; - defaultLocation?: LocationDescriptorObject; + defaultLocation?: Partial; } & Omit< TabsProps, "ref" | "activeKey" | "defaultActiveKey" | "component" | "children" @@ -67,7 +68,7 @@ export const RoutableTabs = ({ }; type RoutableTabParams = { - to: LocationDescriptorObject; + to: Partial; history: History; }; diff --git a/src/dashboard/routes/Dashboard.ts b/src/dashboard/routes/Dashboard.ts index 7afa3214d4..f2a3cb7e46 100644 --- a/src/dashboard/routes/Dashboard.ts +++ b/src/dashboard/routes/Dashboard.ts @@ -1,6 +1,6 @@ -import type { LocationDescriptorObject } from "history"; import { lazy } from "react"; import { generatePath } from "react-router-dom"; +import type { Path } from "react-router-dom-v5-compat"; import type { RouteDef } from "../../route-config"; export type DashboardTab = "info" | "providers"; @@ -15,8 +15,6 @@ export const DashboardRoute: RouteDef = { legacy: true, }; -export const toDashboard = ( - params: DashboardParams -): LocationDescriptorObject => ({ +export const toDashboard = (params: DashboardParams): Partial => ({ pathname: generatePath(DashboardRoute.path, params), }); diff --git a/src/events/routes/Events.ts b/src/events/routes/Events.ts index 867fbda3d5..7942107ed1 100644 --- a/src/events/routes/Events.ts +++ b/src/events/routes/Events.ts @@ -1,6 +1,6 @@ -import type { LocationDescriptorObject } from "history"; import { lazy } from "react"; import { generatePath } from "react-router-dom"; +import type { Path } from "react-router-dom-v5-compat"; import type { RouteDef } from "../../route-config"; export type EventsTab = "user-events" | "admin-events"; @@ -18,6 +18,6 @@ export const EventsRoute: RouteDef = { legacy: true, }; -export const toEvents = (params: EventsParams): LocationDescriptorObject => ({ +export const toEvents = (params: EventsParams): Partial => ({ pathname: generatePath(EventsRoute.path, params), }); diff --git a/src/groups/routes/Groups.tsx b/src/groups/routes/Groups.tsx index d10d5038b2..9ab464b672 100644 --- a/src/groups/routes/Groups.tsx +++ b/src/groups/routes/Groups.tsx @@ -1,6 +1,6 @@ -import type { LocationDescriptorObject } from "history"; import { lazy } from "react"; import { generatePath } from "react-router-dom"; +import type { Path } from "react-router-dom-v5-compat"; import type { RouteDef } from "../../route-config"; export type GroupsParams = { realm: string; id?: string }; @@ -15,6 +15,6 @@ export const GroupsRoute: RouteDef = { legacy: true, }; -export const toGroups = (params: GroupsParams): LocationDescriptorObject => ({ +export const toGroups = (params: GroupsParams): Partial => ({ pathname: generatePath(GroupsRoute.path, params), }); diff --git a/src/groups/routes/GroupsSearch.tsx b/src/groups/routes/GroupsSearch.tsx index 905de81c7a..578fc115d2 100644 --- a/src/groups/routes/GroupsSearch.tsx +++ b/src/groups/routes/GroupsSearch.tsx @@ -1,6 +1,6 @@ -import type { LocationDescriptorObject } from "history"; import { lazy } from "react"; -import { generatePath } from "react-router-dom"; +import type { Path } from "react-router-dom-v5-compat"; +import { generatePath } from "react-router-dom-v5-compat"; import type { RouteDef } from "../../route-config"; export type GroupsSearchParams = { realm: string }; @@ -12,8 +12,6 @@ export const GroupsSearchRoute: RouteDef = { access: "query-groups", }; -export const toGroupsSearch = ( - params: GroupsSearchParams -): LocationDescriptorObject => ({ +export const toGroupsSearch = (params: GroupsSearchParams): Partial => ({ pathname: generatePath(GroupsSearchRoute.path, params), }); diff --git a/src/identity-providers/routes/AddMapper.ts b/src/identity-providers/routes/AddMapper.ts index b69174d597..faf1870d81 100644 --- a/src/identity-providers/routes/AddMapper.ts +++ b/src/identity-providers/routes/AddMapper.ts @@ -1,6 +1,6 @@ -import type { LocationDescriptorObject } from "history"; import { lazy } from "react"; -import { generatePath } from "react-router-dom"; +import type { Path } from "react-router-dom-v5-compat"; +import { generatePath } from "react-router-dom-v5-compat"; import type { RouteDef } from "../../route-config"; export type IdentityProviderAddMapperParams = { @@ -19,6 +19,6 @@ export const IdentityProviderAddMapperRoute: RouteDef = { export const toIdentityProviderAddMapper = ( params: IdentityProviderAddMapperParams -): LocationDescriptorObject => ({ +): Partial => ({ pathname: generatePath(IdentityProviderAddMapperRoute.path, params), }); diff --git a/src/identity-providers/routes/EditMapper.ts b/src/identity-providers/routes/EditMapper.ts index 98a7945fcb..514b1e56d0 100644 --- a/src/identity-providers/routes/EditMapper.ts +++ b/src/identity-providers/routes/EditMapper.ts @@ -1,6 +1,6 @@ -import type { LocationDescriptorObject } from "history"; import { lazy } from "react"; -import { generatePath } from "react-router-dom"; +import type { Path } from "react-router-dom-v5-compat"; +import { generatePath } from "react-router-dom-v5-compat"; import type { RouteDef } from "../../route-config"; export type IdentityProviderEditMapperParams = { @@ -19,6 +19,6 @@ export const IdentityProviderEditMapperRoute: RouteDef = { export const toIdentityProviderEditMapper = ( params: IdentityProviderEditMapperParams -): LocationDescriptorObject => ({ +): Partial => ({ pathname: generatePath(IdentityProviderEditMapperRoute.path, params), }); diff --git a/src/identity-providers/routes/IdentityProvider.ts b/src/identity-providers/routes/IdentityProvider.ts index 0fb42b4d62..1a08118646 100644 --- a/src/identity-providers/routes/IdentityProvider.ts +++ b/src/identity-providers/routes/IdentityProvider.ts @@ -1,6 +1,6 @@ -import type { LocationDescriptorObject } from "history"; import { lazy } from "react"; -import { generatePath } from "react-router-dom"; +import type { Path } from "react-router-dom-v5-compat"; +import { generatePath } from "react-router-dom-v5-compat"; import type { RouteDef } from "../../route-config"; type IdentityProviderTabs = "settings" | "mappers"; @@ -21,6 +21,6 @@ export const IdentityProviderRoute: RouteDef = { export const toIdentityProvider = ( params: IdentityProviderParams -): LocationDescriptorObject => ({ +): Partial => ({ pathname: generatePath(IdentityProviderRoute.path, params), }); diff --git a/src/identity-providers/routes/IdentityProviderCreate.ts b/src/identity-providers/routes/IdentityProviderCreate.ts index 17b916c5ed..86b102789d 100644 --- a/src/identity-providers/routes/IdentityProviderCreate.ts +++ b/src/identity-providers/routes/IdentityProviderCreate.ts @@ -1,6 +1,6 @@ -import type { LocationDescriptorObject } from "history"; import { lazy } from "react"; -import { generatePath } from "react-router-dom"; +import type { Path } from "react-router-dom-v5-compat"; +import { generatePath } from "react-router-dom-v5-compat"; import type { RouteDef } from "../../route-config"; export type IdentityProviderCreateParams = { @@ -17,6 +17,6 @@ export const IdentityProviderCreateRoute: RouteDef = { export const toIdentityProviderCreate = ( params: IdentityProviderCreateParams -): LocationDescriptorObject => ({ +): Partial => ({ pathname: generatePath(IdentityProviderCreateRoute.path, params), }); diff --git a/src/identity-providers/routes/IdentityProviderKeycloakOidc.ts b/src/identity-providers/routes/IdentityProviderKeycloakOidc.ts index 8fbb4b0958..17be0c4cad 100644 --- a/src/identity-providers/routes/IdentityProviderKeycloakOidc.ts +++ b/src/identity-providers/routes/IdentityProviderKeycloakOidc.ts @@ -1,6 +1,6 @@ -import type { LocationDescriptorObject } from "history"; import { lazy } from "react"; -import { generatePath } from "react-router-dom"; +import type { Path } from "react-router-dom-v5-compat"; +import { generatePath } from "react-router-dom-v5-compat"; import type { RouteDef } from "../../route-config"; export type IdentityProviderKeycloakOidcParams = { realm: string }; @@ -14,6 +14,6 @@ export const IdentityProviderKeycloakOidcRoute: RouteDef = { export const toIdentityProviderKeycloakOidc = ( params: IdentityProviderKeycloakOidcParams -): LocationDescriptorObject => ({ +): Partial => ({ pathname: generatePath(IdentityProviderKeycloakOidcRoute.path, params), }); diff --git a/src/identity-providers/routes/IdentityProviderOidc.ts b/src/identity-providers/routes/IdentityProviderOidc.ts index 8d688aee6a..6a1a9fa962 100644 --- a/src/identity-providers/routes/IdentityProviderOidc.ts +++ b/src/identity-providers/routes/IdentityProviderOidc.ts @@ -1,6 +1,6 @@ -import type { LocationDescriptorObject } from "history"; import { lazy } from "react"; -import { generatePath } from "react-router-dom"; +import type { Path } from "react-router-dom-v5-compat"; +import { generatePath } from "react-router-dom-v5-compat"; import type { RouteDef } from "../../route-config"; export type IdentityProviderOidcParams = { realm: string }; @@ -14,6 +14,6 @@ export const IdentityProviderOidcRoute: RouteDef = { export const toIdentityProviderOidc = ( params: IdentityProviderOidcParams -): LocationDescriptorObject => ({ +): Partial => ({ pathname: generatePath(IdentityProviderOidcRoute.path, params), }); diff --git a/src/identity-providers/routes/IdentityProviderSaml.ts b/src/identity-providers/routes/IdentityProviderSaml.ts index 6e670ae7e9..88e91de6ea 100644 --- a/src/identity-providers/routes/IdentityProviderSaml.ts +++ b/src/identity-providers/routes/IdentityProviderSaml.ts @@ -1,6 +1,6 @@ -import type { LocationDescriptorObject } from "history"; import { lazy } from "react"; -import { generatePath } from "react-router-dom"; +import type { Path } from "react-router-dom-v5-compat"; +import { generatePath } from "react-router-dom-v5-compat"; import type { RouteDef } from "../../route-config"; export type IdentityProviderSamlParams = { realm: string }; @@ -14,6 +14,6 @@ export const IdentityProviderSamlRoute: RouteDef = { export const toIdentityProviderSaml = ( params: IdentityProviderSamlParams -): LocationDescriptorObject => ({ +): Partial => ({ pathname: generatePath(IdentityProviderSamlRoute.path, params), }); diff --git a/src/identity-providers/routes/IdentityProviders.ts b/src/identity-providers/routes/IdentityProviders.ts index d4cae21350..a9ce67e4f8 100644 --- a/src/identity-providers/routes/IdentityProviders.ts +++ b/src/identity-providers/routes/IdentityProviders.ts @@ -1,6 +1,6 @@ -import type { LocationDescriptorObject } from "history"; import { lazy } from "react"; -import { generatePath } from "react-router-dom"; +import type { Path } from "react-router-dom-v5-compat"; +import { generatePath } from "react-router-dom-v5-compat"; import type { RouteDef } from "../../route-config"; export type IdentityProvidersParams = { realm: string }; @@ -14,6 +14,6 @@ export const IdentityProvidersRoute: RouteDef = { export const toIdentityProviders = ( params: IdentityProvidersParams -): LocationDescriptorObject => ({ +): Partial => ({ pathname: generatePath(IdentityProvidersRoute.path, params), }); diff --git a/src/realm-roles/routes/AddRole.ts b/src/realm-roles/routes/AddRole.ts index 5219d263f9..38adb8e347 100644 --- a/src/realm-roles/routes/AddRole.ts +++ b/src/realm-roles/routes/AddRole.ts @@ -1,6 +1,6 @@ import { lazy } from "react"; -import type { LocationDescriptorObject } from "history"; -import { generatePath } from "react-router-dom"; +import type { Path } from "react-router-dom-v5-compat"; +import { generatePath } from "react-router-dom-v5-compat"; import type { RouteDef } from "../../route-config"; export type AddRoleParams = { realm: string }; @@ -12,6 +12,6 @@ export const AddRoleRoute: RouteDef = { access: "manage-realm", }; -export const toAddRole = (params: AddRoleParams): LocationDescriptorObject => ({ +export const toAddRole = (params: AddRoleParams): Partial => ({ pathname: generatePath(AddRoleRoute.path, params), }); diff --git a/src/realm-roles/routes/AddRoleToClient.ts b/src/realm-roles/routes/AddRoleToClient.ts index ce4592913c..0f25cc087d 100644 --- a/src/realm-roles/routes/AddRoleToClient.ts +++ b/src/realm-roles/routes/AddRoleToClient.ts @@ -1,6 +1,6 @@ import { lazy } from "react"; -import type { LocationDescriptorObject } from "history"; -import { generatePath } from "react-router-dom"; +import type { Path } from "react-router-dom-v5-compat"; +import { generatePath } from "react-router-dom-v5-compat"; import type { RouteDef } from "../../route-config"; export type AddRoleToClientParams = { @@ -17,6 +17,6 @@ export const AddRoleToClientRoute: RouteDef = { export const toAddRoleToClient = ( params: AddRoleToClientParams -): LocationDescriptorObject => ({ +): Partial => ({ pathname: generatePath(AddRoleToClientRoute.path, params), }); diff --git a/src/realm-roles/routes/ClientRole.ts b/src/realm-roles/routes/ClientRole.ts index 5e79fbc5c2..f8c211ffa6 100644 --- a/src/realm-roles/routes/ClientRole.ts +++ b/src/realm-roles/routes/ClientRole.ts @@ -1,6 +1,6 @@ import { lazy } from "react"; -import type { LocationDescriptorObject } from "history"; import { generatePath } from "react-router-dom"; +import type { Path } from "react-router-dom-v5-compat"; import type { RouteDef } from "../../route-config"; export type ClientRoleTab = @@ -24,8 +24,6 @@ export const ClientRoleRoute: RouteDef = { legacy: true, }; -export const toClientRole = ( - params: ClientRoleParams -): LocationDescriptorObject => ({ +export const toClientRole = (params: ClientRoleParams): Partial => ({ pathname: generatePath(ClientRoleRoute.path, params), }); diff --git a/src/realm-roles/routes/RealmRole.ts b/src/realm-roles/routes/RealmRole.ts index 71c7e8d4ea..f986fb5174 100644 --- a/src/realm-roles/routes/RealmRole.ts +++ b/src/realm-roles/routes/RealmRole.ts @@ -1,6 +1,6 @@ import { lazy } from "react"; import { generatePath } from "react-router"; -import type { LocationDescriptorObject } from "history"; +import type { Path } from "react-router-dom-v5-compat"; import type { RouteDef } from "../../route-config"; export type RealmRoleTab = @@ -23,8 +23,6 @@ export const RealmRoleRoute: RouteDef = { legacy: true, }; -export const toRealmRole = ( - params: RealmRoleParams -): LocationDescriptorObject => ({ +export const toRealmRole = (params: RealmRoleParams): Partial => ({ pathname: generatePath(RealmRoleRoute.path, params), }); diff --git a/src/realm-roles/routes/RealmRoles.ts b/src/realm-roles/routes/RealmRoles.ts index 00fbe852b2..7406012cba 100644 --- a/src/realm-roles/routes/RealmRoles.ts +++ b/src/realm-roles/routes/RealmRoles.ts @@ -1,6 +1,6 @@ -import type { LocationDescriptorObject } from "history"; import { lazy } from "react"; -import { generatePath } from "react-router-dom"; +import type { Path } from "react-router-dom-v5-compat"; +import { generatePath } from "react-router-dom-v5-compat"; import type { RouteDef } from "../../route-config"; export type RealmRolesParams = { realm: string }; @@ -12,8 +12,6 @@ export const RealmRolesRoute: RouteDef = { access: "view-realm", }; -export const toRealmRoles = ( - params: RealmRolesParams -): LocationDescriptorObject => ({ +export const toRealmRoles = (params: RealmRolesParams): Partial => ({ pathname: generatePath(RealmRolesRoute.path, params), }); diff --git a/src/realm-settings/routes/AddAttribute.ts b/src/realm-settings/routes/AddAttribute.ts index f88bc6e903..cceb854de3 100644 --- a/src/realm-settings/routes/AddAttribute.ts +++ b/src/realm-settings/routes/AddAttribute.ts @@ -1,6 +1,6 @@ -import type { LocationDescriptorObject } from "history"; import { lazy } from "react"; -import { generatePath } from "react-router-dom"; +import type { Path } from "react-router-dom-v5-compat"; +import { generatePath } from "react-router-dom-v5-compat"; import type { RouteDef } from "../../route-config"; export type AddAttributeParams = { @@ -14,8 +14,6 @@ export const AddAttributeRoute: RouteDef = { access: "manage-realm", }; -export const toAddAttribute = ( - params: AddAttributeParams -): LocationDescriptorObject => ({ +export const toAddAttribute = (params: AddAttributeParams): Partial => ({ pathname: generatePath(AddAttributeRoute.path, params), }); diff --git a/src/realm-settings/routes/AddClientPolicy.ts b/src/realm-settings/routes/AddClientPolicy.ts index 8608fb732a..022da0bf19 100644 --- a/src/realm-settings/routes/AddClientPolicy.ts +++ b/src/realm-settings/routes/AddClientPolicy.ts @@ -1,6 +1,6 @@ -import type { LocationDescriptorObject } from "history"; import { lazy } from "react"; -import { generatePath } from "react-router-dom"; +import type { Path } from "react-router-dom-v5-compat"; +import { generatePath } from "react-router-dom-v5-compat"; import type { RouteDef } from "../../route-config"; export type AddClientPolicyParams = { realm: string }; @@ -14,6 +14,6 @@ export const AddClientPolicyRoute: RouteDef = { export const toAddClientPolicy = ( params: AddClientPolicyParams -): LocationDescriptorObject => ({ +): Partial => ({ pathname: generatePath(AddClientPolicyRoute.path, params), }); diff --git a/src/realm-settings/routes/AddClientProfile.ts b/src/realm-settings/routes/AddClientProfile.ts index 871405e3e6..b525e6786e 100644 --- a/src/realm-settings/routes/AddClientProfile.ts +++ b/src/realm-settings/routes/AddClientProfile.ts @@ -1,6 +1,6 @@ -import type { LocationDescriptorObject } from "history"; import { lazy } from "react"; -import { generatePath } from "react-router-dom"; +import type { Path } from "react-router-dom-v5-compat"; +import { generatePath } from "react-router-dom-v5-compat"; import type { RouteDef } from "../../route-config"; export type AddClientProfileParams = { @@ -17,6 +17,6 @@ export const AddClientProfileRoute: RouteDef = { export const toAddClientProfile = ( params: AddClientProfileParams -): LocationDescriptorObject => ({ +): Partial => ({ pathname: generatePath(AddClientProfileRoute.path, params), }); diff --git a/src/realm-settings/routes/AddCondition.ts b/src/realm-settings/routes/AddCondition.ts index 59400bb233..36b918d618 100644 --- a/src/realm-settings/routes/AddCondition.ts +++ b/src/realm-settings/routes/AddCondition.ts @@ -1,6 +1,6 @@ -import type { LocationDescriptorObject } from "history"; import { lazy } from "react"; import { generatePath } from "react-router-dom"; +import type { Path } from "react-router-dom-v5-compat"; import type { RouteDef } from "../../route-config"; export type NewClientPolicyConditionParams = { @@ -18,6 +18,6 @@ export const NewClientPolicyConditionRoute: RouteDef = { export const toNewClientPolicyCondition = ( params: NewClientPolicyConditionParams -): LocationDescriptorObject => ({ +): Partial => ({ pathname: generatePath(NewClientPolicyConditionRoute.path, params), }); diff --git a/src/realm-settings/routes/AddExecutor.ts b/src/realm-settings/routes/AddExecutor.ts index 4970697ad8..111d7b4a8a 100644 --- a/src/realm-settings/routes/AddExecutor.ts +++ b/src/realm-settings/routes/AddExecutor.ts @@ -1,6 +1,6 @@ -import type { LocationDescriptorObject } from "history"; import { lazy } from "react"; -import { generatePath } from "react-router-dom"; +import type { Path } from "react-router-dom-v5-compat"; +import { generatePath } from "react-router-dom-v5-compat"; import type { RouteDef } from "../../route-config"; export type AddExecutorParams = { @@ -15,8 +15,6 @@ export const AddExecutorRoute: RouteDef = { access: "manage-realm", }; -export const toAddExecutor = ( - params: AddExecutorParams -): LocationDescriptorObject => ({ +export const toAddExecutor = (params: AddExecutorParams): Partial => ({ pathname: generatePath(AddExecutorRoute.path, params), }); diff --git a/src/realm-settings/routes/Attribute.ts b/src/realm-settings/routes/Attribute.ts index b7d86799e3..9655e865e1 100644 --- a/src/realm-settings/routes/Attribute.ts +++ b/src/realm-settings/routes/Attribute.ts @@ -1,6 +1,6 @@ -import type { LocationDescriptorObject } from "history"; import { lazy } from "react"; -import { generatePath } from "react-router-dom"; +import type { Path } from "react-router-dom-v5-compat"; +import { generatePath } from "react-router-dom-v5-compat"; import type { RouteDef } from "../../route-config"; export type AttributeParams = { @@ -15,8 +15,6 @@ export const AttributeRoute: RouteDef = { access: "manage-realm", }; -export const toAttribute = ( - params: AttributeParams -): LocationDescriptorObject => ({ +export const toAttribute = (params: AttributeParams): Partial => ({ pathname: generatePath(AttributeRoute.path, params), }); diff --git a/src/realm-settings/routes/ClientPolicies.ts b/src/realm-settings/routes/ClientPolicies.ts index 96db3935a5..593a67d10c 100644 --- a/src/realm-settings/routes/ClientPolicies.ts +++ b/src/realm-settings/routes/ClientPolicies.ts @@ -1,6 +1,6 @@ -import type { LocationDescriptorObject } from "history"; import { lazy } from "react"; -import { generatePath } from "react-router-dom"; +import type { Path } from "react-router-dom-v5-compat"; +import { generatePath } from "react-router-dom-v5-compat"; import type { RouteDef } from "../../route-config"; export type ClientPoliciesTab = "profiles" | "policies"; @@ -19,6 +19,6 @@ export const ClientPoliciesRoute: RouteDef = { export const toClientPolicies = ( params: ClientPoliciesParams -): LocationDescriptorObject => ({ +): Partial => ({ pathname: generatePath(ClientPoliciesRoute.path, params), }); diff --git a/src/realm-settings/routes/ClientProfile.ts b/src/realm-settings/routes/ClientProfile.ts index f54415576f..60d7e95180 100644 --- a/src/realm-settings/routes/ClientProfile.ts +++ b/src/realm-settings/routes/ClientProfile.ts @@ -1,6 +1,6 @@ -import type { LocationDescriptorObject } from "history"; import { lazy } from "react"; -import { generatePath } from "react-router-dom"; +import type { Path } from "react-router-dom-v5-compat"; +import { generatePath } from "react-router-dom-v5-compat"; import type { RouteDef } from "../../route-config"; export type ClientProfileParams = { @@ -17,6 +17,6 @@ export const ClientProfileRoute: RouteDef = { export const toClientProfile = ( params: ClientProfileParams -): LocationDescriptorObject => ({ +): Partial => ({ pathname: generatePath(ClientProfileRoute.path, params), }); diff --git a/src/realm-settings/routes/EditAttributesGroup.ts b/src/realm-settings/routes/EditAttributesGroup.ts index 83d9ee6382..7a71333cd8 100644 --- a/src/realm-settings/routes/EditAttributesGroup.ts +++ b/src/realm-settings/routes/EditAttributesGroup.ts @@ -1,6 +1,6 @@ -import type { LocationDescriptorObject } from "history"; import { lazy } from "react"; -import { generatePath } from "react-router-dom"; +import type { Path } from "react-router-dom-v5-compat"; +import { generatePath } from "react-router-dom-v5-compat"; import type { RouteDef } from "../../route-config"; export type EditAttributesGroupParams = { @@ -17,6 +17,6 @@ export const EditAttributesGroupRoute: RouteDef = { export const toEditAttributesGroup = ( params: EditAttributesGroupParams -): LocationDescriptorObject => ({ +): Partial => ({ pathname: generatePath(EditAttributesGroupRoute.path, params), }); diff --git a/src/realm-settings/routes/EditClientPolicy.ts b/src/realm-settings/routes/EditClientPolicy.ts index 16f7a3408e..a484a306da 100644 --- a/src/realm-settings/routes/EditClientPolicy.ts +++ b/src/realm-settings/routes/EditClientPolicy.ts @@ -1,6 +1,6 @@ -import type { LocationDescriptorObject } from "history"; import { lazy } from "react"; -import { generatePath } from "react-router-dom"; +import type { Path } from "react-router-dom-v5-compat"; +import { generatePath } from "react-router-dom-v5-compat"; import type { RouteDef } from "../../route-config"; export type EditClientPolicyParams = { @@ -17,6 +17,6 @@ export const EditClientPolicyRoute: RouteDef = { export const toEditClientPolicy = ( params: EditClientPolicyParams -): LocationDescriptorObject => ({ +): Partial => ({ pathname: generatePath(EditClientPolicyRoute.path, params), }); diff --git a/src/realm-settings/routes/EditCondition.ts b/src/realm-settings/routes/EditCondition.ts index 1890e4a4fa..a1ca4c967f 100644 --- a/src/realm-settings/routes/EditCondition.ts +++ b/src/realm-settings/routes/EditCondition.ts @@ -1,6 +1,6 @@ -import type { LocationDescriptorObject } from "history"; import { lazy } from "react"; import { generatePath } from "react-router-dom"; +import type { Path } from "react-router-dom-v5-compat"; import type { RouteDef } from "../../route-config"; export type EditClientPolicyConditionParams = { @@ -19,6 +19,6 @@ export const EditClientPolicyConditionRoute: RouteDef = { export const toEditClientPolicyCondition = ( params: EditClientPolicyConditionParams -): LocationDescriptorObject => ({ +): Partial => ({ pathname: generatePath(EditClientPolicyConditionRoute.path, params), }); diff --git a/src/realm-settings/routes/Executor.ts b/src/realm-settings/routes/Executor.ts index a11841e4c9..953b5fcc1e 100644 --- a/src/realm-settings/routes/Executor.ts +++ b/src/realm-settings/routes/Executor.ts @@ -1,6 +1,6 @@ -import type { LocationDescriptorObject } from "history"; import { lazy } from "react"; -import { generatePath } from "react-router-dom"; +import type { Path } from "react-router-dom-v5-compat"; +import { generatePath } from "react-router-dom-v5-compat"; import type { RouteDef } from "../../route-config"; export type ExecutorParams = { @@ -16,8 +16,6 @@ export const ExecutorRoute: RouteDef = { access: ["manage-realm"], }; -export const toExecutor = ( - params: ExecutorParams -): LocationDescriptorObject => ({ +export const toExecutor = (params: ExecutorParams): Partial => ({ pathname: generatePath(ExecutorRoute.path, params), }); diff --git a/src/realm-settings/routes/KeyProvider.ts b/src/realm-settings/routes/KeyProvider.ts index 962fdb69e3..544bc16ed3 100644 --- a/src/realm-settings/routes/KeyProvider.ts +++ b/src/realm-settings/routes/KeyProvider.ts @@ -1,6 +1,6 @@ -import type { LocationDescriptorObject } from "history"; import { lazy } from "react"; -import { generatePath } from "react-router-dom"; +import type { Path } from "react-router-dom-v5-compat"; +import { generatePath } from "react-router-dom-v5-compat"; import type { RouteDef } from "../../route-config"; export type ProviderType = @@ -26,8 +26,6 @@ export const KeyProviderFormRoute: RouteDef = { access: "view-realm", }; -export const toKeyProvider = ( - params: KeyProviderParams -): LocationDescriptorObject => ({ +export const toKeyProvider = (params: KeyProviderParams): Partial => ({ pathname: generatePath(KeyProviderFormRoute.path, params), }); diff --git a/src/realm-settings/routes/KeysTab.ts b/src/realm-settings/routes/KeysTab.ts index fbf92598a0..2c46b3d400 100644 --- a/src/realm-settings/routes/KeysTab.ts +++ b/src/realm-settings/routes/KeysTab.ts @@ -1,6 +1,6 @@ -import type { LocationDescriptorObject } from "history"; import { lazy } from "react"; -import { generatePath } from "react-router-dom"; +import type { Path } from "react-router-dom-v5-compat"; +import { generatePath } from "react-router-dom-v5-compat"; import type { RouteDef } from "../../route-config"; export type KeySubTab = "list" | "providers"; @@ -17,6 +17,6 @@ export const KeysRoute: RouteDef = { access: "view-realm", }; -export const toKeysTab = (params: KeysParams): LocationDescriptorObject => ({ +export const toKeysTab = (params: KeysParams): Partial => ({ pathname: generatePath(KeysRoute.path, params), }); diff --git a/src/realm-settings/routes/NewAttributesGroup.ts b/src/realm-settings/routes/NewAttributesGroup.ts index 45ceae0d83..b88595edc7 100644 --- a/src/realm-settings/routes/NewAttributesGroup.ts +++ b/src/realm-settings/routes/NewAttributesGroup.ts @@ -1,6 +1,6 @@ -import type { LocationDescriptorObject } from "history"; import { lazy } from "react"; -import { generatePath } from "react-router-dom"; +import type { Path } from "react-router-dom-v5-compat"; +import { generatePath } from "react-router-dom-v5-compat"; import type { RouteDef } from "../../route-config"; export type NewAttributesGroupParams = { @@ -16,6 +16,6 @@ export const NewAttributesGroupRoute: RouteDef = { export const toNewAttributesGroup = ( params: NewAttributesGroupParams -): LocationDescriptorObject => ({ +): Partial => ({ pathname: generatePath(NewAttributesGroupRoute.path, params), }); diff --git a/src/realm-settings/routes/RealmSettings.ts b/src/realm-settings/routes/RealmSettings.ts index 2ffac9d298..807eed1423 100644 --- a/src/realm-settings/routes/RealmSettings.ts +++ b/src/realm-settings/routes/RealmSettings.ts @@ -1,6 +1,6 @@ -import type { LocationDescriptorObject } from "history"; import { lazy } from "react"; import { generatePath } from "react-router-dom"; +import type { Path } from "react-router-dom-v5-compat"; import type { RouteDef } from "../../route-config"; export type RealmSettingsTab = @@ -33,6 +33,6 @@ export const RealmSettingsRoute: RouteDef = { export const toRealmSettings = ( params: RealmSettingsParams -): LocationDescriptorObject => ({ +): Partial => ({ pathname: generatePath(RealmSettingsRoute.path, params), }); diff --git a/src/realm-settings/routes/UserProfile.ts b/src/realm-settings/routes/UserProfile.ts index 06610fd447..70279eefea 100644 --- a/src/realm-settings/routes/UserProfile.ts +++ b/src/realm-settings/routes/UserProfile.ts @@ -1,6 +1,6 @@ -import type { LocationDescriptorObject } from "history"; import { lazy } from "react"; -import { generatePath } from "react-router-dom"; +import type { Path } from "react-router-dom-v5-compat"; +import { generatePath } from "react-router-dom-v5-compat"; import type { RouteDef } from "../../route-config"; export type UserProfileTab = "attributes" | "attributes-group" | "json-editor"; @@ -17,8 +17,6 @@ export const UserProfileRoute: RouteDef = { access: "view-realm", }; -export const toUserProfile = ( - params: UserProfileParams -): LocationDescriptorObject => ({ +export const toUserProfile = (params: UserProfileParams): Partial => ({ pathname: generatePath(UserProfileRoute.path, params), }); diff --git a/src/realm/routes/AddRealm.ts b/src/realm/routes/AddRealm.ts index a541d85137..9290924c29 100644 --- a/src/realm/routes/AddRealm.ts +++ b/src/realm/routes/AddRealm.ts @@ -1,6 +1,6 @@ -import type { LocationDescriptorObject } from "history"; import { lazy } from "react"; -import { generatePath } from "react-router-dom"; +import type { Path } from "react-router-dom-v5-compat"; +import { generatePath } from "react-router-dom-v5-compat"; import type { RouteDef } from "../../route-config"; export type AddRealmParams = { realm: string }; @@ -12,8 +12,6 @@ export const AddRealmRoute: RouteDef = { access: "view-realm", }; -export const toAddRealm = ( - params: AddRealmParams -): LocationDescriptorObject => ({ +export const toAddRealm = (params: AddRealmParams): Partial => ({ pathname: generatePath(AddRealmRoute.path, params), }); diff --git a/src/sessions/routes/Sessions.ts b/src/sessions/routes/Sessions.ts index 842be05aea..b09623d5d2 100644 --- a/src/sessions/routes/Sessions.ts +++ b/src/sessions/routes/Sessions.ts @@ -1,6 +1,6 @@ -import type { LocationDescriptorObject } from "history"; import { lazy } from "react"; -import { generatePath } from "react-router-dom"; +import type { Path } from "react-router-dom-v5-compat"; +import { generatePath } from "react-router-dom-v5-compat"; import type { RouteDef } from "../../route-config"; export type SessionsParams = { realm: string }; @@ -12,8 +12,6 @@ export const SessionsRoute: RouteDef = { access: ["view-realm", "view-clients", "view-users"], }; -export const toSessions = ( - params: SessionsParams -): LocationDescriptorObject => ({ +export const toSessions = (params: SessionsParams): Partial => ({ pathname: generatePath(SessionsRoute.path, params), }); diff --git a/src/user-federation/routes/NewKerberosUserFederation.ts b/src/user-federation/routes/NewKerberosUserFederation.ts index 8d0cfe8f9d..9e87aabe03 100644 --- a/src/user-federation/routes/NewKerberosUserFederation.ts +++ b/src/user-federation/routes/NewKerberosUserFederation.ts @@ -1,6 +1,6 @@ -import type { LocationDescriptorObject } from "history"; import { lazy } from "react"; -import { generatePath } from "react-router-dom"; +import type { Path } from "react-router-dom-v5-compat"; +import { generatePath } from "react-router-dom-v5-compat"; import type { RouteDef } from "../../route-config"; export type NewKerberosUserFederationParams = { realm: string }; @@ -14,6 +14,6 @@ export const NewKerberosUserFederationRoute: RouteDef = { export const toNewKerberosUserFederation = ( params: NewKerberosUserFederationParams -): LocationDescriptorObject => ({ +): Partial => ({ pathname: generatePath(NewKerberosUserFederationRoute.path, params), }); diff --git a/src/user-federation/routes/NewLdapUserFederation.ts b/src/user-federation/routes/NewLdapUserFederation.ts index bac6cd7626..77120f58c6 100644 --- a/src/user-federation/routes/NewLdapUserFederation.ts +++ b/src/user-federation/routes/NewLdapUserFederation.ts @@ -1,6 +1,6 @@ -import type { LocationDescriptorObject } from "history"; import { lazy } from "react"; -import { generatePath } from "react-router-dom"; +import type { Path } from "react-router-dom-v5-compat"; +import { generatePath } from "react-router-dom-v5-compat"; import type { RouteDef } from "../../route-config"; export type NewLdapUserFederationParams = { realm: string }; @@ -15,6 +15,6 @@ export const NewLdapUserFederationRoute: RouteDef = { export const toNewLdapUserFederation = ( params: NewLdapUserFederationParams -): LocationDescriptorObject => ({ +): Partial => ({ pathname: generatePath(NewLdapUserFederationRoute.path, params), }); diff --git a/src/user-federation/routes/NewProvider.ts b/src/user-federation/routes/NewProvider.ts index 13809a43df..ca390c5d45 100644 --- a/src/user-federation/routes/NewProvider.ts +++ b/src/user-federation/routes/NewProvider.ts @@ -1,7 +1,7 @@ import { lazy } from "react"; -import { generatePath } from "react-router-dom"; +import { generatePath } from "react-router-dom-v5-compat"; -import type { LocationDescriptorObject } from "history"; +import type { Path } from "react-router-dom-v5-compat"; import type { RouteDef } from "../../route-config"; export type ProviderRouteParams = { @@ -24,8 +24,6 @@ export const CustomEditProviderRoute: RouteDef = { access: "view-realm", }; -export const toProvider = ( - params: ProviderRouteParams -): LocationDescriptorObject => ({ +export const toProvider = (params: ProviderRouteParams): Partial => ({ pathname: generatePath(CustomProviderRoute.path, params), }); diff --git a/src/user-federation/routes/UserFederation.ts b/src/user-federation/routes/UserFederation.ts index 1a562ed5a1..7e7d62cede 100644 --- a/src/user-federation/routes/UserFederation.ts +++ b/src/user-federation/routes/UserFederation.ts @@ -1,6 +1,6 @@ -import type { LocationDescriptorObject } from "history"; import { lazy } from "react"; -import { generatePath } from "react-router-dom"; +import type { Path } from "react-router-dom-v5-compat"; +import { generatePath } from "react-router-dom-v5-compat"; import type { RouteDef } from "../../route-config"; export type UserFederationParams = { realm: string }; @@ -14,6 +14,6 @@ export const UserFederationRoute: RouteDef = { export const toUserFederation = ( params: UserFederationParams -): LocationDescriptorObject => ({ +): Partial => ({ pathname: generatePath(UserFederationRoute.path, params), }); diff --git a/src/user-federation/routes/UserFederationKerberos.ts b/src/user-federation/routes/UserFederationKerberos.ts index cc8b3a5752..6701c92d1c 100644 --- a/src/user-federation/routes/UserFederationKerberos.ts +++ b/src/user-federation/routes/UserFederationKerberos.ts @@ -1,6 +1,6 @@ -import type { LocationDescriptorObject } from "history"; import { lazy } from "react"; -import { generatePath } from "react-router-dom"; +import type { Path } from "react-router-dom-v5-compat"; +import { generatePath } from "react-router-dom-v5-compat"; import type { RouteDef } from "../../route-config"; export type UserFederationKerberosParams = { @@ -17,6 +17,6 @@ export const UserFederationKerberosRoute: RouteDef = { export const toUserFederationKerberos = ( params: UserFederationKerberosParams -): LocationDescriptorObject => ({ +): Partial => ({ pathname: generatePath(UserFederationKerberosRoute.path, params), }); diff --git a/src/user-federation/routes/UserFederationLdap.ts b/src/user-federation/routes/UserFederationLdap.ts index cd8d0e2e01..111f18b478 100644 --- a/src/user-federation/routes/UserFederationLdap.ts +++ b/src/user-federation/routes/UserFederationLdap.ts @@ -1,6 +1,6 @@ -import type { LocationDescriptorObject } from "history"; import { lazy } from "react"; import { generatePath } from "react-router-dom"; +import type { Path } from "react-router-dom-v5-compat"; import type { RouteDef } from "../../route-config"; type UserFederationLdapTab = "settings" | "mappers"; @@ -21,6 +21,6 @@ export const UserFederationLdapRoute: RouteDef = { export const toUserFederationLdap = ( params: UserFederationLdapParams -): LocationDescriptorObject => ({ +): Partial => ({ pathname: generatePath(UserFederationLdapRoute.path, params), }); diff --git a/src/user-federation/routes/UserFederationLdapMapper.ts b/src/user-federation/routes/UserFederationLdapMapper.ts index 58aedd239f..b40009c5e4 100644 --- a/src/user-federation/routes/UserFederationLdapMapper.ts +++ b/src/user-federation/routes/UserFederationLdapMapper.ts @@ -1,6 +1,6 @@ -import type { LocationDescriptorObject } from "history"; import { lazy } from "react"; -import { generatePath } from "react-router-dom"; +import type { Path } from "react-router-dom-v5-compat"; +import { generatePath } from "react-router-dom-v5-compat"; import type { RouteDef } from "../../route-config"; export type UserFederationLdapMapperParams = { @@ -19,6 +19,6 @@ export const UserFederationLdapMapperRoute: RouteDef = { export const toUserFederationLdapMapper = ( params: UserFederationLdapMapperParams -): LocationDescriptorObject => ({ +): Partial => ({ pathname: generatePath(UserFederationLdapMapperRoute.path, params), }); diff --git a/src/user-federation/routes/UserFederationsKerberos.ts b/src/user-federation/routes/UserFederationsKerberos.ts index 0c4d371d3f..bf0f659db9 100644 --- a/src/user-federation/routes/UserFederationsKerberos.ts +++ b/src/user-federation/routes/UserFederationsKerberos.ts @@ -1,6 +1,6 @@ -import type { LocationDescriptorObject } from "history"; import { lazy } from "react"; -import { generatePath } from "react-router-dom"; +import type { Path } from "react-router-dom-v5-compat"; +import { generatePath } from "react-router-dom-v5-compat"; import type { RouteDef } from "../../route-config"; export type UserFederationsKerberosParams = { realm: string }; @@ -13,6 +13,6 @@ export const UserFederationsKerberosRoute: RouteDef = { export const toUserFederationsKerberos = ( params: UserFederationsKerberosParams -): LocationDescriptorObject => ({ +): Partial => ({ pathname: generatePath(UserFederationsKerberosRoute.path, params), }); diff --git a/src/user-federation/routes/UserFederationsLdap.ts b/src/user-federation/routes/UserFederationsLdap.ts index 881e18c5d1..bbcb24acea 100644 --- a/src/user-federation/routes/UserFederationsLdap.ts +++ b/src/user-federation/routes/UserFederationsLdap.ts @@ -1,6 +1,6 @@ -import type { LocationDescriptorObject } from "history"; import { lazy } from "react"; -import { generatePath } from "react-router-dom"; +import type { Path } from "react-router-dom-v5-compat"; +import { generatePath } from "react-router-dom-v5-compat"; import type { RouteDef } from "../../route-config"; export type UserFederationsLdapParams = { realm: string }; @@ -13,6 +13,6 @@ export const UserFederationsLdapRoute: RouteDef = { export const toUserFederationsLdap = ( params: UserFederationsLdapParams -): LocationDescriptorObject => ({ +): Partial => ({ pathname: generatePath(UserFederationsLdapRoute.path, params), }); diff --git a/src/user/routes/AddUser.ts b/src/user/routes/AddUser.ts index 4293cad169..30ac150b85 100644 --- a/src/user/routes/AddUser.ts +++ b/src/user/routes/AddUser.ts @@ -1,6 +1,6 @@ -import type { LocationDescriptorObject } from "history"; import { lazy } from "react"; -import { generatePath } from "react-router-dom"; +import type { Path } from "react-router-dom-v5-compat"; +import { generatePath } from "react-router-dom-v5-compat"; import type { RouteDef } from "../../route-config"; @@ -13,6 +13,6 @@ export const AddUserRoute: RouteDef = { access: "manage-users", }; -export const toAddUser = (params: AddUserParams): LocationDescriptorObject => ({ +export const toAddUser = (params: AddUserParams): Partial => ({ pathname: generatePath(AddUserRoute.path, params), }); diff --git a/src/user/routes/User.ts b/src/user/routes/User.ts index 251ad8702e..2b00c67db8 100644 --- a/src/user/routes/User.ts +++ b/src/user/routes/User.ts @@ -1,6 +1,6 @@ -import type { LocationDescriptorObject } from "history"; import { lazy } from "react"; -import { generatePath } from "react-router-dom"; +import type { Path } from "react-router-dom-v5-compat"; +import { generatePath } from "react-router-dom-v5-compat"; import type { RouteDef } from "../../route-config"; export type UserTab = @@ -23,6 +23,6 @@ export const UserRoute: RouteDef = { access: "query-users", }; -export const toUser = (params: UserParams): LocationDescriptorObject => ({ +export const toUser = (params: UserParams): Partial => ({ pathname: generatePath(UserRoute.path, params), }); diff --git a/src/user/routes/Users.ts b/src/user/routes/Users.ts index d59772ca3a..6241af1ccb 100644 --- a/src/user/routes/Users.ts +++ b/src/user/routes/Users.ts @@ -1,6 +1,6 @@ -import type { LocationDescriptorObject } from "history"; import { lazy } from "react"; import { generatePath } from "react-router-dom"; +import type { Path } from "react-router-dom-v5-compat"; import type { RouteDef } from "../../route-config"; export type UserTab = "list" | "permissions"; @@ -15,6 +15,6 @@ export const UsersRoute: RouteDef = { legacy: true, }; -export const toUsers = (params: UsersParams): LocationDescriptorObject => ({ +export const toUsers = (params: UsersParams): Partial => ({ pathname: generatePath(UsersRoute.path, params), });