From 71e7fc1f84e427d898491d7160c897db961ae5c2 Mon Sep 17 00:00:00 2001 From: Erik Jan de Wit Date: Thu, 16 Feb 2023 15:54:44 +0100 Subject: [PATCH] Add `onClose` prop to return to provider list (#4415) fixes: #4406 --- .../keys/key-providers/KeyProviderForm.tsx | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/apps/admin-ui/src/realm-settings/keys/key-providers/KeyProviderForm.tsx b/apps/admin-ui/src/realm-settings/keys/key-providers/KeyProviderForm.tsx index cdb962b02f..ddb43b8f8f 100644 --- a/apps/admin-ui/src/realm-settings/keys/key-providers/KeyProviderForm.tsx +++ b/apps/admin-ui/src/realm-settings/keys/key-providers/KeyProviderForm.tsx @@ -10,6 +10,7 @@ import { } from "@patternfly/react-core"; import { Controller, FormProvider, useForm } from "react-hook-form"; import { useTranslation } from "react-i18next"; +import { useNavigate } from "react-router-dom"; import { useAlerts } from "../../../components/alert/Alerts"; import { DynamicComponents } from "../../../components/dynamic/DynamicComponents"; @@ -21,7 +22,8 @@ import { useAdminClient, useFetch } from "../../../context/auth/AdminClient"; import { useServerInfo } from "../../../context/server-info/ServerInfoProvider"; import { KEY_PROVIDER_TYPE } from "../../../util"; import { useParams } from "../../../utils/useParams"; -import type { KeyProviderParams, ProviderType } from "../../routes/KeyProvider"; +import { KeyProviderParams, ProviderType } from "../../routes/KeyProvider"; +import { toKeysTab } from "../../routes/KeysTab"; type KeyProviderFormProps = { id?: string; @@ -174,11 +176,18 @@ export const KeyProviderForm = ({ export default function KeyProviderFormPage() { const { t } = useTranslation("realm-settings"); const params = useParams(); + const navigate = useNavigate(); + return ( <> - + + navigate(toKeysTab({ realm: params.realm, tab: "providers" })) + } + /> );