Convert route definitions to React Router v6 APIs (#3144)

This commit is contained in:
Jon Koops 2022-08-19 20:05:09 +02:00 committed by GitHub
parent 9d9e774790
commit 7729a54ad6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
75 changed files with 222 additions and 266 deletions

View file

@ -1,6 +1,6 @@
import type { LocationDescriptorObject } from "history";
import { lazy } from "react"; import { lazy } from "react";
import { generatePath } from "react-router-dom"; import { generatePath } from "react-router-dom";
import type { Path } from "react-router-dom-v5-compat";
import type { RouteDef } from "../../route-config"; import type { RouteDef } from "../../route-config";
export type AuthenticationTab = "flows" | "required-actions" | "policies"; export type AuthenticationTab = "flows" | "required-actions" | "policies";
@ -17,6 +17,6 @@ export const AuthenticationRoute: RouteDef = {
export const toAuthentication = ( export const toAuthentication = (
params: AuthenticationParams params: AuthenticationParams
): LocationDescriptorObject => ({ ): Partial<Path> => ({
pathname: generatePath(AuthenticationRoute.path, params), pathname: generatePath(AuthenticationRoute.path, params),
}); });

View file

@ -1,6 +1,6 @@
import type { LocationDescriptorObject } from "history";
import { lazy } from "react"; 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"; import type { RouteDef } from "../../route-config";
export type CreateFlowParams = { realm: string }; export type CreateFlowParams = { realm: string };
@ -12,8 +12,6 @@ export const CreateFlowRoute: RouteDef = {
access: "manage-authorization", access: "manage-authorization",
}; };
export const toCreateFlow = ( export const toCreateFlow = (params: CreateFlowParams): Partial<Path> => ({
params: CreateFlowParams
): LocationDescriptorObject => ({
pathname: generatePath(CreateFlowRoute.path, params), pathname: generatePath(CreateFlowRoute.path, params),
}); });

View file

@ -1,6 +1,6 @@
import type { LocationDescriptorObject } from "history";
import { lazy } from "react"; import { lazy } from "react";
import { generatePath } from "react-router-dom"; import { generatePath } from "react-router-dom";
import type { Path } from "react-router-dom-v5-compat";
import type { RouteDef } from "../../route-config"; import type { RouteDef } from "../../route-config";
export type FlowParams = { export type FlowParams = {
@ -18,6 +18,6 @@ export const FlowRoute: RouteDef = {
legacy: true, legacy: true,
}; };
export const toFlow = (params: FlowParams): LocationDescriptorObject => ({ export const toFlow = (params: FlowParams): Partial<Path> => ({
pathname: generatePath(FlowRoute.path, params), pathname: generatePath(FlowRoute.path, params),
}); });

View file

@ -1,6 +1,6 @@
import { useEffect, useState } from "react"; import { useEffect, useState } from "react";
import { useTranslation } from "react-i18next"; 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 { Link } from "react-router-dom";
import { Dropdown, DropdownItem, DropdownToggle } from "@patternfly/react-core"; import { Dropdown, DropdownItem, DropdownToggle } from "@patternfly/react-core";
import { CaretDownIcon } from "@patternfly/react-icons"; import { CaretDownIcon } from "@patternfly/react-icons";
@ -21,7 +21,7 @@ type MapperListProps = {
mappers: ProtocolMapperTypeRepresentation | ProtocolMapperRepresentation[] mappers: ProtocolMapperTypeRepresentation | ProtocolMapperRepresentation[]
) => void; ) => void;
onDelete: (mapper: ProtocolMapperRepresentation) => void; onDelete: (mapper: ProtocolMapperRepresentation) => void;
detailLink: (id: string) => LocationDescriptorObject; detailLink: (id: string) => Partial<Path>;
}; };
type Row = ProtocolMapperRepresentation & { type Row = ProtocolMapperRepresentation & {

View file

@ -1,6 +1,6 @@
import type { LocationDescriptorObject } from "history";
import { lazy } from "react"; import { lazy } from "react";
import { generatePath } from "react-router-dom"; import { generatePath } from "react-router-dom";
import type { Path } from "react-router-dom-v5-compat";
import type { RouteDef } from "../../route-config"; import type { RouteDef } from "../../route-config";
export type ClientScopeTab = "settings" | "mappers" | "scope"; export type ClientScopeTab = "settings" | "mappers" | "scope";
@ -20,8 +20,6 @@ export const ClientScopeRoute: RouteDef = {
legacy: true, legacy: true,
}; };
export const toClientScope = ( export const toClientScope = (params: ClientScopeParams): Partial<Path> => ({
params: ClientScopeParams
): LocationDescriptorObject => ({
pathname: generatePath(ClientScopeRoute.path, params), pathname: generatePath(ClientScopeRoute.path, params),
}); });

View file

@ -1,6 +1,6 @@
import type { LocationDescriptorObject } from "history";
import { lazy } from "react"; 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"; import type { RouteDef } from "../../route-config";
export type ClientScopesParams = { realm: string }; export type ClientScopesParams = { realm: string };
@ -12,8 +12,6 @@ export const ClientScopesRoute: RouteDef = {
access: "view-clients", access: "view-clients",
}; };
export const toClientScopes = ( export const toClientScopes = (params: ClientScopesParams): Partial<Path> => ({
params: ClientScopesParams
): LocationDescriptorObject => ({
pathname: generatePath(ClientScopesRoute.path, params), pathname: generatePath(ClientScopesRoute.path, params),
}); });

View file

