Encode parameters for React Router links in URL-safe manner (#23667)

Closes #22600

Co-authored-by: Jon Koops <jonkoops@gmail.com>
This commit is contained in:
Erik Jan de Wit 2023-10-17 09:36:26 +02:00 committed by GitHub
parent 7f9ea3afbb
commit 13207aabac
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
76 changed files with 165 additions and 149 deletions

View file

@ -1,6 +1,6 @@
import { lazy } from "react"; import { lazy } from "react";
import type { Path } from "react-router-dom"; import type { Path } from "react-router-dom";
import { generatePath } from "react-router-dom"; import { generateEncodedPath } from "../../utils/generateEncodedPath";
import type { AppRouteObject } from "../../routes"; import type { AppRouteObject } from "../../routes";
export type AuthenticationTab = "flows" | "required-actions" | "policies"; export type AuthenticationTab = "flows" | "required-actions" | "policies";
@ -31,6 +31,6 @@ export const toAuthentication = (
: AuthenticationRoute.path; : AuthenticationRoute.path;
return { return {
pathname: generatePath(path, params), pathname: generateEncodedPath(path, params),
}; };
}; };

View file

@ -1,6 +1,6 @@
import { lazy } from "react"; import { lazy } from "react";
import type { Path } from "react-router-dom"; import type { Path } from "react-router-dom";
import { generatePath } from "react-router-dom"; import { generateEncodedPath } from "../../utils/generateEncodedPath";
import type { AppRouteObject } from "../../routes"; import type { AppRouteObject } from "../../routes";
export type CreateFlowParams = { realm: string }; export type CreateFlowParams = { realm: string };
@ -17,5 +17,5 @@ export const CreateFlowRoute: AppRouteObject = {
}; };
export const toCreateFlow = (params: CreateFlowParams): Partial<Path> => ({ export const toCreateFlow = (params: CreateFlowParams): Partial<Path> => ({
pathname: generatePath(CreateFlowRoute.path, params), pathname: generateEncodedPath(CreateFlowRoute.path, params),
}); });

View file

@ -1,6 +1,6 @@
import { lazy } from "react"; import { lazy } from "react";
import type { Path } from "react-router-dom"; import type { Path } from "react-router-dom";
import { generatePath } from "react-router-dom"; import { generateEncodedPath } from "../../utils/generateEncodedPath";
import type { AppRouteObject } from "../../routes"; import type { AppRouteObject } from "../../routes";
export type FlowParams = { export type FlowParams = {
@ -30,6 +30,6 @@ export const toFlow = (params: FlowParams): Partial<Path> => {
const path = params.builtIn ? FlowWithBuiltInRoute.path : FlowRoute.path; const path = params.builtIn ? FlowWithBuiltInRoute.path : FlowRoute.path;
return { return {
pathname: generatePath(path, params), pathname: generateEncodedPath(path, params),
}; };
}; };

View file

@ -1,6 +1,6 @@
import { lazy } from "react"; import { lazy } from "react";
import type { Path } from "react-router-dom"; import type { Path } from "react-router-dom";
import { generatePath } from "react-router-dom"; import { generateEncodedPath } from "../../utils/generateEncodedPath";
import type { AppRouteObject } from "../../routes"; import type { AppRouteObject } from "../../routes";
export type ClientScopeTab = "settings" | "mappers" | "scope"; export type ClientScopeTab = "settings" | "mappers" | "scope";
@ -26,6 +26,6 @@ export const toClientScope = (params: ClientScopeParams): Partial<Path> => {
const path = ClientScopeRoute.path; const path = ClientScopeRoute.path;
return { return {
pathname: generatePath(path, params), pathname: generateEncodedPath(path, params),
}; };
}; };

View file

@ -1,6 +1,6 @@
import { lazy } from "react"; import { lazy } from "react";
import type { Path } from "react-router-dom"; import type { Path } from "react-router-dom";
import { generatePath } from "react-router-dom"; import { generateEncodedPath } from "../../utils/generateEncodedPath";
import type { AppRouteObject } from "../../routes"; import type { AppRouteObject } from "../../routes";
export type ClientScopesParams = { realm: string }; export type ClientScopesParams = { realm: string };
@ -17,5 +17,5 @@ export const ClientScopesRoute: AppRouteObject = {
}; };
export const toClientScopes = (params: ClientScopesParams): Partial<Path> => ({ export const toClientScopes = (params: ClientScopesParams): Partial<Path> => ({
pathname: generatePath(ClientScopesRoute.path, params), pathname: generateEncodedPath(ClientScopesRoute.path, params),
}); });

View file

@ -1,6 +1,6 @@
import { lazy } from "react"; import { lazy } from "react";
import type { Path } from "react-router-dom"; import type { Path } from "react-router-dom";
import { generatePath } from "react-router-dom"; import { generateEncodedPath } from "../../utils/generateEncodedPath";
import type { AppRouteObject } from "../../routes"; import type { AppRouteObject } from "../../routes";
export type MapperParams = { export type MapperParams = {
@ -21,5 +21,5 @@ export const MapperRoute: AppRouteObject = {
}; };
export const toMapper = (params: MapperParams): Partial<Path> => ({ export const toMapper = (params: MapperParams): Partial<Path> => ({
pathname: generatePath(MapperRoute.path, params), pathname: generateEncodedPath(MapperRoute.path, params),
}); });

View file

@ -1,6 +1,6 @@
import { lazy } from "react"; import { lazy } from "react";
import type { Path } from "react-router-dom"; import type { Path } from "react-router-dom";
import { generatePath } from "react-router-dom"; import { generateEncodedPath } from "../../utils/generateEncodedPath";
import type { AppRouteObject } from "../../routes"; import type { AppRouteObject } from "../../routes";
export type NewClientScopeParams = { realm: string }; export type NewClientScopeParams = { realm: string };
@ -19,5 +19,5 @@ export const NewClientScopeRoute: AppRouteObject = {
export const toNewClientScope = ( export const toNewClientScope = (
params: NewClientScopeParams, params: NewClientScopeParams,
): Partial<Path> => ({ ): Partial<Path> => ({
pathname: generatePath(NewClientScopeRoute.path, params), pathname: generateEncodedPath(NewClientScopeRoute.path, params),
}); });

View file

@ -1,6 +1,6 @@
import { lazy } from "react"; import { lazy } from "react";
import type { Path } from "react-router-dom"; import type { Path } from "react-router-dom";
import { generatePath } from "react-router-dom"; import { generateEncodedPath } from "../../utils/generateEncodedPath";
import type { AppRouteObject } from "../../routes"; import type { AppRouteObject } from "../../routes";
export type AddClientParams = { realm: string }; export type AddClientParams = { realm: string };
@ -17,5 +17,5 @@ export const AddClientRoute: AppRouteObject = {
}; };
export const toAddClient = (params: AddClientParams): Partial<Path> => ({ export const toAddClient = (params: AddClientParams): Partial<Path> => ({
pathname: generatePath(AddClientRoute.path, params), pathname: generateEncodedPath(AddClientRoute.path, params),
}); });

View file

@ -1,6 +1,6 @@
import { lazy } from "react"; import { lazy } from "react";
import type { Path } from "react-router-dom"; import type { Path } from "react-router-dom";
import { generatePath } from "react-router-dom"; import { generateEncodedPath } from "../../utils/generateEncodedPath";
import type { AppRouteObject } from "../../routes"; import type { AppRouteObject } from "../../routes";
import { ClientRegistrationTab } from "./ClientRegistration"; import { ClientRegistrationTab } from "./ClientRegistration";
@ -35,6 +35,6 @@ export const toRegistrationProvider = (
: AddRegistrationProviderRoute.path; : AddRegistrationProviderRoute.path;
return { return {
pathname: generatePath(path, params), pathname: generateEncodedPath(path, params),
}; };
}; };

View file

