Upgrade to React Router v6 (#4198)

This commit is contained in:
Jon Koops 2023-01-18 13:09:49 +01:00 committed by GitHub
parent 45b2a8da62
commit f32d3f5cfb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
176 changed files with 351 additions and 650 deletions

View file

@ -12,12 +12,6 @@ updates:
ignore:
- dependency-name: react-hook-form
update-types: ["version-update:semver-major"]
- dependency-name: react-router
update-types: ["version-update:semver-major"]
- dependency-name: react-router-dom
update-types: ["version-update:semver-major"]
- dependency-name: use-react-router-breadcrumbs
update-types: ["version-update:semver-major"]
- dependency-name: react-flow-renderer
update-types: ["version-update:semver-major"]
- dependency-name: react

View file

@ -18,8 +18,7 @@
"react-dom": "^17.0.2",
"react-hook-form": "^7.38.0",
"react-i18next": "^12.0.0",
"react-router": "^6.4.3",
"react-router-dom": "^6.4.3"
"react-router-dom": "^6.6.2"
},
"devDependencies": {
"@types/react": "^17.0.45",

View file

@ -8,7 +8,7 @@ import {
TextVariants,
} from "@patternfly/react-core";
import { useTranslation } from "react-i18next";
import { useRouteError } from "react-router";
import { useRouteError } from "react-router-dom";
export const ErrorPage = () => {
const { t } = useTranslation();

View file

@ -6,7 +6,7 @@ import {
} from "keycloak-masthead";
import { Suspense, useMemo } from "react";
import { useTranslation } from "react-i18next";
import { Outlet } from "react-router";
import { Outlet } from "react-router-dom";
import { AlertProvider } from "../components/alerts/Alerts";
import { environment } from "../environment";

View file

@ -1,5 +1,5 @@
import { lazy } from "react";
import type { IndexRouteObject, RouteObject } from "react-router";
import type { IndexRouteObject, RouteObject } from "react-router-dom";
import { ErrorPage } from "./root/ErrorPage";
import { Root } from "./root/Root";

View file

@ -76,11 +76,9 @@
"react-hook-form": "^6.15.8",
"react-hook-form-v7": "npm:react-hook-form@^7.35.1",
"react-i18next": "^12.0.0",
"react-router": "^5.3.4",
"react-router-dom": "^5.3.4",
"react-router-dom-v5-compat": "^6.6.1",
"react-router-dom": "^6.6.2",
"react-use-localstorage": "^3.5.3",
"use-react-router-breadcrumbs": "^2.0.2"
"use-react-router-breadcrumbs": "^4.0.1"
},
"devDependencies": {
"@4tw/cypress-drag-drop": "^2.2.3",
@ -98,7 +96,6 @@
"@types/lodash-es": "^4.17.6",
"@types/react": "^17.0.45",
"@types/react-dom": "^17.0.16",
"@types/react-router-dom": "^5.3.3",
"@vitejs/plugin-react": "^2.2.0",
"cypress": "^11.2.0",
"del": "^7.0.0",

View file

@ -1,29 +1,26 @@
import { FunctionComponent, Suspense } from "react";
import { Page } from "@patternfly/react-core";
import { HashRouter as Router, Switch } from "react-router-dom";
import { CompatRouter, CompatRoute } from "react-router-dom-v5-compat";
import { ErrorBoundary } from "react-error-boundary";
import type Keycloak from "keycloak-js";
import type KeycloakAdminClient from "@keycloak/keycloak-admin-client";
import { Page } from "@patternfly/react-core";
import type Keycloak from "keycloak-js";
import { FunctionComponent, Suspense } from "react";
import { ErrorBoundary } from "react-error-boundary";
import { HashRouter as Router, Route, Routes } from "react-router-dom";
import { Header } from "./PageHeader";
import { PageNav } from "./PageNav";
import { Help } from "./components/help-enabler/HelpHeader";
import { ServerInfoProvider } from "./context/server-info/ServerInfoProvider";
import { AlertProvider } from "./components/alert/Alerts";
import { AccessContextProvider, useAccess } from "./context/access/Access";
import { routes, RouteDef } from "./route-config";
import { PageBreadCrumbs } from "./components/bread-crumb/PageBreadCrumbs";
import { ErrorRenderer } from "./components/error/ErrorRenderer";
import { Help } from "./components/help-enabler/HelpHeader";
import { KeycloakSpinner } from "./components/keycloak-spinner/KeycloakSpinner";
import { AccessContextProvider, useAccess } from "./context/access/Access";
import { AdminClientContext } from "./context/auth/AdminClient";
import { RealmContextProvider } from "./context/realm-context/RealmContext";
import { RealmsProvider } from "./context/RealmsContext";
import { ServerInfoProvider } from "./context/server-info/ServerInfoProvider";
import { WhoAmIContextProvider } from "./context/whoami/WhoAmI";
import { ForbiddenSection } from "./ForbiddenSection";
import { SubGroups } from "./groups/SubGroupsContext";
import { RealmsProvider } from "./context/RealmsContext";
import { RealmContextProvider } from "./context/realm-context/RealmContext";
import { ErrorRenderer } from "./components/error/ErrorRenderer";
import { AdminClientContext } from "./context/auth/AdminClient";
import { WhoAmIContextProvider } from "./context/whoami/WhoAmI";
import { Header } from "./PageHeader";
import { PageNav } from "./PageNav";
import { RouteDef, routes } from "./route-config";
export const mainPageContentId = "kc-main-content-page-container";
@ -38,23 +35,21 @@ const AppContexts: FunctionComponent<AdminClientProps> = ({
adminClient,
}) => (
<Router>
<CompatRouter>
<AdminClientContext.Provider value={{ keycloak, adminClient }}>
<WhoAmIContextProvider>
<RealmsProvider>
<RealmContextProvider>
<AccessContextProvider>
<Help>
<AlertProvider>
<SubGroups>{children}</SubGroups>
</AlertProvider>
</Help>
</AccessContextProvider>
</RealmContextProvider>
</RealmsProvider>
</WhoAmIContextProvider>
</AdminClientContext.Provider>
</CompatRouter>
<AdminClientContext.Provider value={{ keycloak, adminClient }}>
<WhoAmIContextProvider>
<RealmsProvider>
<RealmContextProvider>
<AccessContextProvider>
<Help>
<AlertProvider>
<SubGroups>{children}</SubGroups>
</AlertProvider>
</Help>
</AccessContextProvider>
</RealmContextProvider>
</RealmsProvider>
</WhoAmIContextProvider>
</AdminClientContext.Provider>
</Router>
);
@ -96,17 +91,15 @@ export const App = ({ keycloak, adminClient }: AdminClientProps) => {
}
>
<ServerInfoProvider>
<Switch>
<Routes>
{routes.map((route, i) => (
<CompatRoute
<Route
key={i}
path={route.path}
exact={route.matchOptions?.exact ?? true}
>
<SecuredRoute route={route} />
</CompatRoute>
element={<SecuredRoute route={route} />}
/>
))}
</Switch>
</Routes>
</ServerInfoProvider>
</ErrorBoundary>
</Page>

View file

@ -14,7 +14,7 @@ import {
import { HelpIcon } from "@patternfly/react-icons";
import { useState } from "react";
import { useTranslation } from "react-i18next";
import { Link } from "react-router-dom-v5-compat";
import { Link } from "react-router-dom";
import { HelpHeader, useHelp } from "./components/help-enabler/HelpHeader";
import { useAdminClient } from "./context/auth/AdminClient";
import { useRealm } from "./context/realm-context/RealmContext";

View file

@ -1,5 +1,5 @@
import { FormEvent, FunctionComponent } from "react";
import { NavLink, useMatch, useNavigate } from "react-router-dom-v5-compat";
import { NavLink, useMatch, useNavigate } from "react-router-dom";
import { useTranslation } from "react-i18next";
import {
Nav,

View file

@ -1,5 +1,5 @@
import { useState } from "react";
import { Link } from "react-router-dom-v5-compat";
import { Link } from "react-router-dom";
import { Trans, useTranslation } from "react-i18next";
import { sortBy } from "lodash-es";
import {

View file

@ -10,7 +10,7 @@ import {
import { useEffect } from "react";
import { FormProvider, useForm } from "react-hook-form-v7";
import { useTranslation } from "react-i18next";
import { useNavigate } from "react-router-dom-v5-compat";
import { useNavigate } from "react-router-dom";
import { useAlerts } from "../components/alert/Alerts";
import { useAdminClient } from "../context/auth/AdminClient";

View file

@ -1,5 +1,5 @@
import { useState } from "react";
import { useParams, useNavigate } from "react-router-dom-v5-compat";
import { useParams, useNavigate } from "react-router-dom";
import { Trans, useTranslation } from "react-i18next";
import {
DataList,

View file

@ -7,7 +7,7 @@ import {
} from "@patternfly/react-core";
import { FormProvider, useForm } from "react-hook-form-v7";
import { useTranslation } from "react-i18next";
import { Link, useNavigate } from "react-router-dom-v5-compat";
import { Link, useNavigate } from "react-router-dom";
import { useAlerts } from "../../components/alert/Alerts";
import { FormAccess } from "../../components/form-access/FormAccess";

View file

@ -1,6 +1,6 @@
import { lazy } from "react";
import type { Path } from "react-router-dom-v5-compat";
import { generatePath } from "react-router-dom-v5-compat";
import type { Path } from "react-router-dom";
import { generatePath } from "react-router-dom";
import type { RouteDef } from "../../route-config";
export type AuthenticationTab = "flows" | "required-actions" | "policies";

View file

@ -1,6 +1,6 @@
import { lazy } from "react";
import type { Path } from "react-router-dom-v5-compat";
import { generatePath } from "react-router-dom-v5-compat";
import type { Path } from "react-router-dom";
import { generatePath } from "react-router-dom";
import type { RouteDef } from "../../route-config";
export type CreateFlowParams = { realm: string };

View file

@ -1,6 +1,6 @@
import { lazy } from "react";
import type { Path } from "react-router-dom-v5-compat";
import { generatePath } from "react-router-dom-v5-compat";
import type { Path } from "react-router-dom";
import { generatePath } from "react-router-dom";
import type { RouteDef } from "../../route-config";
export type FlowParams = {

View file

@ -1,6 +1,6 @@
import { useState } from "react";
import { useTranslation } from "react-i18next";
import { Link } from "react-router-dom-v5-compat";
import { Link } from "react-router-dom";
import {
AlertVariant,
Button,

View file

@ -1,6 +1,6 @@
import { AlertVariant, PageSection } from "@patternfly/react-core";
import { useTranslation } from "react-i18next";
import { useNavigate } from "react-router-dom-v5-compat";
import { useNavigate } from "react-router-dom";
import { useAlerts } from "../components/alert/Alerts";
import {

View file

@ -12,7 +12,7 @@ import {
} from "@patternfly/react-core";
import { useState } from "react";
import { useTranslation } from "react-i18next";
import { useNavigate } from "react-router-dom-v5-compat";
import { useNavigate } from "react-router-dom";
import { useAlerts } from "../components/alert/Alerts";
import {

View file

@ -1,7 +1,7 @@
import { useEffect, useState } from "react";
import { useTranslation } from "react-i18next";
import type { Path } from "react-router-dom-v5-compat";
import { Link } from "react-router-dom-v5-compat";
import type { Path } from "react-router-dom";
import { Link } from "react-router-dom";
import { Dropdown, DropdownItem, DropdownToggle } from "@patternfly/react-core";
import { CaretDownIcon } from "@patternfly/react-icons";

View file

@ -13,7 +13,7 @@ import {
import { useState } from "react";
import { FormProvider, useForm } from "react-hook-form";
import { useTranslation } from "react-i18next";
import { Link, useMatch, useNavigate } from "react-router-dom-v5-compat";
import { Link, useMatch, useNavigate } from "react-router-dom";
import { toClient } from "../../clients/routes/Client";
import { useAlerts } from "../../components/alert/Alerts";

View file

@ -12,7 +12,7 @@ import {
import { useEffect, useState } from "react";
import { Controller, useForm, useWatch } from "react-hook-form-v7";
import { useTranslation } from "react-i18next";
import { Link } from "react-router-dom-v5-compat";
import { Link } from "react-router-dom";
import { getProtocolName } from "../../clients/utils";
import {

View file

@ -1,6 +1,6 @@
import { lazy } from "react";
import type { Path } from "react-router-dom-v5-compat";
import { generatePath } from "react-router-dom-v5-compat";
import type { Path } from "react-router-dom";
import { generatePath } from "react-router-dom";
import type { RouteDef } from "../../route-config";
export type ClientScopeTab = "settings" | "mappers" | "scope";

View file

@ -1,6 +1,6 @@
import { lazy } from "react";
import type { Path } from "react-router-dom-v5-compat";
import { generatePath } from "react-router-dom-v5-compat";
import type { Path } from "react-router-dom";
import { generatePath } from "react-router-dom";
import type { RouteDef } from "../../route-config";
export type ClientScopesParams = { realm: string };

View file

@ -1,6 +1,6 @@
import { lazy } from "react";
import type { Path } from "react-router-dom-v5-compat";
import { generatePath } from "react-router-dom-v5-compat";
import type { Path } from "react-router-dom";
import { generatePath } from "react-router-dom";
import type { RouteDef } from "../../route-config";
export type MapperParams = {

View file

@ -1,6 +1,6 @@
import { lazy } from "react";
import type { Path } from "react-router-dom-v5-compat";
import { generatePath } from "react-router-dom-v5-compat";
import type { Path } from "react-router-dom";
import { generatePath } from "react-router-dom";
import type { RouteDef } from "../../route-config";
export type NewClientScopeParams = { realm: string };

View file

@ -20,7 +20,7 @@ import {
useWatch,
} from "react-hook-form-v7";
import { useTranslation } from "react-i18next";
import { useNavigate } from "react-router-dom-v5-compat";
import { useNavigate } from "react-router-dom";
import { useAlerts } from "../components/alert/Alerts";
import {

View file

@ -13,7 +13,7 @@ import type ClientRepresentation from "@keycloak/keycloak-admin-client/lib/defs/
import type { ClientQuery } from "@keycloak/keycloak-admin-client/lib/resources/clients";
import { useState } from "react";
import { useTranslation } from "react-i18next";
import { Link } from "react-router-dom-v5-compat";
import { Link } from "react-router-dom";
import { useAlerts } from "../components/alert/Alerts";
import { useConfirmDialog } from "../components/confirm-dialog/ConfirmDialog";
import { formattedLinkTableCell } from "../components/external-link/FormattedLink";

View file

@ -9,7 +9,7 @@ import {
import { useState } from "react";
import { FormProvider, useForm } from "react-hook-form-v7";
import { useTranslation } from "react-i18next";
import { useNavigate } from "react-router-dom-v5-compat";
import { useNavigate } from "react-router-dom";
import { useAlerts } from "../../components/alert/Alerts";
import { FormAccess } from "../../components/form-access/FormAccess";

View file

@ -9,7 +9,7 @@ import {
import { useEffect, useRef } from "react";
import { useFormContext } from "react-hook-form-v7";
import { Trans, useTranslation } from "react-i18next";
import { Link } from "react-router-dom-v5-compat";
import { Link } from "react-router-dom";
import { useAlerts } from "../../components/alert/Alerts";
import { FormAccess } from "../../components/form-access/FormAccess";

View file

@ -11,7 +11,7 @@ import {
import { ExpandableRowContent, Tbody, Td, Tr } from "@patternfly/react-table";
import { useState } from "react";
import { useTranslation } from "react-i18next";
import { Link } from "react-router-dom-v5-compat";
import { Link } from "react-router-dom";
import { useRealm } from "../../context/realm-context/RealmContext";
import { useParams } from "../../utils/useParams";

View file

@ -4,7 +4,7 @@ import {
DescriptionListTerm,
} from "@patternfly/react-core";
import { useTranslation } from "react-i18next";
import { Link, Path } from "react-router-dom-v5-compat";
import { Link, Path } from "react-router-dom";
type DetailDescriptionProps<T> = {
name: string;

View file

@ -1,4 +1,4 @@
import { useNavigate } from "react-router-dom-v5-compat";
import { useNavigate } from "react-router-dom";
import { useTranslation } from "react-i18next";
import {
EmptyState,

View file

@ -20,7 +20,7 @@ import {
useWatch,
} from "react-hook-form-v7";
import { useTranslation } from "react-i18next";
import { Link, useNavigate } from "react-router-dom-v5-compat";
import { Link, useNavigate } from "react-router-dom";
import { useAlerts } from "../../components/alert/Alerts";
import { useConfirmDialog } from "../../components/confirm-dialog/ConfirmDialog";

View file

@ -1,5 +1,5 @@
import { useState } from "react";
import { Link, useNavigate } from "react-router-dom-v5-compat";
import { Link, useNavigate } from "react-router-dom";
import { useTranslation } from "react-i18next";
import {
Alert,

View file

@ -1,5 +1,5 @@
import { useState } from "react";
import { Link, useNavigate } from "react-router-dom-v5-compat";
import { Link, useNavigate } from "react-router-dom";
import { useTranslation } from "react-i18next";
import {
Alert,

View file

@ -16,7 +16,7 @@ import {
import { useState } from "react";
import { Controller, FormProvider, useForm } from "react-hook-form-v7";
import { useTranslation } from "react-i18next";
import { Link, useNavigate } from "react-router-dom-v5-compat";
import { Link, useNavigate } from "react-router-dom";
import { useAlerts } from "../../components/alert/Alerts";
import { useConfirmDialog } from "../../components/confirm-dialog/ConfirmDialog";

View file

@ -1,5 +1,5 @@
import { useState } from "react";
import { Link, useNavigate } from "react-router-dom-v5-compat";
import { Link, useNavigate } from "react-router-dom";
import { useTranslation } from "react-i18next";
import {
Alert,

View file

@ -12,7 +12,7 @@ import {
import { useState } from "react";
import { useForm } from "react-hook-form-v7";
import { useTranslation } from "react-i18next";
import { Link, useNavigate } from "react-router-dom-v5-compat";
import { Link, useNavigate } from "react-router-dom";
import { useAlerts } from "../../components/alert/Alerts";
import { FormAccess } from "../../components/form-access/FormAccess";

View file

@ -1,5 +1,5 @@
import { useState } from "react";
import { Link, useNavigate } from "react-router-dom-v5-compat";
import { Link, useNavigate } from "react-router-dom";
import { useTranslation } from "react-i18next";
import {
Button,

View file

@ -10,7 +10,7 @@ import {
import { FunctionComponent, useState } from "react";
import { FormProvider, useForm } from "react-hook-form-v7";
import { useTranslation } from "react-i18next";
import { Link, useNavigate } from "react-router-dom-v5-compat";
import { Link, useNavigate } from "react-router-dom";
import { useAlerts } from "../../../components/alert/Alerts";
import { useConfirmDialog } from "../../../components/confirm-dialog/ConfirmDialog";

View file

@ -9,7 +9,7 @@ import {
import { useState } from "react";
import { FormProvider, useForm } from "react-hook-form-v7";
import { useTranslation } from "react-i18next";
import { Link, useNavigate } from "react-router-dom-v5-compat";
import { Link, useNavigate } from "react-router-dom";
import type ClientRepresentation from "@keycloak/keycloak-admin-client/lib/defs/clientRepresentation";

View file

@ -15,7 +15,7 @@ import { FormAccess } from "../../components/form-access/FormAccess";
import { ViewHeader } from "../../components/view-header/ViewHeader";
import { HelpItem } from "../../components/help-enabler/HelpItem";
import { TimeSelector } from "../../components/time-selector/TimeSelector";
import { Link, useNavigate } from "react-router-dom-v5-compat";
import { Link, useNavigate } from "react-router-dom";
import { useRealm } from "../../context/realm-context/RealmContext";
import { useAdminClient } from "../../context/auth/AdminClient";
import { useAlerts } from "../../components/alert/Alerts";

View file

@ -3,7 +3,7 @@ import { wrappable } from "@patternfly/react-table";
import type ClientInitialAccessPresentation from "@keycloak/keycloak-admin-client/lib/defs/clientInitialAccessPresentation";
import { useState } from "react";
import { useTranslation } from "react-i18next";
import { Link, useNavigate } from "react-router-dom-v5-compat";
import { Link, useNavigate } from "react-router-dom";
import { useAlerts } from "../../components/alert/Alerts";
import { useConfirmDialog } from "../../components/confirm-dialog/ConfirmDialog";
import { ListEmptyState } from "../../components/list-empty-state/ListEmptyState";

View file

@ -2,7 +2,7 @@ import type RoleRepresentation from "@keycloak/keycloak-admin-client/lib/defs/ro
import { AlertVariant } from "@patternfly/react-core";
import { SubmitHandler, useForm } from "react-hook-form";
import { useTranslation } from "react-i18next";
import { useNavigate, useParams } from "react-router-dom-v5-compat";
import { useNavigate, useParams } from "react-router-dom";
import { useAlerts } from "../../components/alert/Alerts";
import { AttributeForm } from "../../components/key-value-form/AttributeForm";

View file

@ -1,6 +1,6 @@
import { lazy } from "react";
import type { Path } from "react-router-dom-v5-compat";
import { generatePath } from "react-router-dom-v5-compat";
import type { Path } from "react-router-dom";
import { generatePath } from "react-router-dom";
import type { RouteDef } from "../../route-config";
export type AddClientParams = { realm: string };

View file

@ -1,6 +1,6 @@
import { lazy } from "react";
import type { Path } from "react-router-dom-v5-compat";
import { generatePath } from "react-router-dom-v5-compat";
import type { Path } from "react-router-dom";
import { generatePath } from "react-router-dom";
import type { RouteDef } from "../../route-config";
export type AuthorizationTab =

View file

@ -1,6 +1,6 @@
import { lazy } from "react";
import type { Path } from "react-router-dom-v5-compat";
import { generatePath } from "react-router-dom-v5-compat";
import type { Path } from "react-router-dom";
import { generatePath } from "react-router-dom";
import type { RouteDef } from "../../route-config";
export type ClientTab =

View file

@ -1,6 +1,6 @@
import { lazy } from "react";
import type { Path } from "react-router-dom-v5-compat";
import { generatePath } from "react-router-dom-v5-compat";
import type { Path } from "react-router-dom";
import { generatePath } from "react-router-dom";
import type { RouteDef } from "../../route-config";
export type ClientRoleTab =

View file

@ -1,6 +1,6 @@
import { lazy } from "react";
import type { Path } from "react-router-dom-v5-compat";
import { generatePath } from "react-router-dom-v5-compat";
import type { Path } from "react-router-dom";
import { generatePath } from "react-router-dom";
import type { RouteDef } from "../../route-config";
export type ClientScopesTab = "setup" | "evaluate";

View file

@ -1,6 +1,6 @@
import { lazy } from "react";
import type { Path } from "react-router-dom-v5-compat";
import { generatePath } from "react-router-dom-v5-compat";
import type { Path } from "react-router-dom";
import { generatePath } from "react-router-dom";
import type { RouteDef } from "../../route-config";
export type ClientsTab = "list" | "initial-access-token";

View file

@ -1,6 +1,6 @@
import { lazy } from "react";
import type { Path } from "react-router-dom-v5-compat";
import { generatePath } from "react-router-dom-v5-compat";
import type { Path } from "react-router-dom";
import { generatePath } from "react-router-dom";
import type { RouteDef } from "../../route-config";
export type CreateInitialAccessTokenParams = { realm: string };

View file

@ -1,6 +1,6 @@
import { lazy } from "react";
import type { Path } from "react-router-dom-v5-compat";
import { generatePath } from "react-router-dom-v5-compat";
import type { Path } from "react-router-dom";
import { generatePath } from "react-router-dom";
import type { RouteDef } from "../../route-config";
export type DedicatedScopeTab = "mappers" | "scope";

View file

@ -1,6 +1,6 @@
import { lazy } from "react";
import type { Path } from "react-router-dom-v5-compat";
import { generatePath } from "react-router-dom-v5-compat";
import type { Path } from "react-router-dom";
import { generatePath } from "react-router-dom";
import type { RouteDef } from "../../route-config";
export type ImportClientParams = { realm: string };

View file

@ -1,6 +1,6 @@
import { lazy } from "react";
import type { Path } from "react-router-dom-v5-compat";
import { generatePath } from "react-router-dom-v5-compat";
import type { Path } from "react-router-dom";
import { generatePath } from "react-router-dom";
import type { RouteDef } from "../../route-config";
export type MapperParams = {

View file

@ -1,6 +1,6 @@
import { lazy } from "react";
import type { Path } from "react-router-dom-v5-compat";
import { generatePath } from "react-router-dom-v5-compat";
import type { Path } from "react-router-dom";
import { generatePath } from "react-router-dom";
import type { RouteDef } from "../../route-config";
export type PermissionType = "resource" | "scope";

View file

@ -1,6 +1,6 @@
import { lazy } from "react";
import type { Path } from "react-router-dom-v5-compat";
import { generatePath } from "react-router-dom-v5-compat";
import type { Path } from "react-router-dom";
import { generatePath } from "react-router-dom";
import type { RouteDef } from "../../route-config";
export type NewPolicyParams = { realm: string; id: string; policyType: string };

View file

@ -1,6 +1,6 @@
import { lazy } from "react";
import type { Path } from "react-router-dom-v5-compat";
import { generatePath } from "react-router-dom-v5-compat";
import type { Path } from "react-router-dom";
import { generatePath } from "react-router-dom";
import type { RouteDef } from "../../route-config";
export type NewResourceParams = { realm: string; id: string };

View file

@ -1,6 +1,6 @@
import { lazy } from "react";
import type { Path } from "react-router-dom-v5-compat";
import { generatePath } from "react-router-dom-v5-compat";
import type { Path } from "react-router-dom";
import { generatePath } from "react-router-dom";
import type { RouteDef } from "../../route-config";
export type NewRoleParams = { realm: string; clientId: string };

View file

@ -1,6 +1,6 @@
import { lazy } from "react";
import type { Path } from "react-router-dom-v5-compat";
import { generatePath } from "react-router-dom-v5-compat";
import type { Path } from "react-router-dom";
import { generatePath } from "react-router-dom";
import type { RouteDef } from "../../route-config";
export type NewScopeParams = { realm: string; id: string };

View file

@ -1,6 +1,6 @@
import { lazy } from "react";
import type { Path } from "react-router-dom-v5-compat";
import { generatePath } from "react-router-dom-v5-compat";
import type { Path } from "react-router-dom";
import { generatePath } from "react-router-dom";
import type { RouteDef } from "../../route-config";
import type { PermissionType } from "./NewPermission";

View file

@ -1,6 +1,6 @@
import { lazy } from "react";
import type { Path } from "react-router-dom-v5-compat";
import { generatePath } from "react-router-dom-v5-compat";
import type { Path } from "react-router-dom";
import { generatePath } from "react-router-dom";
import type { RouteDef } from "../../route-config";
export type PolicyDetailsParams = {

View file

@ -1,6 +1,6 @@
import { lazy } from "react";
import type { Path } from "react-router-dom-v5-compat";
import { generatePath } from "react-router-dom-v5-compat";
import type { Path } from "react-router-dom";
import { generatePath } from "react-router-dom";
import type { RouteDef } from "../../route-config";
export type ResourceDetailsParams = {

View file

@ -1,6 +1,6 @@
import { lazy } from "react";
import type { Path } from "react-router-dom-v5-compat";
import { generatePath } from "react-router-dom-v5-compat";
import type { Path } from "react-router-dom";
import { generatePath } from "react-router-dom";
import type { RouteDef } from "../../route-config";
export type ScopeDetailsParams = {

View file

@ -1,5 +1,5 @@
import { useState } from "react";
import { Link } from "react-router-dom-v5-compat";
import { Link } from "react-router-dom";
import { useTranslation } from "react-i18next";
import {
AlertVariant,

View file

@ -9,7 +9,7 @@ import {
} from "@patternfly/react-core";
import { useState } from "react";
import { useTranslation } from "react-i18next";
import { useNavigate } from "react-router-dom-v5-compat";
import { useNavigate } from "react-router-dom";
import { MapperList } from "../../client-scopes/details/MapperList";
import { useAlerts } from "../../components/alert/Alerts";

View file

@ -1,5 +1,5 @@
import { useState } from "react";
import { Link } from "react-router-dom-v5-compat";
import { Link } from "react-router-dom";
import { Trans, useTranslation } from "react-i18next";
import { AlertVariant, PageSection } from "@patternfly/react-core";
import { InfoCircleIcon } from "@patternfly/react-icons";

View file

@ -1,5 +1,5 @@
import { useEffect } from "react";
import { Link, useLocation } from "react-router-dom-v5-compat";
import { Link, useLocation } from "react-router-dom";
import { useTranslation } from "react-i18next";
import { Breadcrumb, BreadcrumbItem } from "@patternfly/react-core";

View file

@ -1,12 +1,12 @@
import { Breadcrumb, BreadcrumbItem } from "@patternfly/react-core";
import { uniqBy } from "lodash-es";
import { isValidElement } from "react";
import { Link } from "react-router-dom-v5-compat";
import { useTranslation } from "react-i18next";
import { Link } from "react-router-dom";
import useBreadcrumbs, {
BreadcrumbData,
BreadcrumbsRoute,
} from "use-react-router-breadcrumbs";
import { useTranslation } from "react-i18next";
import { uniqBy } from "lodash-es";
import { Breadcrumb, BreadcrumbItem } from "@patternfly/react-core";
import { useRealm } from "../../context/realm-context/RealmContext";
import { routes } from "../../route-config";
@ -34,7 +34,7 @@ export const PageBreadCrumbs = () => {
{crumbs.map(({ match, breadcrumb: crumb }, i) => (
<BreadcrumbItem key={i} isActive={crumbs.length - 1 === i}>
{crumbs.length - 1 !== i ? (
<Link to={match.url}>{crumb}</Link>
<Link to={match.pathname}>{crumb}</Link>
) : (
crumb
)}

View file

@ -11,7 +11,7 @@ import {
Label,
} from "@patternfly/react-core";
import { ReactElement, useState } from "react";
import { To, useNavigate } from "react-router-dom-v5-compat";
import { To, useNavigate } from "react-router-dom";
import { ClickableCard } from "./ClickableCard";
import "./keycloak-card.css";

View file

@ -1,5 +1,5 @@
import { useState } from "react";
import { Link, useNavigate } from "react-router-dom-v5-compat";
import { Link, useNavigate } from "react-router-dom";
import { Trans, useTranslation } from "react-i18next";
import {
Card,

View file

@ -14,7 +14,7 @@ import {
import { CheckIcon } from "@patternfly/react-icons";
import { Fragment, ReactElement, useMemo, useState } from "react";
import { useTranslation } from "react-i18next";
import { useNavigate } from "react-router-dom-v5-compat";
import { useNavigate } from "react-router-dom";
import { useRealm } from "../../context/realm-context/RealmContext";
import { useRealms } from "../../context/RealmsContext";

View file

@ -7,7 +7,7 @@ import {
} from "@patternfly/react-core";
import { SubmitHandler, useWatch, UseFormMethods } from "react-hook-form";
import { useTranslation } from "react-i18next";
import { Link, To } from "react-router-dom-v5-compat";
import { Link, To } from "react-router-dom";
import { FormAccess } from "../form-access/FormAccess";
import { AttributeForm } from "../key-value-form/AttributeForm";

View file

@ -3,7 +3,7 @@ import type RoleRepresentation from "@keycloak/keycloak-admin-client/lib/defs/ro
import { AlertVariant, Button, ButtonVariant } from "@patternfly/react-core";
import { useState } from "react";
import { useTranslation } from "react-i18next";
import { Link, To, useNavigate } from "react-router-dom-v5-compat";
import { Link, To, useNavigate } from "react-router-dom";
import { useAdminClient, useFetch } from "../../context/auth/AdminClient";
import { useRealm } from "../../context/realm-context/RealmContext";

View file

@ -10,7 +10,7 @@ import {
JSXElementConstructor,
ReactElement,
} from "react";
import { Path, useHref, useLocation } from "react-router-dom-v5-compat";
import { Path, useHref, useLocation } from "react-router-dom";
// TODO: Remove the custom 'children' props and type once the following issue has been resolved:
// https://github.com/patternfly/patternfly-react/issues/6766

View file

@ -1,5 +1,5 @@
import { FunctionComponent, useEffect, useMemo } from "react";
import { useMatch } from "react-router-dom-v5-compat";
import { useMatch } from "react-router-dom";
import { RecentUsed } from "../../components/realm-selector/recent-used";
import { DashboardRouteWithRealm } from "../../dashboard/routes/Dashboard";

View file

@ -1,6 +1,6 @@
import { lazy } from "react";
import type { Path } from "react-router-dom-v5-compat";
import { generatePath } from "react-router-dom-v5-compat";
import type { Path } from "react-router-dom";
import { generatePath } from "react-router-dom";
import type { RouteDef } from "../../route-config";
export type DashboardTab = "info" | "providers";

View file

@ -31,7 +31,7 @@ import { pickBy } from "lodash-es";
import { useState } from "react";
import { Controller, useForm } from "react-hook-form-v7";
import { Trans, useTranslation } from "react-i18next";
import { Link } from "react-router-dom-v5-compat";
import { Link } from "react-router-dom";
import { KeycloakTextInput } from "../components/keycloak-text-input/KeycloakTextInput";
import { ListEmptyState } from "../components/list-empty-state/ListEmptyState";

View file

@ -1,5 +1,5 @@
import { ReactElement } from "react";
import { Link } from "react-router-dom-v5-compat";
import { Link } from "react-router-dom";
import { Tooltip } from "@patternfly/react-core";
import type AdminEventRepresentation from "@keycloak/keycloak-admin-client/lib/defs/adminEventRepresentation";

View file

@ -1,6 +1,6 @@
import { lazy } from "react";
import type { Path } from "react-router-dom-v5-compat";
import { generatePath } from "react-router-dom-v5-compat";
import type { Path } from "react-router-dom";
import { generatePath } from "react-router-dom";
import type { RouteDef } from "../../route-config";
export type EventsTab = "user-events" | "admin-events";

View file

@ -20,7 +20,7 @@ import { useAdminClient } from "../context/auth/AdminClient";
import { getLastId } from "./groupIdUtils";
import { useSubGroups } from "./SubGroupsContext";
import { useLocation } from "react-router-dom-v5-compat";
import { useLocation } from "react-router-dom";
export const GroupAttributes = () => {
const { t } = useTranslation("groups");

View file

@ -1,5 +1,5 @@
import { useState } from "react";
import { Link, useLocation, useNavigate } from "react-router-dom-v5-compat";
import { Link, useLocation, useNavigate } from "react-router-dom";
import { useTranslation } from "react-i18next";
import { SearchInput, ToolbarItem } from "@patternfly/react-core";

View file

@ -1,5 +1,5 @@
import { useState } from "react";
import { useLocation, useNavigate } from "react-router-dom-v5-compat";
import { useLocation, useNavigate } from "react-router-dom";
import { useTranslation } from "react-i18next";
import {
DropdownItem,

View file

@ -1,5 +1,5 @@
import { useState } from "react";
import { Link, useLocation } from "react-router-dom-v5-compat";
import { Link, useLocation } from "react-router-dom";
import { useTranslation } from "react-i18next";
import { uniqBy } from "lodash-es";
import {

View file

@ -1,5 +1,5 @@
import { useState } from "react";
import { Link } from "react-router-dom-v5-compat";
import { Link } from "react-router-dom";
import { useTranslation } from "react-i18next";
import {
Checkbox,

View file

@ -1,17 +1,14 @@
import { lazy } from "react";
import type { Path } from "react-router-dom-v5-compat";
import { generatePath } from "react-router-dom-v5-compat";
import type { Path } from "react-router-dom";
import { generatePath } from "react-router-dom";
import type { RouteDef } from "../../route-config";
export type GroupsParams = { realm: string; id?: string };
export const GroupsRoute: RouteDef = {
path: "/:realm/groups",
path: "/:realm/groups*",
component: lazy(() => import("../GroupsSection")),
access: "query-groups",
matchOptions: {
exact: false,
},
};
export const GroupsWithIdRoute: RouteDef = {

View file

@ -1,5 +1,5 @@
import { Fragment, useState } from "react";
import { Link, useNavigate } from "react-router-dom-v5-compat";
import { Link, useNavigate } from "react-router-dom";
import { useTranslation } from "react-i18next";
import { sortBy, groupBy } from "lodash-es";
import {

View file

@ -7,7 +7,7 @@ import {
} from "@patternfly/react-core";
import { FormProvider, useForm } from "react-hook-form-v7";
import { useTranslation } from "react-i18next";
import { Link, useNavigate } from "react-router-dom-v5-compat";
import { Link, useNavigate } from "react-router-dom";
import { useAlerts } from "../../components/alert/Alerts";
import { FormAccess } from "../../components/form-access/FormAccess";

View file

@ -14,7 +14,7 @@ import {
import { useState } from "react";
import { FormProvider, useForm } from "react-hook-form";
import { useTranslation } from "react-i18next";
import { Link, useNavigate } from "react-router-dom-v5-compat";
import { Link, useNavigate } from "react-router-dom";
import { useAlerts } from "../../components/alert/Alerts";
import { useConfirmDialog } from "../../components/confirm-dialog/ConfirmDialog";

View file

@ -7,7 +7,7 @@ import {
} from "@patternfly/react-core";
import { FormProvider, useForm } from "react-hook-form-v7";
import { useTranslation } from "react-i18next";
import { Link, useLocation, useNavigate } from "react-router-dom-v5-compat";
import { Link, useLocation, useNavigate } from "react-router-dom";
import { useAlerts } from "../../components/alert/Alerts";
import { FormAccess } from "../../components/form-access/FormAccess";

View file

@ -6,7 +6,7 @@ import {
} from "@patternfly/react-core";
import { FormProvider, useForm } from "react-hook-form-v7";
import { useTranslation } from "react-i18next";
import { Link, useNavigate } from "react-router-dom-v5-compat";
import { Link, useNavigate } from "react-router-dom";
import type IdentityProviderRepresentation from "@keycloak/keycloak-admin-client/lib/defs/identityProviderRepresentation";
import { useAlerts } from "../../components/alert/Alerts";

View file

@ -16,7 +16,7 @@ import {
import { useState } from "react";
import { Controller, FormProvider, useForm } from "react-hook-form-v7";
import { useTranslation } from "react-i18next";
import { Link, useNavigate } from "react-router-dom-v5-compat";
import { Link, useNavigate } from "react-router-dom";
import { useAlerts } from "../../components/alert/Alerts";
import { useConfirmDialog } from "../../components/confirm-dialog/ConfirmDialog";

View file

@ -1,7 +1,7 @@
import { FormGroup, ValidatedOptions } from "@patternfly/react-core";
import { useFormContext } from "react-hook-form-v7";
import { useTranslation } from "react-i18next";
import { useParams } from "react-router-dom-v5-compat";
import { useParams } from "react-router-dom";
import { HelpItem } from "../../components/help-enabler/HelpItem";
import { KeycloakTextInput } from "../../components/keycloak-text-input/KeycloakTextInput";

View file

@ -1,6 +1,6 @@
import { lazy } from "react";
import type { Path } from "react-router-dom-v5-compat";
import { generatePath } from "react-router-dom-v5-compat";
import type { Path } from "react-router-dom";
import { generatePath } from "react-router-dom";
import type { RouteDef } from "../../route-config";
export type IdentityProviderAddMapperParams = {

View file

@ -1,6 +1,6 @@
import { lazy } from "react";
import type { Path } from "react-router-dom-v5-compat";
import { generatePath } from "react-router-dom-v5-compat";
import type { Path } from "react-router-dom";
import { generatePath } from "react-router-dom";
import type { RouteDef } from "../../route-config";
export type IdentityProviderEditMapperParams = {

View file

@ -1,6 +1,6 @@
import { lazy } from "react";
import type { Path } from "react-router-dom-v5-compat";
import { generatePath } from "react-router-dom-v5-compat";
import type { Path } from "react-router-dom";
import { generatePath } from "react-router-dom";
import type { RouteDef } from "../../route-config";
export type IdentityProviderTab = "settings" | "mappers" | "permissions";

View file

@ -1,6 +1,6 @@
import { lazy } from "react";
import type { Path } from "react-router-dom-v5-compat";
import { generatePath } from "react-router-dom-v5-compat";
import type { Path } from "react-router-dom";
import { generatePath } from "react-router-dom";
import type { RouteDef } from "../../route-config";
export type IdentityProviderCreateParams = {

View file

@ -1,6 +1,6 @@
import { lazy } from "react";
import type { Path } from "react-router-dom-v5-compat";
import { generatePath } from "react-router-dom-v5-compat";
import type { Path } from "react-router-dom";
import { generatePath } from "react-router-dom";
import type { RouteDef } from "../../route-config";
export type IdentityProviderKeycloakOidcParams = { realm: string };

View file

@ -1,6 +1,6 @@
import { lazy } from "react";
import type { Path } from "react-router-dom-v5-compat";
import { generatePath } from "react-router-dom-v5-compat";
import type { Path } from "react-router-dom";
import { generatePath } from "react-router-dom";
import type { RouteDef } from "../../route-config";
export type IdentityProviderOidcParams = { realm: string };

View file

@ -1,6 +1,6 @@
import { lazy } from "react";
import type { Path } from "react-router-dom-v5-compat";
import { generatePath } from "react-router-dom-v5-compat";
import type { Path } from "react-router-dom";
import { generatePath } from "react-router-dom";
import type { RouteDef } from "../../route-config";
export type IdentityProviderSamlParams = { realm: string };

Some files were not shown because too many files have changed in this diff Show more