@ -1,6 +1,6 @@
import type { LocationDescriptorObject } from "history";
import { lazy } from "react"; 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"; import type { RouteDef } from "../../route-config";
export type MapperParams = { export type MapperParams = {
@ -17,6 +17,6 @@ export const MapperRoute: RouteDef = {
access: "view-clients", access: "view-clients",
}; };
export const toMapper = (params: MapperParams): LocationDescriptorObject => ({ export const toMapper = (params: MapperParams): Partial<Path> => ({
pathname: generatePath(MapperRoute.path, params), pathname: generatePath(MapperRoute.path, params),
}); });

View file

@ -1,6 +1,6 @@
import type { LocationDescriptorObject } from "history";
import { lazy } from "react"; 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"; import type { RouteDef } from "../../route-config";
export type NewClientScopeParams = { realm: string }; export type NewClientScopeParams = { realm: string };
@ -14,6 +14,6 @@ export const NewClientScopeRoute: RouteDef = {
export const toNewClientScope = ( export const toNewClientScope = (
params: NewClientScopeParams params: NewClientScopeParams
): LocationDescriptorObject => ({ ): Partial<Path> => ({
pathname: generatePath(NewClientScopeRoute.path, params), pathname: generatePath(NewClientScopeRoute.path, params),
}); });

View file

@ -1,11 +1,11 @@
import { Link } from "react-router-dom";
import type { LocationDescriptor } from "history";
import { useTranslation } from "react-i18next";
import { import {
DescriptionListDescription,
DescriptionListGroup, DescriptionListGroup,
DescriptionListTerm, DescriptionListTerm,
DescriptionListDescription,
} from "@patternfly/react-core"; } 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<T> = { type DetailDescriptionProps<T> = {
name: string; name: string;
@ -18,7 +18,7 @@ export function DetailDescription<T>(props: DetailDescriptionProps<T>) {
} }
type DetailDescriptionLinkProps<T> = DetailDescriptionProps<T> & { type DetailDescriptionLinkProps<T> = DetailDescriptionProps<T> & {
link?: (element: T) => LocationDescriptor; link?: (element: T) => Partial<Path>;
}; };
export function DetailDescriptionLink<T>({ export function DetailDescriptionLink<T>({

View file

@ -1,6 +1,6 @@
import type { LocationDescriptorObject } from "history";
import { lazy } from "react"; 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"; import type { RouteDef } from "../../route-config";
export type AddClientParams = { realm: string }; export type AddClientParams = { realm: string };
@ -12,8 +12,6 @@ export const AddClientRoute: RouteDef = {
access: "manage-clients", access: "manage-clients",
}; };
export const toAddClient = ( export const toAddClient = (params: AddClientParams): Partial<Path> => ({
params: AddClientParams
): LocationDescriptorObject => ({
pathname: generatePath(AddClientRoute.path, params), pathname: generatePath(AddClientRoute.path, params),
}); });

View file

@ -1,6 +1,6 @@
import type { LocationDescriptorObject } from "history";
import { lazy } from "react"; 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"; import type { RouteDef } from "../../route-config";
export type AuthorizationTab = export type AuthorizationTab =
@ -26,6 +26,6 @@ export const AuthorizationRoute: RouteDef = {
export const toAuthorizationTab = ( export const toAuthorizationTab = (
params: AuthorizationParams params: AuthorizationParams
): LocationDescriptorObject => ({ ): Partial<Path> => ({
pathname: generatePath(AuthorizationRoute.path, params), pathname: generatePath(AuthorizationRoute.path, params),
}); });

View file

@ -1,6 +1,6 @@
import type { LocationDescriptorObject } from "history";
import { lazy } from "react"; 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"; import type { RouteDef } from "../../route-config";
export type ClientTab = export type ClientTab =
@ -29,6 +29,6 @@ export const ClientRoute: RouteDef = {
access: "query-clients", access: "query-clients",
}; };
export const toClient = (params: ClientParams): LocationDescriptorObject => ({ export const toClient = (params: ClientParams): Partial<Path> => ({
pathname: generatePath(ClientRoute.path, params), pathname: generatePath(ClientRoute.path, params),
}); });

View file

@ -1,6 +1,6 @@
import type { LocationDescriptorObject } from "history";
import { lazy } from "react"; 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"; import type { RouteDef } from "../../route-config";
export type ClientScopesTab = "setup" | "evaluate"; export type ClientScopesTab = "setup" | "evaluate";
@ -10,6 +10,7 @@ export type ClientScopesParams = {
clientId: string; clientId: string;
tab: ClientScopesTab; tab: ClientScopesTab;
}; };
export const ClientScopesRoute: RouteDef = { export const ClientScopesRoute: RouteDef = {
path: "/:realm/clients/:clientId/clientScopes/:tab", path: "/:realm/clients/:clientId/clientScopes/:tab",
component: lazy(() => import("../ClientDetails")), component: lazy(() => import("../ClientDetails")),
@ -19,6 +20,6 @@ export const ClientScopesRoute: RouteDef = {
export const toClientScopesTab = ( export const toClientScopesTab = (
params: ClientScopesParams params: ClientScopesParams
): LocationDescriptorObject => ({ ): Partial<Path> => ({
pathname: generatePath(ClientScopesRoute.path, params), pathname: generatePath(ClientScopesRoute.path, params),
}); });

View file

@ -1,6 +1,6 @@
import type { LocationDescriptorObject } from "history";
import { lazy } from "react"; import { lazy } from "react";
import { generatePath } from "react-router-dom"; import { generatePath } from "react-router-dom";
import type { Path } from "react-router-dom-v5-compat";
import type { RouteDef } from "../../route-config"; import type { RouteDef } from "../../route-config";
export type ClientsTab = "list" | "initial-access-token"; export type ClientsTab = "list" | "initial-access-token";
@ -18,6 +18,6 @@ export const ClientsRoute: RouteDef = {
legacy: true, legacy: true,
}; };
export const toClients = (params: ClientsParams): LocationDescriptorObject => ({ export const toClients = (params: ClientsParams): Partial<Path> => ({
pathname: generatePath(ClientsRoute.path, params), pathname: generatePath(ClientsRoute.path, params),
}); });

View file

@ -1,6 +1,6 @@
import type { LocationDescriptorObject } from "history";
import { lazy } from "react"; 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"; import type { RouteDef } from "../../route-config";
export type CreateInitialAccessTokenParams = { realm: string }; export type CreateInitialAccessTokenParams = { realm: string };
@ -14,6 +14,6 @@ export const CreateInitialAccessTokenRoute: RouteDef = {
export const toCreateInitialAccessToken = ( export const toCreateInitialAccessToken = (
params: CreateInitialAccessTokenParams params: CreateInitialAccessTokenParams
): LocationDescriptorObject => ({ ): Partial<Path> => ({
pathname: generatePath(CreateInitialAccessTokenRoute.path, params), pathname: generatePath(CreateInitialAccessTokenRoute.path, params),
}); });

View file

@ -1,6 +1,6 @@
import type { LocationDescriptorObject } from "history";
import { lazy } from "react"; import { lazy } from "react";
import { generatePath } from "react-router-dom"; import { generatePath } from "react-router-dom";
import type { Path } from "react-router-dom-v5-compat";
import type { RouteDef } from "../../route-config"; import type { RouteDef } from "../../route-config";
export type DedicatedScopeTab = "mappers" | "scope"; export type DedicatedScopeTab = "mappers" | "scope";
@ -21,6 +21,6 @@ export const DedicatedScopeDetailsRoute: RouteDef = {
export const toDedicatedScope = ( export const toDedicatedScope = (
params: DedicatedScopeDetailsParams params: DedicatedScopeDetailsParams
): LocationDescriptorObject => ({ ): Partial<Path> => ({
pathname: generatePath(DedicatedScopeDetailsRoute.path, params), pathname: generatePath(DedicatedScopeDetailsRoute.path, params),
}); });

View file

@ -1,6 +1,6 @@
import type { LocationDescriptorObject } from "history";
import { lazy } from "react"; 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"; import type { RouteDef } from "../../route-config";
export type ImportClientParams = { realm: string }; export type ImportClientParams = { realm: string };
@ -12,8 +12,6 @@ export const ImportClientRoute: RouteDef = {
access: "manage-clients", access: "manage-clients",
}; };
export const toImportClient = ( export const toImportClient = (params: ImportClientParams): Partial<Path> => ({
params: ImportClientParams
): LocationDescriptorObject => ({
pathname: generatePath(ImportClientRoute.path, params), pathname: generatePath(ImportClientRoute.path, params),
}); });

View file

@ -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 { 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 = { export type MapperParams = {
realm: string; realm: string;
@ -16,6 +16,6 @@ export const MapperRoute: RouteDef = {
access: "view-clients", access: "view-clients",
}; };
export const toMapper = (params: MapperParams): LocationDescriptorObject => ({ export const toMapper = (params: MapperParams): Partial<Path> => ({
pathname: generatePath(MapperRoute.path, params), pathname: generatePath(MapperRoute.path, params),
}); });

View file

@ -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 { 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"; export type PermissionType = "resource" | "scope";
@ -22,6 +22,6 @@ export const NewPermissionRoute: RouteDef = {
export const toNewPermission = ( export const toNewPermission = (
params: NewPermissionParams params: NewPermissionParams
): LocationDescriptorObject => ({ ): Partial<Path> => ({
pathname: generatePath(NewPermissionRoute.path, params), pathname: generatePath(NewPermissionRoute.path, params),
}); });

View file

@ -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 { 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 }; export type NewPolicyParams = { realm: string; id: string; policyType: string };
@ -12,8 +12,6 @@ export const NewPolicyRoute: RouteDef = {
access: "view-clients", access: "view-clients",
}; };
export const toCreatePolicy = ( export const toCreatePolicy = (params: NewPolicyParams): Partial<Path> => ({
params: NewPolicyParams
): LocationDescriptorObject => ({
pathname: generatePath(NewPolicyRoute.path, params), pathname: generatePath(NewPolicyRoute.path, params),
}); });

View file

@ -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 { 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 }; export type NewResourceParams = { realm: string; id: string };
@ -12,8 +12,6 @@ export const NewResourceRoute: RouteDef = {
access: "view-clients", access: "view-clients",
}; };
export const toCreateResource = ( export const toCreateResource = (params: NewResourceParams): Partial<Path> => ({
params: NewResourceParams
): LocationDescriptorObject => ({
pathname: generatePath(NewResourceRoute.path, params), pathname: generatePath(NewResourceRoute.path, params),
}); });

View file

@ -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 { 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 }; export type NewScopeParams = { realm: string; id: string };
@ -12,8 +12,6 @@ export const NewScopeRoute: RouteDef = {
access: "view-clients", access: "view-clients",
}; };
export const toNewScope = ( export const toNewScope = (params: NewScopeParams): Partial<Path> => ({
params: NewScopeParams
): LocationDescriptorObject => ({
pathname: generatePath(NewScopeRoute.path, params), pathname: generatePath(NewScopeRoute.path, params),
}); });

View file

@ -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 { 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"; import type { PermissionType } from "./NewPermission";
export type PermissionDetailsParams = { export type PermissionDetailsParams = {
@ -20,6 +20,6 @@ export const PermissionDetailsRoute: RouteDef = {
export const toPermissionDetails = ( export const toPermissionDetails = (
params: PermissionDetailsParams params: PermissionDetailsParams
): LocationDescriptorObject => ({ ): Partial<Path> => ({
pathname: generatePath(PermissionDetailsRoute.path, params), pathname: generatePath(PermissionDetailsRoute.path, params),
}); });

View file

@ -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 { 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 = { export type PolicyDetailsParams = {
realm: string; realm: string;
@ -19,6 +19,6 @@ export const PolicyDetailsRoute: RouteDef = {
export const toPolicyDetails = ( export const toPolicyDetails = (
params: PolicyDetailsParams params: PolicyDetailsParams
): LocationDescriptorObject => ({ ): Partial<Path> => ({
pathname: generatePath(PolicyDetailsRoute.path, params), pathname: generatePath(PolicyDetailsRoute.path, params),
}); });

View file

@ -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 { 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 = { export type ResourceDetailsParams = {
realm: string; realm: string;
@ -19,6 +19,6 @@ export const ResourceDetailsRoute: RouteDef = {
export const toResourceDetails = ( export const toResourceDetails = (
params: ResourceDetailsParams params: ResourceDetailsParams
): LocationDescriptorObject => ({ ): Partial<Path> => ({
pathname: generatePath(ResourceDetailsRoute.path, params), pathname: generatePath(ResourceDetailsRoute.path, params),
}); });

View file

@ -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 { 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 = { export type ScopeDetailsParams = {
realm: string; realm: string;
@ -17,8 +17,6 @@ export const ScopeDetailsRoute: RouteDef = {
legacy: true, legacy: true,
}; };
export const toScopeDetails = ( export const toScopeDetails = (params: ScopeDetailsParams): Partial<Path> => ({
params: ScopeDetailsParams
): LocationDescriptorObject => ({
pathname: generatePath(ScopeDetailsRoute.path, params), pathname: generatePath(ScopeDetailsRoute.path, params),
}); });

View file

@ -4,13 +4,14 @@ import {
TabsComponent, TabsComponent,
TabsProps, TabsProps,
} from "@patternfly/react-core"; } from "@patternfly/react-core";
import type { History, LocationDescriptorObject } from "history"; import type { History } from "history";
import { import {
Children, Children,
isValidElement, isValidElement,
JSXElementConstructor, JSXElementConstructor,
ReactElement, ReactElement,
} from "react"; } from "react";
import type { Path } from "react-router-dom-v5-compat";
import { useLocation } 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: // 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. // TODO: Figure out why we need to omit 'ref' from the props.
type RoutableTabsProps = { type RoutableTabsProps = {
children: Child | Child[]; children: Child | Child[];
defaultLocation?: LocationDescriptorObject; defaultLocation?: Partial<Path>;
} & Omit< } & Omit<
TabsProps, TabsProps,
"ref" | "activeKey" | "defaultActiveKey" | "component" | "children" "ref" | "activeKey" | "defaultActiveKey" | "component" | "children"
@ -67,7 +68,7 @@ export const RoutableTabs = ({
}; };
type RoutableTabParams = { type RoutableTabParams = {
to: LocationDescriptorObject; to: Partial<Path>;
history: History<unknown>; history: History<unknown>;
}; };

View file

@ -1,6 +1,6 @@
import type { LocationDescriptorObject } from "history";
import { lazy } from "react"; import { lazy } from "react";
import { generatePath } from "react-router-dom"; import { generatePath } from "react-router-dom";
import type { Path } from "react-router-dom-v5-compat";
import type { RouteDef } from "../../route-config"; import type { RouteDef } from "../../route-config";
export type DashboardTab = "info" | "providers"; export type DashboardTab = "info" | "providers";
@ -15,8 +15,6 @@ export const DashboardRoute: RouteDef = {
legacy: true, legacy: true,
}; };
export const toDashboard = ( export const toDashboard = (params: DashboardParams): Partial<Path> => ({
params: DashboardParams
): LocationDescriptorObject => ({
pathname: generatePath(DashboardRoute.path, params), pathname: generatePath(DashboardRoute.path, params),
}); });

View file

@ -1,6 +1,6 @@
import type { LocationDescriptorObject } from "history";
import { lazy } from "react"; import { lazy } from "react";
import { generatePath } from "react-router-dom"; import { generatePath } from "react-router-dom";
import type { Path } from "react-router-dom-v5-compat";
import type { RouteDef } from "../../route-config"; import type { RouteDef } from "../../route-config";
export type EventsTab = "user-events" | "admin-events"; export type EventsTab = "user-events" | "admin-events";
@ -18,6 +18,6 @@ export const EventsRoute: RouteDef = {
legacy: true, legacy: true,
}; };
export const toEvents = (params: EventsParams): LocationDescriptorObject => ({ export const toEvents = (params: EventsParams): Partial<Path> => ({
pathname: generatePath(EventsRoute.path, params), pathname: generatePath(EventsRoute.path, params),
}); });

View file

@ -1,6 +1,6 @@
import type { LocationDescriptorObject } from "history";
import { lazy } from "react"; import { lazy } from "react";
import { generatePath } from "react-router-dom"; import { generatePath } from "react-router-dom";
import type { Path } from "react-router-dom-v5-compat";
import type { RouteDef } from "../../route-config"; import type { RouteDef } from "../../route-config";
export type GroupsParams = { realm: string; id?: string }; export type GroupsParams = { realm: string; id?: string };
@ -15,6 +15,6 @@ export const GroupsRoute: RouteDef = {
legacy: true, legacy: true,
}; };
export const toGroups = (params: GroupsParams): LocationDescriptorObject => ({ export const toGroups = (params: GroupsParams): Partial<Path> => ({
pathname: generatePath(GroupsRoute.path, params), pathname: generatePath(GroupsRoute.path, params),
}); });

View file

@ -1,6 +1,6 @@
import type { LocationDescriptorObject } from "history";
import { lazy } from "react"; 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"; import type { RouteDef } from "../../route-config";
export type GroupsSearchParams = { realm: string }; export type GroupsSearchParams = { realm: string };
@ -12,8 +12,6 @@ export const GroupsSearchRoute: RouteDef = {
access: "query-groups", access: "query-groups",
}; };
export const toGroupsSearch = ( export const toGroupsSearch = (params: GroupsSearchParams): Partial<Path> => ({
params: GroupsSearchParams
): LocationDescriptorObject => ({
pathname: generatePath(GroupsSearchRoute.path, params), pathname: generatePath(GroupsSearchRoute.path, params),
}); });

View file

@ -1,6 +1,6 @@
import type { LocationDescriptorObject } from "history";
import { lazy } from "react"; 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"; import type { RouteDef } from "../../route-config";
export type IdentityProviderAddMapperParams = { export type IdentityProviderAddMapperParams = {
@ -19,6 +19,6 @@ export const IdentityProviderAddMapperRoute: RouteDef = {
export const toIdentityProviderAddMapper = ( export const toIdentityProviderAddMapper = (
params: IdentityProviderAddMapperParams params: IdentityProviderAddMapperParams
): LocationDescriptorObject => ({ ): Partial<Path> => ({
pathname: generatePath(IdentityProviderAddMapperRoute.path, params), pathname: generatePath(IdentityProviderAddMapperRoute.path, params),
}); });

View file

@ -1,6 +1,6 @@
import type { LocationDescriptorObject } from "history";
import { lazy } from "react"; 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"; import type { RouteDef } from "../../route-config";
export type IdentityProviderEditMapperParams = { export type IdentityProviderEditMapperParams = {
@ -19,6 +19,6 @@ export const IdentityProviderEditMapperRoute: RouteDef = {
export const toIdentityProviderEditMapper = ( export const toIdentityProviderEditMapper = (
params: IdentityProviderEditMapperParams params: IdentityProviderEditMapperParams
): LocationDescriptorObject => ({ ): Partial<Path> => ({
pathname: generatePath(IdentityProviderEditMapperRoute.path, params), pathname: generatePath(IdentityProviderEditMapperRoute.path, params),
}); });

View file

@ -1,6 +1,6 @@
import type { LocationDescriptorObject } from "history";
import { lazy } from "react"; 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"; import type { RouteDef } from "../../route-config";
type IdentityProviderTabs = "settings" | "mappers"; type IdentityProviderTabs = "settings" | "mappers";
@ -21,6 +21,6 @@ export const IdentityProviderRoute: RouteDef = {
export const toIdentityProvider = ( export const toIdentityProvider = (
params: IdentityProviderParams params: IdentityProviderParams
): LocationDescriptorObject => ({ ): Partial<Path> => ({
pathname: generatePath(IdentityProviderRoute.path, params), pathname: generatePath(IdentityProviderRoute.path, params),
}); });

View file

@ -1,6 +1,6 @@
import type { LocationDescriptorObject } from "history";
import { lazy } from "react"; 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"; import type { RouteDef } from "../../route-config";
export type IdentityProviderCreateParams = { export type IdentityProviderCreateParams = {
@ -17,6 +17,6 @@ export const IdentityProviderCreateRoute: RouteDef = {
export const toIdentityProviderCreate = ( export const toIdentityProviderCreate = (
params: IdentityProviderCreateParams params: IdentityProviderCreateParams
): LocationDescriptorObject => ({ ): Partial<Path> => ({
pathname: generatePath(IdentityProviderCreateRoute.path, params), pathname: generatePath(IdentityProviderCreateRoute.path, params),
}); });

View file

@ -1,6 +1,6 @@
import type { LocationDescriptorObject } from "history";
import { lazy } from "react"; 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"; import type { RouteDef } from "../../route-config";
export type IdentityProviderKeycloakOidcParams = { realm: string }; export type IdentityProviderKeycloakOidcParams = { realm: string };
@ -14,6 +14,6 @@ export const IdentityProviderKeycloakOidcRoute: RouteDef = {
export const toIdentityProviderKeycloakOidc = ( export const toIdentityProviderKeycloakOidc = (
params: IdentityProviderKeycloakOidcParams params: IdentityProviderKeycloakOidcParams
): LocationDescriptorObject => ({ ): Partial<Path> => ({
pathname: generatePath(IdentityProviderKeycloakOidcRoute.path, params), pathname: generatePath(IdentityProviderKeycloakOidcRoute.path, params),
}); });

View file

@ -1,6 +1,6 @@
import type { LocationDescriptorObject } from "history";
import { lazy } from "react"; 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"; import type { RouteDef } from "../../route-config";
export type IdentityProviderOidcParams = { realm: string }; export type IdentityProviderOidcParams = { realm: string };
@ -14,6 +14,6 @@ export const IdentityProviderOidcRoute: RouteDef = {
export const toIdentityProviderOidc = ( export const toIdentityProviderOidc = (
params: IdentityProviderOidcParams params: IdentityProviderOidcParams
): LocationDescriptorObject => ({ ): Partial<Path> => ({
pathname: generatePath(IdentityProviderOidcRoute.path, params), pathname: generatePath(IdentityProviderOidcRoute.path, params),
}); });

View file

@ -1,6 +1,6 @@
import type { LocationDescriptorObject } from "history";
import { lazy } from "react"; 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"; import type { RouteDef } from "../../route-config";
export type IdentityProviderSamlParams = { realm: string }; export type IdentityProviderSamlParams = { realm: string };
@ -14,6 +14,6 @@ export const IdentityProviderSamlRoute: RouteDef = {
export const toIdentityProviderSaml = ( export const toIdentityProviderSaml = (
params: IdentityProviderSamlParams params: IdentityProviderSamlParams
): LocationDescriptorObject => ({ ): Partial<Path> => ({
pathname: generatePath(IdentityProviderSamlRoute.path, params), pathname: generatePath(IdentityProviderSamlRoute.path, params),
}); });

View file

@ -1,6 +1,6 @@
import type { LocationDescriptorObject } from "history";
import { lazy } from "react"; 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"; import type { RouteDef } from "../../route-config";
export type IdentityProvidersParams = { realm: string }; export type IdentityProvidersParams = { realm: string };
@ -14,6 +14,6 @@ export const IdentityProvidersRoute: RouteDef = {
export const toIdentityProviders = ( export const toIdentityProviders = (
params: IdentityProvidersParams params: IdentityProvidersParams
): LocationDescriptorObject => ({ ): Partial<Path> => ({
pathname: generatePath(IdentityProvidersRoute.path, params), pathname: generatePath(IdentityProvidersRoute.path, params),
}); });

View file

@ -1,6 +1,6 @@
import { lazy } from "react"; import { lazy } from "react";
import type { LocationDescriptorObject } from "history"; import type { Path } from "react-router-dom-v5-compat";
import { generatePath } from "react-router-dom"; import { generatePath } from "react-router-dom-v5-compat";
import type { RouteDef } from "../../route-config"; import type { RouteDef } from "../../route-config";
export type AddRoleParams = { realm: string }; export type AddRoleParams = { realm: string };
@ -12,6 +12,6 @@ export const AddRoleRoute: RouteDef = {
access: "manage-realm", access: "manage-realm",
}; };
export const toAddRole = (params: AddRoleParams): LocationDescriptorObject => ({ export const toAddRole = (params: AddRoleParams): Partial<Path> => ({
pathname: generatePath(AddRoleRoute.path, params), pathname: generatePath(AddRoleRoute.path, params),
}); });

View file

@ -1,6 +1,6 @@
import { lazy } from "react"; import { lazy } from "react";
import type { LocationDescriptorObject } from "history"; import type { Path } from "react-router-dom-v5-compat";
import { generatePath } from "react-router-dom"; import { generatePath } from "react-router-dom-v5-compat";
import type { RouteDef } from "../../route-config"; import type { RouteDef } from "../../route-config";
export type AddRoleToClientParams = { export type AddRoleToClientParams = {
@ -17,6 +17,6 @@ export const AddRoleToClientRoute: RouteDef = {
export const toAddRoleToClient = ( export const toAddRoleToClient = (
params: AddRoleToClientParams params: AddRoleToClientParams
): LocationDescriptorObject => ({ ): Partial<Path> => ({
pathname: generatePath(AddRoleToClientRoute.path, params), pathname: generatePath(AddRoleToClientRoute.path, params),
}); });

View file

@ -1,6 +1,6 @@
import { lazy } from "react"; import { lazy } from "react";
import type { LocationDescriptorObject } from "history";
import { generatePath } from "react-router-dom"; import { generatePath } from "react-router-dom";
import type { Path } from "react-router-dom-v5-compat";
import type { RouteDef } from "../../route-config"; import type { RouteDef } from "../../route-config";
export type ClientRoleTab = export type ClientRoleTab =
@ -24,8 +24,6 @@ export const ClientRoleRoute: RouteDef = {
legacy: true, legacy: true,
}; };
export const toClientRole = ( export const toClientRole = (params: ClientRoleParams): Partial<Path> => ({
params: ClientRoleParams
): LocationDescriptorObject => ({
pathname: generatePath(ClientRoleRoute.path, params), pathname: generatePath(ClientRoleRoute.path, params),
}); });

View file

@ -1,6 +1,6 @@
import { lazy } from "react"; import { lazy } from "react";
import { generatePath } from "react-router"; 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"; import type { RouteDef } from "../../route-config";
export type RealmRoleTab = export type RealmRoleTab =
@ -23,8 +23,6 @@ export const RealmRoleRoute: RouteDef = {
legacy: true, legacy: true,
}; };
export const toRealmRole = ( export const toRealmRole = (params: RealmRoleParams): Partial<Path> => ({
params: RealmRoleParams
): LocationDescriptorObject => ({
pathname: generatePath(RealmRoleRoute.path, params), pathname: generatePath(RealmRoleRoute.path, params),
}); });

View file

@ -1,6 +1,6 @@
import type { LocationDescriptorObject } from "history";
import { lazy } from "react"; 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"; import type { RouteDef } from "../../route-config";
export type RealmRolesParams = { realm: string }; export type RealmRolesParams = { realm: string };
@ -12,8 +12,6 @@ export const RealmRolesRoute: RouteDef = {
access: "view-realm", access: "view-realm",
}; };
export const toRealmRoles = ( export const toRealmRoles = (params: RealmRolesParams): Partial<Path> => ({
params: RealmRolesParams
): LocationDescriptorObject => ({
pathname: generatePath(RealmRolesRoute.path, params), pathname: generatePath(RealmRolesRoute.path, params),
}); });

View file

@ -1,6 +1,6 @@
import type { LocationDescriptorObject } from "history";
import { lazy } from "react"; 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"; import type { RouteDef } from "../../route-config";
export type AddAttributeParams = { export type AddAttributeParams = {
@ -14,8 +14,6 @@ export const AddAttributeRoute: RouteDef = {
access: "manage-realm", access: "manage-realm",
}; };
export const toAddAttribute = ( export const toAddAttribute = (params: AddAttributeParams): Partial<Path> => ({
params: AddAttributeParams
): LocationDescriptorObject => ({
pathname: generatePath(AddAttributeRoute.path, params), pathname: generatePath(AddAttributeRoute.path, params),
}); });

View file

@ -1,6 +1,6 @@
import type { LocationDescriptorObject } from "history";
import { lazy } from "react"; 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"; import type { RouteDef } from "../../route-config";
export type AddClientPolicyParams = { realm: string }; export type AddClientPolicyParams = { realm: string };
@ -14,6 +14,6 @@ export const AddClientPolicyRoute: RouteDef = {
export const toAddClientPolicy = ( export const toAddClientPolicy = (
params: AddClientPolicyParams params: AddClientPolicyParams
): LocationDescriptorObject => ({ ): Partial<Path> => ({
pathname: generatePath(AddClientPolicyRoute.path, params), pathname: generatePath(AddClientPolicyRoute.path, params),
}); });

View file

@ -1,6 +1,6 @@
import type { LocationDescriptorObject } from "history";
import { lazy } from "react"; 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"; import type { RouteDef } from "../../route-config";
export type AddClientProfileParams = { export type AddClientProfileParams = {
@ -17,6 +17,6 @@ export const AddClientProfileRoute: RouteDef = {
export const toAddClientProfile = ( export const toAddClientProfile = (
params: AddClientProfileParams params: AddClientProfileParams
): LocationDescriptorObject => ({ ): Partial<Path> => ({
pathname: generatePath(AddClientProfileRoute.path, params), pathname: generatePath(AddClientProfileRoute.path, params),
}); });

View file

@ -1,6 +1,6 @@
import type { LocationDescriptorObject } from "history";
import { lazy } from "react"; import { lazy } from "react";
import { generatePath } from "react-router-dom"; import { generatePath } from "react-router-dom";
import type { Path } from "react-router-dom-v5-compat";
import type { RouteDef } from "../../route-config"; import type { RouteDef } from "../../route-config";
export type NewClientPolicyConditionParams = { export type NewClientPolicyConditionParams = {
@ -18,6 +18,6 @@ export const NewClientPolicyConditionRoute: RouteDef = {
export const toNewClientPolicyCondition = ( export const toNewClientPolicyCondition = (
params: NewClientPolicyConditionParams params: NewClientPolicyConditionParams
): LocationDescriptorObject => ({ ): Partial<Path> => ({
pathname: generatePath(NewClientPolicyConditionRoute.path, params), pathname: generatePath(NewClientPolicyConditionRoute.path, params),
}); });

View file

@ -1,6 +1,6 @@
import type { LocationDescriptorObject } from "history";
import { lazy } from "react"; 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"; import type { RouteDef } from "../../route-config";
export type AddExecutorParams = { export type AddExecutorParams = {
@ -15,8 +15,6 @@ export const AddExecutorRoute: RouteDef = {
access: "manage-realm", access: "manage-realm",
}; };
export const toAddExecutor = ( export const toAddExecutor = (params: AddExecutorParams): Partial<Path> => ({
params: AddExecutorParams
): LocationDescriptorObject => ({
pathname: generatePath(AddExecutorRoute.path, params), pathname: generatePath(AddExecutorRoute.path, params),
}); });

View file

@ -1,6 +1,6 @@
import type { LocationDescriptorObject } from "history";
import { lazy } from "react"; 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"; import type { RouteDef } from "../../route-config";
export type AttributeParams = { export type AttributeParams = {
@ -15,8 +15,6 @@ export const AttributeRoute: RouteDef = {
access: "manage-realm", access: "manage-realm",
}; };
export const toAttribute = ( export const toAttribute = (params: AttributeParams): Partial<Path> => ({
params: AttributeParams
): LocationDescriptorObject => ({
pathname: generatePath(AttributeRoute.path, params), pathname: generatePath(AttributeRoute.path, params),
}); });

View file

@ -1,6 +1,6 @@
import type { LocationDescriptorObject } from "history";
import { lazy } from "react"; 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"; import type { RouteDef } from "../../route-config";
export type ClientPoliciesTab = "profiles" | "policies"; export type ClientPoliciesTab = "profiles" | "policies";
@ -19,6 +19,6 @@ export const ClientPoliciesRoute: RouteDef = {
export const toClientPolicies = ( export const toClientPolicies = (
params: ClientPoliciesParams params: ClientPoliciesParams
): LocationDescriptorObject => ({ ): Partial<Path> => ({
pathname: generatePath(ClientPoliciesRoute.path, params), pathname: generatePath(ClientPoliciesRoute.path, params),
}); });

View file

@ -1,6 +1,6 @@
import type { LocationDescriptorObject } from "history";
import { lazy } from "react"; 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"; import type { RouteDef } from "../../route-config";
export type ClientProfileParams = { export type ClientProfileParams = {
@ -17,6 +17,6 @@ export const ClientProfileRoute: RouteDef = {
export const toClientProfile = ( export const toClientProfile = (
params: ClientProfileParams params: ClientProfileParams
): LocationDescriptorObject => ({ ): Partial<Path> => ({
pathname: generatePath(ClientProfileRoute.path, params), pathname: generatePath(ClientProfileRoute.path, params),
}); });

View file

@ -1,6 +1,6 @@
import type { LocationDescriptorObject } from "history";
import { lazy } from "react"; 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"; import type { RouteDef } from "../../route-config";
export type EditAttributesGroupParams = { export type EditAttributesGroupParams = {
@ -17,6 +17,6 @@ export const EditAttributesGroupRoute: RouteDef = {
export const toEditAttributesGroup = ( export const toEditAttributesGroup = (
params: EditAttributesGroupParams params: EditAttributesGroupParams
): LocationDescriptorObject => ({ ): Partial<Path> => ({
pathname: generatePath(EditAttributesGroupRoute.path, params), pathname: generatePath(EditAttributesGroupRoute.path, params),
}); });

View file

@ -1,6 +1,6 @@
import type { LocationDescriptorObject } from "history";
import { lazy } from "react"; 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"; import type { RouteDef } from "../../route-config";
export type EditClientPolicyParams = { export type EditClientPolicyParams = {
@ -17,6 +17,6 @@ export const EditClientPolicyRoute: RouteDef = {
export const toEditClientPolicy = ( export const toEditClientPolicy = (
params: EditClientPolicyParams params: EditClientPolicyParams
): LocationDescriptorObject => ({ ): Partial<Path> => ({
pathname: generatePath(EditClientPolicyRoute.path, params), pathname: generatePath(EditClientPolicyRoute.path, params),
}); });

View file

@ -1,6 +1,6 @@
import type { LocationDescriptorObject } from "history";
import { lazy } from "react"; import { lazy } from "react";
import { generatePath } from "react-router-dom"; import { generatePath } from "react-router-dom";
import type { Path } from "react-router-dom-v5-compat";
import type { RouteDef } from "../../route-config"; import type { RouteDef } from "../../route-config";
export type EditClientPolicyConditionParams = { export type EditClientPolicyConditionParams = {
@ -19,6 +19,6 @@ export const EditClientPolicyConditionRoute: RouteDef = {
export const toEditClientPolicyCondition = ( export const toEditClientPolicyCondition = (
params: EditClientPolicyConditionParams params: EditClientPolicyConditionParams
): LocationDescriptorObject => ({ ): Partial<Path> => ({
pathname: generatePath(EditClientPolicyConditionRoute.path, params), pathname: generatePath(EditClientPolicyConditionRoute.path, params),
}); });

View file

@ -1,6 +1,6 @@
import type { LocationDescriptorObject } from "history";
import { lazy } from "react"; 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"; import type { RouteDef } from "../../route-config";
export type ExecutorParams = { export type ExecutorParams = {
@ -16,8 +16,6 @@ export const ExecutorRoute: RouteDef = {
access: ["manage-realm"], access: ["manage-realm"],
}; };
export const toExecutor = ( export const toExecutor = (params: ExecutorParams): Partial<Path> => ({
params: ExecutorParams
): LocationDescriptorObject => ({
pathname: generatePath(ExecutorRoute.path, params), pathname: generatePath(ExecutorRoute.path, params),
}); });

View file

@ -1,6 +1,6 @@
import type { LocationDescriptorObject } from "history";
import { lazy } from "react"; 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"; import type { RouteDef } from "../../route-config";
export type ProviderType = export type ProviderType =
@ -26,8 +26,6 @@ export const KeyProviderFormRoute: RouteDef = {
access: "view-realm", access: "view-realm",
}; };
export const toKeyProvider = ( export const toKeyProvider = (params: KeyProviderParams): Partial<Path> => ({
params: KeyProviderParams
): LocationDescriptorObject => ({
pathname: generatePath(KeyProviderFormRoute.path, params), pathname: generatePath(KeyProviderFormRoute.path, params),
}); });

View file

@ -1,6 +1,6 @@
import type { LocationDescriptorObject } from "history";
import { lazy } from "react"; 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"; import type { RouteDef } from "../../route-config";
export type KeySubTab = "list" | "providers"; export type KeySubTab = "list" | "providers";
@ -17,6 +17,6 @@ export const KeysRoute: RouteDef = {
access: "view-realm", access: "view-realm",
}; };
export const toKeysTab = (params: KeysParams): LocationDescriptorObject => ({ export const toKeysTab = (params: KeysParams): Partial<Path> => ({
pathname: generatePath(KeysRoute.path, params), pathname: generatePath(KeysRoute.path, params),
}); });

View file

@ -1,6 +1,6 @@
import type { LocationDescriptorObject } from "history";
import { lazy } from "react"; 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"; import type { RouteDef } from "../../route-config";
export type NewAttributesGroupParams = { export type NewAttributesGroupParams = {
@ -16,6 +16,6 @@ export const NewAttributesGroupRoute: RouteDef = {
export const toNewAttributesGroup = ( export const toNewAttributesGroup = (
params: NewAttributesGroupParams params: NewAttributesGroupParams
): LocationDescriptorObject => ({ ): Partial<Path> => ({
pathname: generatePath(NewAttributesGroupRoute.path, params), pathname: generatePath(NewAttributesGroupRoute.path, params),
}); });

View file

@ -1,6 +1,6 @@
import type { LocationDescriptorObject } from "history";
import { lazy } from "react"; import { lazy } from "react";
import { generatePath } from "react-router-dom"; import { generatePath } from "react-router-dom";
import type { Path } from "react-router-dom-v5-compat";
import type { RouteDef } from "../../route-config"; import type { RouteDef } from "../../route-config";
export type RealmSettingsTab = export type RealmSettingsTab =
@ -33,6 +33,6 @@ export const RealmSettingsRoute: RouteDef = {
export const toRealmSettings = ( export const toRealmSettings = (
params: RealmSettingsParams params: RealmSettingsParams
): LocationDescriptorObject => ({ ): Partial<Path> => ({
pathname: generatePath(RealmSettingsRoute.path, params), pathname: generatePath(RealmSettingsRoute.path, params),
}); });

View file

@ -1,6 +1,6 @@
import type { LocationDescriptorObject } from "history";
import { lazy } from "react"; 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"; import type { RouteDef } from "../../route-config";
export type UserProfileTab = "attributes" | "attributes-group" | "json-editor"; export type UserProfileTab = "attributes" | "attributes-group" | "json-editor";
@ -17,8 +17,6 @@ export const UserProfileRoute: RouteDef = {
access: "view-realm", access: "view-realm",
}; };
export const toUserProfile = ( export const toUserProfile = (params: UserProfileParams): Partial<Path> => ({
params: UserProfileParams
): LocationDescriptorObject => ({
pathname: generatePath(UserProfileRoute.path, params), pathname: generatePath(UserProfileRoute.path, params),
}); });

View file

@ -1,6 +1,6 @@
import type { LocationDescriptorObject } from "history";
import { lazy } from "react"; 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"; import type { RouteDef } from "../../route-config";
export type AddRealmParams = { realm: string }; export type AddRealmParams = { realm: string };
@ -12,8 +12,6 @@ export const AddRealmRoute: RouteDef = {
access: "view-realm", access: "view-realm",
}; };
export const toAddRealm = ( export const toAddRealm = (params: AddRealmParams): Partial<Path> => ({
params: AddRealmParams
): LocationDescriptorObject => ({
pathname: generatePath(AddRealmRoute.path, params), pathname: generatePath(AddRealmRoute.path, params),
}); });

View file

@ -1,6 +1,6 @@
import type { LocationDescriptorObject } from "history";
import { lazy } from "react"; 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"; import type { RouteDef } from "../../route-config";
export type SessionsParams = { realm: string }; export type SessionsParams = { realm: string };
@ -12,8 +12,6 @@ export const SessionsRoute: RouteDef = {
access: ["view-realm", "view-clients", "view-users"], access: ["view-realm", "view-clients", "view-users"],
}; };
export const toSessions = ( export const toSessions = (params: SessionsParams): Partial<Path> => ({
params: SessionsParams
): LocationDescriptorObject => ({
pathname: generatePath(SessionsRoute.path, params), pathname: generatePath(SessionsRoute.path, params),
}); });

View file

@ -1,6 +1,6 @@
import type { LocationDescriptorObject } from "history";
import { lazy } from "react"; 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"; import type { RouteDef } from "../../route-config";
export type NewKerberosUserFederationParams = { realm: string }; export type NewKerberosUserFederationParams = { realm: string };
@ -14,6 +14,6 @@ export const NewKerberosUserFederationRoute: RouteDef = {
export const toNewKerberosUserFederation = ( export const toNewKerberosUserFederation = (
params: NewKerberosUserFederationParams params: NewKerberosUserFederationParams
): LocationDescriptorObject => ({ ): Partial<Path> => ({
pathname: generatePath(NewKerberosUserFederationRoute.path, params), pathname: generatePath(NewKerberosUserFederationRoute.path, params),
}); });

View file

@ -1,6 +1,6 @@
import type { LocationDescriptorObject } from "history";
import { lazy } from "react"; 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"; import type { RouteDef } from "../../route-config";
export type NewLdapUserFederationParams = { realm: string }; export type NewLdapUserFederationParams = { realm: string };
@ -15,6 +15,6 @@ export const NewLdapUserFederationRoute: RouteDef = {
export const toNewLdapUserFederation = ( export const toNewLdapUserFederation = (
params: NewLdapUserFederationParams params: NewLdapUserFederationParams
): LocationDescriptorObject => ({ ): Partial<Path> => ({
pathname: generatePath(NewLdapUserFederationRoute.path, params), pathname: generatePath(NewLdapUserFederationRoute.path, params),
}); });

View file

@ -1,7 +1,7 @@
import { lazy } from "react"; 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"; import type { RouteDef } from "../../route-config";
export type ProviderRouteParams = { export type ProviderRouteParams = {
@ -24,8 +24,6 @@ export const CustomEditProviderRoute: RouteDef = {
access: "view-realm", access: "view-realm",
}; };
export const toProvider = ( export const toProvider = (params: ProviderRouteParams): Partial<Path> => ({
params: ProviderRouteParams
): LocationDescriptorObject => ({
pathname: generatePath(CustomProviderRoute.path, params), pathname: generatePath(CustomProviderRoute.path, params),
}); });

View file

@ -1,6 +1,6 @@
import type { LocationDescriptorObject } from "history";
import { lazy } from "react"; 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"; import type { RouteDef } from "../../route-config";
export type UserFederationParams = { realm: string }; export type UserFederationParams = { realm: string };
@ -14,6 +14,6 @@ export const UserFederationRoute: RouteDef = {
export const toUserFederation = ( export const toUserFederation = (
params: UserFederationParams params: UserFederationParams
): LocationDescriptorObject => ({ ): Partial<Path> => ({
pathname: generatePath(UserFederationRoute.path, params), pathname: generatePath(UserFederationRoute.path, params),
}); });

View file

@ -1,6 +1,6 @@
import type { LocationDescriptorObject } from "history";
import { lazy } from "react"; 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"; import type { RouteDef } from "../../route-config";
export type UserFederationKerberosParams = { export type UserFederationKerberosParams = {
@ -17,6 +17,6 @@ export const UserFederationKerberosRoute: RouteDef = {
export const toUserFederationKerberos = ( export const toUserFederationKerberos = (
params: UserFederationKerberosParams params: UserFederationKerberosParams
): LocationDescriptorObject => ({ ): Partial<Path> => ({
pathname: generatePath(UserFederationKerberosRoute.path, params), pathname: generatePath(UserFederationKerberosRoute.path, params),
}); });

View file

@ -1,6 +1,6 @@
import type { LocationDescriptorObject } from "history";
import { lazy } from "react"; import { lazy } from "react";
import { generatePath } from "react-router-dom"; import { generatePath } from "react-router-dom";
import type { Path } from "react-router-dom-v5-compat";
import type { RouteDef } from "../../route-config"; import type { RouteDef } from "../../route-config";
type UserFederationLdapTab = "settings" | "mappers"; type UserFederationLdapTab = "settings" | "mappers";
@ -21,6 +21,6 @@ export const UserFederationLdapRoute: RouteDef = {
export const toUserFederationLdap = ( export const toUserFederationLdap = (
params: UserFederationLdapParams params: UserFederationLdapParams
): LocationDescriptorObject => ({ ): Partial<Path> => ({
pathname: generatePath(UserFederationLdapRoute.path, params), pathname: generatePath(UserFederationLdapRoute.path, params),
}); });

View file

@ -1,6 +1,6 @@
import type { LocationDescriptorObject } from "history";
import { lazy } from "react"; 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"; import type { RouteDef } from "../../route-config";
export type UserFederationLdapMapperParams = { export type UserFederationLdapMapperParams = {
@ -19,6 +19,6 @@ export const UserFederationLdapMapperRoute: RouteDef = {
export const toUserFederationLdapMapper = ( export const toUserFederationLdapMapper = (
params: UserFederationLdapMapperParams params: UserFederationLdapMapperParams
): LocationDescriptorObject => ({ ): Partial<Path> => ({
pathname: generatePath(UserFederationLdapMapperRoute.path, params), pathname: generatePath(UserFederationLdapMapperRoute.path, params),
}); });

View file

@ -1,6 +1,6 @@
import type { LocationDescriptorObject } from "history";
import { lazy } from "react"; 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"; import type { RouteDef } from "../../route-config";
export type UserFederationsKerberosParams = { realm: string }; export type UserFederationsKerberosParams = { realm: string };
@ -13,6 +13,6 @@ export const UserFederationsKerberosRoute: RouteDef = {
export const toUserFederationsKerberos = ( export const toUserFederationsKerberos = (
params: UserFederationsKerberosParams params: UserFederationsKerberosParams
): LocationDescriptorObject => ({ ): Partial<Path> => ({
pathname: generatePath(UserFederationsKerberosRoute.path, params), pathname: generatePath(UserFederationsKerberosRoute.path, params),
}); });

View file

@ -1,6 +1,6 @@
import type { LocationDescriptorObject } from "history";
import { lazy } from "react"; 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"; import type { RouteDef } from "../../route-config";
export type UserFederationsLdapParams = { realm: string }; export type UserFederationsLdapParams = { realm: string };
@ -13,6 +13,6 @@ export const UserFederationsLdapRoute: RouteDef = {
export const toUserFederationsLdap = ( export const toUserFederationsLdap = (
params: UserFederationsLdapParams params: UserFederationsLdapParams
): LocationDescriptorObject => ({ ): Partial<Path> => ({
pathname: generatePath(UserFederationsLdapRoute.path, params), pathname: generatePath(UserFederationsLdapRoute.path, params),
}); });

View file

@ -1,6 +1,6 @@
import type { LocationDescriptorObject } from "history";
import { lazy } from "react"; 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"; import type { RouteDef } from "../../route-config";
@ -13,6 +13,6 @@ export const AddUserRoute: RouteDef = {
access: "manage-users", access: "manage-users",
}; };
export const toAddUser = (params: AddUserParams): LocationDescriptorObject => ({ export const toAddUser = (params: AddUserParams): Partial<Path> => ({
pathname: generatePath(AddUserRoute.path, params), pathname: generatePath(AddUserRoute.path, params),
}); });

View file

@ -1,6 +1,6 @@
import type { LocationDescriptorObject } from "history";
import { lazy } from "react"; 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"; import type { RouteDef } from "../../route-config";
export type UserTab = export type UserTab =
@ -23,6 +23,6 @@ export const UserRoute: RouteDef = {
access: "query-users", access: "query-users",
}; };
export const toUser = (params: UserParams): LocationDescriptorObject => ({ export const toUser = (params: UserParams): Partial<Path> => ({
pathname: generatePath(UserRoute.path, params), pathname: generatePath(UserRoute.path, params),
}); });

View file

@ -1,6 +1,6 @@
import type { LocationDescriptorObject } from "history";
import { lazy } from "react"; import { lazy } from "react";
import { generatePath } from "react-router-dom"; import { generatePath } from "react-router-dom";
import type { Path } from "react-router-dom-v5-compat";
import type { RouteDef } from "../../route-config"; import type { RouteDef } from "../../route-config";
export type UserTab = "list" | "permissions"; export type UserTab = "list" | "permissions";
@ -15,6 +15,6 @@ export const UsersRoute: RouteDef = {
legacy: true, legacy: true,
}; };
export const toUsers = (params: UsersParams): LocationDescriptorObject => ({ export const toUsers = (params: UsersParams): Partial<Path> => ({
pathname: generatePath(UsersRoute.path, params), pathname: generatePath(UsersRoute.path, params),
}); });