@ -1,6 +1,6 @@
import { lazy } from "react"; import { lazy } from "react";
import type { Path } from "react-router-dom"; import type { Path } from "react-router-dom";
import { generatePath } from "react-router-dom"; import { generateEncodedPath } from "../../utils/generateEncodedPath";
import type { AppRouteObject } from "../../routes"; import type { AppRouteObject } from "../../routes";
export type AuthorizationTab = export type AuthorizationTab =
@ -32,5 +32,5 @@ export const AuthorizationRoute: AppRouteObject = {
export const toAuthorizationTab = ( export const toAuthorizationTab = (
params: AuthorizationParams, params: AuthorizationParams,
): Partial<Path> => ({ ): Partial<Path> => ({
pathname: generatePath(AuthorizationRoute.path, params), pathname: generateEncodedPath(AuthorizationRoute.path, params),
}); });

View file

@ -1,6 +1,6 @@
import { lazy } from "react"; import { lazy } from "react";
import type { Path } from "react-router-dom"; import type { Path } from "react-router-dom";
import { generatePath } from "react-router-dom"; import { generateEncodedPath } from "../../utils/generateEncodedPath";
import type { AppRouteObject } from "../../routes"; import type { AppRouteObject } from "../../routes";
export type ClientTab = export type ClientTab =
@ -34,5 +34,5 @@ export const ClientRoute: AppRouteObject = {
}; };
export const toClient = (params: ClientParams): Partial<Path> => ({ export const toClient = (params: ClientParams): Partial<Path> => ({
pathname: generatePath(ClientRoute.path, params), pathname: generateEncodedPath(ClientRoute.path, params),
}); });

View file

@ -1,6 +1,6 @@
import { lazy } from "react"; import { lazy } from "react";
import type { Path } from "react-router-dom"; import type { Path } from "react-router-dom";
import { generatePath } from "react-router-dom"; import { generateEncodedPath } from "../../utils/generateEncodedPath";
import type { AppRouteObject } from "../../routes"; import type { AppRouteObject } from "../../routes";
export type ClientRegistrationTab = "anonymous" | "authenticated"; export type ClientRegistrationTab = "anonymous" | "authenticated";
@ -24,5 +24,5 @@ export const ClientRegistrationRoute: AppRouteObject = {
export const toClientRegistration = ( export const toClientRegistration = (
params: ClientRegistrationParams, params: ClientRegistrationParams,
): Partial<Path> => ({ ): Partial<Path> => ({
pathname: generatePath(ClientRegistrationRoute.path, params), pathname: generateEncodedPath(ClientRegistrationRoute.path, params),
}); });

View file

@ -1,6 +1,6 @@
import { lazy } from "react"; import { lazy } from "react";
import type { Path } from "react-router-dom"; import type { Path } from "react-router-dom";
import { generatePath } from "react-router-dom"; import { generateEncodedPath } from "../../utils/generateEncodedPath";
import type { AppRouteObject } from "../../routes"; import type { AppRouteObject } from "../../routes";
export type ClientRoleTab = export type ClientRoleTab =
@ -28,5 +28,5 @@ export const ClientRoleRoute: AppRouteObject = {
} satisfies AppRouteObject; } satisfies AppRouteObject;
export const toClientRole = (params: ClientRoleParams): Partial<Path> => ({ export const toClientRole = (params: ClientRoleParams): Partial<Path> => ({
pathname: generatePath(ClientRoleRoute.path, params), pathname: generateEncodedPath(ClientRoleRoute.path, params),
}); });

View file

@ -1,6 +1,6 @@
import { lazy } from "react"; import { lazy } from "react";
import type { Path } from "react-router-dom"; import type { Path } from "react-router-dom";
import { generatePath } from "react-router-dom"; import { generateEncodedPath } from "../../utils/generateEncodedPath";
import type { AppRouteObject } from "../../routes"; import type { AppRouteObject } from "../../routes";
export type ClientScopesTab = "setup" | "evaluate"; export type ClientScopesTab = "setup" | "evaluate";
@ -25,5 +25,5 @@ export const ClientScopesRoute: AppRouteObject = {
export const toClientScopesTab = ( export const toClientScopesTab = (
params: ClientScopesParams, params: ClientScopesParams,
): Partial<Path> => ({ ): Partial<Path> => ({
pathname: generatePath(ClientScopesRoute.path, params), pathname: generateEncodedPath(ClientScopesRoute.path, params),
}); });

View file

@ -1,6 +1,6 @@
import { lazy } from "react"; import { lazy } from "react";
import type { Path } from "react-router-dom"; import type { Path } from "react-router-dom";
import { generatePath } from "react-router-dom"; import { generateEncodedPath } from "../../utils/generateEncodedPath";
import type { AppRouteObject } from "../../routes"; import type { AppRouteObject } from "../../routes";
export type ClientsTab = export type ClientsTab =
@ -33,6 +33,6 @@ export const toClients = (params: ClientsParams): Partial<Path> => {
const path = params.tab ? ClientsRouteWithTab.path : ClientsRoute.path; const path = params.tab ? ClientsRouteWithTab.path : ClientsRoute.path;
return { return {
pathname: generatePath(path, params), pathname: generateEncodedPath(path, params),
}; };
}; };

View file

@ -1,6 +1,6 @@
import { lazy } from "react"; import { lazy } from "react";
import type { Path } from "react-router-dom"; import type { Path } from "react-router-dom";
import { generatePath } from "react-router-dom"; import { generateEncodedPath } from "../../utils/generateEncodedPath";
import type { AppRouteObject } from "../../routes"; import type { AppRouteObject } from "../../routes";
export type CreateInitialAccessTokenParams = { realm: string }; export type CreateInitialAccessTokenParams = { realm: string };
@ -21,5 +21,5 @@ export const CreateInitialAccessTokenRoute: AppRouteObject = {
export const toCreateInitialAccessToken = ( export const toCreateInitialAccessToken = (
params: CreateInitialAccessTokenParams, params: CreateInitialAccessTokenParams,
): Partial<Path> => ({ ): Partial<Path> => ({
pathname: generatePath(CreateInitialAccessTokenRoute.path, params), pathname: generateEncodedPath(CreateInitialAccessTokenRoute.path, params),
}); });

View file

@ -1,7 +1,7 @@
import { lazy } from "react"; import { lazy } from "react";
import type { Path } from "react-router-dom"; import type { Path } from "react-router-dom";
import { generatePath } from "react-router-dom";
import type { AppRouteObject } from "../../routes"; import type { AppRouteObject } from "../../routes";
import { generateEncodedPath } from "../../utils/generateEncodedPath";
export type DedicatedScopeTab = "mappers" | "scope"; export type DedicatedScopeTab = "mappers" | "scope";
@ -35,6 +35,6 @@ export const toDedicatedScope = (
: DedicatedScopeDetailsRoute.path; : DedicatedScopeDetailsRoute.path;
return { return {
pathname: generatePath(path, params), pathname: generateEncodedPath(path, params),
}; };
}; };

View file

@ -1,6 +1,6 @@
import { lazy } from "react"; import { lazy } from "react";
import type { Path } from "react-router-dom"; import type { Path } from "react-router-dom";
import { generatePath } from "react-router-dom"; import { generateEncodedPath } from "../../utils/generateEncodedPath";
import type { AppRouteObject } from "../../routes"; import type { AppRouteObject } from "../../routes";
export type ImportClientParams = { realm: string }; export type ImportClientParams = { realm: string };
@ -17,5 +17,5 @@ export const ImportClientRoute: AppRouteObject = {
}; };
export const toImportClient = (params: ImportClientParams): Partial<Path> => ({ export const toImportClient = (params: ImportClientParams): Partial<Path> => ({
pathname: generatePath(ImportClientRoute.path, params), pathname: generateEncodedPath(ImportClientRoute.path, params),
}); });

View file

@ -1,7 +1,7 @@
import { lazy } from "react"; import { lazy } from "react";
import type { Path } from "react-router-dom"; import type { Path } from "react-router-dom";
import { generatePath } from "react-router-dom";
import type { AppRouteObject } from "../../routes"; import type { AppRouteObject } from "../../routes";
import { generateEncodedPath } from "../../utils/generateEncodedPath";
export type MapperParams = { export type MapperParams = {
realm: string; realm: string;
@ -23,5 +23,5 @@ export const MapperRoute: AppRouteObject = {
}; };
export const toMapper = (params: MapperParams): Partial<Path> => ({ export const toMapper = (params: MapperParams): Partial<Path> => ({
pathname: generatePath(MapperRoute.path, params), pathname: generateEncodedPath(MapperRoute.path, params),
}); });

View file

@ -1,6 +1,6 @@
import { lazy } from "react"; import { lazy } from "react";
import type { Path } from "react-router-dom"; import type { Path } from "react-router-dom";
import { generatePath } from "react-router-dom"; import { generateEncodedPath } from "../../utils/generateEncodedPath";
import type { AppRouteObject } from "../../routes"; import type { AppRouteObject } from "../../routes";
export type PermissionType = "resource" | "scope"; export type PermissionType = "resource" | "scope";
@ -36,6 +36,6 @@ export const toNewPermission = (params: NewPermissionParams): Partial<Path> => {
: NewPermissionRoute.path; : NewPermissionRoute.path;
return { return {
pathname: generatePath(path, params), pathname: generateEncodedPath(path, params),
}; };
}; };

