Replace 'useHistory' with React Router v6 APIs (#3115)
This commit is contained in:
parent
9a3aa33079
commit
7c9449b42b
61 changed files with 279 additions and 243 deletions
|
@ -1,5 +1,6 @@
|
||||||
import { FormEvent, FunctionComponent } from "react";
|
import { FormEvent, FunctionComponent } from "react";
|
||||||
import { NavLink, useHistory, useRouteMatch } from "react-router-dom";
|
import { NavLink, useRouteMatch } from "react-router-dom";
|
||||||
|
import { useLocation, useNavigate } from "react-router-dom-v5-compat";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import {
|
import {
|
||||||
Nav,
|
Nav,
|
||||||
|
@ -20,8 +21,8 @@ export const PageNav: FunctionComponent = () => {
|
||||||
const { t } = useTranslation("common");
|
const { t } = useTranslation("common");
|
||||||
const { hasAccess, hasSomeAccess } = useAccess();
|
const { hasAccess, hasSomeAccess } = useAccess();
|
||||||
const { realm } = useRealm();
|
const { realm } = useRealm();
|
||||||
|
const location = useLocation();
|
||||||
const history = useHistory();
|
const navigate = useNavigate();
|
||||||
|
|
||||||
type SelectedItem = {
|
type SelectedItem = {
|
||||||
groupId: number | string;
|
groupId: number | string;
|
||||||
|
@ -31,7 +32,7 @@ export const PageNav: FunctionComponent = () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const onSelect = (item: SelectedItem) => {
|
const onSelect = (item: SelectedItem) => {
|
||||||
history.push(item.to);
|
navigate(item.to);
|
||||||
item.event.preventDefault();
|
item.event.preventDefault();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -52,7 +53,7 @@ export const PageNav: FunctionComponent = () => {
|
||||||
}
|
}
|
||||||
|
|
||||||
//remove "/realm-name" from the start of the path
|
//remove "/realm-name" from the start of the path
|
||||||
const activeItem = history.location.pathname.substring(realm.length + 1);
|
const activeItem = location.pathname.substring(realm.length + 1);
|
||||||
return (
|
return (
|
||||||
<li>
|
<li>
|
||||||
<NavLink
|
<NavLink
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { useHistory, useParams } from "react-router-dom";
|
import { useParams } from "react-router-dom";
|
||||||
|
import { useNavigate } from "react-router-dom-v5-compat";
|
||||||
import { Trans, useTranslation } from "react-i18next";
|
import { Trans, useTranslation } from "react-i18next";
|
||||||
import {
|
import {
|
||||||
DataList,
|
DataList,
|
||||||
|
@ -59,7 +60,7 @@ export default function FlowDetails() {
|
||||||
const { realm } = useRealm();
|
const { realm } = useRealm();
|
||||||
const { addAlert, addError } = useAlerts();
|
const { addAlert, addError } = useAlerts();
|
||||||
const { id, usedBy, builtIn } = useParams<FlowParams>();
|
const { id, usedBy, builtIn } = useParams<FlowParams>();
|
||||||
const history = useHistory();
|
const navigate = useNavigate();
|
||||||
const [key, setKey] = useState(0);
|
const [key, setKey] = useState(0);
|
||||||
const refresh = () => setKey(new Date().getTime());
|
const refresh = () => setKey(new Date().getTime());
|
||||||
|
|
||||||
|
@ -222,7 +223,7 @@ export default function FlowDetails() {
|
||||||
await adminClient.authenticationManagement.deleteFlow({
|
await adminClient.authenticationManagement.deleteFlow({
|
||||||
flowId: flow!.id!,
|
flowId: flow!.id!,
|
||||||
});
|
});
|
||||||
history.push(toAuthentication({ realm }));
|
navigate(toAuthentication({ realm }));
|
||||||
addAlert(t("deleteFlowSuccess"), AlertVariant.success);
|
addAlert(t("deleteFlowSuccess"), AlertVariant.success);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
addError("authentication:deleteFlowError", error);
|
addError("authentication:deleteFlowError", error);
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import { Link, useHistory } from "react-router-dom";
|
import { Link } from "react-router-dom";
|
||||||
|
import { useNavigate } from "react-router-dom-v5-compat";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { FormProvider, useForm } from "react-hook-form";
|
import { FormProvider, useForm } from "react-hook-form";
|
||||||
import {
|
import {
|
||||||
|
@ -21,7 +22,7 @@ import { toAuthentication } from "../routes/Authentication";
|
||||||
|
|
||||||
export default function CreateFlow() {
|
export default function CreateFlow() {
|
||||||
const { t } = useTranslation("authentication");
|
const { t } = useTranslation("authentication");
|
||||||
const history = useHistory();
|
const navigate = useNavigate();
|
||||||
const { realm } = useRealm();
|
const { realm } = useRealm();
|
||||||
const form = useForm<AuthenticationFlowRepresentation>({
|
const form = useForm<AuthenticationFlowRepresentation>({
|
||||||
defaultValues: { builtIn: false, topLevel: true },
|
defaultValues: { builtIn: false, topLevel: true },
|
||||||
|
@ -37,7 +38,7 @@ export default function CreateFlow() {
|
||||||
flow
|
flow
|
||||||
);
|
);
|
||||||
addAlert(t("flowCreatedSuccess"), AlertVariant.success);
|
addAlert(t("flowCreatedSuccess"), AlertVariant.success);
|
||||||
history.push(
|
navigate(
|
||||||
toFlow({
|
toFlow({
|
||||||
realm,
|
realm,
|
||||||
id: id!,
|
id: id!,
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { Link, useHistory, useParams, useRouteMatch } from "react-router-dom";
|
import { Link, useParams, useRouteMatch } from "react-router-dom";
|
||||||
|
import { useNavigate } from "react-router-dom-v5-compat";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { FormProvider, useForm } from "react-hook-form";
|
import { FormProvider, useForm } from "react-hook-form";
|
||||||
import {
|
import {
|
||||||
|
@ -45,7 +46,7 @@ export default function MappingDetails() {
|
||||||
protocolMapper?: string;
|
protocolMapper?: string;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
const history = useHistory();
|
const navigate = useNavigate();
|
||||||
const { realm } = useRealm();
|
const { realm } = useRealm();
|
||||||
const serverInfo = useServerInfo();
|
const serverInfo = useServerInfo();
|
||||||
const isGuid = /^[{]?[0-9a-fA-F]{8}-([0-9a-fA-F]{4}-){3}[0-9a-fA-F]{12}[}]?$/;
|
const isGuid = /^[{]?[0-9a-fA-F]{8}-([0-9a-fA-F]{4}-){3}[0-9a-fA-F]{12}[}]?$/;
|
||||||
|
@ -142,7 +143,7 @@ export default function MappingDetails() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
addAlert(t("common:mappingDeletedSuccess"), AlertVariant.success);
|
addAlert(t("common:mappingDeletedSuccess"), AlertVariant.success);
|
||||||
history.push(toDetails());
|
navigate(toDetails());
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
addError("common:mappingDeletedError", error);
|
addError("common:mappingDeletedError", error);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { useHistory, useParams } from "react-router-dom";
|
import { useHistory, useParams } from "react-router-dom";
|
||||||
|
import { useNavigate } from "react-router-dom-v5-compat";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import {
|
import {
|
||||||
AlertVariant,
|
AlertVariant,
|
||||||
|
@ -40,6 +41,7 @@ export default function ClientScopeForm() {
|
||||||
const [clientScope, setClientScope] =
|
const [clientScope, setClientScope] =
|
||||||
useState<ClientScopeDefaultOptionalType>();
|
useState<ClientScopeDefaultOptionalType>();
|
||||||
const history = useHistory();
|
const history = useHistory();
|
||||||
|
const navigate = useNavigate();
|
||||||
const { realm } = useRealm();
|
const { realm } = useRealm();
|
||||||
|
|
||||||
const { adminClient } = useAdminClient();
|
const { adminClient } = useAdminClient();
|
||||||
|
@ -97,7 +99,7 @@ export default function ClientScopeForm() {
|
||||||
{ ...clientScopes, id: scope.id },
|
{ ...clientScopes, id: scope.id },
|
||||||
clientScopes.type
|
clientScopes.type
|
||||||
);
|
);
|
||||||
history.push(
|
navigate(
|
||||||
toClientScope({
|
toClientScope({
|
||||||
realm,
|
realm,
|
||||||
id: scope.id!,
|
id: scope.id!,
|
||||||
|
@ -166,7 +168,7 @@ export default function ClientScopeForm() {
|
||||||
): Promise<void> => {
|
): Promise<void> => {
|
||||||
if (!Array.isArray(mappers)) {
|
if (!Array.isArray(mappers)) {
|
||||||
const mapper = mappers as ProtocolMapperTypeRepresentation;
|
const mapper = mappers as ProtocolMapperTypeRepresentation;
|
||||||
history.push(
|
navigate(
|
||||||
toMapper({
|
toMapper({
|
||||||
realm,
|
realm,
|
||||||
id: clientScope!.id!,
|
id: clientScope!.id!,
|
||||||
|
|
|
@ -17,6 +17,7 @@ import { useMemo, useState } from "react";
|
||||||
import { Controller, FormProvider, useForm, useWatch } from "react-hook-form";
|
import { Controller, FormProvider, useForm, useWatch } from "react-hook-form";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { useHistory, useParams } from "react-router-dom";
|
import { useHistory, useParams } from "react-router-dom";
|
||||||
|
import { useNavigate } from "react-router-dom-v5-compat";
|
||||||
import { useAlerts } from "../components/alert/Alerts";
|
import { useAlerts } from "../components/alert/Alerts";
|
||||||
import {
|
import {
|
||||||
ConfirmDialogModal,
|
ConfirmDialogModal,
|
||||||
|
@ -197,6 +198,7 @@ export default function ClientDetails() {
|
||||||
const hasViewUsers = hasAccess("view-users");
|
const hasViewUsers = hasAccess("view-users");
|
||||||
|
|
||||||
const history = useHistory();
|
const history = useHistory();
|
||||||
|
const navigate = useNavigate();
|
||||||
|
|
||||||
const [downloadDialogOpen, toggleDownloadDialogOpen] = useToggle();
|
const [downloadDialogOpen, toggleDownloadDialogOpen] = useToggle();
|
||||||
const [changeAuthenticatorOpen, toggleChangeAuthenticatorOpen] = useToggle();
|
const [changeAuthenticatorOpen, toggleChangeAuthenticatorOpen] = useToggle();
|
||||||
|
@ -227,7 +229,7 @@ export default function ClientDetails() {
|
||||||
try {
|
try {
|
||||||
await adminClient.clients.del({ id: clientId });
|
await adminClient.clients.del({ id: clientId });
|
||||||
addAlert(t("clientDeletedSuccess"), AlertVariant.success);
|
addAlert(t("clientDeletedSuccess"), AlertVariant.success);
|
||||||
history.push(toClients({ realm }));
|
navigate(toClients({ realm }));
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
addError("clients:clientDeleteError", error);
|
addError("clients:clientDeleteError", error);
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,7 @@ import type ClientRepresentation from "@keycloak/keycloak-admin-client/lib/defs/
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { FormProvider, useForm } from "react-hook-form";
|
import { FormProvider, useForm } from "react-hook-form";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { useHistory } from "react-router-dom";
|
import { useNavigate } from "react-router-dom-v5-compat";
|
||||||
import { useAlerts } from "../../components/alert/Alerts";
|
import { useAlerts } from "../../components/alert/Alerts";
|
||||||
import { ViewHeader } from "../../components/view-header/ViewHeader";
|
import { ViewHeader } from "../../components/view-header/ViewHeader";
|
||||||
import { useAdminClient } from "../../context/auth/AdminClient";
|
import { useAdminClient } from "../../context/auth/AdminClient";
|
||||||
|
@ -25,7 +25,7 @@ export default function NewClientForm() {
|
||||||
const { t } = useTranslation("clients");
|
const { t } = useTranslation("clients");
|
||||||
const { realm } = useRealm();
|
const { realm } = useRealm();
|
||||||
const { adminClient } = useAdminClient();
|
const { adminClient } = useAdminClient();
|
||||||
const history = useHistory();
|
const navigate = useNavigate();
|
||||||
|
|
||||||
const [showCapabilityConfig, setShowCapabilityConfig] = useState(false);
|
const [showCapabilityConfig, setShowCapabilityConfig] = useState(false);
|
||||||
const [client, setClient] = useState<ClientRepresentation>({
|
const [client, setClient] = useState<ClientRepresentation>({
|
||||||
|
@ -52,9 +52,7 @@ export default function NewClientForm() {
|
||||||
clientId: client.clientId?.trim(),
|
clientId: client.clientId?.trim(),
|
||||||
});
|
});
|
||||||
addAlert(t("createSuccess"), AlertVariant.success);
|
addAlert(t("createSuccess"), AlertVariant.success);
|
||||||
history.push(
|
navigate(toClient({ realm, clientId: newClient.id, tab: "settings" }));
|
||||||
toClient({ realm, clientId: newClient.id, tab: "settings" })
|
|
||||||
);
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
addError("clients:createError", error);
|
addError("clients:createError", error);
|
||||||
}
|
}
|
||||||
|
@ -138,7 +136,7 @@ export default function NewClientForm() {
|
||||||
<PageSection variant="light">
|
<PageSection variant="light">
|
||||||
<FormProvider {...methods}>
|
<FormProvider {...methods}>
|
||||||
<Wizard
|
<Wizard
|
||||||
onClose={() => history.push(toClients({ realm }))}
|
onClose={() => navigate(toClients({ realm }))}
|
||||||
navAriaLabel={`${title} steps`}
|
navAriaLabel={`${title} steps`}
|
||||||
mainAriaLabel={`${title} content`}
|
mainAriaLabel={`${title} content`}
|
||||||
steps={[
|
steps={[
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { useHistory } from "react-router-dom";
|
import { useNavigate } from "react-router-dom-v5-compat";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import {
|
import {
|
||||||
EmptyState,
|
EmptyState,
|
||||||
|
@ -27,7 +27,7 @@ const EmptyButton = ({
|
||||||
}: EmptyButtonProps) => {
|
}: EmptyButtonProps) => {
|
||||||
const { t } = useTranslation("clients");
|
const { t } = useTranslation("clients");
|
||||||
const { realm } = useRealm();
|
const { realm } = useRealm();
|
||||||
const history = useHistory();
|
const navigate = useNavigate();
|
||||||
return (
|
return (
|
||||||
<Button
|
<Button
|
||||||
data-testid={`create-${permissionType}`}
|
data-testid={`create-${permissionType}`}
|
||||||
|
@ -37,7 +37,7 @@ const EmptyButton = ({
|
||||||
variant="secondary"
|
variant="secondary"
|
||||||
onClick={() =>
|
onClick={() =>
|
||||||
!disabled &&
|
!disabled &&
|
||||||
history.push(toNewPermission({ realm, id: clientId, permissionType }))
|
navigate(toNewPermission({ realm, id: clientId, permissionType }))
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
{t(`create${toUpperCase(permissionType)}BasedPermission`)}
|
{t(`create${toUpperCase(permissionType)}BasedPermission`)}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { Link, useHistory, useParams } from "react-router-dom";
|
import { Link, useParams } from "react-router-dom";
|
||||||
|
import { useNavigate } from "react-router-dom-v5-compat";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { Controller, FormProvider, useForm, useWatch } from "react-hook-form";
|
import { Controller, FormProvider, useForm, useWatch } from "react-hook-form";
|
||||||
import {
|
import {
|
||||||
|
@ -46,7 +47,7 @@ export default function PermissionDetails() {
|
||||||
});
|
});
|
||||||
const { register, control, reset, errors, handleSubmit } = form;
|
const { register, control, reset, errors, handleSubmit } = form;
|
||||||
|
|
||||||
const history = useHistory();
|
const navigate = useNavigate();
|
||||||
const { id, realm, permissionType, permissionId, selectedId } = useParams<
|
const { id, realm, permissionType, permissionId, selectedId } = useParams<
|
||||||
NewPermissionParams & PermissionDetailsParams
|
NewPermissionParams & PermissionDetailsParams
|
||||||
>();
|
>();
|
||||||
|
@ -116,7 +117,7 @@ export default function PermissionDetails() {
|
||||||
{ id, type: permissionType },
|
{ id, type: permissionType },
|
||||||
permission
|
permission
|
||||||
);
|
);
|
||||||
history.push(
|
navigate(
|
||||||
toPermissionDetails({
|
toPermissionDetails({
|
||||||
realm,
|
realm,
|
||||||
id,
|
id,
|
||||||
|
@ -149,7 +150,7 @@ export default function PermissionDetails() {
|
||||||
permissionId: permissionId,
|
permissionId: permissionId,
|
||||||
});
|
});
|
||||||
addAlert(t("permissionDeletedSuccess"), AlertVariant.success);
|
addAlert(t("permissionDeletedSuccess"), AlertVariant.success);
|
||||||
history.push(
|
navigate(
|
||||||
toAuthorizationTab({ realm, clientId: id, tab: "permissions" })
|
toAuthorizationTab({ realm, clientId: id, tab: "permissions" })
|
||||||
);
|
);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { Link, useHistory } from "react-router-dom";
|
import { Link } from "react-router-dom";
|
||||||
|
import { useNavigate } from "react-router-dom-v5-compat";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import {
|
import {
|
||||||
AlertVariant,
|
AlertVariant,
|
||||||
|
@ -52,7 +53,7 @@ type ExpandablePolicyRepresentation = PolicyRepresentation & {
|
||||||
|
|
||||||
export const AuthorizationPermissions = ({ clientId }: PermissionsProps) => {
|
export const AuthorizationPermissions = ({ clientId }: PermissionsProps) => {
|
||||||
const { t } = useTranslation("clients");
|
const { t } = useTranslation("clients");
|
||||||
const history = useHistory();
|
const navigate = useNavigate();
|
||||||
const { adminClient } = useAdminClient();
|
const { adminClient } = useAdminClient();
|
||||||
const { addAlert, addError } = useAlerts();
|
const { addAlert, addError } = useAlerts();
|
||||||
const { realm } = useRealm();
|
const { realm } = useRealm();
|
||||||
|
@ -216,7 +217,7 @@ export const AuthorizationPermissions = ({ clientId }: PermissionsProps) => {
|
||||||
isDisabled={disabledCreate?.resources}
|
isDisabled={disabledCreate?.resources}
|
||||||
component="button"
|
component="button"
|
||||||
onClick={() =>
|
onClick={() =>
|
||||||
history.push(
|
navigate(
|
||||||
toNewPermission({
|
toNewPermission({
|
||||||
realm,
|
realm,
|
||||||
id: clientId,
|
id: clientId,
|
||||||
|
@ -233,7 +234,7 @@ export const AuthorizationPermissions = ({ clientId }: PermissionsProps) => {
|
||||||
isDisabled={disabledCreate?.scopes}
|
isDisabled={disabledCreate?.scopes}
|
||||||
component="button"
|
component="button"
|
||||||
onClick={() =>
|
onClick={() =>
|
||||||
history.push(
|
navigate(
|
||||||
toNewPermission({
|
toNewPermission({
|
||||||
realm,
|
realm,
|
||||||
id: clientId,
|
id: clientId,
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { Link, useHistory } from "react-router-dom";
|
import { Link } from "react-router-dom";
|
||||||
|
import { useNavigate } from "react-router-dom-v5-compat";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import {
|
import {
|
||||||
Alert,
|
Alert,
|
||||||
|
@ -52,7 +53,7 @@ export const AuthorizationPolicies = ({ clientId }: PoliciesProps) => {
|
||||||
const { adminClient } = useAdminClient();
|
const { adminClient } = useAdminClient();
|
||||||
const { addAlert, addError } = useAlerts();
|
const { addAlert, addError } = useAlerts();
|
||||||
const { realm } = useRealm();
|
const { realm } = useRealm();
|
||||||
const history = useHistory();
|
const navigate = useNavigate();
|
||||||
|
|
||||||
const [policies, setPolicies] = useState<ExpandablePolicyRepresentation[]>();
|
const [policies, setPolicies] = useState<ExpandablePolicyRepresentation[]>();
|
||||||
const [selectedPolicy, setSelectedPolicy] =
|
const [selectedPolicy, setSelectedPolicy] =
|
||||||
|
@ -172,7 +173,7 @@ export const AuthorizationPolicies = ({ clientId }: PoliciesProps) => {
|
||||||
<NewPolicyDialog
|
<NewPolicyDialog
|
||||||
policyProviders={policyProviders}
|
policyProviders={policyProviders}
|
||||||
onSelect={(p) =>
|
onSelect={(p) =>
|
||||||
history.push(
|
navigate(
|
||||||
toCreatePolicy({ id: clientId, realm, policyType: p.type! })
|
toCreatePolicy({ id: clientId, realm, policyType: p.type! })
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -319,7 +320,7 @@ export const AuthorizationPolicies = ({ clientId }: PoliciesProps) => {
|
||||||
(p) => p.type !== "aggregate"
|
(p) => p.type !== "aggregate"
|
||||||
)}
|
)}
|
||||||
onSelect={(p) =>
|
onSelect={(p) =>
|
||||||
history.push(
|
navigate(
|
||||||
toCreatePolicy({ id: clientId, realm, policyType: p.type! })
|
toCreatePolicy({ id: clientId, realm, policyType: p.type! })
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { Link, useHistory, useParams } from "react-router-dom";
|
import { Link, useParams } from "react-router-dom";
|
||||||
|
import { useNavigate } from "react-router-dom-v5-compat";
|
||||||
import { Controller, FormProvider, useForm } from "react-hook-form";
|
import { Controller, FormProvider, useForm } from "react-hook-form";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import {
|
import {
|
||||||
|
@ -57,7 +58,7 @@ export default function ResourceDetails() {
|
||||||
const { register, errors, control, setValue, handleSubmit } = form;
|
const { register, errors, control, setValue, handleSubmit } = form;
|
||||||
|
|
||||||
const { id, resourceId, realm } = useParams<ResourceDetailsParams>();
|
const { id, resourceId, realm } = useParams<ResourceDetailsParams>();
|
||||||
const history = useHistory();
|
const navigate = useNavigate();
|
||||||
|
|
||||||
const setupForm = (resource: ResourceRepresentation = {}) => {
|
const setupForm = (resource: ResourceRepresentation = {}) => {
|
||||||
convertToFormValues(resource, setValue);
|
convertToFormValues(resource, setValue);
|
||||||
|
@ -100,7 +101,7 @@ export default function ResourceDetails() {
|
||||||
{ id },
|
{ id },
|
||||||
resource
|
resource
|
||||||
);
|
);
|
||||||
history.push(toResourceDetails({ realm, id, resourceId: result._id! }));
|
navigate(toResourceDetails({ realm, id, resourceId: result._id! }));
|
||||||
}
|
}
|
||||||
addAlert(
|
addAlert(
|
||||||
t((resourceId ? "update" : "create") + "ResourceSuccess"),
|
t((resourceId ? "update" : "create") + "ResourceSuccess"),
|
||||||
|
@ -143,9 +144,7 @@ export default function ResourceDetails() {
|
||||||
resourceId: resourceId!,
|
resourceId: resourceId!,
|
||||||
});
|
});
|
||||||
addAlert(t("resourceDeletedSuccess"), AlertVariant.success);
|
addAlert(t("resourceDeletedSuccess"), AlertVariant.success);
|
||||||
history.push(
|
navigate(toAuthorizationTab({ realm, clientId: id, tab: "resources" }));
|
||||||
toAuthorizationTab({ realm, clientId: id, tab: "resources" })
|
|
||||||
);
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
addError("clients:resourceDeletedError", error);
|
addError("clients:resourceDeletedError", error);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { Link, useHistory, useParams } from "react-router-dom";
|
import { Link, useParams } from "react-router-dom";
|
||||||
|
import { useNavigate } from "react-router-dom-v5-compat";
|
||||||
import { useForm } from "react-hook-form";
|
import { useForm } from "react-hook-form";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import {
|
import {
|
||||||
|
@ -28,7 +29,7 @@ import { DeleteScopeDialog } from "./DeleteScopeDialog";
|
||||||
export default function ScopeDetails() {
|
export default function ScopeDetails() {
|
||||||
const { t } = useTranslation("clients");
|
const { t } = useTranslation("clients");
|
||||||
const { id, scopeId, realm } = useParams<ScopeDetailsParams>();
|
const { id, scopeId, realm } = useParams<ScopeDetailsParams>();
|
||||||
const history = useHistory();
|
const navigate = useNavigate();
|
||||||
|
|
||||||
const { adminClient } = useAdminClient();
|
const { adminClient } = useAdminClient();
|
||||||
const { addAlert, addError } = useAlerts();
|
const { addAlert, addError } = useAlerts();
|
||||||
|
@ -81,9 +82,7 @@ export default function ScopeDetails() {
|
||||||
iconUri: scope.iconUri,
|
iconUri: scope.iconUri,
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
history.push(
|
navigate(toAuthorizationTab({ realm, clientId: id, tab: "scopes" }));
|
||||||
toAuthorizationTab({ realm, clientId: id, tab: "scopes" })
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
addAlert(
|
addAlert(
|
||||||
t((scopeId ? "update" : "create") + "ScopeSuccess"),
|
t((scopeId ? "update" : "create") + "ScopeSuccess"),
|
||||||
|
@ -102,9 +101,7 @@ export default function ScopeDetails() {
|
||||||
toggleDialog={toggleDeleteDialog}
|
toggleDialog={toggleDeleteDialog}
|
||||||
selectedScope={scope}
|
selectedScope={scope}
|
||||||
refresh={() =>
|
refresh={() =>
|
||||||
history.push(
|
navigate(toAuthorizationTab({ realm, clientId: id, tab: "scopes" }))
|
||||||
toAuthorizationTab({ realm, clientId: id, tab: "scopes" })
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
<ViewHeader
|
<ViewHeader
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { Link, useHistory } from "react-router-dom";
|
import { Link } from "react-router-dom";
|
||||||
|
import { useNavigate } from "react-router-dom-v5-compat";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import {
|
import {
|
||||||
Button,
|
Button,
|
||||||
|
@ -46,7 +47,7 @@ export type ExpandableScopeRepresentation = ScopeRepresentation & {
|
||||||
|
|
||||||
export const AuthorizationScopes = ({ clientId }: ScopesProps) => {
|
export const AuthorizationScopes = ({ clientId }: ScopesProps) => {
|
||||||
const { t } = useTranslation("clients");
|
const { t } = useTranslation("clients");
|
||||||
const history = useHistory();
|
const navigate = useNavigate();
|
||||||
const { adminClient } = useAdminClient();
|
const { adminClient } = useAdminClient();
|
||||||
const { realm } = useRealm();
|
const { realm } = useRealm();
|
||||||
|
|
||||||
|
@ -291,9 +292,7 @@ export const AuthorizationScopes = ({ clientId }: ScopesProps) => {
|
||||||
<ListEmptyState
|
<ListEmptyState
|
||||||
message={t("emptyAuthorizationScopes")}
|
message={t("emptyAuthorizationScopes")}
|
||||||
instructions={t("emptyAuthorizationInstructions")}
|
instructions={t("emptyAuthorizationInstructions")}
|
||||||
onPrimaryAction={() =>
|
onPrimaryAction={() => navigate(toNewScope({ id: clientId, realm }))}
|
||||||
history.push(toNewScope({ id: clientId, realm }))
|
|
||||||
}
|
|
||||||
primaryActionText={t("createAuthorizationScope")}
|
primaryActionText={t("createAuthorizationScope")}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import { FunctionComponent, useState } from "react";
|
import { FunctionComponent, useState } from "react";
|
||||||
import { Link, useHistory, useParams } from "react-router-dom";
|
import { Link, useParams } from "react-router-dom";
|
||||||
|
import { useNavigate } from "react-router-dom-v5-compat";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { FormProvider, useForm } from "react-hook-form";
|
import { FormProvider, useForm } from "react-hook-form";
|
||||||
import {
|
import {
|
||||||
|
@ -62,7 +63,7 @@ export const isValidComponentType = (value: string) => value in COMPONENTS;
|
||||||
export default function PolicyDetails() {
|
export default function PolicyDetails() {
|
||||||
const { t } = useTranslation("clients");
|
const { t } = useTranslation("clients");
|
||||||
const { id, realm, policyId, policyType } = useParams<PolicyDetailsParams>();
|
const { id, realm, policyId, policyType } = useParams<PolicyDetailsParams>();
|
||||||
const history = useHistory();
|
const navigate = useNavigate();
|
||||||
const form = useForm({ shouldUnregister: false });
|
const form = useForm({ shouldUnregister: false });
|
||||||
const { reset, handleSubmit } = form;
|
const { reset, handleSubmit } = form;
|
||||||
|
|
||||||
|
@ -123,7 +124,7 @@ export default function PolicyDetails() {
|
||||||
{ id, type: policyType },
|
{ id, type: policyType },
|
||||||
policy
|
policy
|
||||||
);
|
);
|
||||||
history.push(
|
navigate(
|
||||||
toPolicyDetails({
|
toPolicyDetails({
|
||||||
realm,
|
realm,
|
||||||
id,
|
id,
|
||||||
|
@ -152,9 +153,7 @@ export default function PolicyDetails() {
|
||||||
policyId,
|
policyId,
|
||||||
});
|
});
|
||||||
addAlert(t("policyDeletedSuccess"), AlertVariant.success);
|
addAlert(t("policyDeletedSuccess"), AlertVariant.success);
|
||||||
history.push(
|
navigate(toAuthorizationTab({ realm, clientId: id, tab: "policies" }));
|
||||||
toAuthorizationTab({ realm, clientId: id, tab: "policies" })
|
|
||||||
);
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
addError("clients:policyDeletedError", error);
|
addError("clients:policyDeletedError", error);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { Link, useHistory } from "react-router-dom";
|
import { Link } from "react-router-dom";
|
||||||
|
import { useNavigate } from "react-router-dom-v5-compat";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { FormProvider, useForm } from "react-hook-form";
|
import { FormProvider, useForm } from "react-hook-form";
|
||||||
import {
|
import {
|
||||||
|
@ -35,7 +36,7 @@ const isXml = (text: string) => text.startsWith("<");
|
||||||
|
|
||||||
export default function ImportForm() {
|
export default function ImportForm() {
|
||||||
const { t } = useTranslation("clients");
|
const { t } = useTranslation("clients");
|
||||||
const history = useHistory();
|
const navigate = useNavigate();
|
||||||
const { adminClient } = useAdminClient();
|
const { adminClient } = useAdminClient();
|
||||||
const { realm } = useRealm();
|
const { realm } = useRealm();
|
||||||
const form = useForm<ClientRepresentation>({ shouldUnregister: false });
|
const form = useForm<ClientRepresentation>({ shouldUnregister: false });
|
||||||
|
@ -89,9 +90,7 @@ export default function ImportForm() {
|
||||||
...convertFormValuesToObject(client),
|
...convertFormValuesToObject(client),
|
||||||
});
|
});
|
||||||
addAlert(t("clientImportSuccess"), AlertVariant.success);
|
addAlert(t("clientImportSuccess"), AlertVariant.success);
|
||||||
history.push(
|
navigate(toClient({ realm, clientId: newClient.id, tab: "settings" }));
|
||||||
toClient({ realm, clientId: newClient.id, tab: "settings" })
|
|
||||||
);
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
addError("clients:clientImportError", error);
|
addError("clients:clientImportError", error);
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,8 @@ import { FormAccess } from "../../components/form-access/FormAccess";
|
||||||
import { ViewHeader } from "../../components/view-header/ViewHeader";
|
import { ViewHeader } from "../../components/view-header/ViewHeader";
|
||||||
import { HelpItem } from "../../components/help-enabler/HelpItem";
|
import { HelpItem } from "../../components/help-enabler/HelpItem";
|
||||||
import { TimeSelector } from "../../components/time-selector/TimeSelector";
|
import { TimeSelector } from "../../components/time-selector/TimeSelector";
|
||||||
import { Link, useHistory } from "react-router-dom";
|
import { Link } from "react-router-dom";
|
||||||
|
import { useNavigate } from "react-router-dom-v5-compat";
|
||||||
import { useRealm } from "../../context/realm-context/RealmContext";
|
import { useRealm } from "../../context/realm-context/RealmContext";
|
||||||
import { useAdminClient } from "../../context/auth/AdminClient";
|
import { useAdminClient } from "../../context/auth/AdminClient";
|
||||||
import { useAlerts } from "../../components/alert/Alerts";
|
import { useAlerts } from "../../components/alert/Alerts";
|
||||||
|
@ -34,7 +35,7 @@ export default function CreateInitialAccessToken() {
|
||||||
const { realm } = useRealm();
|
const { realm } = useRealm();
|
||||||
const { addAlert, addError } = useAlerts();
|
const { addAlert, addError } = useAlerts();
|
||||||
|
|
||||||
const history = useHistory();
|
const navigate = useNavigate();
|
||||||
const [token, setToken] = useState("");
|
const [token, setToken] = useState("");
|
||||||
|
|
||||||
const save = async (clientToken: ClientInitialAccessPresentation) => {
|
const save = async (clientToken: ClientInitialAccessPresentation) => {
|
||||||
|
@ -57,7 +58,7 @@ export default function CreateInitialAccessToken() {
|
||||||
toggleDialog={() => {
|
toggleDialog={() => {
|
||||||
setToken("");
|
setToken("");
|
||||||
addAlert(t("tokenSaveSuccess"), AlertVariant.success);
|
addAlert(t("tokenSaveSuccess"), AlertVariant.success);
|
||||||
history.push(toClients({ realm, tab: "initial-access-token" }));
|
navigate(toClients({ realm, tab: "initial-access-token" }));
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|
|
@ -3,7 +3,8 @@ import { wrappable } from "@patternfly/react-table";
|
||||||
import type ClientInitialAccessPresentation from "@keycloak/keycloak-admin-client/lib/defs/clientInitialAccessPresentation";
|
import type ClientInitialAccessPresentation from "@keycloak/keycloak-admin-client/lib/defs/clientInitialAccessPresentation";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { Link, useHistory } from "react-router-dom";
|
import { Link } from "react-router-dom";
|
||||||
|
import { useNavigate } from "react-router-dom-v5-compat";
|
||||||
import { useAlerts } from "../../components/alert/Alerts";
|
import { useAlerts } from "../../components/alert/Alerts";
|
||||||
import { useConfirmDialog } from "../../components/confirm-dialog/ConfirmDialog";
|
import { useConfirmDialog } from "../../components/confirm-dialog/ConfirmDialog";
|
||||||
import { ListEmptyState } from "../../components/list-empty-state/ListEmptyState";
|
import { ListEmptyState } from "../../components/list-empty-state/ListEmptyState";
|
||||||
|
@ -21,7 +22,7 @@ export const InitialAccessTokenList = () => {
|
||||||
const { realm } = useRealm();
|
const { realm } = useRealm();
|
||||||
const formatDate = useFormatDate();
|
const formatDate = useFormatDate();
|
||||||
|
|
||||||
const history = useHistory();
|
const navigate = useNavigate();
|
||||||
|
|
||||||
const [token, setToken] = useState<ClientInitialAccessPresentation>();
|
const [token, setToken] = useState<ClientInitialAccessPresentation>();
|
||||||
|
|
||||||
|
@ -114,7 +115,7 @@ export const InitialAccessTokenList = () => {
|
||||||
instructions={t("noTokensInstructions")}
|
instructions={t("noTokensInstructions")}
|
||||||
primaryActionText={t("common:create")}
|
primaryActionText={t("common:create")}
|
||||||
onPrimaryAction={() =>
|
onPrimaryAction={() =>
|
||||||
history.push(toCreateInitialAccessToken({ realm }))
|
navigate(toCreateInitialAccessToken({ realm }))
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { useHistory, useParams } from "react-router-dom";
|
import { useHistory, useParams } from "react-router-dom";
|
||||||
|
import { useNavigate } from "react-router-dom-v5-compat";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import {
|
import {
|
||||||
AlertVariant,
|
AlertVariant,
|
||||||
|
@ -31,6 +32,7 @@ import { DedicatedScope } from "./DecicatedScope";
|
||||||
export default function DedicatedScopes() {
|
export default function DedicatedScopes() {
|
||||||
const { t } = useTranslation("clients");
|
const { t } = useTranslation("clients");
|
||||||
const history = useHistory();
|
const history = useHistory();
|
||||||
|
const navigate = useNavigate();
|
||||||
const { realm, clientId } = useParams<DedicatedScopeDetailsParams>();
|
const { realm, clientId } = useParams<DedicatedScopeDetailsParams>();
|
||||||
|
|
||||||
const { adminClient } = useAdminClient();
|
const { adminClient } = useAdminClient();
|
||||||
|
@ -55,7 +57,7 @@ export default function DedicatedScopes() {
|
||||||
): Promise<void> => {
|
): Promise<void> => {
|
||||||
if (!Array.isArray(mappers)) {
|
if (!Array.isArray(mappers)) {
|
||||||
const mapper = mappers as ProtocolMapperTypeRepresentation;
|
const mapper = mappers as ProtocolMapperTypeRepresentation;
|
||||||
history.push(
|
navigate(
|
||||||
toMapper({
|
toMapper({
|
||||||
realm,
|
realm,
|
||||||
id: client.id!,
|
id: client.id!,
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import { useEffect } from "react";
|
import { useEffect } from "react";
|
||||||
import { Link, useHistory, useLocation } from "react-router-dom";
|
import { Link } from "react-router-dom";
|
||||||
|
import { useLocation } from "react-router-dom-v5-compat";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { Breadcrumb, BreadcrumbItem } from "@patternfly/react-core";
|
import { Breadcrumb, BreadcrumbItem } from "@patternfly/react-core";
|
||||||
|
|
||||||
|
@ -10,17 +11,15 @@ export const GroupBreadCrumbs = () => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const { clear, remove, subGroups } = useSubGroups();
|
const { clear, remove, subGroups } = useSubGroups();
|
||||||
const { realm } = useRealm();
|
const { realm } = useRealm();
|
||||||
|
|
||||||
const history = useHistory();
|
|
||||||
const location = useLocation();
|
const location = useLocation();
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
return history.listen(({ pathname }) => {
|
const { pathname } = location;
|
||||||
|
|
||||||
if (!pathname.includes("/groups") || pathname.endsWith("/groups")) {
|
if (!pathname.includes("/groups") || pathname.endsWith("/groups")) {
|
||||||
clear();
|
clear();
|
||||||
}
|
}
|
||||||
});
|
}, [location]);
|
||||||
}, [history]);
|
|
||||||
|
|
||||||
return subGroups.length !== 0 ? (
|
return subGroups.length !== 0 ? (
|
||||||
<Breadcrumb>
|
<Breadcrumb>
|
||||||
|
|
|
@ -13,7 +13,8 @@ import {
|
||||||
FlexItem,
|
FlexItem,
|
||||||
} from "@patternfly/react-core";
|
} from "@patternfly/react-core";
|
||||||
import "./keycloak-card.css";
|
import "./keycloak-card.css";
|
||||||
import { useHistory, useRouteMatch } from "react-router-dom";
|
import { useRouteMatch } from "react-router-dom";
|
||||||
|
import { useNavigate } from "react-router-dom-v5-compat";
|
||||||
|
|
||||||
export type KeycloakCardProps = {
|
export type KeycloakCardProps = {
|
||||||
id: string;
|
id: string;
|
||||||
|
@ -37,7 +38,7 @@ export const KeycloakCard = ({
|
||||||
}: KeycloakCardProps) => {
|
}: KeycloakCardProps) => {
|
||||||
const [isDropdownOpen, setIsDropdownOpen] = useState(false);
|
const [isDropdownOpen, setIsDropdownOpen] = useState(false);
|
||||||
|
|
||||||
const history = useHistory();
|
const navigate = useNavigate();
|
||||||
const { url } = useRouteMatch();
|
const { url } = useRouteMatch();
|
||||||
|
|
||||||
const onDropdownToggle = () => {
|
const onDropdownToggle = () => {
|
||||||
|
@ -49,7 +50,7 @@ export const KeycloakCard = ({
|
||||||
};
|
};
|
||||||
|
|
||||||
const openSettings = () => {
|
const openSettings = () => {
|
||||||
history.push(`${url}/${providerId}/${id}`);
|
navigate(`${url}/${providerId}/${id}`);
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import { Children, isValidElement, useState } from "react";
|
import { Children, isValidElement, useState } from "react";
|
||||||
import { useHistory, useRouteMatch } from "react-router-dom";
|
import { useRouteMatch } from "react-router-dom";
|
||||||
|
import { useNavigate } from "react-router-dom-v5-compat";
|
||||||
import { TabProps, Tabs, TabsProps } from "@patternfly/react-core";
|
import { TabProps, Tabs, TabsProps } from "@patternfly/react-core";
|
||||||
import { useFormContext } from "react-hook-form";
|
import { useFormContext } from "react-hook-form";
|
||||||
import { useConfirmDialog } from "../confirm-dialog/ConfirmDialog";
|
import { useConfirmDialog } from "../confirm-dialog/ConfirmDialog";
|
||||||
|
@ -29,7 +30,7 @@ export const KeycloakTabs = ({
|
||||||
}: KeycloakTabsProps) => {
|
}: KeycloakTabsProps) => {
|
||||||
const match = useRouteMatch();
|
const match = useRouteMatch();
|
||||||
const params = match.params as { [index: string]: string };
|
const params = match.params as { [index: string]: string };
|
||||||
const history = useHistory();
|
const navigate = useNavigate();
|
||||||
const form = useFormContext() as
|
const form = useFormContext() as
|
||||||
| ReturnType<typeof useFormContext>
|
| ReturnType<typeof useFormContext>
|
||||||
| undefined;
|
| undefined;
|
||||||
|
@ -50,7 +51,7 @@ export const KeycloakTabs = ({
|
||||||
continueButtonLabel: "common:leave",
|
continueButtonLabel: "common:leave",
|
||||||
onConfirm: () => {
|
onConfirm: () => {
|
||||||
form?.reset();
|
form?.reset();
|
||||||
history.push(createUrl(path, { ...params, [paramName]: key as string }));
|
navigate(createUrl(path, { ...params, [paramName]: key as string }));
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -70,7 +71,7 @@ export const KeycloakTabs = ({
|
||||||
setKey(key as string);
|
setKey(key as string);
|
||||||
toggleChangeTabDialog();
|
toggleChangeTabDialog();
|
||||||
} else {
|
} else {
|
||||||
history.push(
|
navigate(
|
||||||
createUrl(path, { ...params, [paramName]: key as string })
|
createUrl(path, { ...params, [paramName]: key as string })
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { Link, useHistory } from "react-router-dom";
|
import { Link } from "react-router-dom";
|
||||||
|
import { useNavigate } from "react-router-dom-v5-compat";
|
||||||
import { Trans, useTranslation } from "react-i18next";
|
import { Trans, useTranslation } from "react-i18next";
|
||||||
import {
|
import {
|
||||||
Card,
|
Card,
|
||||||
|
@ -45,7 +46,7 @@ type PermissionsTabProps = {
|
||||||
|
|
||||||
export const PermissionsTab = ({ id, type }: PermissionsTabProps) => {
|
export const PermissionsTab = ({ id, type }: PermissionsTabProps) => {
|
||||||
const { t } = useTranslation("common");
|
const { t } = useTranslation("common");
|
||||||
const history = useHistory();
|
const navigate = useNavigate();
|
||||||
const { adminClient } = useAdminClient();
|
const { adminClient } = useAdminClient();
|
||||||
const { realm } = useRealm();
|
const { realm } = useRealm();
|
||||||
const [realmId, setRealmId] = useState("");
|
const [realmId, setRealmId] = useState("");
|
||||||
|
@ -219,7 +220,7 @@ export const PermissionsTab = ({ id, type }: PermissionsTabProps) => {
|
||||||
{
|
{
|
||||||
title: t("common:edit"),
|
title: t("common:edit"),
|
||||||
onClick() {
|
onClick() {
|
||||||
history.push(
|
navigate(
|
||||||
toPermissionDetails({
|
toPermissionDetails({
|
||||||
realm,
|
realm,
|
||||||
id: realmId,
|
id: realmId,
|
||||||
|
|
|
@ -13,7 +13,7 @@ import {
|
||||||
import { CheckIcon } from "@patternfly/react-icons";
|
import { CheckIcon } from "@patternfly/react-icons";
|
||||||
import { Fragment, ReactElement, useMemo, useState } from "react";
|
import { Fragment, ReactElement, useMemo, useState } from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { useHistory } from "react-router-dom";
|
import { useNavigate } from "react-router-dom-v5-compat";
|
||||||
|
|
||||||
import { useRealm } from "../../context/realm-context/RealmContext";
|
import { useRealm } from "../../context/realm-context/RealmContext";
|
||||||
import { useRealms } from "../../context/RealmsContext";
|
import { useRealms } from "../../context/RealmsContext";
|
||||||
|
@ -31,7 +31,7 @@ export const RealmSelector = () => {
|
||||||
const { whoAmI } = useWhoAmI();
|
const { whoAmI } = useWhoAmI();
|
||||||
const [open, setOpen] = useState(false);
|
const [open, setOpen] = useState(false);
|
||||||
const [search, setSearch] = useState("");
|
const [search, setSearch] = useState("");
|
||||||
const history = useHistory();
|
const navigate = useNavigate();
|
||||||
const { t } = useTranslation("common");
|
const { t } = useTranslation("common");
|
||||||
const recentUsed = new RecentUsed();
|
const recentUsed = new RecentUsed();
|
||||||
const all = recentUsed.used
|
const all = recentUsed.used
|
||||||
|
@ -70,7 +70,7 @@ export const RealmSelector = () => {
|
||||||
component="div"
|
component="div"
|
||||||
isBlock
|
isBlock
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
history.push(toAddRealm({ realm }));
|
navigate(toAddRealm({ realm }));
|
||||||
setOpen(!open);
|
setOpen(!open);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
|
@ -80,7 +80,7 @@ export const RealmSelector = () => {
|
||||||
|
|
||||||
const selectRealm = (realm: string) => {
|
const selectRealm = (realm: string) => {
|
||||||
setOpen(!open);
|
setOpen(!open);
|
||||||
history.push(toDashboard({ realm }));
|
navigate(toDashboard({ realm }));
|
||||||
};
|
};
|
||||||
|
|
||||||
const dropdownItems = realms.map((r) => (
|
const dropdownItems = realms.map((r) => (
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { Link, useHistory, useLocation } from "react-router-dom";
|
import { Link, useLocation } from "react-router-dom";
|
||||||
|
import { useNavigate } from "react-router-dom-v5-compat";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { cellWidth } from "@patternfly/react-table";
|
import { cellWidth } from "@patternfly/react-table";
|
||||||
|
|
||||||
|
@ -37,7 +38,7 @@ export const GroupTable = ({ toggleView }: GroupTableProps) => {
|
||||||
const [key, setKey] = useState(0);
|
const [key, setKey] = useState(0);
|
||||||
const refresh = () => setKey(new Date().getTime());
|
const refresh = () => setKey(new Date().getTime());
|
||||||
|
|
||||||
const history = useHistory();
|
const navigate = useNavigate();
|
||||||
const location = useLocation();
|
const location = useLocation();
|
||||||
const id = getLastId(location.pathname);
|
const id = getLastId(location.pathname);
|
||||||
|
|
||||||
|
@ -63,7 +64,7 @@ export const GroupTable = ({ toggleView }: GroupTableProps) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!groupsData) {
|
if (!groupsData) {
|
||||||
history.push(toGroups({ realm }));
|
navigate(toGroups({ realm }));
|
||||||
}
|
}
|
||||||
|
|
||||||
return groupsData || [];
|
return groupsData || [];
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { Link, useHistory, useLocation } from "react-router-dom";
|
import { Link, useLocation } from "react-router-dom";
|
||||||
|
import { useNavigate } from "react-router-dom-v5-compat";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import {
|
import {
|
||||||
DropdownItem,
|
DropdownItem,
|
||||||
|
@ -46,7 +47,7 @@ export default function GroupsSection() {
|
||||||
const [rename, setRename] = useState<string>();
|
const [rename, setRename] = useState<string>();
|
||||||
const [viewType, setViewType] = useState<ViewType>(ViewType.Table);
|
const [viewType, setViewType] = useState<ViewType>(ViewType.Table);
|
||||||
|
|
||||||
const history = useHistory();
|
const navigate = useNavigate();
|
||||||
const location = useLocation();
|
const location = useLocation();
|
||||||
const id = getLastId(location.pathname);
|
const id = getLastId(location.pathname);
|
||||||
|
|
||||||
|
@ -144,7 +145,7 @@ export default function GroupsSection() {
|
||||||
key="deleteGroup"
|
key="deleteGroup"
|
||||||
onClick={async () => {
|
onClick={async () => {
|
||||||
await deleteGroup({ id });
|
await deleteGroup({ id });
|
||||||
history.push(toGroups({ realm }));
|
navigate(toGroups({ realm }));
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{t("deleteGroup")}
|
{t("deleteGroup")}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { useHistory, useLocation } from "react-router-dom";
|
import { useLocation } from "react-router-dom";
|
||||||
|
import { useNavigate } from "react-router-dom-v5-compat";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import {
|
import {
|
||||||
Dropdown,
|
Dropdown,
|
||||||
|
@ -32,7 +33,7 @@ const GroupTreeContextMenu = ({
|
||||||
const { t } = useTranslation("groups");
|
const { t } = useTranslation("groups");
|
||||||
|
|
||||||
const location = useLocation();
|
const location = useLocation();
|
||||||
const history = useHistory();
|
const navigate = useNavigate();
|
||||||
|
|
||||||
const [isOpen, toggleOpen] = useToggle();
|
const [isOpen, toggleOpen] = useToggle();
|
||||||
const [createOpen, toggleCreateOpen] = useToggle();
|
const [createOpen, toggleCreateOpen] = useToggle();
|
||||||
|
@ -71,7 +72,7 @@ const GroupTreeContextMenu = ({
|
||||||
</DropdownItem>,
|
</DropdownItem>,
|
||||||
<DropdownItem
|
<DropdownItem
|
||||||
key="edit"
|
key="edit"
|
||||||
onClick={() => history.push(`${location.pathname}/${group.id}`)}
|
onClick={() => navigate(`${location.pathname}/${group.id}`)}
|
||||||
>
|
>
|
||||||
{t("common:edit")}
|
{t("common:edit")}
|
||||||
</DropdownItem>,
|
</DropdownItem>,
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import { Fragment, useState } from "react";
|
import { Fragment, useState } from "react";
|
||||||
import { Link, useHistory } from "react-router-dom";
|
import { Link } from "react-router-dom";
|
||||||
|
import { useNavigate } from "react-router-dom-v5-compat";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { sortBy, groupBy } from "lodash-es";
|
import { sortBy, groupBy } from "lodash-es";
|
||||||
import {
|
import {
|
||||||
|
@ -46,7 +47,7 @@ export default function IdentityProvidersSection() {
|
||||||
"groupName"
|
"groupName"
|
||||||
);
|
);
|
||||||
const { realm } = useRealm();
|
const { realm } = useRealm();
|
||||||
const history = useHistory();
|
const navigate = useNavigate();
|
||||||
const [key, setKey] = useState(0);
|
const [key, setKey] = useState(0);
|
||||||
const refresh = () => setKey(key + 1);
|
const refresh = () => setKey(key + 1);
|
||||||
|
|
||||||
|
@ -98,7 +99,7 @@ export default function IdentityProvidersSection() {
|
||||||
);
|
);
|
||||||
|
|
||||||
const navigateToCreate = (providerId: string) =>
|
const navigateToCreate = (providerId: string) =>
|
||||||
history.push(
|
navigate(
|
||||||
toIdentityProviderCreate({
|
toIdentityProviderCreate({
|
||||||
realm,
|
realm,
|
||||||
providerId,
|
providerId,
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import { Link, useHistory, useParams } from "react-router-dom";
|
import { Link, useParams } from "react-router-dom";
|
||||||
|
import { useNavigate } from "react-router-dom-v5-compat";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { FormProvider, useForm } from "react-hook-form";
|
import { FormProvider, useForm } from "react-hook-form";
|
||||||
import {
|
import {
|
||||||
|
@ -31,7 +32,7 @@ export default function AddIdentityProvider() {
|
||||||
|
|
||||||
const { adminClient } = useAdminClient();
|
const { adminClient } = useAdminClient();
|
||||||
const { addAlert, addError } = useAlerts();
|
const { addAlert, addError } = useAlerts();
|
||||||
const history = useHistory();
|
const navigate = useNavigate();
|
||||||
const { realm } = useRealm();
|
const { realm } = useRealm();
|
||||||
|
|
||||||
const save = async (provider: IdentityProviderRepresentation) => {
|
const save = async (provider: IdentityProviderRepresentation) => {
|
||||||
|
@ -42,7 +43,7 @@ export default function AddIdentityProvider() {
|
||||||
alias: providerId,
|
alias: providerId,
|
||||||
});
|
});
|
||||||
addAlert(t("createSuccess"), AlertVariant.success);
|
addAlert(t("createSuccess"), AlertVariant.success);
|
||||||
history.push(
|
navigate(
|
||||||
toIdentityProvider({
|
toIdentityProvider({
|
||||||
realm,
|
realm,
|
||||||
providerId: providerId!,
|
providerId: providerId!,
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { Link, useHistory, useParams } from "react-router-dom";
|
import { Link, useParams } from "react-router-dom";
|
||||||
|
import { useNavigate } from "react-router-dom-v5-compat";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { FormProvider, useForm } from "react-hook-form";
|
import { FormProvider, useForm } from "react-hook-form";
|
||||||
import {
|
import {
|
||||||
|
@ -52,7 +53,7 @@ export default function AddMapper() {
|
||||||
});
|
});
|
||||||
const { handleSubmit, register, errors } = form;
|
const { handleSubmit, register, errors } = form;
|
||||||
const { addAlert, addError } = useAlerts();
|
const { addAlert, addError } = useAlerts();
|
||||||
const history = useHistory();
|
const navigate = useNavigate();
|
||||||
const localeSort = useLocaleSort();
|
const localeSort = useLocaleSort();
|
||||||
|
|
||||||
const { realm } = useRealm();
|
const { realm } = useRealm();
|
||||||
|
@ -105,7 +106,7 @@ export default function AddMapper() {
|
||||||
});
|
});
|
||||||
|
|
||||||
addAlert(t("mapperCreateSuccess"), AlertVariant.success);
|
addAlert(t("mapperCreateSuccess"), AlertVariant.success);
|
||||||
history.push(
|
navigate(
|
||||||
toIdentityProviderEditMapper({
|
toIdentityProviderEditMapper({
|
||||||
realm,
|
realm,
|
||||||
alias,
|
alias,
|
||||||
|
@ -133,7 +134,7 @@ export default function AddMapper() {
|
||||||
id: id!,
|
id: id!,
|
||||||
});
|
});
|
||||||
addAlert(t("deleteMapperSuccess"), AlertVariant.success);
|
addAlert(t("deleteMapperSuccess"), AlertVariant.success);
|
||||||
history.push(
|
navigate(
|
||||||
toIdentityProvider({ providerId, alias, tab: "mappers", realm })
|
toIdentityProvider({ providerId, alias, tab: "mappers", realm })
|
||||||
);
|
);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import { Link, useHistory, useRouteMatch } from "react-router-dom";
|
import { Link, useRouteMatch } from "react-router-dom";
|
||||||
|
import { useNavigate } from "react-router-dom-v5-compat";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { FormProvider, useForm } from "react-hook-form";
|
import { FormProvider, useForm } from "react-hook-form";
|
||||||
import {
|
import {
|
||||||
|
@ -26,7 +27,7 @@ type DiscoveryIdentity = IdentityProviderRepresentation & {
|
||||||
|
|
||||||
export default function AddOpenIdConnect() {
|
export default function AddOpenIdConnect() {
|
||||||
const { t } = useTranslation("identity-providers");
|
const { t } = useTranslation("identity-providers");
|
||||||
const history = useHistory();
|
const navigate = useNavigate();
|
||||||
const { url } = useRouteMatch();
|
const { url } = useRouteMatch();
|
||||||
const isKeycloak = url.endsWith("keycloak-oidc");
|
const isKeycloak = url.endsWith("keycloak-oidc");
|
||||||
const id = `${isKeycloak ? "keycloak-" : ""}oidc`;
|
const id = `${isKeycloak ? "keycloak-" : ""}oidc`;
|
||||||
|
@ -51,7 +52,7 @@ export default function AddOpenIdConnect() {
|
||||||
providerId: id,
|
providerId: id,
|
||||||
});
|
});
|
||||||
addAlert(t("createSuccess"), AlertVariant.success);
|
addAlert(t("createSuccess"), AlertVariant.success);
|
||||||
history.push(
|
navigate(
|
||||||
toIdentityProvider({
|
toIdentityProvider({
|
||||||
realm,
|
realm,
|
||||||
providerId: id,
|
providerId: id,
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import { Link, useHistory } from "react-router-dom";
|
import { Link } from "react-router-dom";
|
||||||
|
import { useNavigate } from "react-router-dom-v5-compat";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { FormProvider, useForm } from "react-hook-form";
|
import { FormProvider, useForm } from "react-hook-form";
|
||||||
import {
|
import {
|
||||||
|
@ -25,7 +26,7 @@ type DiscoveryIdentityProvider = IdentityProviderRepresentation & {
|
||||||
|
|
||||||
export default function AddSamlConnect() {
|
export default function AddSamlConnect() {
|
||||||
const { t } = useTranslation("identity-providers");
|
const { t } = useTranslation("identity-providers");
|
||||||
const history = useHistory();
|
const navigate = useNavigate();
|
||||||
const id = "saml";
|
const id = "saml";
|
||||||
|
|
||||||
const form = useForm<DiscoveryIdentityProvider>({
|
const form = useForm<DiscoveryIdentityProvider>({
|
||||||
|
@ -48,7 +49,7 @@ export default function AddSamlConnect() {
|
||||||
providerId: id,
|
providerId: id,
|
||||||
});
|
});
|
||||||
addAlert(t("createSuccess"), AlertVariant.success);
|
addAlert(t("createSuccess"), AlertVariant.success);
|
||||||
history.push(
|
navigate(
|
||||||
toIdentityProvider({
|
toIdentityProvider({
|
||||||
realm,
|
realm,
|
||||||
providerId: id,
|
providerId: id,
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { Link, useHistory, useParams } from "react-router-dom";
|
import { Link, useParams } from "react-router-dom";
|
||||||
|
import { useNavigate } from "react-router-dom-v5-compat";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import {
|
import {
|
||||||
Controller,
|
Controller,
|
||||||
|
@ -128,7 +129,7 @@ export default function DetailSettings() {
|
||||||
|
|
||||||
const { adminClient } = useAdminClient();
|
const { adminClient } = useAdminClient();
|
||||||
const { addAlert, addError } = useAlerts();
|
const { addAlert, addError } = useAlerts();
|
||||||
const history = useHistory();
|
const navigate = useNavigate();
|
||||||
const { realm } = useRealm();
|
const { realm } = useRealm();
|
||||||
const [key, setKey] = useState(0);
|
const [key, setKey] = useState(0);
|
||||||
const refresh = () => setKey(key + 1);
|
const refresh = () => setKey(key + 1);
|
||||||
|
@ -203,7 +204,7 @@ export default function DetailSettings() {
|
||||||
try {
|
try {
|
||||||
await adminClient.identityProviders.del({ alias: alias });
|
await adminClient.identityProviders.del({ alias: alias });
|
||||||
addAlert(t("deletedSuccess"), AlertVariant.success);
|
addAlert(t("deletedSuccess"), AlertVariant.success);
|
||||||
history.push(toIdentityProviders({ realm }));
|
navigate(toIdentityProviders({ realm }));
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
addError("identity-providers:deleteErrorError", error);
|
addError("identity-providers:deleteErrorError", error);
|
||||||
}
|
}
|
||||||
|
@ -225,7 +226,7 @@ export default function DetailSettings() {
|
||||||
});
|
});
|
||||||
addAlert(t("deleteMapperSuccess"), AlertVariant.success);
|
addAlert(t("deleteMapperSuccess"), AlertVariant.success);
|
||||||
refresh();
|
refresh();
|
||||||
history.push(
|
navigate(
|
||||||
toIdentityProvider({ providerId, alias, tab: "mappers", realm })
|
toIdentityProvider({ providerId, alias, tab: "mappers", realm })
|
||||||
);
|
);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
@ -382,7 +383,7 @@ export default function DetailSettings() {
|
||||||
instructions={t("identity-providers:noMappersInstructions")}
|
instructions={t("identity-providers:noMappersInstructions")}
|
||||||
primaryActionText={t("identity-providers:addMapper")}
|
primaryActionText={t("identity-providers:addMapper")}
|
||||||
onPrimaryAction={() =>
|
onPrimaryAction={() =>
|
||||||
history.push(
|
navigate(
|
||||||
toIdentityProviderAddMapper({
|
toIdentityProviderAddMapper({
|
||||||
realm,
|
realm,
|
||||||
alias: alias!,
|
alias: alias!,
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { useHistory, useParams, useRouteMatch } from "react-router-dom";
|
import { useParams, useRouteMatch } from "react-router-dom";
|
||||||
|
import { useNavigate } from "react-router-dom-v5-compat";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import {
|
import {
|
||||||
AlertVariant,
|
AlertVariant,
|
||||||
|
@ -48,7 +49,7 @@ export const AssociatedRolesTab = ({
|
||||||
}: AssociatedRolesTabProps) => {
|
}: AssociatedRolesTabProps) => {
|
||||||
const { t } = useTranslation("roles");
|
const { t } = useTranslation("roles");
|
||||||
|
|
||||||
const history = useHistory();
|
const navigate = useNavigate();
|
||||||
const { addAlert, addError } = useAlerts();
|
const { addAlert, addError } = useAlerts();
|
||||||
const { id, realm } = useParams<RealmRoleParams>();
|
const { id, realm } = useParams<RealmRoleParams>();
|
||||||
|
|
||||||
|
@ -126,7 +127,7 @@ export const AssociatedRolesTab = ({
|
||||||
tab,
|
tab,
|
||||||
})
|
})
|
||||||
: undefined;
|
: undefined;
|
||||||
if (to) history.push(to);
|
if (to) navigate(to);
|
||||||
};
|
};
|
||||||
|
|
||||||
const AliasRenderer = ({ id, name, clientRole, containerId }: Role) => {
|
const AliasRenderer = ({ id, name, clientRole, containerId }: Role) => {
|
||||||
|
|
|
@ -13,7 +13,7 @@ import type { AttributeForm } from "../components/key-value-form/AttributeForm";
|
||||||
import { KeycloakTextInput } from "../components/keycloak-text-input/KeycloakTextInput";
|
import { KeycloakTextInput } from "../components/keycloak-text-input/KeycloakTextInput";
|
||||||
import { KeycloakTextArea } from "../components/keycloak-text-area/KeycloakTextArea";
|
import { KeycloakTextArea } from "../components/keycloak-text-area/KeycloakTextArea";
|
||||||
import { useRealm } from "../context/realm-context/RealmContext";
|
import { useRealm } from "../context/realm-context/RealmContext";
|
||||||
import { useHistory } from "react-router-dom";
|
import { useNavigate } from "react-router-dom-v5-compat";
|
||||||
|
|
||||||
export type RealmRoleFormProps = {
|
export type RealmRoleFormProps = {
|
||||||
form: UseFormMethods<AttributeForm>;
|
form: UseFormMethods<AttributeForm>;
|
||||||
|
@ -29,7 +29,7 @@ export const RealmRoleForm = ({
|
||||||
reset,
|
reset,
|
||||||
}: RealmRoleFormProps) => {
|
}: RealmRoleFormProps) => {
|
||||||
const { t } = useTranslation("roles");
|
const { t } = useTranslation("roles");
|
||||||
const history = useHistory();
|
const navigate = useNavigate();
|
||||||
const { realm: realmName } = useRealm();
|
const { realm: realmName } = useRealm();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -101,7 +101,7 @@ export const RealmRoleForm = ({
|
||||||
<Button
|
<Button
|
||||||
data-testid="cancel"
|
data-testid="cancel"
|
||||||
onClick={() =>
|
onClick={() =>
|
||||||
editMode ? reset() : history.push(`/${realmName}/roles`)
|
editMode ? reset() : navigate(`/${realmName}/roles`)
|
||||||
}
|
}
|
||||||
variant="link"
|
variant="link"
|
||||||
>
|
>
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { useHistory, useParams, useRouteMatch } from "react-router-dom";
|
import { useParams, useRouteMatch } from "react-router-dom";
|
||||||
|
import { useNavigate } from "react-router-dom-v5-compat";
|
||||||
import {
|
import {
|
||||||
AlertVariant,
|
AlertVariant,
|
||||||
ButtonVariant,
|
ButtonVariant,
|
||||||
|
@ -47,7 +48,7 @@ export default function RealmRoleTabs() {
|
||||||
mode: "onChange",
|
mode: "onChange",
|
||||||
});
|
});
|
||||||
const { setValue, getValues, trigger, reset } = form;
|
const { setValue, getValues, trigger, reset } = form;
|
||||||
const history = useHistory();
|
const navigate = useNavigate();
|
||||||
|
|
||||||
const { adminClient } = useAdminClient();
|
const { adminClient } = useAdminClient();
|
||||||
const [role, setRole] = useState<AttributeForm>();
|
const [role, setRole] = useState<AttributeForm>();
|
||||||
|
@ -170,7 +171,7 @@ export default function RealmRoleTabs() {
|
||||||
}
|
}
|
||||||
|
|
||||||
setRole(convert(createdRole));
|
setRole(convert(createdRole));
|
||||||
history.push(
|
navigate(
|
||||||
url.substr(0, url.lastIndexOf("/") + 1) + createdRole.id + "/details"
|
url.substr(0, url.lastIndexOf("/") + 1) + createdRole.id + "/details"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -198,7 +199,7 @@ export default function RealmRoleTabs() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
addAlert(t("roleDeletedSuccess"), AlertVariant.success);
|
addAlert(t("roleDeletedSuccess"), AlertVariant.success);
|
||||||
history.push(url.substr(0, url.indexOf("/roles") + "/roles".length));
|
navigate(url.substr(0, url.indexOf("/roles") + "/roles".length));
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
addError("roles:roleDeleteError", error);
|
addError("roles:roleDeleteError", error);
|
||||||
}
|
}
|
||||||
|
@ -264,7 +265,7 @@ export default function RealmRoleTabs() {
|
||||||
t("compositesRemovedAlertDescription")
|
t("compositesRemovedAlertDescription")
|
||||||
);
|
);
|
||||||
const loc = url.replace(/\/AssociatedRoles/g, "/details");
|
const loc = url.replace(/\/AssociatedRoles/g, "/details");
|
||||||
history.push(loc);
|
navigate(loc);
|
||||||
refresh();
|
refresh();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
addError("roles:roleDeleteError", error);
|
addError("roles:roleDeleteError", error);
|
||||||
|
@ -291,7 +292,7 @@ export default function RealmRoleTabs() {
|
||||||
id,
|
id,
|
||||||
tab: "associated-roles",
|
tab: "associated-roles",
|
||||||
});
|
});
|
||||||
history.push(to);
|
navigate(to);
|
||||||
};
|
};
|
||||||
|
|
||||||
const addComposites = async (composites: RoleRepresentation[]) => {
|
const addComposites = async (composites: RoleRepresentation[]) => {
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import { FunctionComponent, useState } from "react";
|
import { FunctionComponent, useState } from "react";
|
||||||
import { Link, useHistory, useRouteMatch } from "react-router-dom";
|
import { Link, useRouteMatch } from "react-router-dom";
|
||||||
|
import { useNavigate } from "react-router-dom-v5-compat";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { AlertVariant, Button, ButtonVariant } from "@patternfly/react-core";
|
import { AlertVariant, Button, ButtonVariant } from "@patternfly/react-core";
|
||||||
|
|
||||||
|
@ -55,7 +56,7 @@ export const RolesList = ({
|
||||||
isReadOnly,
|
isReadOnly,
|
||||||
}: RolesListProps) => {
|
}: RolesListProps) => {
|
||||||
const { t } = useTranslation(messageBundle);
|
const { t } = useTranslation(messageBundle);
|
||||||
const history = useHistory();
|
const navigate = useNavigate();
|
||||||
const { adminClient } = useAdminClient();
|
const { adminClient } = useAdminClient();
|
||||||
const { addAlert, addError } = useAlerts();
|
const { addAlert, addError } = useAlerts();
|
||||||
const { url } = useRouteMatch();
|
const { url } = useRouteMatch();
|
||||||
|
@ -115,7 +116,7 @@ export const RolesList = ({
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const goToCreate = () => history.push(`${url}/add-role`);
|
const goToCreate = () => navigate(`${url}/add-role`);
|
||||||
|
|
||||||
if (!realm) {
|
if (!realm) {
|
||||||
return <KeycloakSpinner />;
|
return <KeycloakSpinner />;
|
||||||
|
|
|
@ -2,7 +2,8 @@ import { Button, PageSection, Popover } from "@patternfly/react-core";
|
||||||
import { QuestionCircleIcon } from "@patternfly/react-icons";
|
import { QuestionCircleIcon } from "@patternfly/react-icons";
|
||||||
|
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { useHistory, useParams } from "react-router-dom";
|
import { useParams } from "react-router-dom";
|
||||||
|
import { useNavigate } from "react-router-dom-v5-compat";
|
||||||
import { useHelp } from "../components/help-enabler/HelpHeader";
|
import { useHelp } from "../components/help-enabler/HelpHeader";
|
||||||
import { ListEmptyState } from "../components/list-empty-state/ListEmptyState";
|
import { ListEmptyState } from "../components/list-empty-state/ListEmptyState";
|
||||||
import { KeycloakDataTable } from "../components/table-toolbar/KeycloakDataTable";
|
import { KeycloakDataTable } from "../components/table-toolbar/KeycloakDataTable";
|
||||||
|
@ -12,7 +13,7 @@ import { emptyFormatter, upperCaseFormatter } from "../util";
|
||||||
import type { ClientRoleParams } from "./routes/ClientRole";
|
import type { ClientRoleParams } from "./routes/ClientRole";
|
||||||
|
|
||||||
export const UsersInRoleTab = () => {
|
export const UsersInRoleTab = () => {
|
||||||
const history = useHistory();
|
const navigate = useNavigate();
|
||||||
const { realm } = useRealm();
|
const { realm } = useRealm();
|
||||||
|
|
||||||
const { t } = useTranslation("roles");
|
const { t } = useTranslation("roles");
|
||||||
|
@ -62,7 +63,7 @@ export const UsersInRoleTab = () => {
|
||||||
<Button
|
<Button
|
||||||
className="kc-groups-link"
|
className="kc-groups-link"
|
||||||
variant="link"
|
variant="link"
|
||||||
onClick={() => history.push(`/${realm}/groups`)}
|
onClick={() => navigate(`/${realm}/groups`)}
|
||||||
>
|
>
|
||||||
{t("common:groups")}
|
{t("common:groups")}
|
||||||
</Button>
|
</Button>
|
||||||
|
@ -70,7 +71,7 @@ export const UsersInRoleTab = () => {
|
||||||
<Button
|
<Button
|
||||||
className="kc-users-link"
|
className="kc-users-link"
|
||||||
variant="link"
|
variant="link"
|
||||||
onClick={() => history.push(`/${realm}/users`)}
|
onClick={() => navigate(`/${realm}/users`)}
|
||||||
>
|
>
|
||||||
{t("users")}.
|
{t("users")}.
|
||||||
</Button>
|
</Button>
|
||||||
|
@ -99,7 +100,7 @@ export const UsersInRoleTab = () => {
|
||||||
<Button
|
<Button
|
||||||
className="kc-groups-link-empty-state"
|
className="kc-groups-link-empty-state"
|
||||||
variant="link"
|
variant="link"
|
||||||
onClick={() => history.push(`/${realm}/groups`)}
|
onClick={() => navigate(`/${realm}/groups`)}
|
||||||
>
|
>
|
||||||
{t("common:groups")}
|
{t("common:groups")}
|
||||||
</Button>
|
</Button>
|
||||||
|
@ -107,7 +108,7 @@ export const UsersInRoleTab = () => {
|
||||||
<Button
|
<Button
|
||||||
className="kc-users-link-empty-state"
|
className="kc-users-link-empty-state"
|
||||||
variant="link"
|
variant="link"
|
||||||
onClick={() => history.push(`/${realm}/users`)}
|
onClick={() => navigate(`/${realm}/users`)}
|
||||||
>
|
>
|
||||||
{t("users")}
|
{t("users")}
|
||||||
</Button>
|
</Button>
|
||||||
|
|
|
@ -23,7 +23,8 @@ import { useTranslation } from "react-i18next";
|
||||||
import { useForm } from "react-hook-form";
|
import { useForm } from "react-hook-form";
|
||||||
import { FormAccess } from "../components/form-access/FormAccess";
|
import { FormAccess } from "../components/form-access/FormAccess";
|
||||||
import { ViewHeader } from "../components/view-header/ViewHeader";
|
import { ViewHeader } from "../components/view-header/ViewHeader";
|
||||||
import { Link, useHistory, useParams } from "react-router-dom";
|
import { Link, useParams } from "react-router-dom";
|
||||||
|
import { useNavigate } from "react-router-dom-v5-compat";
|
||||||
import { useAlerts } from "../components/alert/Alerts";
|
import { useAlerts } from "../components/alert/Alerts";
|
||||||
import { useAdminClient, useFetch } from "../context/auth/AdminClient";
|
import { useAdminClient, useFetch } from "../context/auth/AdminClient";
|
||||||
import type ClientProfileRepresentation from "@keycloak/keycloak-admin-client/lib/defs/clientProfileRepresentation";
|
import type ClientProfileRepresentation from "@keycloak/keycloak-admin-client/lib/defs/clientProfileRepresentation";
|
||||||
|
@ -49,7 +50,7 @@ const defaultValues: ClientProfileForm = {
|
||||||
|
|
||||||
export default function ClientProfileForm() {
|
export default function ClientProfileForm() {
|
||||||
const { t } = useTranslation("realm-settings");
|
const { t } = useTranslation("realm-settings");
|
||||||
const history = useHistory();
|
const navigate = useNavigate();
|
||||||
const {
|
const {
|
||||||
handleSubmit,
|
handleSubmit,
|
||||||
setValue,
|
setValue,
|
||||||
|
@ -109,7 +110,7 @@ export default function ClientProfileForm() {
|
||||||
AlertVariant.success
|
AlertVariant.success
|
||||||
);
|
);
|
||||||
|
|
||||||
history.push(toClientProfile({ realm, profileName: form.name }));
|
navigate(toClientProfile({ realm, profileName: form.name }));
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
addError(
|
addError(
|
||||||
editMode
|
editMode
|
||||||
|
@ -162,7 +163,7 @@ export default function ClientProfileForm() {
|
||||||
globalProfiles,
|
globalProfiles,
|
||||||
});
|
});
|
||||||
addAlert(t("deleteExecutorSuccess"), AlertVariant.success);
|
addAlert(t("deleteExecutorSuccess"), AlertVariant.success);
|
||||||
history.push(toClientProfile({ realm, profileName }));
|
navigate(toClientProfile({ realm, profileName }));
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
addError(t("deleteExecutorError"), error);
|
addError(t("deleteExecutorError"), error);
|
||||||
}
|
}
|
||||||
|
@ -177,7 +178,7 @@ export default function ClientProfileForm() {
|
||||||
globalProfiles,
|
globalProfiles,
|
||||||
});
|
});
|
||||||
addAlert(t("deleteClientSuccess"), AlertVariant.success);
|
addAlert(t("deleteClientSuccess"), AlertVariant.success);
|
||||||
history.push(toClientPolicies({ realm, tab: "profiles" }));
|
navigate(toClientPolicies({ realm, tab: "profiles" }));
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
addError(t("deleteClientError"), error);
|
addError(t("deleteClientError"), error);
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,8 @@ import { useAlerts } from "../components/alert/Alerts";
|
||||||
import { useServerInfo } from "../context/server-info/ServerInfoProvider";
|
import { useServerInfo } from "../context/server-info/ServerInfoProvider";
|
||||||
import { Controller, FormProvider, useForm } from "react-hook-form";
|
import { Controller, FormProvider, useForm } from "react-hook-form";
|
||||||
import { HelpItem } from "../components/help-enabler/HelpItem";
|
import { HelpItem } from "../components/help-enabler/HelpItem";
|
||||||
import { Link, useHistory, useParams } from "react-router-dom";
|
import { Link, useParams } from "react-router-dom";
|
||||||
|
import { useNavigate } from "react-router-dom-v5-compat";
|
||||||
import { useAdminClient, useFetch } from "../context/auth/AdminClient";
|
import { useAdminClient, useFetch } from "../context/auth/AdminClient";
|
||||||
import type ComponentTypeRepresentation from "@keycloak/keycloak-admin-client/lib/defs/componentTypeRepresentation";
|
import type ComponentTypeRepresentation from "@keycloak/keycloak-admin-client/lib/defs/componentTypeRepresentation";
|
||||||
import type { ConfigPropertyRepresentation } from "@keycloak/keycloak-admin-client/lib/defs/authenticatorConfigInfoRepresentation";
|
import type { ConfigPropertyRepresentation } from "@keycloak/keycloak-admin-client/lib/defs/authenticatorConfigInfoRepresentation";
|
||||||
|
@ -37,7 +38,7 @@ const defaultValues: ExecutorForm = {
|
||||||
|
|
||||||
export default function ExecutorForm() {
|
export default function ExecutorForm() {
|
||||||
const { t } = useTranslation("realm-settings");
|
const { t } = useTranslation("realm-settings");
|
||||||
const history = useHistory();
|
const navigate = useNavigate();
|
||||||
const { realm, profileName } = useParams<ClientProfileParams>();
|
const { realm, profileName } = useParams<ClientProfileParams>();
|
||||||
const { executorName } = useParams<ExecutorParams>();
|
const { executorName } = useParams<ExecutorParams>();
|
||||||
const { addAlert, addError } = useAlerts();
|
const { addAlert, addError } = useAlerts();
|
||||||
|
@ -124,7 +125,7 @@ export default function ExecutorForm() {
|
||||||
AlertVariant.success
|
AlertVariant.success
|
||||||
);
|
);
|
||||||
|
|
||||||
history.push(toClientProfile({ realm, profileName }));
|
navigate(toClientProfile({ realm, profileName }));
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
addError(
|
addError(
|
||||||
editMode
|
editMode
|
||||||
|
|
|
@ -8,7 +8,8 @@ import {
|
||||||
} from "@patternfly/react-core";
|
} from "@patternfly/react-core";
|
||||||
import { FormProvider, useForm, useFormContext } from "react-hook-form";
|
import { FormProvider, useForm, useFormContext } from "react-hook-form";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { Link, useHistory, useParams } from "react-router-dom";
|
import { Link, useParams } from "react-router-dom";
|
||||||
|
import { useNavigate } from "react-router-dom-v5-compat";
|
||||||
import { ScrollForm } from "../components/scroll-form/ScrollForm";
|
import { ScrollForm } from "../components/scroll-form/ScrollForm";
|
||||||
import type UserProfileConfig from "@keycloak/keycloak-admin-client/lib/defs/userProfileConfig";
|
import type UserProfileConfig from "@keycloak/keycloak-admin-client/lib/defs/userProfileConfig";
|
||||||
import { AttributeGeneralSettings } from "./user-profile/attribute/AttributeGeneralSettings";
|
import { AttributeGeneralSettings } from "./user-profile/attribute/AttributeGeneralSettings";
|
||||||
|
@ -102,7 +103,7 @@ export default function NewAttributeSettings() {
|
||||||
const { adminClient } = useAdminClient();
|
const { adminClient } = useAdminClient();
|
||||||
const form = useForm<UserProfileConfig>({ shouldUnregister: false });
|
const form = useForm<UserProfileConfig>({ shouldUnregister: false });
|
||||||
const { t } = useTranslation("realm-settings");
|
const { t } = useTranslation("realm-settings");
|
||||||
const history = useHistory();
|
const navigate = useNavigate();
|
||||||
const { addAlert, addError } = useAlerts();
|
const { addAlert, addError } = useAlerts();
|
||||||
const [config, setConfig] = useState<UserProfileConfig | null>(null);
|
const [config, setConfig] = useState<UserProfileConfig | null>(null);
|
||||||
const editMode = attributeName ? true : false;
|
const editMode = attributeName ? true : false;
|
||||||
|
@ -208,7 +209,7 @@ export default function NewAttributeSettings() {
|
||||||
realm,
|
realm,
|
||||||
});
|
});
|
||||||
|
|
||||||
history.push(toUserProfile({ realm, tab: "attributes" }));
|
navigate(toUserProfile({ realm, tab: "attributes" }));
|
||||||
|
|
||||||
addAlert(
|
addAlert(
|
||||||
t("realm-settings:createAttributeSuccess"),
|
t("realm-settings:createAttributeSuccess"),
|
||||||
|
|
|
@ -20,7 +20,8 @@ import type ClientPolicyRepresentation from "@keycloak/keycloak-admin-client/lib
|
||||||
import { camelCase } from "lodash-es";
|
import { camelCase } from "lodash-es";
|
||||||
import { useAdminClient, useFetch } from "../context/auth/AdminClient";
|
import { useAdminClient, useFetch } from "../context/auth/AdminClient";
|
||||||
import { useAlerts } from "../components/alert/Alerts";
|
import { useAlerts } from "../components/alert/Alerts";
|
||||||
import { useHistory, useParams } from "react-router";
|
import { useParams } from "react-router";
|
||||||
|
import { useNavigate } from "react-router-dom-v5-compat";
|
||||||
import type ComponentTypeRepresentation from "@keycloak/keycloak-admin-client/lib/defs/componentTypeRepresentation";
|
import type ComponentTypeRepresentation from "@keycloak/keycloak-admin-client/lib/defs/componentTypeRepresentation";
|
||||||
import { useRealm } from "../context/realm-context/RealmContext";
|
import { useRealm } from "../context/realm-context/RealmContext";
|
||||||
import type { ConfigPropertyRepresentation } from "@keycloak/keycloak-admin-client/lib/defs/authenticatorConfigInfoRepresentation";
|
import type { ConfigPropertyRepresentation } from "@keycloak/keycloak-admin-client/lib/defs/authenticatorConfigInfoRepresentation";
|
||||||
|
@ -41,7 +42,7 @@ type ConfigProperty = ConfigPropertyRepresentation & {
|
||||||
export default function NewClientPolicyCondition() {
|
export default function NewClientPolicyCondition() {
|
||||||
const { t } = useTranslation("realm-settings");
|
const { t } = useTranslation("realm-settings");
|
||||||
const { addAlert, addError } = useAlerts();
|
const { addAlert, addError } = useAlerts();
|
||||||
const history = useHistory();
|
const navigate = useNavigate();
|
||||||
const { realm } = useRealm();
|
const { realm } = useRealm();
|
||||||
|
|
||||||
const [openConditionType, setOpenConditionType] = useState(false);
|
const [openConditionType, setOpenConditionType] = useState(false);
|
||||||
|
@ -162,7 +163,7 @@ export default function NewClientPolicyCondition() {
|
||||||
policies: updatedPolicies,
|
policies: updatedPolicies,
|
||||||
});
|
});
|
||||||
setPolicies(updatedPolicies);
|
setPolicies(updatedPolicies);
|
||||||
history.push(toEditClientPolicy({ realm, policyName }));
|
navigate(toEditClientPolicy({ realm, policyName }));
|
||||||
addAlert(
|
addAlert(
|
||||||
conditionName
|
conditionName
|
||||||
? t("realm-settings:updateClientConditionSuccess")
|
? t("realm-settings:updateClientConditionSuccess")
|
||||||
|
@ -267,7 +268,7 @@ export default function NewClientPolicyCondition() {
|
||||||
variant="link"
|
variant="link"
|
||||||
data-testid="addCondition-cancelBtn"
|
data-testid="addCondition-cancelBtn"
|
||||||
onClick={() =>
|
onClick={() =>
|
||||||
history.push(toEditClientPolicy({ realm, policyName }))
|
navigate(toEditClientPolicy({ realm, policyName }))
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
{t("common:cancel")}
|
{t("common:cancel")}
|
||||||
|
|
|
@ -23,7 +23,8 @@ import { useTranslation } from "react-i18next";
|
||||||
import { Controller, useForm } from "react-hook-form";
|
import { Controller, useForm } from "react-hook-form";
|
||||||
import { FormAccess } from "../components/form-access/FormAccess";
|
import { FormAccess } from "../components/form-access/FormAccess";
|
||||||
import { ViewHeader } from "../components/view-header/ViewHeader";
|
import { ViewHeader } from "../components/view-header/ViewHeader";
|
||||||
import { Link, useHistory, useParams } from "react-router-dom";
|
import { Link, useParams } from "react-router-dom";
|
||||||
|
import { useNavigate } from "react-router-dom-v5-compat";
|
||||||
import { useRealm } from "../context/realm-context/RealmContext";
|
import { useRealm } from "../context/realm-context/RealmContext";
|
||||||
import { useAlerts } from "../components/alert/Alerts";
|
import { useAlerts } from "../components/alert/Alerts";
|
||||||
import { useAdminClient, useFetch } from "../context/auth/AdminClient";
|
import { useAdminClient, useFetch } from "../context/auth/AdminClient";
|
||||||
|
@ -97,7 +98,7 @@ export default function NewClientPolicyForm() {
|
||||||
|
|
||||||
const { policyName } = useParams<EditClientPolicyParams>();
|
const { policyName } = useParams<EditClientPolicyParams>();
|
||||||
|
|
||||||
const history = useHistory();
|
const navigate = useNavigate();
|
||||||
const form = useForm<ClientPolicyRepresentation>({ mode: "onChange" });
|
const form = useForm<ClientPolicyRepresentation>({ mode: "onChange" });
|
||||||
const { handleSubmit } = form;
|
const { handleSubmit } = form;
|
||||||
|
|
||||||
|
@ -259,9 +260,7 @@ export default function NewClientPolicyForm() {
|
||||||
: t("realm-settings:createClientPolicySuccess"),
|
: t("realm-settings:createClientPolicySuccess"),
|
||||||
AlertVariant.success
|
AlertVariant.success
|
||||||
);
|
);
|
||||||
history.push(
|
navigate(toEditClientPolicy({ realm, policyName: createdForm.name! }));
|
||||||
toEditClientPolicy({ realm, policyName: createdForm.name! })
|
|
||||||
);
|
|
||||||
setShowAddConditionsAndProfilesForm(true);
|
setShowAddConditionsAndProfilesForm(true);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
addError("realm-settings:createClientPolicyError", error);
|
addError("realm-settings:createClientPolicyError", error);
|
||||||
|
@ -285,7 +284,7 @@ export default function NewClientPolicyForm() {
|
||||||
policies: updatedPolicies,
|
policies: updatedPolicies,
|
||||||
});
|
});
|
||||||
addAlert(t("deleteClientPolicySuccess"), AlertVariant.success);
|
addAlert(t("deleteClientPolicySuccess"), AlertVariant.success);
|
||||||
history.push(
|
navigate(
|
||||||
toClientPolicies({
|
toClientPolicies({
|
||||||
realm,
|
realm,
|
||||||
tab: "policies",
|
tab: "policies",
|
||||||
|
@ -313,7 +312,7 @@ export default function NewClientPolicyForm() {
|
||||||
policies: policies,
|
policies: policies,
|
||||||
});
|
});
|
||||||
addAlert(t("deleteConditionSuccess"), AlertVariant.success);
|
addAlert(t("deleteConditionSuccess"), AlertVariant.success);
|
||||||
history.push(
|
navigate(
|
||||||
toEditClientPolicy({ realm, policyName: formValues.name! })
|
toEditClientPolicy({ realm, policyName: formValues.name! })
|
||||||
);
|
);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
@ -329,7 +328,7 @@ export default function NewClientPolicyForm() {
|
||||||
policies: updatedPolicies,
|
policies: updatedPolicies,
|
||||||
});
|
});
|
||||||
addAlert(t("deleteClientSuccess"), AlertVariant.success);
|
addAlert(t("deleteClientSuccess"), AlertVariant.success);
|
||||||
history.push(
|
navigate(
|
||||||
toClientPolicies({
|
toClientPolicies({
|
||||||
realm,
|
realm,
|
||||||
tab: "policies",
|
tab: "policies",
|
||||||
|
@ -358,9 +357,7 @@ export default function NewClientPolicyForm() {
|
||||||
policies: policies,
|
policies: policies,
|
||||||
});
|
});
|
||||||
addAlert(t("deleteClientPolicyProfileSuccess"), AlertVariant.success);
|
addAlert(t("deleteClientPolicyProfileSuccess"), AlertVariant.success);
|
||||||
history.push(
|
navigate(toEditClientPolicy({ realm, policyName: formValues.name! }));
|
||||||
toEditClientPolicy({ realm, policyName: formValues.name! })
|
|
||||||
);
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
addError(t("deleteClientPolicyProfileError"), error);
|
addError(t("deleteClientPolicyProfileError"), error);
|
||||||
}
|
}
|
||||||
|
@ -374,7 +371,7 @@ export default function NewClientPolicyForm() {
|
||||||
policies: updatedPolicies,
|
policies: updatedPolicies,
|
||||||
});
|
});
|
||||||
addAlert(t("deleteClientSuccess"), AlertVariant.success);
|
addAlert(t("deleteClientSuccess"), AlertVariant.success);
|
||||||
history.push(
|
navigate(
|
||||||
toClientPolicies({
|
toClientPolicies({
|
||||||
realm,
|
realm,
|
||||||
tab: "policies",
|
tab: "policies",
|
||||||
|
@ -422,7 +419,7 @@ export default function NewClientPolicyForm() {
|
||||||
policies: newPolicies,
|
policies: newPolicies,
|
||||||
});
|
});
|
||||||
setPolicies(newPolicies);
|
setPolicies(newPolicies);
|
||||||
history.push(toEditClientPolicy({ realm, policyName: formValues.name! }));
|
navigate(toEditClientPolicy({ realm, policyName: formValues.name! }));
|
||||||
addAlert(
|
addAlert(
|
||||||
t("realm-settings:addClientProfileSuccess"),
|
t("realm-settings:addClientProfileSuccess"),
|
||||||
AlertVariant.success
|
AlertVariant.success
|
||||||
|
@ -506,7 +503,7 @@ export default function NewClientPolicyForm() {
|
||||||
onClick={() =>
|
onClick={() =>
|
||||||
showAddConditionsAndProfilesForm || policyName
|
showAddConditionsAndProfilesForm || policyName
|
||||||
? reset()
|
? reset()
|
||||||
: history.push(
|
: navigate(
|
||||||
toClientPolicies({
|
toClientPolicies({
|
||||||
realm,
|
realm,
|
||||||
tab: "policies",
|
tab: "policies",
|
||||||
|
|
|
@ -19,7 +19,8 @@ import { useTranslation } from "react-i18next";
|
||||||
import { useAdminClient, useFetch } from "../context/auth/AdminClient";
|
import { useAdminClient, useFetch } from "../context/auth/AdminClient";
|
||||||
import { prettyPrintJSON } from "../util";
|
import { prettyPrintJSON } from "../util";
|
||||||
import { CodeEditor, Language } from "@patternfly/react-code-editor";
|
import { CodeEditor, Language } from "@patternfly/react-code-editor";
|
||||||
import { Link, useHistory } from "react-router-dom";
|
import { Link } from "react-router-dom";
|
||||||
|
import { useNavigate } from "react-router-dom-v5-compat";
|
||||||
import type ClientPolicyRepresentation from "@keycloak/keycloak-admin-client/lib/defs/clientPolicyRepresentation";
|
import type ClientPolicyRepresentation from "@keycloak/keycloak-admin-client/lib/defs/clientPolicyRepresentation";
|
||||||
import { useConfirmDialog } from "../components/confirm-dialog/ConfirmDialog";
|
import { useConfirmDialog } from "../components/confirm-dialog/ConfirmDialog";
|
||||||
import { useAlerts } from "../components/alert/Alerts";
|
import { useAlerts } from "../components/alert/Alerts";
|
||||||
|
@ -38,7 +39,7 @@ export const PoliciesTab = () => {
|
||||||
const { adminClient } = useAdminClient();
|
const { adminClient } = useAdminClient();
|
||||||
const { addAlert, addError } = useAlerts();
|
const { addAlert, addError } = useAlerts();
|
||||||
const { realm } = useRealm();
|
const { realm } = useRealm();
|
||||||
const history = useHistory();
|
const navigate = useNavigate();
|
||||||
const [show, setShow] = useState(false);
|
const [show, setShow] = useState(false);
|
||||||
const [policies, setPolicies] = useState<ClientPolicyRepresentation[]>();
|
const [policies, setPolicies] = useState<ClientPolicyRepresentation[]>();
|
||||||
const [selectedPolicy, setSelectedPolicy] =
|
const [selectedPolicy, setSelectedPolicy] =
|
||||||
|
@ -81,7 +82,7 @@ export const PoliciesTab = () => {
|
||||||
await adminClient.clientPolicies.updatePolicy({
|
await adminClient.clientPolicies.updatePolicy({
|
||||||
policies: updatedPolicies,
|
policies: updatedPolicies,
|
||||||
});
|
});
|
||||||
history.push(toClientPolicies({ realm, tab: "policies" }));
|
navigate(toClientPolicies({ realm, tab: "policies" }));
|
||||||
addAlert(
|
addAlert(
|
||||||
t("realm-settings:updateClientPolicySuccess"),
|
t("realm-settings:updateClientPolicySuccess"),
|
||||||
AlertVariant.success
|
AlertVariant.success
|
||||||
|
@ -234,7 +235,7 @@ export const PoliciesTab = () => {
|
||||||
message={t("realm-settings:noClientPolicies")}
|
message={t("realm-settings:noClientPolicies")}
|
||||||
instructions={t("realm-settings:noClientPoliciesInstructions")}
|
instructions={t("realm-settings:noClientPoliciesInstructions")}
|
||||||
primaryActionText={t("realm-settings:createClientPolicy")}
|
primaryActionText={t("realm-settings:createClientPolicy")}
|
||||||
onPrimaryAction={() => history.push(toAddClientPolicy({ realm }))}
|
onPrimaryAction={() => navigate(toAddClientPolicy({ realm }))}
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
ariaLabelKey="realm-settings:clientPolicies"
|
ariaLabelKey="realm-settings:clientPolicies"
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { useHistory } from "react-router-dom";
|
import { useHistory } from "react-router-dom";
|
||||||
|
import { useNavigate } from "react-router-dom-v5-compat";
|
||||||
import { Controller, useForm } from "react-hook-form";
|
import { Controller, useForm } from "react-hook-form";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import {
|
import {
|
||||||
|
@ -74,7 +75,7 @@ const RealmSettingsHeader = ({
|
||||||
const { adminClient } = useAdminClient();
|
const { adminClient } = useAdminClient();
|
||||||
const { refresh: refreshRealms } = useRealms();
|
const { refresh: refreshRealms } = useRealms();
|
||||||
const { addAlert, addError } = useAlerts();
|
const { addAlert, addError } = useAlerts();
|
||||||
const history = useHistory();
|
const navigate = useNavigate();
|
||||||
const [partialImportOpen, setPartialImportOpen] = useState(false);
|
const [partialImportOpen, setPartialImportOpen] = useState(false);
|
||||||
const [partialExportOpen, setPartialExportOpen] = useState(false);
|
const [partialExportOpen, setPartialExportOpen] = useState(false);
|
||||||
|
|
||||||
|
@ -98,7 +99,7 @@ const RealmSettingsHeader = ({
|
||||||
await adminClient.realms.del({ realm: realmName });
|
await adminClient.realms.del({ realm: realmName });
|
||||||
addAlert(t("deletedSuccess"), AlertVariant.success);
|
addAlert(t("deletedSuccess"), AlertVariant.success);
|
||||||
await refreshRealms();
|
await refreshRealms();
|
||||||
history.push(toDashboard({ realm: environment.masterRealm }));
|
navigate(toDashboard({ realm: environment.masterRealm }));
|
||||||
refresh();
|
refresh();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
addError("realm-settings:deleteError", error);
|
addError("realm-settings:deleteError", error);
|
||||||
|
@ -174,6 +175,7 @@ export const RealmSettingsTabs = ({
|
||||||
const { realm: realmName } = useRealm();
|
const { realm: realmName } = useRealm();
|
||||||
const { refresh: refreshRealms } = useRealms();
|
const { refresh: refreshRealms } = useRealms();
|
||||||
const history = useHistory();
|
const history = useHistory();
|
||||||
|
const navigate = useNavigate();
|
||||||
const isFeatureEnabled = useIsFeatureEnabled();
|
const isFeatureEnabled = useIsFeatureEnabled();
|
||||||
|
|
||||||
const { control, setValue, getValues } = useForm({
|
const { control, setValue, getValues } = useForm({
|
||||||
|
@ -225,7 +227,7 @@ export const RealmSettingsTabs = ({
|
||||||
const isRealmRenamed = realmName !== (r.realm || realm.realm);
|
const isRealmRenamed = realmName !== (r.realm || realm.realm);
|
||||||
if (isRealmRenamed) {
|
if (isRealmRenamed) {
|
||||||
await refreshRealms();
|
await refreshRealms();
|
||||||
history.push(toRealmSettings({ realm: r.realm!, tab: "general" }));
|
navigate(toRealmSettings({ realm: r.realm!, tab: "general" }));
|
||||||
}
|
}
|
||||||
refresh();
|
refresh();
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { useHistory } from "react-router-dom";
|
import { useNavigate } from "react-router-dom-v5-compat";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import {
|
import {
|
||||||
Button,
|
Button,
|
||||||
|
@ -80,7 +80,7 @@ const SelectFilter = ({ onFilter }: SelectFilterProps) => {
|
||||||
|
|
||||||
export const KeysListTab = ({ realmComponents }: KeysListTabProps) => {
|
export const KeysListTab = ({ realmComponents }: KeysListTabProps) => {
|
||||||
const { t } = useTranslation("realm-settings");
|
const { t } = useTranslation("realm-settings");
|
||||||
const history = useHistory();
|
const navigate = useNavigate();
|
||||||
|
|
||||||
const [publicKey, setPublicKey] = useState("");
|
const [publicKey, setPublicKey] = useState("");
|
||||||
const [certificate, setCertificate] = useState("");
|
const [certificate, setCertificate] = useState("");
|
||||||
|
@ -235,7 +235,7 @@ export const KeysListTab = ({ realmComponents }: KeysListTabProps) => {
|
||||||
instructions={t("noKeysDescription")}
|
instructions={t("noKeysDescription")}
|
||||||
primaryActionText={t("addProvider")}
|
primaryActionText={t("addProvider")}
|
||||||
onPrimaryAction={() =>
|
onPrimaryAction={() =>
|
||||||
history.push(toKeysTab({ realm, tab: "providers" }))
|
navigate(toKeysTab({ realm, tab: "providers" }))
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,8 @@ import {
|
||||||
import { useEffect, useMemo } from "react";
|
import { useEffect, useMemo } from "react";
|
||||||
import { FormProvider, SubmitHandler, useForm } from "react-hook-form";
|
import { FormProvider, SubmitHandler, useForm } from "react-hook-form";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { Link, useHistory, useParams } from "react-router-dom";
|
import { Link, useParams } from "react-router-dom";
|
||||||
|
import { useNavigate } from "react-router-dom-v5-compat";
|
||||||
import { KeyValueInput } from "../../components/key-value-form/KeyValueInput";
|
import { KeyValueInput } from "../../components/key-value-form/KeyValueInput";
|
||||||
import { FormAccess } from "../../components/form-access/FormAccess";
|
import { FormAccess } from "../../components/form-access/FormAccess";
|
||||||
import { HelpItem } from "../../components/help-enabler/HelpItem";
|
import { HelpItem } from "../../components/help-enabler/HelpItem";
|
||||||
|
@ -57,7 +58,7 @@ export default function AttributesGroupForm() {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const { realm } = useRealm();
|
const { realm } = useRealm();
|
||||||
const { config, save } = useUserProfile();
|
const { config, save } = useUserProfile();
|
||||||
const history = useHistory();
|
const navigate = useNavigate();
|
||||||
const params = useParams<Partial<EditAttributesGroupParams>>();
|
const params = useParams<Partial<EditAttributesGroupParams>>();
|
||||||
const form = useForm<FormFields>({ defaultValues, shouldUnregister: false });
|
const form = useForm<FormFields>({ defaultValues, shouldUnregister: false });
|
||||||
|
|
||||||
|
@ -99,7 +100,7 @@ export default function AttributesGroupForm() {
|
||||||
const success = await save({ ...config, groups });
|
const success = await save({ ...config, groups });
|
||||||
|
|
||||||
if (success) {
|
if (success) {
|
||||||
history.push(toUserProfile({ realm, tab: "attributes-group" }));
|
navigate(toUserProfile({ realm, tab: "attributes-group" }));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,8 @@ import {
|
||||||
} from "@patternfly/react-core";
|
} from "@patternfly/react-core";
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { Trans, useTranslation } from "react-i18next";
|
import { Trans, useTranslation } from "react-i18next";
|
||||||
import { Link, useHistory } from "react-router-dom";
|
import { Link } from "react-router-dom";
|
||||||
|
import { useNavigate } from "react-router-dom-v5-compat";
|
||||||
import { useConfirmDialog } from "../../components/confirm-dialog/ConfirmDialog";
|
import { useConfirmDialog } from "../../components/confirm-dialog/ConfirmDialog";
|
||||||
import { ListEmptyState } from "../../components/list-empty-state/ListEmptyState";
|
import { ListEmptyState } from "../../components/list-empty-state/ListEmptyState";
|
||||||
import { KeycloakDataTable } from "../../components/table-toolbar/KeycloakDataTable";
|
import { KeycloakDataTable } from "../../components/table-toolbar/KeycloakDataTable";
|
||||||
|
@ -19,7 +20,7 @@ import { useUserProfile } from "./UserProfileContext";
|
||||||
export const AttributesGroupTab = () => {
|
export const AttributesGroupTab = () => {
|
||||||
const { config, save } = useUserProfile();
|
const { config, save } = useUserProfile();
|
||||||
const { t } = useTranslation("attributes-group");
|
const { t } = useTranslation("attributes-group");
|
||||||
const history = useHistory();
|
const navigate = useNavigate();
|
||||||
const { realm } = useRealm();
|
const { realm } = useRealm();
|
||||||
const [key, setKey] = useState(0);
|
const [key, setKey] = useState(0);
|
||||||
const [groupToDelete, setGroupToDelete] = useState<UserProfileGroup>();
|
const [groupToDelete, setGroupToDelete] = useState<UserProfileGroup>();
|
||||||
|
@ -109,9 +110,7 @@ export const AttributesGroupTab = () => {
|
||||||
message={t("emptyStateMessage")}
|
message={t("emptyStateMessage")}
|
||||||
instructions={t("emptyStateInstructions")}
|
instructions={t("emptyStateInstructions")}
|
||||||
primaryActionText={t("createGroupText")}
|
primaryActionText={t("createGroupText")}
|
||||||
onPrimaryAction={() =>
|
onPrimaryAction={() => navigate(toNewAttributesGroup({ realm }))}
|
||||||
history.push(toNewAttributesGroup({ realm }))
|
|
||||||
}
|
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
|
|
|
@ -15,7 +15,8 @@ import { FilterIcon } from "@patternfly/react-icons";
|
||||||
|
|
||||||
import { KeycloakSpinner } from "../../components/keycloak-spinner/KeycloakSpinner";
|
import { KeycloakSpinner } from "../../components/keycloak-spinner/KeycloakSpinner";
|
||||||
import { DraggableTable } from "../../authentication/components/DraggableTable";
|
import { DraggableTable } from "../../authentication/components/DraggableTable";
|
||||||
import { Link, useHistory } from "react-router-dom";
|
import { Link } from "react-router-dom";
|
||||||
|
import { useNavigate } from "react-router-dom-v5-compat";
|
||||||
import { toAddAttribute } from "../routes/AddAttribute";
|
import { toAddAttribute } from "../routes/AddAttribute";
|
||||||
import { useRealm } from "../../context/realm-context/RealmContext";
|
import { useRealm } from "../../context/realm-context/RealmContext";
|
||||||
import { useUserProfile } from "./UserProfileContext";
|
import { useUserProfile } from "./UserProfileContext";
|
||||||
|
@ -32,7 +33,7 @@ export const AttributesTab = () => {
|
||||||
const { config, save } = useUserProfile();
|
const { config, save } = useUserProfile();
|
||||||
const { realm: realmName } = useRealm();
|
const { realm: realmName } = useRealm();
|
||||||
const { t } = useTranslation("realm-settings");
|
const { t } = useTranslation("realm-settings");
|
||||||
const history = useHistory();
|
const navigate = useNavigate();
|
||||||
const [filter, setFilter] = useState("allGroups");
|
const [filter, setFilter] = useState("allGroups");
|
||||||
const [isFilterTypeDropdownOpen, toggleIsFilterTypeDropdownOpen] =
|
const [isFilterTypeDropdownOpen, toggleIsFilterTypeDropdownOpen] =
|
||||||
useToggle();
|
useToggle();
|
||||||
|
@ -174,7 +175,7 @@ export const AttributesTab = () => {
|
||||||
{
|
{
|
||||||
title: t("common:edit"),
|
title: t("common:edit"),
|
||||||
onClick: (_key, _idx, component) => {
|
onClick: (_key, _idx, component) => {
|
||||||
history.push(
|
navigate(
|
||||||
toAttribute({
|
toAttribute({
|
||||||
realm: realmName,
|
realm: realmName,
|
||||||
attributeName: component.name,
|
attributeName: component.name,
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { useHistory } from "react-router-dom";
|
import { useNavigate } from "react-router-dom-v5-compat";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { Controller, useForm } from "react-hook-form";
|
import { Controller, useForm } from "react-hook-form";
|
||||||
import {
|
import {
|
||||||
|
@ -24,7 +24,7 @@ import { convertFormValuesToObject, convertToFormValues } from "../../util";
|
||||||
|
|
||||||
export default function NewRealmForm() {
|
export default function NewRealmForm() {
|
||||||
const { t } = useTranslation("realm");
|
const { t } = useTranslation("realm");
|
||||||
const history = useHistory();
|
const navigate = useNavigate();
|
||||||
const { refresh, whoAmI } = useWhoAmI();
|
const { refresh, whoAmI } = useWhoAmI();
|
||||||
const { refresh: refreshRealms } = useRealms();
|
const { refresh: refreshRealms } = useRealms();
|
||||||
const { adminClient } = useAdminClient();
|
const { adminClient } = useAdminClient();
|
||||||
|
@ -55,7 +55,7 @@ export default function NewRealmForm() {
|
||||||
|
|
||||||
refresh();
|
refresh();
|
||||||
await refreshRealms();
|
await refreshRealms();
|
||||||
history.push(toDashboard({ realm: fields.realm }));
|
navigate(toDashboard({ realm: fields.realm }));
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
addError("realm:saveRealmError", error);
|
addError("realm:saveRealmError", error);
|
||||||
}
|
}
|
||||||
|
@ -113,7 +113,7 @@ export default function NewRealmForm() {
|
||||||
<Button variant="primary" type="submit">
|
<Button variant="primary" type="submit">
|
||||||
{t("common:create")}
|
{t("common:create")}
|
||||||
</Button>
|
</Button>
|
||||||
<Button variant="link" onClick={() => history.goBack()}>
|
<Button variant="link" onClick={() => navigate(-1)}>
|
||||||
{t("common:cancel")}
|
{t("common:cancel")}
|
||||||
</Button>
|
</Button>
|
||||||
</ActionGroup>
|
</ActionGroup>
|
||||||
|
|
|
@ -15,14 +15,15 @@ import { FormProvider, useForm } from "react-hook-form";
|
||||||
import { useAdminClient, useFetch } from "../context/auth/AdminClient";
|
import { useAdminClient, useFetch } from "../context/auth/AdminClient";
|
||||||
import { useAlerts } from "../components/alert/Alerts";
|
import { useAlerts } from "../components/alert/Alerts";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { useHistory, useParams } from "react-router-dom";
|
import { useParams } from "react-router-dom";
|
||||||
|
import { useNavigate } from "react-router-dom-v5-compat";
|
||||||
import { Header } from "./shared/Header";
|
import { Header } from "./shared/Header";
|
||||||
import { toUserFederation } from "./routes/UserFederation";
|
import { toUserFederation } from "./routes/UserFederation";
|
||||||
|
|
||||||
export default function UserFederationKerberosSettings() {
|
export default function UserFederationKerberosSettings() {
|
||||||
const { t } = useTranslation("user-federation");
|
const { t } = useTranslation("user-federation");
|
||||||
const form = useForm<ComponentRepresentation>({ mode: "onChange" });
|
const form = useForm<ComponentRepresentation>({ mode: "onChange" });
|
||||||
const history = useHistory();
|
const navigate = useNavigate();
|
||||||
const { adminClient } = useAdminClient();
|
const { adminClient } = useAdminClient();
|
||||||
const { realm } = useRealm();
|
const { realm } = useRealm();
|
||||||
|
|
||||||
|
@ -54,7 +55,7 @@ export default function UserFederationKerberosSettings() {
|
||||||
try {
|
try {
|
||||||
if (!id) {
|
if (!id) {
|
||||||
await adminClient.components.create(component);
|
await adminClient.components.create(component);
|
||||||
history.push(`/${realm}/user-federation`);
|
navigate(`/${realm}/user-federation`);
|
||||||
} else {
|
} else {
|
||||||
await adminClient.components.update({ id }, component);
|
await adminClient.components.update({ id }, component);
|
||||||
}
|
}
|
||||||
|
@ -87,7 +88,7 @@ export default function UserFederationKerberosSettings() {
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
variant="link"
|
variant="link"
|
||||||
onClick={() => history.push(toUserFederation({ realm }))}
|
onClick={() => navigate(toUserFederation({ realm }))}
|
||||||
data-testid="kerberos-cancel"
|
data-testid="kerberos-cancel"
|
||||||
>
|
>
|
||||||
{t("common:cancel")}
|
{t("common:cancel")}
|
||||||
|
|
|
@ -24,7 +24,8 @@ import { FormProvider, useForm, useFormContext } from "react-hook-form";
|
||||||
import { useAdminClient, useFetch } from "../context/auth/AdminClient";
|
import { useAdminClient, useFetch } from "../context/auth/AdminClient";
|
||||||
import { useAlerts } from "../components/alert/Alerts";
|
import { useAlerts } from "../components/alert/Alerts";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { useHistory, useParams } from "react-router-dom";
|
import { useParams } from "react-router-dom";
|
||||||
|
import { useNavigate } from "react-router-dom-v5-compat";
|
||||||
import { ScrollForm } from "../components/scroll-form/ScrollForm";
|
import { ScrollForm } from "../components/scroll-form/ScrollForm";
|
||||||
|
|
||||||
import { KeycloakTabs } from "../components/keycloak-tabs/KeycloakTabs";
|
import { KeycloakTabs } from "../components/keycloak-tabs/KeycloakTabs";
|
||||||
|
@ -47,7 +48,7 @@ const AddLdapFormContent = ({
|
||||||
const { t } = useTranslation("user-federation");
|
const { t } = useTranslation("user-federation");
|
||||||
const form = useFormContext();
|
const form = useFormContext();
|
||||||
const { id } = useParams<{ id: string }>();
|
const { id } = useParams<{ id: string }>();
|
||||||
const history = useHistory();
|
const navigate = useNavigate();
|
||||||
|
|
||||||
const { realm } = useRealm();
|
const { realm } = useRealm();
|
||||||
|
|
||||||
|
@ -94,7 +95,7 @@ const AddLdapFormContent = ({
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
variant="link"
|
variant="link"
|
||||||
onClick={() => history.push(toUserFederation({ realm }))}
|
onClick={() => navigate(toUserFederation({ realm }))}
|
||||||
data-testid="ldap-cancel"
|
data-testid="ldap-cancel"
|
||||||
>
|
>
|
||||||
{t("common:cancel")}
|
{t("common:cancel")}
|
||||||
|
@ -108,7 +109,7 @@ const AddLdapFormContent = ({
|
||||||
export default function UserFederationLdapSettings() {
|
export default function UserFederationLdapSettings() {
|
||||||
const { t } = useTranslation("user-federation");
|
const { t } = useTranslation("user-federation");
|
||||||
const form = useForm<ComponentRepresentation>({ mode: "onChange" });
|
const form = useForm<ComponentRepresentation>({ mode: "onChange" });
|
||||||
const history = useHistory();
|
const navigate = useNavigate();
|
||||||
const { adminClient } = useAdminClient();
|
const { adminClient } = useAdminClient();
|
||||||
const { realm } = useRealm();
|
const { realm } = useRealm();
|
||||||
|
|
||||||
|
@ -167,7 +168,7 @@ export default function UserFederationLdapSettings() {
|
||||||
try {
|
try {
|
||||||
if (!id) {
|
if (!id) {
|
||||||
await adminClient.components.create(component);
|
await adminClient.components.create(component);
|
||||||
history.push(toUserFederation({ realm }));
|
navigate(toUserFederation({ realm }));
|
||||||
} else {
|
} else {
|
||||||
await adminClient.components.update({ id }, component);
|
await adminClient.components.update({ id }, component);
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,7 @@ import { DatabaseIcon } from "@patternfly/react-icons";
|
||||||
import type ComponentRepresentation from "@keycloak/keycloak-admin-client/lib/defs/componentRepresentation";
|
import type ComponentRepresentation from "@keycloak/keycloak-admin-client/lib/defs/componentRepresentation";
|
||||||
import { useMemo, useState } from "react";
|
import { useMemo, useState } from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { useHistory } from "react-router-dom";
|
import { useNavigate } from "react-router-dom-v5-compat";
|
||||||
import { useAlerts } from "../components/alert/Alerts";
|
import { useAlerts } from "../components/alert/Alerts";
|
||||||
import { useConfirmDialog } from "../components/confirm-dialog/ConfirmDialog";
|
import { useConfirmDialog } from "../components/confirm-dialog/ConfirmDialog";
|
||||||
import { ManagePriorityDialog } from "./ManagePriorityDialog";
|
import { ManagePriorityDialog } from "./ManagePriorityDialog";
|
||||||
|
@ -42,7 +42,7 @@ export default function UserFederationSection() {
|
||||||
const [key, setKey] = useState(0);
|
const [key, setKey] = useState(0);
|
||||||
const refresh = () => setKey(new Date().getTime());
|
const refresh = () => setKey(new Date().getTime());
|
||||||
|
|
||||||
const history = useHistory();
|
const navigate = useNavigate();
|
||||||
|
|
||||||
const [manageDisplayDialog, setManageDisplayDialog] = useState(false);
|
const [manageDisplayDialog, setManageDisplayDialog] = useState(false);
|
||||||
|
|
||||||
|
@ -72,7 +72,7 @@ export default function UserFederationSection() {
|
||||||
<DropdownItem
|
<DropdownItem
|
||||||
key={p.id}
|
key={p.id}
|
||||||
onClick={() =>
|
onClick={() =>
|
||||||
history.push(toProvider({ realm, providerId: p.id!, id: "new" }))
|
navigate(toProvider({ realm, providerId: p.id!, id: "new" }))
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
{p.id.toUpperCase() == "LDAP"
|
{p.id.toUpperCase() == "LDAP"
|
||||||
|
@ -200,7 +200,7 @@ export default function UserFederationSection() {
|
||||||
role="button"
|
role="button"
|
||||||
isHoverable
|
isHoverable
|
||||||
onClick={() =>
|
onClick={() =>
|
||||||
history.push(toProvider({ realm, providerId: p.id! }))
|
navigate(toProvider({ realm, providerId: p.id! }))
|
||||||
}
|
}
|
||||||
data-testid={`${p.id}-card`}
|
data-testid={`${p.id}-card`}
|
||||||
>
|
>
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { Link, useHistory, useParams } from "react-router-dom";
|
import { Link, useParams } from "react-router-dom";
|
||||||
|
import { useNavigate } from "react-router-dom-v5-compat";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { FormProvider, useForm } from "react-hook-form";
|
import { FormProvider, useForm } from "react-hook-form";
|
||||||
import {
|
import {
|
||||||
|
@ -29,7 +30,7 @@ import "./custom-provider-settings.css";
|
||||||
export default function CustomProviderSettings() {
|
export default function CustomProviderSettings() {
|
||||||
const { t } = useTranslation("user-federation");
|
const { t } = useTranslation("user-federation");
|
||||||
const { id, providerId } = useParams<ProviderRouteParams>();
|
const { id, providerId } = useParams<ProviderRouteParams>();
|
||||||
const history = useHistory();
|
const navigate = useNavigate();
|
||||||
const form = useForm<ComponentRepresentation>({
|
const form = useForm<ComponentRepresentation>({
|
||||||
mode: "onChange",
|
mode: "onChange",
|
||||||
});
|
});
|
||||||
|
@ -88,7 +89,7 @@ export default function CustomProviderSettings() {
|
||||||
try {
|
try {
|
||||||
if (!id) {
|
if (!id) {
|
||||||
await adminClient.components.create(saveComponent);
|
await adminClient.components.create(saveComponent);
|
||||||
history.push(toUserFederation({ realm: realmName }));
|
navigate(toUserFederation({ realm: realmName }));
|
||||||
} else {
|
} else {
|
||||||
await adminClient.components.update({ id }, saveComponent);
|
await adminClient.components.update({ id }, saveComponent);
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,8 @@ import { convertFormValuesToObject, convertToFormValues } from "../../../util";
|
||||||
import type ComponentRepresentation from "@keycloak/keycloak-admin-client/lib/defs/componentRepresentation";
|
import type ComponentRepresentation from "@keycloak/keycloak-admin-client/lib/defs/componentRepresentation";
|
||||||
import { useAdminClient, useFetch } from "../../../context/auth/AdminClient";
|
import { useAdminClient, useFetch } from "../../../context/auth/AdminClient";
|
||||||
import { ViewHeader } from "../../../components/view-header/ViewHeader";
|
import { ViewHeader } from "../../../components/view-header/ViewHeader";
|
||||||
import { useHistory, useParams } from "react-router-dom";
|
import { useParams } from "react-router-dom";
|
||||||
|
import { useNavigate } from "react-router-dom-v5-compat";
|
||||||
import { Controller, FormProvider, useForm, useWatch } from "react-hook-form";
|
import { Controller, FormProvider, useForm, useWatch } from "react-hook-form";
|
||||||
import { useAlerts } from "../../../components/alert/Alerts";
|
import { useAlerts } from "../../../components/alert/Alerts";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
|
@ -39,7 +40,7 @@ export default function LdapMapperDetails() {
|
||||||
|
|
||||||
const { adminClient } = useAdminClient();
|
const { adminClient } = useAdminClient();
|
||||||
const { id, mapperId } = useParams<{ id: string; mapperId: string }>();
|
const { id, mapperId } = useParams<{ id: string; mapperId: string }>();
|
||||||
const history = useHistory();
|
const navigate = useNavigate();
|
||||||
const { realm } = useRealm();
|
const { realm } = useRealm();
|
||||||
const { t } = useTranslation("user-federation");
|
const { t } = useTranslation("user-federation");
|
||||||
const { addAlert, addError } = useAlerts();
|
const { addAlert, addError } = useAlerts();
|
||||||
|
@ -92,7 +93,7 @@ export default function LdapMapperDetails() {
|
||||||
try {
|
try {
|
||||||
if (mapperId === "new") {
|
if (mapperId === "new") {
|
||||||
await adminClient.components.create(map);
|
await adminClient.components.create(map);
|
||||||
history.push(
|
navigate(
|
||||||
toUserFederationLdap({ realm, id: mapper.parentId!, tab: "mappers" })
|
toUserFederationLdap({ realm, id: mapper.parentId!, tab: "mappers" })
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
|
@ -128,7 +129,7 @@ export default function LdapMapperDetails() {
|
||||||
id: mapping!.id!,
|
id: mapping!.id!,
|
||||||
});
|
});
|
||||||
addAlert(t("common:mappingDeletedSuccess"), AlertVariant.success);
|
addAlert(t("common:mappingDeletedSuccess"), AlertVariant.success);
|
||||||
history.push(toUserFederationLdap({ id, realm, tab: "mappers" }));
|
navigate(toUserFederationLdap({ id, realm, tab: "mappers" }));
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
addError("common:mappingDeletedError", error);
|
addError("common:mappingDeletedError", error);
|
||||||
}
|
}
|
||||||
|
@ -306,8 +307,8 @@ export default function LdapMapperDetails() {
|
||||||
variant="link"
|
variant="link"
|
||||||
onClick={() =>
|
onClick={() =>
|
||||||
isNew
|
isNew
|
||||||
? history.goBack()
|
? navigate(-1)
|
||||||
: history.push(
|
: navigate(
|
||||||
`/${realm}/user-federation/ldap/${
|
`/${realm}/user-federation/ldap/${
|
||||||
mapping!.parentId
|
mapping!.parentId
|
||||||
}/mappers`
|
}/mappers`
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { Link, useHistory, useParams, useRouteMatch } from "react-router-dom";
|
import { Link, useParams, useRouteMatch } from "react-router-dom";
|
||||||
|
import { useNavigate } from "react-router-dom-v5-compat";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import {
|
import {
|
||||||
AlertVariant,
|
AlertVariant,
|
||||||
|
@ -17,7 +18,7 @@ import { useConfirmDialog } from "../../../components/confirm-dialog/ConfirmDial
|
||||||
import useLocaleSort, { mapByKey } from "../../../utils/useLocaleSort";
|
import useLocaleSort, { mapByKey } from "../../../utils/useLocaleSort";
|
||||||
|
|
||||||
export const LdapMapperList = () => {
|
export const LdapMapperList = () => {
|
||||||
const history = useHistory();
|
const navigate = useNavigate();
|
||||||
const { t } = useTranslation("user-federation");
|
const { t } = useTranslation("user-federation");
|
||||||
const { adminClient } = useAdminClient();
|
const { adminClient } = useAdminClient();
|
||||||
const { addAlert, addError } = useAlerts();
|
const { addAlert, addError } = useAlerts();
|
||||||
|
@ -97,7 +98,7 @@ export const LdapMapperList = () => {
|
||||||
<Button
|
<Button
|
||||||
data-testid="add-mapper-btn"
|
data-testid="add-mapper-btn"
|
||||||
variant="primary"
|
variant="primary"
|
||||||
onClick={() => history.push(`${url}/new`)}
|
onClick={() => navigate(`${url}/new`)}
|
||||||
>
|
>
|
||||||
{t("common:addMapper")}
|
{t("common:addMapper")}
|
||||||
</Button>
|
</Button>
|
||||||
|
@ -126,7 +127,7 @@ export const LdapMapperList = () => {
|
||||||
message={t("common:emptyMappers")}
|
message={t("common:emptyMappers")}
|
||||||
instructions={t("common:emptyMappersInstructions")}
|
instructions={t("common:emptyMappersInstructions")}
|
||||||
primaryActionText={t("common:emptyPrimaryAction")}
|
primaryActionText={t("common:emptyPrimaryAction")}
|
||||||
onPrimaryAction={() => history.push(`${url}/new`)}
|
onPrimaryAction={() => navigate(`${url}/new`)}
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import { ReactElement } from "react";
|
import { ReactElement } from "react";
|
||||||
import { useHistory, useParams } from "react-router-dom";
|
import { useParams } from "react-router-dom";
|
||||||
|
import { useNavigate } from "react-router-dom-v5-compat";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import {
|
import {
|
||||||
AlertVariant,
|
AlertVariant,
|
||||||
|
@ -31,7 +32,7 @@ export const Header = ({
|
||||||
}: HeaderProps) => {
|
}: HeaderProps) => {
|
||||||
const { t } = useTranslation("user-federation");
|
const { t } = useTranslation("user-federation");
|
||||||
const { id } = useParams<ProviderRouteParams>();
|
const { id } = useParams<ProviderRouteParams>();
|
||||||
const history = useHistory();
|
const navigate = useNavigate();
|
||||||
|
|
||||||
const { adminClient } = useAdminClient();
|
const { adminClient } = useAdminClient();
|
||||||
const { addAlert, addError } = useAlerts();
|
const { addAlert, addError } = useAlerts();
|
||||||
|
@ -58,7 +59,7 @@ export const Header = ({
|
||||||
try {
|
try {
|
||||||
await adminClient.components.del({ id: id! });
|
await adminClient.components.del({ id: id! });
|
||||||
addAlert(t("userFedDeletedSuccess"), AlertVariant.success);
|
addAlert(t("userFedDeletedSuccess"), AlertVariant.success);
|
||||||
history.replace(toUserFederation({ realm }));
|
navigate(toUserFederation({ realm }), { replace: true });
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
addError("user-federation:userFedDeleteError", error);
|
addError("user-federation:userFedDeleteError", error);
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,8 @@ import {
|
||||||
} from "@patternfly/react-core";
|
} from "@patternfly/react-core";
|
||||||
import { SearchIcon } from "@patternfly/react-icons";
|
import { SearchIcon } from "@patternfly/react-icons";
|
||||||
import { useForm } from "react-hook-form";
|
import { useForm } from "react-hook-form";
|
||||||
import { useHistory, useRouteMatch } from "react-router-dom";
|
import { useRouteMatch } from "react-router-dom";
|
||||||
|
import { useNavigate } from "react-router-dom-v5-compat";
|
||||||
|
|
||||||
import { KeycloakTextInput } from "../components/keycloak-text-input/KeycloakTextInput";
|
import { KeycloakTextInput } from "../components/keycloak-text-input/KeycloakTextInput";
|
||||||
|
|
||||||
|
@ -22,9 +23,9 @@ export const SearchUser = ({ onSearch }: SearchUserProps) => {
|
||||||
const { t } = useTranslation("users");
|
const { t } = useTranslation("users");
|
||||||
const { register, handleSubmit } = useForm<{ search: string }>();
|
const { register, handleSubmit } = useForm<{ search: string }>();
|
||||||
const { url } = useRouteMatch();
|
const { url } = useRouteMatch();
|
||||||
const history = useHistory();
|
const navigate = useNavigate();
|
||||||
|
|
||||||
const goToCreate = () => history.push(`${url}/add-user`);
|
const goToCreate = () => navigate(`${url}/add-user`);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<EmptyState>
|
<EmptyState>
|
||||||
|
|
|
@ -13,7 +13,7 @@ import {
|
||||||
} from "@patternfly/react-core";
|
} from "@patternfly/react-core";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { Controller, useFormContext } from "react-hook-form";
|
import { Controller, useFormContext } from "react-hook-form";
|
||||||
import { useHistory } from "react-router-dom";
|
import { useNavigate } from "react-router-dom-v5-compat";
|
||||||
|
|
||||||
import { FormAccess } from "../components/form-access/FormAccess";
|
import { FormAccess } from "../components/form-access/FormAccess";
|
||||||
import type UserRepresentation from "@keycloak/keycloak-admin-client/lib/defs/userRepresentation";
|
import type UserRepresentation from "@keycloak/keycloak-admin-client/lib/defs/userRepresentation";
|
||||||
|
@ -58,7 +58,7 @@ export const UserForm = ({
|
||||||
isRequiredUserActionsDropdownOpen,
|
isRequiredUserActionsDropdownOpen,
|
||||||
setRequiredUserActionsDropdownOpen,
|
setRequiredUserActionsDropdownOpen,
|
||||||
] = useState(false);
|
] = useState(false);
|
||||||
const history = useHistory();
|
const navigate = useNavigate();
|
||||||
const { adminClient } = useAdminClient();
|
const { adminClient } = useAdminClient();
|
||||||
const { addAlert, addError } = useAlerts();
|
const { addAlert, addError } = useAlerts();
|
||||||
|
|
||||||
|
@ -432,7 +432,7 @@ export const UserForm = ({
|
||||||
<Button
|
<Button
|
||||||
data-testid="cancel-create-user"
|
data-testid="cancel-create-user"
|
||||||
onClick={() =>
|
onClick={() =>
|
||||||
user?.id ? reset(user) : history.push(`/${realmName}/users`)
|
user?.id ? reset(user) : navigate(`/${realmName}/users`)
|
||||||
}
|
}
|
||||||
variant="link"
|
variant="link"
|
||||||
>
|
>
|
||||||
|
|
|
@ -32,6 +32,7 @@ import type UserRepresentation from "@keycloak/keycloak-admin-client/lib/defs/us
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { Link, useHistory } from "react-router-dom";
|
import { Link, useHistory } from "react-router-dom";
|
||||||
|
import { useNavigate } from "react-router-dom-v5-compat";
|
||||||
import { useAlerts } from "../components/alert/Alerts";
|
import { useAlerts } from "../components/alert/Alerts";
|
||||||
import { useConfirmDialog } from "../components/confirm-dialog/ConfirmDialog";
|
import { useConfirmDialog } from "../components/confirm-dialog/ConfirmDialog";
|
||||||
import { ListEmptyState } from "../components/list-empty-state/ListEmptyState";
|
import { ListEmptyState } from "../components/list-empty-state/ListEmptyState";
|
||||||
|
@ -64,6 +65,7 @@ export default function UsersSection() {
|
||||||
const { addAlert, addError } = useAlerts();
|
const { addAlert, addError } = useAlerts();
|
||||||
const { realm: realmName } = useRealm();
|
const { realm: realmName } = useRealm();
|
||||||
const history = useHistory();
|
const history = useHistory();
|
||||||
|
const navigate = useNavigate();
|
||||||
const [userStorage, setUserStorage] = useState<ComponentRepresentation[]>();
|
const [userStorage, setUserStorage] = useState<ComponentRepresentation[]>();
|
||||||
const [searchUser, setSearchUser] = useState<string>();
|
const [searchUser, setSearchUser] = useState<string>();
|
||||||
const [realm, setRealm] = useState<RealmRepresentation | undefined>();
|
const [realm, setRealm] = useState<RealmRepresentation | undefined>();
|
||||||
|
@ -222,7 +224,7 @@ export default function UsersSection() {
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
const goToCreate = () => history.push(toAddUser({ realm: realmName }));
|
const goToCreate = () => navigate(toAddUser({ realm: realmName }));
|
||||||
|
|
||||||
if (!userStorage) {
|
if (!userStorage) {
|
||||||
return <KeycloakSpinner />;
|
return <KeycloakSpinner />;
|
||||||
|
|
|
@ -16,7 +16,8 @@ import { ViewHeader } from "../components/view-header/ViewHeader";
|
||||||
import { BruteForced, UserForm } from "./UserForm";
|
import { BruteForced, UserForm } from "./UserForm";
|
||||||
import { useAlerts } from "../components/alert/Alerts";
|
import { useAlerts } from "../components/alert/Alerts";
|
||||||
import { useAdminClient, useFetch } from "../context/auth/AdminClient";
|
import { useAdminClient, useFetch } from "../context/auth/AdminClient";
|
||||||
import { useHistory, useParams } from "react-router-dom";
|
import { useParams } from "react-router-dom";
|
||||||
|
import { useNavigate } from "react-router-dom-v5-compat";
|
||||||
import { KeycloakTabs } from "../components/keycloak-tabs/KeycloakTabs";
|
import { KeycloakTabs } from "../components/keycloak-tabs/KeycloakTabs";
|
||||||
import { UserGroups } from "./UserGroups";
|
import { UserGroups } from "./UserGroups";
|
||||||
import { UserConsents } from "./UserConsents";
|
import { UserConsents } from "./UserConsents";
|
||||||
|
@ -35,7 +36,7 @@ import { KeycloakSpinner } from "../components/keycloak-spinner/KeycloakSpinner"
|
||||||
const UsersTabs = () => {
|
const UsersTabs = () => {
|
||||||
const { t } = useTranslation("users");
|
const { t } = useTranslation("users");
|
||||||
const { addAlert, addError } = useAlerts();
|
const { addAlert, addError } = useAlerts();
|
||||||
const history = useHistory();
|
const navigate = useNavigate();
|
||||||
const { realm } = useRealm();
|
const { realm } = useRealm();
|
||||||
const { hasAccess } = useAccess();
|
const { hasAccess } = useAccess();
|
||||||
|
|
||||||
|
@ -100,7 +101,7 @@ const UsersTabs = () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
addAlert(t("userCreated"), AlertVariant.success);
|
addAlert(t("userCreated"), AlertVariant.success);
|
||||||
history.push(toUser({ id: createdUser.id, realm, tab: "settings" }));
|
navigate(toUser({ id: createdUser.id, realm, tab: "settings" }));
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
addError("users:userCreateError", error);
|
addError("users:userCreateError", error);
|
||||||
|
@ -116,7 +117,7 @@ const UsersTabs = () => {
|
||||||
try {
|
try {
|
||||||
await adminClient.users.del({ id });
|
await adminClient.users.del({ id });
|
||||||
addAlert(t("userDeletedSuccess"), AlertVariant.success);
|
addAlert(t("userDeletedSuccess"), AlertVariant.success);
|
||||||
history.push(toUsers({ realm }));
|
navigate(toUsers({ realm }));
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
addError("users:userDeletedError", error);
|
addError("users:userDeletedError", error);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue