Use Link component from new React Router API (#3159)

This commit is contained in:
Jon Koops 2022-08-22 17:51:19 +02:00 committed by GitHub
parent e4882d31d6
commit 3e08fbaa4b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
56 changed files with 81 additions and 73 deletions

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";
import { Link } from "react-router-dom-v5-compat";
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,6 @@
import { useState } from "react";
import { Link, useHistory } from "react-router-dom";
import { useHistory } from "react-router-dom";
import { Link } from "react-router-dom-v5-compat";
import { Trans, useTranslation } from "react-i18next";
import { sortBy } from "lodash-es";
import {

View file

@ -1,4 +1,4 @@
import { Link } from "react-router-dom";
import { Link } from "react-router-dom-v5-compat";
import { useNavigate } from "react-router-dom-v5-compat";
import { useTranslation } from "react-i18next";
import { FormProvider, useForm } from "react-hook-form";

View file

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

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";
import { Link } from "react-router-dom-v5-compat";
import { Dropdown, DropdownItem, DropdownToggle } from "@patternfly/react-core";
import { CaretDownIcon } from "@patternfly/react-icons";

View file

@ -1,5 +1,6 @@
import { useState } from "react";
import { Link, useParams, useRouteMatch } from "react-router-dom";
import { useParams, useRouteMatch } from "react-router-dom";
import { Link } from "react-router-dom-v5-compat";
import { useNavigate } from "react-router-dom-v5-compat";
import { useTranslation } from "react-i18next";
import { FormProvider, useForm } from "react-hook-form";

View file

@ -1,5 +1,6 @@
import { useEffect, useState } from "react";
import { Link, useParams } from "react-router-dom";
import { useParams } from "react-router-dom";
import { Link } from "react-router-dom-v5-compat";
import { useTranslation } from "react-i18next";
import { Controller, useForm, useWatch } from "react-hook-form";
import {

View file

@ -13,7 +13,8 @@ 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, useHistory } from "react-router-dom";
import { useHistory } from "react-router-dom";
import { Link } from "react-router-dom-v5-compat";
import { useAlerts } from "../components/alert/Alerts";
import { useConfirmDialog } from "../components/confirm-dialog/ConfirmDialog";
import { formattedLinkTableCell } from "../components/external-link/FormattedLink";

View file

@ -1,5 +1,5 @@
import { useEffect, useRef } from "react";
import { Link } from "react-router-dom";
import { Link } from "react-router-dom-v5-compat";
import { Trans, useTranslation } from "react-i18next";
import { useFormContext } from "react-hook-form";
import {

View file

@ -11,7 +11,8 @@ import { useTranslation } from "react-i18next";
import type PolicyResultRepresentation from "@keycloak/keycloak-admin-client/lib/defs/policyResultRepresentation";
import type EvaluationResultRepresentation from "@keycloak/keycloak-admin-client/lib/defs/evaluationResultRepresentation";
import { DecisionEffect } from "@keycloak/keycloak-admin-client/lib/defs/policyRepresentation";
import { Link, useParams } from "react-router-dom";
import { useParams } from "react-router-dom";
import { Link } from "react-router-dom-v5-compat";
import { toPermissionDetails } from "../routes/PermissionDetails";
import { toPolicyDetails } from "../routes/PolicyDetails";
import { useRealm } from "../../context/realm-context/RealmContext";

View file

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

View file

@ -1,6 +1,6 @@
import { useState } from "react";
import { Link, useParams } from "react-router-dom";
import { useNavigate } from "react-router-dom-v5-compat";
import { useParams } from "react-router-dom";
import { Link, useNavigate } from "react-router-dom-v5-compat";
import { useTranslation } from "react-i18next";
import { Controller, FormProvider, useForm, useWatch } from "react-hook-form";
import {

View file

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

View file

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

View file

@ -1,6 +1,6 @@
import { useState } from "react";
import { Link, useParams } from "react-router-dom";
import { useNavigate } from "react-router-dom-v5-compat";
import { useParams } from "react-router-dom";
import { Link, useNavigate } from "react-router-dom-v5-compat";
import { Controller, FormProvider, useForm } from "react-hook-form";
import { useTranslation } from "react-i18next";
import {

View file

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

View file

@ -1,6 +1,6 @@
import { useState } from "react";
import { Link, useParams } from "react-router-dom";
import { useNavigate } from "react-router-dom-v5-compat";
import { useParams } from "react-router-dom";
import { Link, useNavigate } from "react-router-dom-v5-compat";
import { useForm } from "react-hook-form";
import { useTranslation } from "react-i18next";
import {

View file

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

View file

@ -1,6 +1,6 @@
import { FunctionComponent, useState } from "react";
import { Link, useParams } from "react-router-dom";
import { useNavigate } from "react-router-dom-v5-compat";
import { useParams } from "react-router-dom";
import { Link, useNavigate } from "react-router-dom-v5-compat";
import { useTranslation } from "react-i18next";
import { FormProvider, useForm } from "react-hook-form";
import {

View file

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

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 } from "react-router-dom";
import { Link } from "react-router-dom-v5-compat";
import { useNavigate } from "react-router-dom-v5-compat";
import { useRealm } from "../../context/realm-context/RealmContext";
import { useAdminClient } from "../../context/auth/AdminClient";

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 } from "react-router-dom";
import { Link } from "react-router-dom-v5-compat";
import { useNavigate } from "react-router-dom-v5-compat";
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 } from "react-router-dom";
import { Link } from "react-router-dom-v5-compat";
import { useTranslation } from "react-i18next";
import {
AlertVariant,

View file

@ -1,5 +1,5 @@
import { useState } from "react";
import { Link } from "react-router-dom";
import { Link } from "react-router-dom-v5-compat";
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 } from "react-router-dom";
import { Link } from "react-router-dom-v5-compat";
import { useLocation } from "react-router-dom-v5-compat";
import { useTranslation } from "react-i18next";
import { Breadcrumb, BreadcrumbItem } from "@patternfly/react-core";

View file

@ -1,5 +1,5 @@
import { isValidElement } from "react";
import { Link } from "react-router-dom";
import { Link } from "react-router-dom-v5-compat";
import useBreadcrumbs, {
BreadcrumbData,
BreadcrumbsRoute,

View file

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

View file

@ -30,7 +30,8 @@ import { pickBy } from "lodash-es";
import { useState } from "react";
import { Controller, useForm } from "react-hook-form";
import { Trans, useTranslation } from "react-i18next";
import { Link, useHistory } from "react-router-dom";
import { useHistory } from "react-router-dom";
import { Link } from "react-router-dom-v5-compat";
import { ListEmptyState } from "../components/list-empty-state/ListEmptyState";
import { KeycloakDataTable } from "../components/table-toolbar/KeycloakDataTable";
import { ViewHeader } from "../components/view-header/ViewHeader";

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,5 +1,5 @@
import { Link, useParams } from "react-router-dom";
import { useNavigate } from "react-router-dom-v5-compat";
import { useParams } from "react-router-dom";
import { Link, useNavigate } from "react-router-dom-v5-compat";
import { useTranslation } from "react-i18next";
import { FormProvider, useForm } from "react-hook-form";
import {

View file

@ -1,6 +1,6 @@
import { useState } from "react";
import { Link, useParams } from "react-router-dom";
import { useNavigate } from "react-router-dom-v5-compat";
import { useParams } from "react-router-dom";
import { Link, useNavigate } from "react-router-dom-v5-compat";
import { useTranslation } from "react-i18next";
import { FormProvider, useForm } from "react-hook-form";
import {

View file

@ -1,5 +1,5 @@
import { Link, useRouteMatch } from "react-router-dom";
import { useNavigate } from "react-router-dom-v5-compat";
import { useRouteMatch } from "react-router-dom";
import { Link, useNavigate } from "react-router-dom-v5-compat";
import { useTranslation } from "react-i18next";
import { FormProvider, useForm } from "react-hook-form";
import {

View file

@ -1,4 +1,4 @@
import { Link } from "react-router-dom";
import { Link } from "react-router-dom-v5-compat";
import { useNavigate } from "react-router-dom-v5-compat";
import { useTranslation } from "react-i18next";
import { FormProvider, useForm } from "react-hook-form";

View file

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

View file

@ -1,6 +1,6 @@
import { FunctionComponent, useState } from "react";
import { Link, useRouteMatch } from "react-router-dom";
import { useNavigate } from "react-router-dom-v5-compat";
import { useRouteMatch } from "react-router-dom";
import { Link, useNavigate } from "react-router-dom-v5-compat";
import { useTranslation } from "react-i18next";
import { AlertVariant, Button, ButtonVariant } from "@patternfly/react-core";

View file

@ -23,8 +23,8 @@ import { useTranslation } from "react-i18next";
import { useForm } from "react-hook-form";
import { FormAccess } from "../components/form-access/FormAccess";
import { ViewHeader } from "../components/view-header/ViewHeader";
import { Link, useParams } from "react-router-dom";
import { useNavigate } from "react-router-dom-v5-compat";
import { useParams } from "react-router-dom";
import { Link, useNavigate } from "react-router-dom-v5-compat";
import { useAlerts } from "../components/alert/Alerts";
import { useAdminClient, useFetch } from "../context/auth/AdminClient";
import type ClientProfileRepresentation from "@keycloak/keycloak-admin-client/lib/defs/clientProfileRepresentation";

View file

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

View file

@ -16,8 +16,8 @@ import { useAlerts } from "../components/alert/Alerts";
import { useServerInfo } from "../context/server-info/ServerInfoProvider";
import { Controller, FormProvider, useForm } from "react-hook-form";
import { HelpItem } from "../components/help-enabler/HelpItem";
import { Link, useParams } from "react-router-dom";
import { useNavigate } from "react-router-dom-v5-compat";
import { useParams } from "react-router-dom";
import { Link, useNavigate } from "react-router-dom-v5-compat";
import { useAdminClient, useFetch } from "../context/auth/AdminClient";
import type ComponentTypeRepresentation from "@keycloak/keycloak-admin-client/lib/defs/componentTypeRepresentation";
import type { ConfigPropertyRepresentation } from "@keycloak/keycloak-admin-client/lib/defs/authenticatorConfigInfoRepresentation";

View file

@ -8,8 +8,8 @@ import {
} from "@patternfly/react-core";
import { FormProvider, useForm, useFormContext } from "react-hook-form";
import { useTranslation } from "react-i18next";
import { Link, useParams } from "react-router-dom";
import { useNavigate } from "react-router-dom-v5-compat";
import { useParams } from "react-router-dom";
import { Link, useNavigate } from "react-router-dom-v5-compat";
import { ScrollForm } from "../components/scroll-form/ScrollForm";
import type UserProfileConfig from "@keycloak/keycloak-admin-client/lib/defs/userProfileConfig";
import { AttributeGeneralSettings } from "./user-profile/attribute/AttributeGeneralSettings";

View file

@ -23,8 +23,8 @@ import { useTranslation } from "react-i18next";
import { Controller, useForm } from "react-hook-form";
import { FormAccess } from "../components/form-access/FormAccess";
import { ViewHeader } from "../components/view-header/ViewHeader";
import { Link, useParams } from "react-router-dom";
import { useNavigate } from "react-router-dom-v5-compat";
import { useParams } from "react-router-dom";
import { Link, useNavigate } from "react-router-dom-v5-compat";
import { useRealm } from "../context/realm-context/RealmContext";
import { useAlerts } from "../components/alert/Alerts";
import { useAdminClient, useFetch } from "../context/auth/AdminClient";

View file

@ -19,7 +19,7 @@ import { useTranslation } from "react-i18next";
import { useAdminClient, useFetch } from "../context/auth/AdminClient";
import { prettyPrintJSON } from "../util";
import { CodeEditor, Language } from "@patternfly/react-code-editor";
import { Link } from "react-router-dom";
import { Link } from "react-router-dom-v5-compat";
import { useNavigate } from "react-router-dom-v5-compat";
import type ClientPolicyRepresentation from "@keycloak/keycloak-admin-client/lib/defs/clientPolicyRepresentation";
import { useConfirmDialog } from "../components/confirm-dialog/ConfirmDialog";

View file

@ -20,7 +20,7 @@ import { useConfirmDialog } from "../components/confirm-dialog/ConfirmDialog";
import { useRealm } from "../context/realm-context/RealmContext";
import { useAlerts } from "../components/alert/Alerts";
import { prettyPrintJSON } from "../util";
import { Link } from "react-router-dom";
import { Link } from "react-router-dom-v5-compat";
import { toAddClientProfile } from "./routes/AddClientProfile";
import type ClientProfileRepresentation from "@keycloak/keycloak-admin-client/lib/defs/clientProfileRepresentation";
import { toClientProfile } from "./routes/ClientProfile";

View file

@ -26,7 +26,8 @@ import { useAdminClient } from "../../context/auth/AdminClient";
import { useAlerts } from "../../components/alert/Alerts";
import { useConfirmDialog } from "../../components/confirm-dialog/ConfirmDialog";
import { useRealm } from "../../context/realm-context/RealmContext";
import { Link, useRouteMatch } from "react-router-dom";
import { useRouteMatch } from "react-router-dom";
import { Link } from "react-router-dom-v5-compat";
import { KEY_PROVIDER_TYPE } from "../../util";
import { DraggableTable } from "../../authentication/components/DraggableTable";
import { KeyProviderModal } from "./key-providers/KeyProviderModal";

View file

@ -10,8 +10,8 @@ import {
import { useEffect, useMemo } from "react";
import { FormProvider, SubmitHandler, useForm } from "react-hook-form";
import { useTranslation } from "react-i18next";
import { Link, useParams } from "react-router-dom";
import { useNavigate } from "react-router-dom-v5-compat";
import { useParams } from "react-router-dom";
import { Link, useNavigate } from "react-router-dom-v5-compat";
import { KeyValueInput } from "../../components/key-value-form/KeyValueInput";
import { FormAccess } from "../../components/form-access/FormAccess";
import { HelpItem } from "../../components/help-enabler/HelpItem";

View file

@ -7,7 +7,7 @@ import {
} from "@patternfly/react-core";
import { useEffect, useState } from "react";
import { Trans, useTranslation } from "react-i18next";
import { Link } from "react-router-dom";
import { Link } from "react-router-dom-v5-compat";
import { useNavigate } from "react-router-dom-v5-compat";
import { useConfirmDialog } from "../../components/confirm-dialog/ConfirmDialog";
import { ListEmptyState } from "../../components/list-empty-state/ListEmptyState";

View file

@ -15,7 +15,7 @@ import { FilterIcon } from "@patternfly/react-icons";
import { KeycloakSpinner } from "../../components/keycloak-spinner/KeycloakSpinner";
import { DraggableTable } from "../../authentication/components/DraggableTable";
import { Link } from "react-router-dom";
import { Link } from "react-router-dom-v5-compat";
import { useNavigate } from "react-router-dom-v5-compat";
import { toAddAttribute } from "../routes/AddAttribute";
import { useRealm } from "../../context/realm-context/RealmContext";

View file

@ -9,7 +9,7 @@ import {
import { CubesIcon } from "@patternfly/react-icons";
import { useMemo, useState } from "react";
import { useTranslation } from "react-i18next";
import { Link } from "react-router-dom";
import { Link } from "react-router-dom-v5-compat";
import { toClient } from "../clients/routes/Client";
import { useAlerts } from "../components/alert/Alerts";

View file

@ -1,6 +1,6 @@
import { useState } from "react";
import { Link, useParams } from "react-router-dom";
import { useNavigate } from "react-router-dom-v5-compat";
import { useParams } from "react-router-dom";
import { Link, useNavigate } from "react-router-dom-v5-compat";
import { useTranslation } from "react-i18next";
import { FormProvider, useForm } from "react-hook-form";
import {

View file

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

View file

@ -12,7 +12,8 @@ import {
import { FormPanel } from "../components/scroll-form/FormPanel";
import { KeycloakDataTable } from "../components/table-toolbar/KeycloakDataTable";
import { cellWidth } from "@patternfly/react-table";
import { Link, useParams } from "react-router-dom";
import { useParams } from "react-router-dom";
import { Link } from "react-router-dom-v5-compat";
import { useAdminClient } from "../context/auth/AdminClient";
import { emptyFormatter, upperCaseFormatter } from "../util";
import type IdentityProviderRepresentation from "@keycloak/keycloak-admin-client/lib/defs/identityProviderRepresentation";

View file

@ -31,8 +31,8 @@ import type ComponentRepresentation from "@keycloak/keycloak-admin-client/lib/de
import type UserRepresentation from "@keycloak/keycloak-admin-client/lib/defs/userRepresentation";
import { useState } from "react";
import { useTranslation } from "react-i18next";
import { Link, useHistory } from "react-router-dom";
import { useNavigate } from "react-router-dom-v5-compat";
import { useHistory } from "react-router-dom";
import { Link, useNavigate } from "react-router-dom-v5-compat";
import { useAlerts } from "../components/alert/Alerts";
import { useConfirmDialog } from "../components/confirm-dialog/ConfirmDialog";
import { ListEmptyState } from "../components/list-empty-state/ListEmptyState";