View file

@ -1,6 +1,6 @@
import { lazy } from "react"; import { lazy } from "react";
import type { Path } from "react-router-dom"; import type { Path } from "react-router-dom";
import { generatePath } from "react-router-dom"; import { generateEncodedPath } from "../../utils/generateEncodedPath";
import type { AppRouteObject } from "../../routes"; import type { AppRouteObject } from "../../routes";
export type NewPolicyParams = { realm: string; id: string; policyType: string }; export type NewPolicyParams = { realm: string; id: string; policyType: string };
@ -19,5 +19,5 @@ export const NewPolicyRoute: AppRouteObject = {
}; };
export const toCreatePolicy = (params: NewPolicyParams): Partial<Path> => ({ export const toCreatePolicy = (params: NewPolicyParams): Partial<Path> => ({
pathname: generatePath(NewPolicyRoute.path, params), pathname: generateEncodedPath(NewPolicyRoute.path, params),
}); });

View file

@ -1,6 +1,6 @@
import { lazy } from "react"; import { lazy } from "react";
import type { Path } from "react-router-dom"; import type { Path } from "react-router-dom";
import { generatePath } from "react-router-dom"; import { generateEncodedPath } from "../../utils/generateEncodedPath";
import type { AppRouteObject } from "../../routes"; import type { AppRouteObject } from "../../routes";
export type NewResourceParams = { realm: string; id: string }; export type NewResourceParams = { realm: string; id: string };
@ -17,5 +17,5 @@ export const NewResourceRoute: AppRouteObject = {
}; };
export const toCreateResource = (params: NewResourceParams): Partial<Path> => ({ export const toCreateResource = (params: NewResourceParams): Partial<Path> => ({
pathname: generatePath(NewResourceRoute.path, params), pathname: generateEncodedPath(NewResourceRoute.path, params),
}); });

View file

@ -1,6 +1,6 @@
import { lazy } from "react"; import { lazy } from "react";
import type { Path } from "react-router-dom"; import type { Path } from "react-router-dom";
import { generatePath } from "react-router-dom"; import { generateEncodedPath } from "../../utils/generateEncodedPath";
import type { AppRouteObject } from "../../routes"; import type { AppRouteObject } from "../../routes";
export type NewRoleParams = { realm: string; clientId: string }; export type NewRoleParams = { realm: string; clientId: string };
@ -17,5 +17,5 @@ export const NewRoleRoute: AppRouteObject = {
}; };
export const toCreateRole = (params: NewRoleParams): Partial<Path> => ({ export const toCreateRole = (params: NewRoleParams): Partial<Path> => ({
pathname: generatePath(NewRoleRoute.path, params), pathname: generateEncodedPath(NewRoleRoute.path, params),
}); });

View file

@ -1,6 +1,6 @@
import { lazy } from "react"; import { lazy } from "react";
import type { Path } from "react-router-dom"; import type { Path } from "react-router-dom";
import { generatePath } from "react-router-dom"; import { generateEncodedPath } from "../../utils/generateEncodedPath";
import type { AppRouteObject } from "../../routes"; import type { AppRouteObject } from "../../routes";
export type NewScopeParams = { realm: string; id: string }; export type NewScopeParams = { realm: string; id: string };
@ -17,5 +17,5 @@ export const NewScopeRoute: AppRouteObject = {
}; };
export const toNewScope = (params: NewScopeParams): Partial<Path> => ({ export const toNewScope = (params: NewScopeParams): Partial<Path> => ({
pathname: generatePath(NewScopeRoute.path, params), pathname: generateEncodedPath(NewScopeRoute.path, params),
}); });

View file

@ -1,6 +1,6 @@
import { lazy } from "react"; import { lazy } from "react";
import type { Path } from "react-router-dom"; import type { Path } from "react-router-dom";
import { generatePath } from "react-router-dom"; import { generateEncodedPath } from "../../utils/generateEncodedPath";
import type { AppRouteObject } from "../../routes"; import type { AppRouteObject } from "../../routes";
import type { PermissionType } from "./NewPermission"; import type { PermissionType } from "./NewPermission";
@ -27,5 +27,5 @@ export const PermissionDetailsRoute: AppRouteObject = {
export const toPermissionDetails = ( export const toPermissionDetails = (
params: PermissionDetailsParams, params: PermissionDetailsParams,
): Partial<Path> => ({ ): Partial<Path> => ({
pathname: generatePath(PermissionDetailsRoute.path, params), pathname: generateEncodedPath(PermissionDetailsRoute.path, params),
}); });

View file

@ -1,6 +1,6 @@
import { lazy } from "react"; import { lazy } from "react";
import type { Path } from "react-router-dom"; import type { Path } from "react-router-dom";
import { generatePath } from "react-router-dom"; import { generateEncodedPath } from "../../utils/generateEncodedPath";
import type { AppRouteObject } from "../../routes"; import type { AppRouteObject } from "../../routes";
export type PolicyDetailsParams = { export type PolicyDetailsParams = {
@ -26,5 +26,5 @@ export const PolicyDetailsRoute: AppRouteObject = {
export const toPolicyDetails = ( export const toPolicyDetails = (
params: PolicyDetailsParams, params: PolicyDetailsParams,
): Partial<Path> => ({ ): Partial<Path> => ({
pathname: generatePath(PolicyDetailsRoute.path, params), pathname: generateEncodedPath(PolicyDetailsRoute.path, params),
}); });

View file

@ -1,6 +1,6 @@
import { lazy } from "react"; import { lazy } from "react";
import type { Path } from "react-router-dom"; import type { Path } from "react-router-dom";
import { generatePath } from "react-router-dom"; import { generateEncodedPath } from "../../utils/generateEncodedPath";
import type { AppRouteObject } from "../../routes"; import type { AppRouteObject } from "../../routes";
export type ResourceDetailsParams = { export type ResourceDetailsParams = {
@ -33,6 +33,6 @@ export const toResourceDetails = (
: ResourceDetailsRoute.path; : ResourceDetailsRoute.path;
return { return {
pathname: generatePath(path, params), pathname: generateEncodedPath(path, params),
}; };
}; };

View file

@ -1,6 +1,6 @@
import { lazy } from "react"; import { lazy } from "react";
import type { Path } from "react-router-dom"; import type { Path } from "react-router-dom";
import { generatePath } from "react-router-dom"; import { generateEncodedPath } from "../../utils/generateEncodedPath";
import type { AppRouteObject } from "../../routes"; import type { AppRouteObject } from "../../routes";
export type ScopeDetailsParams = { export type ScopeDetailsParams = {
@ -31,6 +31,6 @@ export const toScopeDetails = (params: ScopeDetailsParams): Partial<Path> => {
: ScopeDetailsRoute.path; : ScopeDetailsRoute.path;
return { return {
pathname: generatePath(path, params), pathname: generateEncodedPath(path, params),
}; };
}; };

View file

@ -1,6 +1,6 @@
import { lazy } from "react"; import { lazy } from "react";
import type { Path } from "react-router-dom"; import type { Path } from "react-router-dom";
import { generatePath } from "react-router-dom"; import { generateEncodedPath } from "../../utils/generateEncodedPath";
import type { AppRouteObject } from "../../routes"; import type { AppRouteObject } from "../../routes";
export type DashboardTab = "info" | "providers"; export type DashboardTab = "info" | "providers";
@ -36,6 +36,6 @@ export const toDashboard = (params: DashboardParams): Partial<Path> => {
: DashboardRoute.path; : DashboardRoute.path;
return { return {
pathname: generatePath(pathname, params), pathname: generateEncodedPath(pathname, params),
}; };
}; };

View file

@ -1,6 +1,6 @@
import { lazy } from "react"; import { lazy } from "react";
import type { Path } from "react-router-dom"; import type { Path } from "react-router-dom";
import { generatePath } from "react-router-dom"; import { generateEncodedPath } from "../../utils/generateEncodedPath";
import type { AppRouteObject } from "../../routes"; import type { AppRouteObject } from "../../routes";
export type EventsTab = "user-events" | "admin-events"; export type EventsTab = "user-events" | "admin-events";
@ -30,6 +30,6 @@ export const toEvents = (params: EventsParams): Partial<Path> => {
const path = params.tab ? EventsRouteWithTab.path : EventsRoute.path; const path = params.tab ? EventsRouteWithTab.path : EventsRoute.path;
return { return {
pathname: generatePath(path, params), pathname: generateEncodedPath(path, params),
}; };
}; };

View file

@ -1,6 +1,6 @@
import { lazy } from "react"; import { lazy } from "react";
import type { Path } from "react-router-dom"; import type { Path } from "react-router-dom";
import { generatePath } from "react-router-dom"; import { generateEncodedPath } from "../../utils/generateEncodedPath";
import type { AppRouteObject } from "../../routes"; import type { AppRouteObject } from "../../routes";
export type GroupsParams = { realm: string; id?: string; lazy?: string }; export type GroupsParams = { realm: string; id?: string; lazy?: string };
@ -24,6 +24,6 @@ export const toGroups = (params: GroupsParams): Partial<Path> => {
const path = params.id ? GroupsWithIdRoute.path : GroupsRoute.path; const path = params.id ? GroupsWithIdRoute.path : GroupsRoute.path;
return { return {
pathname: generatePath(path, params), pathname: generateEncodedPath(path, params),
}; };
}; };

View file

@ -1,6 +1,6 @@
import { lazy } from "react"; import { lazy } from "react";
import type { Path } from "react-router-dom"; import type { Path } from "react-router-dom";
import { generatePath } from "react-router-dom"; import { generateEncodedPath } from "../../utils/generateEncodedPath";
import type { AppRouteObject } from "../../routes"; import type { AppRouteObject } from "../../routes";
export type IdentityProviderAddMapperParams = { export type IdentityProviderAddMapperParams = {
@ -24,5 +24,5 @@ export const IdentityProviderAddMapperRoute: AppRouteObject = {
export const toIdentityProviderAddMapper = ( export const toIdentityProviderAddMapper = (
params: IdentityProviderAddMapperParams, params: IdentityProviderAddMapperParams,
): Partial<Path> => ({ ): Partial<Path> => ({
pathname: generatePath(IdentityProviderAddMapperRoute.path, params), pathname: generateEncodedPath(IdentityProviderAddMapperRoute.path, params),
}); });

View file

@ -1,6 +1,6 @@
import { lazy } from "react"; import { lazy } from "react";
import type { Path } from "react-router-dom"; import type { Path } from "react-router-dom";
import { generatePath } from "react-router-dom"; import { generateEncodedPath } from "../../utils/generateEncodedPath";
import type { AppRouteObject } from "../../routes"; import type { AppRouteObject } from "../../routes";
export type IdentityProviderEditMapperParams = { export type IdentityProviderEditMapperParams = {
@ -24,5 +24,5 @@ export const IdentityProviderEditMapperRoute: AppRouteObject = {
export const toIdentityProviderEditMapper = ( export const toIdentityProviderEditMapper = (
params: IdentityProviderEditMapperParams, params: IdentityProviderEditMapperParams,
): Partial<Path> => ({ ): Partial<Path> => ({
pathname: generatePath(IdentityProviderEditMapperRoute.path, params), pathname: generateEncodedPath(IdentityProviderEditMapperRoute.path, params),
}); });

View file

@ -1,6 +1,6 @@
import { lazy } from "react"; import { lazy } from "react";
import type { Path } from "react-router-dom"; import type { Path } from "react-router-dom";
import { generatePath } from "react-router-dom"; import { generateEncodedPath } from "../../utils/generateEncodedPath";
import type { AppRouteObject } from "../../routes"; import type { AppRouteObject } from "../../routes";
export type IdentityProviderTab = "settings" | "mappers" | "permissions"; export type IdentityProviderTab = "settings" | "mappers" | "permissions";
@ -26,5 +26,5 @@ export const IdentityProviderRoute: AppRouteObject = {
export const toIdentityProvider = ( export const toIdentityProvider = (
params: IdentityProviderParams, params: IdentityProviderParams,
): Partial<Path> => ({ ): Partial<Path> => ({
pathname: generatePath(IdentityProviderRoute.path, params), pathname: generateEncodedPath(IdentityProviderRoute.path, params),
}); });

View file

@ -1,6 +1,6 @@
import { lazy } from "react"; import { lazy } from "react";
import type { Path } from "react-router-dom"; import type { Path } from "react-router-dom";
import { generatePath } from "react-router-dom"; import { generateEncodedPath } from "../../utils/generateEncodedPath";
import type { AppRouteObject } from "../../routes"; import type { AppRouteObject } from "../../routes";
export type IdentityProviderCreateParams = { export type IdentityProviderCreateParams = {
@ -22,5 +22,5 @@ export const IdentityProviderCreateRoute: AppRouteObject = {
export const toIdentityProviderCreate = ( export const toIdentityProviderCreate = (
params: IdentityProviderCreateParams, params: IdentityProviderCreateParams,
): Partial<Path> => ({ ): Partial<Path> => ({
pathname: generatePath(IdentityProviderCreateRoute.path, params), pathname: generateEncodedPath(IdentityProviderCreateRoute.path, params),
}); });

View file

@ -1,6 +1,6 @@
import { lazy } from "react"; import { lazy } from "react";
import type { Path } from "react-router-dom"; import type { Path } from "react-router-dom";
import { generatePath } from "react-router-dom"; import { generateEncodedPath } from "../../utils/generateEncodedPath";
import type { AppRouteObject } from "../../routes"; import type { AppRouteObject } from "../../routes";
export type IdentityProviderKeycloakOidcParams = { realm: string }; export type IdentityProviderKeycloakOidcParams = { realm: string };
@ -19,5 +19,5 @@ export const IdentityProviderKeycloakOidcRoute: AppRouteObject = {
export const toIdentityProviderKeycloakOidc = ( export const toIdentityProviderKeycloakOidc = (
params: IdentityProviderKeycloakOidcParams, params: IdentityProviderKeycloakOidcParams,
): Partial<Path> => ({ ): Partial<Path> => ({
pathname: generatePath(IdentityProviderKeycloakOidcRoute.path, params), pathname: generateEncodedPath(IdentityProviderKeycloakOidcRoute.path, params),
}); });

View file

@ -1,6 +1,6 @@
import { lazy } from "react"; import { lazy } from "react";
import type { Path } from "react-router-dom"; import type { Path } from "react-router-dom";
import { generatePath } from "react-router-dom"; import { generateEncodedPath } from "../../utils/generateEncodedPath";
import type { AppRouteObject } from "../../routes"; import type { AppRouteObject } from "../../routes";
export type IdentityProviderOidcParams = { realm: string }; export type IdentityProviderOidcParams = { realm: string };
@ -19,5 +19,5 @@ export const IdentityProviderOidcRoute: AppRouteObject = {
export const toIdentityProviderOidc = ( export const toIdentityProviderOidc = (
params: IdentityProviderOidcParams, params: IdentityProviderOidcParams,
): Partial<Path> => ({ ): Partial<Path> => ({
pathname: generatePath(IdentityProviderOidcRoute.path, params), pathname: generateEncodedPath(IdentityProviderOidcRoute.path, params),
}); });

View file

@ -1,6 +1,6 @@
import { lazy } from "react"; import { lazy } from "react";
import type { Path } from "react-router-dom"; import type { Path } from "react-router-dom";
import { generatePath } from "react-router-dom"; import { generateEncodedPath } from "../../utils/generateEncodedPath";
import type { AppRouteObject } from "../../routes"; import type { AppRouteObject } from "../../routes";
export type IdentityProviderSamlParams = { realm: string }; export type IdentityProviderSamlParams = { realm: string };
@ -19,5 +19,5 @@ export const IdentityProviderSamlRoute: AppRouteObject = {
export const toIdentityProviderSaml = ( export const toIdentityProviderSaml = (
params: IdentityProviderSamlParams, params: IdentityProviderSamlParams,
): Partial<Path> => ({ ): Partial<Path> => ({
pathname: generatePath(IdentityProviderSamlRoute.path, params), pathname: generateEncodedPath(IdentityProviderSamlRoute.path, params),
}); });

View file

@ -1,6 +1,6 @@
import { lazy } from "react"; import { lazy } from "react";
import type { Path } from "react-router-dom"; import type { Path } from "react-router-dom";
import { generatePath } from "react-router-dom"; import { generateEncodedPath } from "../../utils/generateEncodedPath";
import type { AppRouteObject } from "../../routes"; import type { AppRouteObject } from "../../routes";
export type IdentityProvidersParams = { realm: string }; export type IdentityProvidersParams = { realm: string };
@ -21,5 +21,5 @@ export const IdentityProvidersRoute: AppRouteObject = {
export const toIdentityProviders = ( export const toIdentityProviders = (
params: IdentityProvidersParams, params: IdentityProvidersParams,
): Partial<Path> => ({ ): Partial<Path> => ({
pathname: generatePath(IdentityProvidersRoute.path, params), pathname: generateEncodedPath(IdentityProvidersRoute.path, params),
}); });

View file

@ -1,6 +1,6 @@
import { lazy } from "react"; import { lazy } from "react";
import type { Path } from "react-router-dom"; import type { Path } from "react-router-dom";
import { generatePath } from "react-router-dom"; import { generateEncodedPath } from "../../utils/generateEncodedPath";
import type { AppRouteObject } from "../../routes"; import type { AppRouteObject } from "../../routes";
export type AddRoleParams = { realm: string }; export type AddRoleParams = { realm: string };
@ -17,5 +17,5 @@ export const AddRoleRoute: AppRouteObject = {
}; };
export const toAddRole = (params: AddRoleParams): Partial<Path> => ({ export const toAddRole = (params: AddRoleParams): Partial<Path> => ({
pathname: generatePath(AddRoleRoute.path, params), pathname: generateEncodedPath(AddRoleRoute.path, params),
}); });

View file

@ -1,6 +1,6 @@
import { lazy } from "react"; import { lazy } from "react";
import type { Path } from "react-router-dom"; import type { Path } from "react-router-dom";
import { generatePath } from "react-router-dom"; import { generateEncodedPath } from "../../utils/generateEncodedPath";
import type { AppRouteObject } from "../../routes"; import type { AppRouteObject } from "../../routes";
@ -29,5 +29,5 @@ export const RealmRoleRoute: AppRouteObject = {
}; };
export const toRealmRole = (params: RealmRoleParams): Partial<Path> => ({ export const toRealmRole = (params: RealmRoleParams): Partial<Path> => ({
pathname: generatePath(RealmRoleRoute.path, params), pathname: generateEncodedPath(RealmRoleRoute.path, params),
}); });

View file

@ -1,6 +1,6 @@
import { lazy } from "react"; import { lazy } from "react";
import type { Path } from "react-router-dom"; import type { Path } from "react-router-dom";
import { generatePath } from "react-router-dom"; import { generateEncodedPath } from "../../utils/generateEncodedPath";
import type { AppRouteObject } from "../../routes"; import type { AppRouteObject } from "../../routes";
export type RealmRolesParams = { realm: string }; export type RealmRolesParams = { realm: string };
@ -17,5 +17,5 @@ export const RealmRolesRoute: AppRouteObject = {
}; };
export const toRealmRoles = (params: RealmRolesParams): Partial<Path> => ({ export const toRealmRoles = (params: RealmRolesParams): Partial<Path> => ({
pathname: generatePath(RealmRolesRoute.path, params), pathname: generateEncodedPath(RealmRolesRoute.path, params),
}); });

View file

@ -1,6 +1,6 @@
import { lazy } from "react"; import { lazy } from "react";
import type { Path } from "react-router-dom"; import type { Path } from "react-router-dom";
import { generatePath } from "react-router-dom"; import { generateEncodedPath } from "../../utils/generateEncodedPath";
import type { AppRouteObject } from "../../routes"; import type { AppRouteObject } from "../../routes";
export type AddAttributeParams = { export type AddAttributeParams = {
@ -19,5 +19,5 @@ export const AddAttributeRoute: AppRouteObject = {
}; };
export const toAddAttribute = (params: AddAttributeParams): Partial<Path> => ({ export const toAddAttribute = (params: AddAttributeParams): Partial<Path> => ({
pathname: generatePath(AddAttributeRoute.path, params), pathname: generateEncodedPath(AddAttributeRoute.path, params),
}); });

View file

@ -1,6 +1,6 @@
import { lazy } from "react"; import { lazy } from "react";
import type { Path } from "react-router-dom"; import type { Path } from "react-router-dom";
import { generatePath } from "react-router-dom"; import { generateEncodedPath } from "../../utils/generateEncodedPath";
import type { AppRouteObject } from "../../routes"; import type { AppRouteObject } from "../../routes";
export type AddClientPolicyParams = { realm: string }; export type AddClientPolicyParams = { realm: string };
@ -19,5 +19,5 @@ export const AddClientPolicyRoute: AppRouteObject = {
export const toAddClientPolicy = ( export const toAddClientPolicy = (
params: AddClientPolicyParams, params: AddClientPolicyParams,
): Partial<Path> => ({ ): Partial<Path> => ({
pathname: generatePath(AddClientPolicyRoute.path, params), pathname: generateEncodedPath(AddClientPolicyRoute.path, params),
}); });

View file

@ -1,6 +1,6 @@
import { lazy } from "react"; import { lazy } from "react";
import type { Path } from "react-router-dom"; import type { Path } from "react-router-dom";
import { generatePath } from "react-router-dom"; import { generateEncodedPath } from "../../utils/generateEncodedPath";
import type { AppRouteObject } from "../../routes"; import type { AppRouteObject } from "../../routes";
export type AddClientProfileParams = { export type AddClientProfileParams = {
@ -22,5 +22,5 @@ export const AddClientProfileRoute: AppRouteObject = {
export const toAddClientProfile = ( export const toAddClientProfile = (
params: AddClientProfileParams, params: AddClientProfileParams,
): Partial<Path> => ({ ): Partial<Path> => ({
pathname: generatePath(AddClientProfileRoute.path, params), pathname: generateEncodedPath(AddClientProfileRoute.path, params),
}); });

View file

@ -1,6 +1,6 @@
import { lazy } from "react"; import { lazy } from "react";
import type { Path } from "react-router-dom"; import type { Path } from "react-router-dom";
import { generatePath } from "react-router-dom"; import { generateEncodedPath } from "../../utils/generateEncodedPath";
import type { AppRouteObject } from "../../routes"; import type { AppRouteObject } from "../../routes";
export type NewClientPolicyConditionParams = { export type NewClientPolicyConditionParams = {
@ -24,5 +24,5 @@ export const NewClientPolicyConditionRoute: AppRouteObject = {
export const toNewClientPolicyCondition = ( export const toNewClientPolicyCondition = (
params: NewClientPolicyConditionParams, params: NewClientPolicyConditionParams,
): Partial<Path> => ({ ): Partial<Path> => ({
pathname: generatePath(NewClientPolicyConditionRoute.path, params), pathname: generateEncodedPath(NewClientPolicyConditionRoute.path, params),
}); });

View file

@ -1,6 +1,6 @@
import { lazy } from "react"; import { lazy } from "react";
import type { Path } from "react-router-dom"; import type { Path } from "react-router-dom";
import { generatePath } from "react-router-dom"; import { generateEncodedPath } from "../../utils/generateEncodedPath";
import type { AppRouteObject } from "../../routes"; import type { AppRouteObject } from "../../routes";
export type AddExecutorParams = { export type AddExecutorParams = {
@ -20,5 +20,5 @@ export const AddExecutorRoute: AppRouteObject = {
}; };
export const toAddExecutor = (params: AddExecutorParams): Partial<Path> => ({ export const toAddExecutor = (params: AddExecutorParams): Partial<Path> => ({
pathname: generatePath(AddExecutorRoute.path, params), pathname: generateEncodedPath(AddExecutorRoute.path, params),
}); });

View file

@ -1,6 +1,6 @@
import { lazy } from "react"; import { lazy } from "react";
import type { Path } from "react-router-dom"; import type { Path } from "react-router-dom";
import { generatePath } from "react-router-dom"; import { generateEncodedPath } from "../../utils/generateEncodedPath";
import type { AppRouteObject } from "../../routes"; import type { AppRouteObject } from "../../routes";
export type AttributeParams = { export type AttributeParams = {
@ -20,5 +20,5 @@ export const AttributeRoute: AppRouteObject = {
}; };
export const toAttribute = (params: AttributeParams): Partial<Path> => ({ export const toAttribute = (params: AttributeParams): Partial<Path> => ({
pathname: generatePath(AttributeRoute.path, params), pathname: generateEncodedPath(AttributeRoute.path, params),
}); });

View file

@ -1,6 +1,6 @@
import { lazy } from "react"; import { lazy } from "react";
import type { Path } from "react-router-dom"; import type { Path } from "react-router-dom";
import { generatePath } from "react-router-dom"; import { generateEncodedPath } from "../../utils/generateEncodedPath";
import type { AppRouteObject } from "../../routes"; import type { AppRouteObject } from "../../routes";
export type ClientPoliciesTab = "profiles" | "policies"; export type ClientPoliciesTab = "profiles" | "policies";
@ -24,5 +24,5 @@ export const ClientPoliciesRoute: AppRouteObject = {
export const toClientPolicies = ( export const toClientPolicies = (
params: ClientPoliciesParams, params: ClientPoliciesParams,
): Partial<Path> => ({ ): Partial<Path> => ({
pathname: generatePath(ClientPoliciesRoute.path, params), pathname: generateEncodedPath(ClientPoliciesRoute.path, params),
}); });

View file

@ -1,6 +1,6 @@
import { lazy } from "react"; import { lazy } from "react";
import type { Path } from "react-router-dom"; import type { Path } from "react-router-dom";
import { generatePath } from "react-router-dom"; import { generateEncodedPath } from "../../utils/generateEncodedPath";
import type { AppRouteObject } from "../../routes"; import type { AppRouteObject } from "../../routes";
export type ClientProfileParams = { export type ClientProfileParams = {
@ -22,5 +22,5 @@ export const ClientProfileRoute: AppRouteObject = {
export const toClientProfile = ( export const toClientProfile = (
params: ClientProfileParams, params: ClientProfileParams,
): Partial<Path> => ({ ): Partial<Path> => ({
pathname: generatePath(ClientProfileRoute.path, params), pathname: generateEncodedPath(ClientProfileRoute.path, params),
}); });

View file

@ -1,6 +1,6 @@
import { lazy } from "react"; import { lazy } from "react";
import type { Path } from "react-router-dom"; import type { Path } from "react-router-dom";
import { generatePath } from "react-router-dom"; import { generateEncodedPath } from "../../utils/generateEncodedPath";
import type { AppRouteObject } from "../../routes"; import type { AppRouteObject } from "../../routes";
export type EditAttributesGroupParams = { export type EditAttributesGroupParams = {
@ -24,5 +24,5 @@ export const EditAttributesGroupRoute: AppRouteObject = {
export const toEditAttributesGroup = ( export const toEditAttributesGroup = (
params: EditAttributesGroupParams, params: EditAttributesGroupParams,
): Partial<Path> => ({ ): Partial<Path> => ({
pathname: generatePath(EditAttributesGroupRoute.path, params), pathname: generateEncodedPath(EditAttributesGroupRoute.path, params),
}); });

View file

@ -1,6 +1,6 @@
import { lazy } from "react"; import { lazy } from "react";
import type { Path } from "react-router-dom"; import type { Path } from "react-router-dom";
import { generatePath } from "react-router-dom"; import { generateEncodedPath } from "../../utils/generateEncodedPath";
import type { AppRouteObject } from "../../routes"; import type { AppRouteObject } from "../../routes";
export type EditClientPolicyParams = { export type EditClientPolicyParams = {
@ -22,5 +22,5 @@ export const EditClientPolicyRoute: AppRouteObject = {
export const toEditClientPolicy = ( export const toEditClientPolicy = (
params: EditClientPolicyParams, params: EditClientPolicyParams,
): Partial<Path> => ({ ): Partial<Path> => ({
pathname: generatePath(EditClientPolicyRoute.path, params), pathname: generateEncodedPath(EditClientPolicyRoute.path, params),
}); });

View file

@ -1,6 +1,6 @@
import { lazy } from "react"; import { lazy } from "react";
import type { Path } from "react-router-dom"; import type { Path } from "react-router-dom";
import { generatePath } from "react-router-dom"; import { generateEncodedPath } from "../../utils/generateEncodedPath";
import type { AppRouteObject } from "../../routes"; import type { AppRouteObject } from "../../routes";
export type EditClientPolicyConditionParams = { export type EditClientPolicyConditionParams = {
@ -25,5 +25,5 @@ export const EditClientPolicyConditionRoute: AppRouteObject = {
export const toEditClientPolicyCondition = ( export const toEditClientPolicyCondition = (
params: EditClientPolicyConditionParams, params: EditClientPolicyConditionParams,
): Partial<Path> => ({ ): Partial<Path> => ({
pathname: generatePath(EditClientPolicyConditionRoute.path, params), pathname: generateEncodedPath(EditClientPolicyConditionRoute.path, params),
}); });

View file

@ -1,6 +1,6 @@
import { lazy } from "react"; import { lazy } from "react";
import type { Path } from "react-router-dom"; import type { Path } from "react-router-dom";
import { generatePath } from "react-router-dom"; import { generateEncodedPath } from "../../utils/generateEncodedPath";
import type { AppRouteObject } from "../../routes"; import type { AppRouteObject } from "../../routes";
export type ExecutorParams = { export type ExecutorParams = {
@ -21,5 +21,5 @@ export const ExecutorRoute: AppRouteObject = {
}; };
export const toExecutor = (params: ExecutorParams): Partial<Path> => ({ export const toExecutor = (params: ExecutorParams): Partial<Path> => ({
pathname: generatePath(ExecutorRoute.path, params), pathname: generateEncodedPath(ExecutorRoute.path, params),
}); });

View file

@ -1,6 +1,6 @@
import { lazy } from "react"; import { lazy } from "react";
import type { Path } from "react-router-dom"; import type { Path } from "react-router-dom";
import { generatePath } from "react-router-dom"; import { generateEncodedPath } from "../../utils/generateEncodedPath";
import type { AppRouteObject } from "../../routes"; import type { AppRouteObject } from "../../routes";
export type ProviderType = export type ProviderType =
@ -33,5 +33,5 @@ export const KeyProviderFormRoute: AppRouteObject = {
}; };
export const toKeyProvider = (params: KeyProviderParams): Partial<Path> => ({ export const toKeyProvider = (params: KeyProviderParams): Partial<Path> => ({
pathname: generatePath(KeyProviderFormRoute.path, params), pathname: generateEncodedPath(KeyProviderFormRoute.path, params),
}); });

View file

@ -1,6 +1,6 @@
import { lazy } from "react"; import { lazy } from "react";
import type { Path } from "react-router-dom"; import type { Path } from "react-router-dom";
import { generatePath } from "react-router-dom"; import { generateEncodedPath } from "../../utils/generateEncodedPath";
import type { AppRouteObject } from "../../routes"; import type { AppRouteObject } from "../../routes";
export type KeySubTab = "list" | "providers"; export type KeySubTab = "list" | "providers";
@ -22,5 +22,5 @@ export const KeysRoute: AppRouteObject = {
}; };
export const toKeysTab = (params: KeysParams): Partial<Path> => ({ export const toKeysTab = (params: KeysParams): Partial<Path> => ({
pathname: generatePath(KeysRoute.path, params), pathname: generateEncodedPath(KeysRoute.path, params),
}); });

View file

@ -1,6 +1,6 @@
import { lazy } from "react"; import { lazy } from "react";
import type { Path } from "react-router-dom"; import type { Path } from "react-router-dom";
import { generatePath } from "react-router-dom"; import { generateEncodedPath } from "../../utils/generateEncodedPath";
import type { AppRouteObject } from "../../routes"; import type { AppRouteObject } from "../../routes";
export type NewAttributesGroupParams = { export type NewAttributesGroupParams = {
@ -23,5 +23,5 @@ export const NewAttributesGroupRoute: AppRouteObject = {
export const toNewAttributesGroup = ( export const toNewAttributesGroup = (
params: NewAttributesGroupParams, params: NewAttributesGroupParams,
): Partial<Path> => ({ ): Partial<Path> => ({
pathname: generatePath(NewAttributesGroupRoute.path, params), pathname: generateEncodedPath(NewAttributesGroupRoute.path, params),
}); });

View file

@ -1,6 +1,6 @@
import { lazy } from "react"; import { lazy } from "react";
import type { Path } from "react-router-dom"; import type { Path } from "react-router-dom";
import { generatePath } from "react-router-dom"; import { generateEncodedPath } from "../../utils/generateEncodedPath";
import type { AppRouteObject } from "../../routes"; import type { AppRouteObject } from "../../routes";
export type RealmSettingsTab = export type RealmSettingsTab =
@ -45,6 +45,6 @@ export const toRealmSettings = (params: RealmSettingsParams): Partial<Path> => {
: RealmSettingsRoute.path; : RealmSettingsRoute.path;
return { return {
pathname: generatePath(path, params), pathname: generateEncodedPath(path, params),
}; };
}; };

View file

@ -1,6 +1,6 @@
import { lazy } from "react"; import { lazy } from "react";
import type { Path } from "react-router-dom"; import type { Path } from "react-router-dom";
import { generatePath } from "react-router-dom"; import { generateEncodedPath } from "../../utils/generateEncodedPath";
import type { AppRouteObject } from "../../routes"; import type { AppRouteObject } from "../../routes";
export type UserProfileTab = "attributes" | "attributes-group" | "json-editor"; export type UserProfileTab = "attributes" | "attributes-group" | "json-editor";
@ -22,5 +22,5 @@ export const UserProfileRoute: AppRouteObject = {
}; };
export const toUserProfile = (params: UserProfileParams): Partial<Path> => ({ export const toUserProfile = (params: UserProfileParams): Partial<Path> => ({
pathname: generatePath(UserProfileRoute.path, params), pathname: generateEncodedPath(UserProfileRoute.path, params),
}); });

View file

@ -1,6 +1,6 @@
import { lazy } from "react"; import { lazy } from "react";
import type { Path } from "react-router-dom"; import type { Path } from "react-router-dom";
import { generatePath } from "react-router-dom"; import { generateEncodedPath } from "../../utils/generateEncodedPath";
import type { AppRouteObject } from "../../routes"; import type { AppRouteObject } from "../../routes";
export type AddRealmParams = { realm: string }; export type AddRealmParams = { realm: string };
@ -17,5 +17,5 @@ export const AddRealmRoute: AppRouteObject = {
}; };
export const toAddRealm = (params: AddRealmParams): Partial<Path> => ({ export const toAddRealm = (params: AddRealmParams): Partial<Path> => ({
pathname: generatePath(AddRealmRoute.path, params), pathname: generateEncodedPath(AddRealmRoute.path, params),
}); });

View file

@ -1,6 +1,6 @@
import { lazy } from "react"; import { lazy } from "react";
import type { Path } from "react-router-dom"; import type { Path } from "react-router-dom";
import { generatePath } from "react-router-dom"; import { generateEncodedPath } from "../../utils/generateEncodedPath";
import type { AppRouteObject } from "../../routes"; import type { AppRouteObject } from "../../routes";
export type SessionsParams = { realm: string }; export type SessionsParams = { realm: string };
@ -17,5 +17,5 @@ export const SessionsRoute: AppRouteObject = {
}; };
export const toSessions = (params: SessionsParams): Partial<Path> => ({ export const toSessions = (params: SessionsParams): Partial<Path> => ({
pathname: generatePath(SessionsRoute.path, params), pathname: generateEncodedPath(SessionsRoute.path, params),
}); });

View file

@ -1,6 +1,6 @@
import { lazy } from "react"; import { lazy } from "react";
import type { Path } from "react-router-dom"; import type { Path } from "react-router-dom";
import { generatePath } from "react-router-dom"; import { generateEncodedPath } from "../../utils/generateEncodedPath";
import type { AppRouteObject } from "../../routes"; import type { AppRouteObject } from "../../routes";
@ -26,5 +26,5 @@ export const CustomUserFederationRoute: AppRouteObject = {
export const toCustomUserFederation = ( export const toCustomUserFederation = (
params: CustomUserFederationRouteParams, params: CustomUserFederationRouteParams,
): Partial<Path> => ({ ): Partial<Path> => ({
pathname: generatePath(CustomUserFederationRoute.path, params), pathname: generateEncodedPath(CustomUserFederationRoute.path, params),
}); });

View file

@ -1,6 +1,6 @@
import { lazy } from "react"; import { lazy } from "react";
import type { Path } from "react-router-dom"; import type { Path } from "react-router-dom";
import { generatePath } from "react-router-dom"; import { generateEncodedPath } from "../../utils/generateEncodedPath";
import type { AppRouteObject } from "../../routes"; import type { AppRouteObject } from "../../routes";
@ -25,5 +25,5 @@ export const NewCustomUserFederationRoute: AppRouteObject = {
export const toNewCustomUserFederation = ( export const toNewCustomUserFederation = (
params: NewCustomUserFederationRouteParams, params: NewCustomUserFederationRouteParams,
): Partial<Path> => ({ ): Partial<Path> => ({
pathname: generatePath(NewCustomUserFederationRoute.path, params), pathname: generateEncodedPath(NewCustomUserFederationRoute.path, params),
}); });

View file

@ -1,6 +1,6 @@
import { lazy } from "react"; import { lazy } from "react";
import type { Path } from "react-router-dom"; import type { Path } from "react-router-dom";
import { generatePath } from "react-router-dom"; import { generateEncodedPath } from "../../utils/generateEncodedPath";
import type { AppRouteObject } from "../../routes"; import type { AppRouteObject } from "../../routes";
export type NewKerberosUserFederationParams = { realm: string }; export type NewKerberosUserFederationParams = { realm: string };
@ -21,5 +21,5 @@ export const NewKerberosUserFederationRoute: AppRouteObject = {
export const toNewKerberosUserFederation = ( export const toNewKerberosUserFederation = (
params: NewKerberosUserFederationParams, params: NewKerberosUserFederationParams,
): Partial<Path> => ({ ): Partial<Path> => ({
pathname: generatePath(NewKerberosUserFederationRoute.path, params), pathname: generateEncodedPath(NewKerberosUserFederationRoute.path, params),
}); });

View file

@ -1,6 +1,6 @@
import { lazy } from "react"; import { lazy } from "react";
import type { Path } from "react-router-dom"; import type { Path } from "react-router-dom";
import { generatePath } from "react-router-dom"; import { generateEncodedPath } from "../../utils/generateEncodedPath";
import type { AppRouteObject } from "../../routes"; import type { AppRouteObject } from "../../routes";
export type NewLdapUserFederationParams = { realm: string }; export type NewLdapUserFederationParams = { realm: string };
@ -21,5 +21,5 @@ export const NewLdapUserFederationRoute: AppRouteObject = {
export const toNewLdapUserFederation = ( export const toNewLdapUserFederation = (
params: NewLdapUserFederationParams, params: NewLdapUserFederationParams,
): Partial<Path> => ({ ): Partial<Path> => ({
pathname: generatePath(NewLdapUserFederationRoute.path, params), pathname: generateEncodedPath(NewLdapUserFederationRoute.path, params),
}); });

View file

@ -1,6 +1,6 @@
import { lazy } from "react"; import { lazy } from "react";
import type { Path } from "react-router-dom"; import type { Path } from "react-router-dom";
import { generatePath } from "react-router-dom"; import { generateEncodedPath } from "../../utils/generateEncodedPath";
import type { AppRouteObject } from "../../routes"; import type { AppRouteObject } from "../../routes";
export type UserFederationParams = { realm: string }; export type UserFederationParams = { realm: string };
@ -19,5 +19,5 @@ export const UserFederationRoute: AppRouteObject = {
export const toUserFederation = ( export const toUserFederation = (
params: UserFederationParams, params: UserFederationParams,
): Partial<Path> => ({ ): Partial<Path> => ({
pathname: generatePath(UserFederationRoute.path, params), pathname: generateEncodedPath(UserFederationRoute.path, params),
}); });

View file

@ -1,6 +1,6 @@
import { lazy } from "react"; import { lazy } from "react";
import type { Path } from "react-router-dom"; import type { Path } from "react-router-dom";
import { generatePath } from "react-router-dom"; import { generateEncodedPath } from "../../utils/generateEncodedPath";
import type { AppRouteObject } from "../../routes"; import type { AppRouteObject } from "../../routes";
export type UserFederationKerberosParams = { export type UserFederationKerberosParams = {
@ -24,5 +24,5 @@ export const UserFederationKerberosRoute: AppRouteObject = {
export const toUserFederationKerberos = ( export const toUserFederationKerberos = (
params: UserFederationKerberosParams, params: UserFederationKerberosParams,
): Partial<Path> => ({ ): Partial<Path> => ({
pathname: generatePath(UserFederationKerberosRoute.path, params), pathname: generateEncodedPath(UserFederationKerberosRoute.path, params),
}); });

View file

@ -1,6 +1,6 @@
import { lazy } from "react"; import { lazy } from "react";
import type { Path } from "react-router-dom"; import type { Path } from "react-router-dom";
import { generatePath } from "react-router-dom"; import { generateEncodedPath } from "../../utils/generateEncodedPath";
import type { AppRouteObject } from "../../routes"; import type { AppRouteObject } from "../../routes";
export type UserFederationLdapTab = "settings" | "mappers"; export type UserFederationLdapTab = "settings" | "mappers";
@ -37,6 +37,6 @@ export const toUserFederationLdap = (
: UserFederationLdapRoute.path; : UserFederationLdapRoute.path;
return { return {
pathname: generatePath(path, params), pathname: generateEncodedPath(path, params),
}; };
}; };

View file

@ -1,6 +1,6 @@
import { lazy } from "react"; import { lazy } from "react";
import type { Path } from "react-router-dom"; import type { Path } from "react-router-dom";
import { generatePath } from "react-router-dom"; import { generateEncodedPath } from "../../utils/generateEncodedPath";
import type { AppRouteObject } from "../../routes"; import type { AppRouteObject } from "../../routes";
export type UserFederationLdapMapperParams = { export type UserFederationLdapMapperParams = {
@ -25,5 +25,5 @@ export const UserFederationLdapMapperRoute: AppRouteObject = {
export const toUserFederationLdapMapper = ( export const toUserFederationLdapMapper = (
params: UserFederationLdapMapperParams, params: UserFederationLdapMapperParams,
): Partial<Path> => ({ ): Partial<Path> => ({
pathname: generatePath(UserFederationLdapMapperRoute.path, params), pathname: generateEncodedPath(UserFederationLdapMapperRoute.path, params),
}); });

View file

@ -1,6 +1,6 @@
import { lazy } from "react"; import { lazy } from "react";
import type { Path } from "react-router-dom"; import type { Path } from "react-router-dom";
import { generatePath } from "react-router-dom"; import { generateEncodedPath } from "../../utils/generateEncodedPath";
import type { AppRouteObject } from "../../routes"; import type { AppRouteObject } from "../../routes";
export type UserFederationsKerberosParams = { realm: string }; export type UserFederationsKerberosParams = { realm: string };
@ -18,5 +18,5 @@ export const UserFederationsKerberosRoute: AppRouteObject = {
export const toUserFederationsKerberos = ( export const toUserFederationsKerberos = (
params: UserFederationsKerberosParams, params: UserFederationsKerberosParams,
): Partial<Path> => ({ ): Partial<Path> => ({
pathname: generatePath(UserFederationsKerberosRoute.path, params), pathname: generateEncodedPath(UserFederationsKerberosRoute.path, params),
}); });

View file

@ -1,6 +1,6 @@
import { lazy } from "react"; import { lazy } from "react";
import type { Path } from "react-router-dom"; import type { Path } from "react-router-dom";
import { generatePath } from "react-router-dom"; import { generateEncodedPath } from "../../utils/generateEncodedPath";
import type { AppRouteObject } from "../../routes"; import type { AppRouteObject } from "../../routes";
export type UserFederationsLdapParams = { realm: string }; export type UserFederationsLdapParams = { realm: string };
@ -18,5 +18,5 @@ export const UserFederationsLdapRoute: AppRouteObject = {
export const toUserFederationsLdap = ( export const toUserFederationsLdap = (
params: UserFederationsLdapParams, params: UserFederationsLdapParams,
): Partial<Path> => ({ ): Partial<Path> => ({
pathname: generatePath(UserFederationsLdapRoute.path, params), pathname: generateEncodedPath(UserFederationsLdapRoute.path, params),
}); });

View file

@ -1,6 +1,6 @@
import { lazy } from "react"; import { lazy } from "react";
import type { Path } from "react-router-dom"; import type { Path } from "react-router-dom";
import { generatePath } from "react-router-dom"; import { generateEncodedPath } from "../../utils/generateEncodedPath";
import type { AppRouteObject } from "../../routes"; import type { AppRouteObject } from "../../routes";
@ -18,5 +18,5 @@ export const AddUserRoute: AppRouteObject = {
}; };
export const toAddUser = (params: AddUserParams): Partial<Path> => ({ export const toAddUser = (params: AddUserParams): Partial<Path> => ({
pathname: generatePath(AddUserRoute.path, params), pathname: generateEncodedPath(AddUserRoute.path, params),
}); });

View file

@ -1,6 +1,6 @@
import { lazy } from "react"; import { lazy } from "react";
import type { Path } from "react-router-dom"; import type { Path } from "react-router-dom";
import { generatePath } from "react-router-dom"; import { generateEncodedPath } from "../../utils/generateEncodedPath";
import type { AppRouteObject } from "../../routes"; import type { AppRouteObject } from "../../routes";
export type UserTab = export type UserTab =
@ -31,5 +31,5 @@ export const UserRoute: AppRouteObject = {
}; };
export const toUser = (params: UserParams): Partial<Path> => ({ export const toUser = (params: UserParams): Partial<Path> => ({
pathname: generatePath(UserRoute.path, params), pathname: generateEncodedPath(UserRoute.path, params),
}); });

View file

@ -1,5 +1,5 @@
import { lazy } from "react"; import { lazy } from "react";
import { generatePath } from "react-router-dom"; import { generateEncodedPath } from "../../utils/generateEncodedPath";
import type { Path } from "react-router-dom"; import type { Path } from "react-router-dom";
import type { AppRouteObject } from "../../routes"; import type { AppRouteObject } from "../../routes";
@ -27,6 +27,6 @@ export const toUsers = (params: UsersParams): Partial<Path> => {
const path = params.tab ? UsersRouteWithTab.path : UsersRoute.path; const path = params.tab ? UsersRouteWithTab.path : UsersRoute.path;
return { return {
pathname: generatePath(path, params), pathname: generateEncodedPath(path, params),
}; };
}; };

View file

@ -2,7 +2,6 @@ import { saveAs } from "file-saver";
import { cloneDeep } from "lodash-es"; import { cloneDeep } from "lodash-es";
import { FieldValues, Path, PathValue, UseFormSetValue } from "react-hook-form"; import { FieldValues, Path, PathValue, UseFormSetValue } from "react-hook-form";
import { flatten } from "flat"; import { flatten } from "flat";
import type ClientRepresentation from "@keycloak/keycloak-admin-client/lib/defs/clientRepresentation"; import type ClientRepresentation from "@keycloak/keycloak-admin-client/lib/defs/clientRepresentation";
import type { ProviderRepresentation } from "@keycloak/keycloak-admin-client/lib/defs/serverInfoRepesentation"; import type { ProviderRepresentation } from "@keycloak/keycloak-admin-client/lib/defs/serverInfoRepesentation";
import type { IFormatter, IFormatterValueType } from "@patternfly/react-table"; import type { IFormatter, IFormatterValueType } from "@patternfly/react-table";

View file

@ -0,0 +1,17 @@
import { generatePath } from "react-router-dom";
export type PathParam = { [key: string]: string };
export function generateEncodedPath<Path extends string>(
originalPath: Path,
params: PathParam,
): string {
const encodedParams: PathParam = {};
Object.entries(params).forEach(
([k, v]) => (encodedParams[k] = encodeURIComponent(v)),
);
//TODO: Fix type once https://github.com/remix-run/react-router/pull/10719 is merged.
return generatePath(originalPath, encodedParams as any);
}