Migrate more of the realm setting to new form controls (#27647)

Signed-off-by: Erik Jan de Wit <erikjan.dewit@gmail.com>
This commit is contained in:
Erik Jan de Wit 2024-03-13 12:05:54 +01:00 committed by GitHub
parent 4a4e20c262
commit 1b761b5b4c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 468 additions and 565 deletions

View file

@ -101,13 +101,15 @@ describe("Realm settings tabs tests", () => {
realmSettingsPage.fillReplyToEmail("replyTo@email.com"); realmSettingsPage.fillReplyToEmail("replyTo@email.com");
realmSettingsPage.fillPort("10"); realmSettingsPage.fillPort("10");
cy.findByTestId("email-tab-save").click(); cy.findByTestId("email-tab-save").click();
cy.get("#kc-display-name-helper").contains("You must enter a valid email."); cy.get("#smtpServer\\.from-helper").contains(
cy.get("#kc-host-helper").contains("Required field"); "You must enter a valid email.",
);
cy.get("#smtpServer\\.host-helper").contains("Required field");
cy.findByTestId("email-tab-revert").click(); cy.findByTestId("email-tab-revert").click();
cy.findByTestId("sender-email-address").should("be.empty"); cy.findByTestId("smtpServer.from").should("be.empty");
cy.findByTestId("from-display-name").should("be.empty"); cy.findByTestId("smtpServer.fromDisplayName").should("be.empty");
cy.get("#kc-port").should("be.empty"); cy.findByTestId("smtpServer.port").should("be.empty");
realmSettingsPage.addSenderEmail("example@example.com"); realmSettingsPage.addSenderEmail("example@example.com");
realmSettingsPage.toggleCheck(realmSettingsPage.enableSslCheck); realmSettingsPage.toggleCheck(realmSettingsPage.enableSslCheck);

View file

@ -27,7 +27,7 @@ export default class RealmSettingsPage extends CommonPage {
adminThemeList = "#kc-admin-ui-theme + ul"; adminThemeList = "#kc-admin-ui-theme + ul";
selectEmailTheme = "#kc-email-theme"; selectEmailTheme = "#kc-email-theme";
emailThemeList = "#kc-email-theme + ul"; emailThemeList = "#kc-email-theme + ul";
hostInput = "#kc-host"; hostInput = "smtpServer.host";
ssoSessionIdleSelectMenu = "#kc-sso-session-idle-select-menu"; ssoSessionIdleSelectMenu = "#kc-sso-session-idle-select-menu";
ssoSessionIdleSelectMenuList = "#kc-sso-session-idle-select-menu > div > ul"; ssoSessionIdleSelectMenuList = "#kc-sso-session-idle-select-menu > div > ul";
ssoSessionMaxSelectMenu = "#kc-sso-session-max-select-menu"; ssoSessionMaxSelectMenu = "#kc-sso-session-max-select-menu";
@ -76,7 +76,7 @@ export default class RealmSettingsPage extends CommonPage {
duplicateEmailsSwitch = "duplicate-emails-switch"; duplicateEmailsSwitch = "duplicate-emails-switch";
verifyEmailSwitch = "verify-email-switch"; verifyEmailSwitch = "verify-email-switch";
authSwitch = "email-authentication-switch"; authSwitch = "email-authentication-switch";
fromInput = "sender-email-address"; fromInput = "smtpServer.from";
enableSslCheck = "enable-ssl"; enableSslCheck = "enable-ssl";
enableStartTlsCheck = "enable-start-tls"; enableStartTlsCheck = "enable-start-tls";
addProviderDropdown = "addProviderDropdown"; addProviderDropdown = "addProviderDropdown";
@ -98,8 +98,8 @@ export default class RealmSettingsPage extends CommonPage {
emailAddressInput = "email-address-input"; emailAddressInput = "email-address-input";
addBundleButton = "add-translationBtn"; addBundleButton = "add-translationBtn";
confirmAddTranslation = "add-translation-confirm-button"; confirmAddTranslation = "add-translation-confirm-button";
keyInput = "key-input"; keyInput = "key";
valueInput = "value-input"; valueInput = "value";
deleteAction = "delete-action"; deleteAction = "delete-action";
modalConfirm = "confirm"; modalConfirm = "confirm";
ssoSessionIdleInput = "sso-session-idle-input"; ssoSessionIdleInput = "sso-session-idle-input";
@ -173,8 +173,8 @@ export default class RealmSettingsPage extends CommonPage {
#jsonEditorSelect = "jsonEditor-profilesView"; #jsonEditorSelect = "jsonEditor-profilesView";
#formViewSelectPolicies = "formView-policiesView"; #formViewSelectPolicies = "formView-policiesView";
#jsonEditorSelectPolicies = "jsonEditor-policiesView"; #jsonEditorSelectPolicies = "jsonEditor-policiesView";
#newClientProfileNameInput = "client-profile-name"; #newClientProfileNameInput = "name";
#newClientProfileDescriptionInput = "client-profile-description"; #newClientProfileDescriptionInput = "description";
#saveNewClientProfileBtn = "saveCreateProfile"; #saveNewClientProfileBtn = "saveCreateProfile";
#cancelNewClientProfile = "cancelCreateProfile"; #cancelNewClientProfile = "cancelCreateProfile";
#createPolicyEmptyStateBtn = "no-client-policies-empty-action"; #createPolicyEmptyStateBtn = "no-client-policies-empty-action";
@ -234,9 +234,9 @@ export default class RealmSettingsPage extends CommonPage {
#frontEndURL = "#kc-frontend-url"; #frontEndURL = "#kc-frontend-url";
#requireSSL = "#kc-require-ssl"; #requireSSL = "#kc-require-ssl";
#unmanagedAttributes = "#kc-user-profile-unmanaged-attribute-policy"; #unmanagedAttributes = "#kc-user-profile-unmanaged-attribute-policy";
#fromDisplayName = "from-display-name"; #fromDisplayName = "smtpServer.fromDisplayName";
#replyToEmail = "#kc-reply-to"; #replyToEmail = "smtpServer.replyTo";
#port = "#kc-port"; #port = "smtpServer.port";
#publicKeyBtn = ".kc-keys-list > tbody > tr > td > .button-wrapper > button"; #publicKeyBtn = ".kc-keys-list > tbody > tr > td > .button-wrapper > button";
#localizationLocalesSubTab = "rs-localization-locales-tab"; #localizationLocalesSubTab = "rs-localization-locales-tab";
@ -300,7 +300,8 @@ export default class RealmSettingsPage extends CommonPage {
} }
fillHostField(host: string) { fillHostField(host: string) {
cy.get(this.hostInput).clear().type(host); cy.findByTestId(this.hostInput).clear();
cy.findByTestId(this.hostInput).type(host);
return this; return this;
} }
@ -339,11 +340,13 @@ export default class RealmSettingsPage extends CommonPage {
} }
fillReplyToEmail(email: string) { fillReplyToEmail(email: string) {
cy.get(this.#replyToEmail).clear().type(email); cy.findByTestId(this.#replyToEmail).clear();
cy.findByTestId(this.#replyToEmail).type(email);
} }
fillPort(port: string) { fillPort(port: string) {
cy.get(this.#port).clear().type(port); cy.findByTestId(this.#port).clear();
cy.findByTestId(this.#port).type(port);
} }
fillFrontendURL(url: string) { fillFrontendURL(url: string) {

View file

@ -3105,3 +3105,10 @@ emptyAdminEvents=No admin events
emptyAdminEventsInstructions=There are no admin events in this realm. emptyAdminEventsInstructions=There are no admin events in this realm.
emptyUserEvents=No user events emptyUserEvents=No user events
emptyUserEventsInstructions=There are no user events in this realm. emptyUserEventsInstructions=There are no user events in this realm.
smtpFromPlaceholder=Sender email address
smtpFromDisplayPlaceholder=Display name for Sender email address
replyToEmailPlaceholder=Reply to email address
replyToDisplayPlaceholder=Display name for "reply to" email address
senderEnvelopePlaceholder=Sender envelope email address
smtpPortPlaceholder=SMTP port (defaults to 25)
loginUsernamePlaceholder=Login username

View file

@ -2,16 +2,13 @@ import {
Button, Button,
ButtonVariant, ButtonVariant,
Form, Form,
FormGroup,
Modal, Modal,
ModalVariant, ModalVariant,
ValidatedOptions,
} from "@patternfly/react-core"; } from "@patternfly/react-core";
import { SubmitHandler, UseFormReturn } from "react-hook-form"; import { FormProvider, SubmitHandler, UseFormReturn } from "react-hook-form";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import { TextControl } from "ui-shared";
import type { KeyValueType } from "../components/key-value-form/key-value-convert"; import type { KeyValueType } from "../components/key-value-form/key-value-convert";
import { KeycloakTextInput } from "../components/keycloak-text-input/KeycloakTextInput";
type AddTranslationModalProps = { type AddTranslationModalProps = {
id?: string; id?: string;
@ -29,11 +26,7 @@ export type TranslationForm = {
export const AddTranslationModal = ({ export const AddTranslationModal = ({
handleModalToggle, handleModalToggle,
save, save,
form: { form,
register,
handleSubmit,
formState: { errors },
},
}: AddTranslationModalProps) => { }: AddTranslationModalProps) => {
const { t } = useTranslation(); const { t } = useTranslation();
@ -66,46 +59,28 @@ export const AddTranslationModal = ({
</Button>, </Button>,
]} ]}
> >
<Form id="translation-form" isHorizontal onSubmit={handleSubmit(save)}> <Form
<FormGroup id="translation-form"
label={t("key")} isHorizontal
onSubmit={form.handleSubmit(save)}
>
<FormProvider {...form}>
<TextControl
name="key" name="key"
fieldId="key-id" label={t("key")}
helperTextInvalid={t("required")}
validated={
errors.key ? ValidatedOptions.error : ValidatedOptions.default
}
isRequired
>
<KeycloakTextInput
data-testid="key-input"
autoFocus autoFocus
id="key-id" rules={{
validated={ required: t("required"),
errors.key ? ValidatedOptions.error : ValidatedOptions.default }}
}
{...register("key", { required: true })}
/> />
</FormGroup> <TextControl
<FormGroup name="value"
label={t("value")} label={t("value")}
name="add-value" rules={{
fieldId="value-id" required: t("required"),
helperTextInvalid={t("required")} }}
validated={
errors.value ? ValidatedOptions.error : ValidatedOptions.default
}
isRequired
>
<KeycloakTextInput
data-testid="value-input"
id="value-id"
validated={
errors.value ? ValidatedOptions.error : ValidatedOptions.default
}
{...register("value", { required: true })}
/> />
</FormGroup> </FormProvider>
</Form> </Form>
</Modal> </Modal>
); );

View file

@ -14,27 +14,22 @@ import {
DropdownItem, DropdownItem,
Flex, Flex,
FlexItem, FlexItem,
FormGroup,
Label, Label,
PageSection, PageSection,
Text, Text,
TextVariants, TextVariants,
ValidatedOptions,
} from "@patternfly/react-core"; } from "@patternfly/react-core";
import { PlusCircleIcon, TrashIcon } from "@patternfly/react-icons"; import { PlusCircleIcon, TrashIcon } from "@patternfly/react-icons";
import { Fragment, useMemo, useState } from "react"; import { Fragment, useMemo, useState } from "react";
import { useFieldArray, useForm } from "react-hook-form"; import { FormProvider, useFieldArray, useForm } from "react-hook-form";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import { Link, useNavigate } from "react-router-dom"; import { Link, useNavigate } from "react-router-dom";
import { HelpItem } from "ui-shared"; import { HelpItem, TextAreaControl, TextControl } from "ui-shared";
import { adminClient } from "../admin-client"; import { adminClient } from "../admin-client";
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 { FormAccess } from "../components/form/FormAccess"; import { FormAccess } from "../components/form/FormAccess";
import { KeycloakSpinner } from "../components/keycloak-spinner/KeycloakSpinner"; import { KeycloakSpinner } from "../components/keycloak-spinner/KeycloakSpinner";
import { KeycloakTextArea } from "../components/keycloak-text-area/KeycloakTextArea";
import { KeycloakTextInput } from "../components/keycloak-text-input/KeycloakTextInput";
import { ViewHeader } from "../components/view-header/ViewHeader"; import { ViewHeader } from "../components/view-header/ViewHeader";
import { useServerInfo } from "../context/server-info/ServerInfoProvider"; import { useServerInfo } from "../context/server-info/ServerInfoProvider";
import { useFetch } from "../utils/useFetch"; import { useFetch } from "../utils/useFetch";
@ -57,17 +52,18 @@ const defaultValues: ClientProfileForm = {
export default function ClientProfileForm() { export default function ClientProfileForm() {
const { t } = useTranslation(); const { t } = useTranslation();
const navigate = useNavigate(); const navigate = useNavigate();
const form = useForm<ClientProfileForm>({
defaultValues,
mode: "onChange",
});
const { const {
handleSubmit, handleSubmit,
setValue, setValue,
getValues, getValues,
register, formState: { isDirty },
formState: { isDirty, errors },
control, control,
} = useForm<ClientProfileForm>({ } = form;
defaultValues,
mode: "onChange",
});
const { fields: profileExecutors, remove } = useFieldArray({ const { fields: profileExecutors, remove } = useFieldArray({
name: "executors", name: "executors",
@ -220,32 +216,22 @@ export default function ClientProfileForm() {
} }
/> />
<PageSection variant="light"> <PageSection variant="light">
<FormProvider {...form}>
<FormAccess isHorizontal role="view-realm" className="pf-u-mt-lg"> <FormAccess isHorizontal role="view-realm" className="pf-u-mt-lg">
<FormGroup <TextControl
name="name"
label={t("newClientProfileName")} label={t("newClientProfileName")}
fieldId="kc-name"
helperText={t("createClientProfileNameHelperText")} helperText={t("createClientProfileNameHelperText")}
isRequired readOnly={isGlobalProfile}
helperTextInvalid={t("required")} rules={{
validated={ required: t("required"),
errors.name ? ValidatedOptions.error : ValidatedOptions.default }}
}
>
<KeycloakTextInput
id="kc-name"
data-testid="client-profile-name"
isReadOnly={isGlobalProfile}
{...register("name", { required: true })}
/> />
</FormGroup> <TextAreaControl
<FormGroup label={t("description")} fieldId="kc-description"> name="description"
<KeycloakTextArea label={t("description")}
id="kc-description" readOnly={isGlobalProfile}
data-testid="client-profile-description"
isReadOnly={isGlobalProfile}
{...register("description")}
/> />
</FormGroup>
<ActionGroup> <ActionGroup>
{!isGlobalProfile && ( {!isGlobalProfile && (
<Button <Button
@ -430,6 +416,7 @@ export default function ClientProfileForm() {
</> </>
)} )}
</FormAccess> </FormAccess>
</FormProvider>
</PageSection> </PageSection>
</> </>
); );

View file

@ -9,16 +9,14 @@ import {
Checkbox, Checkbox,
FormGroup, FormGroup,
PageSection, PageSection,
Switch,
} from "@patternfly/react-core"; } from "@patternfly/react-core";
import { Controller, 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 { Link } from "react-router-dom"; import { Link } from "react-router-dom";
import { FormPanel, HelpItem } from "ui-shared"; import { FormPanel, HelpItem, SwitchControl, TextControl } from "ui-shared";
import { adminClient } from "../admin-client"; import { adminClient } from "../admin-client";
import { useAlerts } from "../components/alert/Alerts"; import { useAlerts } from "../components/alert/Alerts";
import { FormAccess } from "../components/form/FormAccess"; import { FormAccess } from "../components/form/FormAccess";
import { KeycloakTextInput } from "../components/keycloak-text-input/KeycloakTextInput";
import { PasswordInput } from "../components/password-input/PasswordInput"; import { PasswordInput } from "../components/password-input/PasswordInput";
import { useRealm } from "../context/realm-context/RealmContext"; import { useRealm } from "../context/realm-context/RealmContext";
import { toUser } from "../user/routes/User"; import { toUser } from "../user/routes/User";
@ -43,6 +41,7 @@ export const RealmSettingsEmailTab = ({
const { addAlert, addError } = useAlerts(); const { addAlert, addError } = useAlerts();
const currentUser = useCurrentUser(); const currentUser = useCurrentUser();
const form = useForm<FormFields>({ defaultValues: realm });
const { const {
register, register,
control, control,
@ -51,7 +50,7 @@ export const RealmSettingsEmailTab = ({
reset: resetForm, reset: resetForm,
getValues, getValues,
formState: { errors }, formState: { errors },
} = useForm<FormFields>({ defaultValues: realm }); } = form;
const reset = () => resetForm(realm); const reset = () => resetForm(realm);
const watchFromValue = watch("smtpServer.from", ""); const watchFromValue = watch("smtpServer.from", "");
@ -98,6 +97,7 @@ export const RealmSettingsEmailTab = ({
return ( return (
<PageSection variant="light"> <PageSection variant="light">
<FormProvider {...form}>
<FormPanel title={t("template")} className="kc-email-template"> <FormPanel title={t("template")} className="kc-email-template">
<FormAccess <FormAccess
isHorizontal isHorizontal
@ -105,90 +105,49 @@ export const RealmSettingsEmailTab = ({
className="pf-u-mt-lg" className="pf-u-mt-lg"
onSubmit={handleSubmit(save)} onSubmit={handleSubmit(save)}
> >
<FormGroup <TextControl
name="smtpServer.from"
label={t("from")} label={t("from")}
fieldId="kc-display-name"
isRequired
validated={errors.smtpServer?.from ? "error" : "default"}
helperTextInvalid={t("emailInvalid")}
>
<KeycloakTextInput
type="email" type="email"
id="kc-sender-email-address" placeholder={t("smtpFromPlaceholder")}
data-testid="sender-email-address" rules={{
placeholder="Sender email address" pattern: {
validated={errors.smtpServer?.from ? "error" : "default"} value: emailRegexPattern,
{...register("smtpServer.from", { message: t("emailInvalid"),
pattern: emailRegexPattern, },
required: true, required: t("required"),
})} }}
/> />
</FormGroup> <TextControl
<FormGroup name="smtpServer.fromDisplayName"
label={t("fromDisplayName")} label={t("fromDisplayName")}
fieldId="kc-from-display-name" labelIcon={t("fromDisplayNameHelp")}
labelIcon={ placeholder={t("smtpFromDisplayPlaceholder")}
<HelpItem
helpText={t("fromDisplayNameHelp")}
fieldLabelId="authentication"
/> />
} <TextControl
> name="smtpServer.replyTo"
<KeycloakTextInput
id="kc-from-display-name"
data-testid="from-display-name"
placeholder="Display name for Sender email address"
{...register("smtpServer.fromDisplayName")}
/>
</FormGroup>
<FormGroup
label={t("replyTo")} label={t("replyTo")}
fieldId="kc-reply-to"
validated={errors.smtpServer?.replyTo ? "error" : "default"}
helperTextInvalid={t("emailInvalid")}
>
<KeycloakTextInput
type="email" type="email"
id="kc-reply-to" placeholder={t("replyToEmailPlaceholder")}
placeholder="Reply to email address" rules={{
validated={errors.smtpServer?.replyTo ? "error" : "default"} pattern: {
{...register("smtpServer.replyTo", { value: emailRegexPattern,
pattern: emailRegexPattern, message: t("emailInvalid"),
})} },
}}
/> />
</FormGroup> <TextControl
<FormGroup name="smtpServer.replyToDisplayName"
label={t("replyToDisplayName")} label={t("replyToDisplayName")}
fieldId="kc-reply-to-display-name" labelIcon={t("replyToDisplayNameHelp")}
labelIcon={ placeholder={t("replyToDisplayPlaceholder")}
<HelpItem
helpText={t("replyToDisplayNameHelp")}
fieldLabelId="replyToDisplayName"
/> />
} <TextControl
> name="smtpServer.envelopeFrom"
<KeycloakTextInput
id="kc-reply-to-display-name"
placeholder='Display name for "reply to" email address'
{...register("smtpServer.replyToDisplayName")}
/>
</FormGroup>
<FormGroup
label={t("envelopeFrom")} label={t("envelopeFrom")}
fieldId="kc-envelope-from" labelIcon={t("envelopeFromHelp")}
labelIcon={ placeholder={t("senderEnvelopePlaceholder")}
<HelpItem
helpText={t("envelopeFromHelp")}
fieldLabelId="envelopeFrom"
/> />
}
>
<KeycloakTextInput
id="kc-envelope-from"
placeholder="Sender envelope email address"
{...register("smtpServer.envelopeFrom")}
/>
</FormGroup>
</FormAccess> </FormAccess>
</FormPanel> </FormPanel>
<FormPanel <FormPanel
@ -201,27 +160,18 @@ export const RealmSettingsEmailTab = ({
className="pf-u-mt-lg" className="pf-u-mt-lg"
onSubmit={handleSubmit(save)} onSubmit={handleSubmit(save)}
> >
<FormGroup <TextControl
name="smtpServer.host"
label={t("host")} label={t("host")}
fieldId="kc-host" rules={{
isRequired required: t("required"),
validated={errors.smtpServer?.host ? "error" : "default"} }}
helperTextInvalid={t("required")}
>
<KeycloakTextInput
id="kc-host"
placeholder="SMTP host"
validated={errors.smtpServer?.host ? "error" : "default"}
{...register("smtpServer.host", { required: true })}
/> />
</FormGroup> <TextControl
<FormGroup label={t("port")} fieldId="kc-port"> name="smtpServer.port"
<KeycloakTextInput label={t("port")}
id="kc-port" placeholder={t("smtpPortPlaceholder")}
placeholder="SMTP port (defaults to 25)"
{...register("smtpServer.port")}
/> />
</FormGroup>
<FormGroup label={t("encryption")} fieldId="kc-html-display-name"> <FormGroup label={t("encryption")} fieldId="kc-html-display-name">
<Controller <Controller
name="smtpServer.ssl" name="smtpServer.ssl"
@ -252,47 +202,23 @@ export const RealmSettingsEmailTab = ({
)} )}
/> />
</FormGroup> </FormGroup>
<FormGroup <SwitchControl
hasNoPaddingTop
label={t("authentication")}
fieldId="kc-authentication"
>
<Controller
name="smtpServer.auth" name="smtpServer.auth"
control={control} label={t("authentication")}
defaultValue="" defaultValue=""
render={({ field }) => ( labelOn={t("enabled")}
<Switch
id="kc-authentication-switch"
data-testid="email-authentication-switch"
label={t("enabled")}
labelOff={t("disabled")} labelOff={t("disabled")}
isChecked={field.value === "true"}
onChange={(value) => {
field.onChange("" + value);
}}
aria-label={t("authentication")}
/> />
)}
/>
</FormGroup>
{authenticationEnabled === "true" && ( {authenticationEnabled === "true" && (
<> <>
<FormGroup <TextControl
name="smtpServer.user"
label={t("username")} label={t("username")}
fieldId="kc-username" placeholder={t("loginUsernamePlaceholder")}
isRequired rules={{
validated={errors.smtpServer?.user ? "error" : "default"} required: t("required"),
helperTextInvalid={t("required")} }}
>
<KeycloakTextInput
id="kc-username"
data-testid="username-input"
placeholder="Login username"
validated={errors.smtpServer?.user ? "error" : "default"}
{...register("smtpServer.user", { required: true })}
/> />
</FormGroup>
<FormGroup <FormGroup
label={t("password")} label={t("password")}
fieldId="kc-username" fieldId="kc-username"
@ -310,7 +236,9 @@ export const RealmSettingsEmailTab = ({
id="kc-password" id="kc-password"
data-testid="password-input" data-testid="password-input"
aria-label={t("password")} aria-label={t("password")}
validated={errors.smtpServer?.password ? "error" : "default"} validated={
errors.smtpServer?.password ? "error" : "default"
}
{...register("smtpServer.password", { required: true })} {...register("smtpServer.password", { required: true })}
/> />
</FormGroup> </FormGroup>
@ -371,8 +299,9 @@ export const RealmSettingsEmailTab = ({
onClick={() => testConnection()} onClick={() => testConnection()}
data-testid="test-connection-button" data-testid="test-connection-button"
isDisabled={ isDisabled={
!(emailRegexPattern.test(watchFromValue) && watchHostValue) || !(
!currentUser?.email emailRegexPattern.test(watchFromValue) && watchHostValue
) || !currentUser?.email
} }
aria-describedby="descriptionTestConnection" aria-describedby="descriptionTestConnection"
isLoading={isTesting} isLoading={isTesting}
@ -393,6 +322,7 @@ export const RealmSettingsEmailTab = ({
</ActionGroup> </ActionGroup>
</FormAccess> </FormAccess>
</FormPanel> </FormPanel>
</FormProvider>
</PageSection> </PageSection>
); );
}; };

View file

@ -7,7 +7,6 @@ import {
UseControllerProps, UseControllerProps,
} from "react-hook-form"; } from "react-hook-form";
import { FormLabel } from "./FormLabel"; import { FormLabel } from "./FormLabel";
import { KeycloakTextArea } from "./keycloak-text-area/KeycloakTextArea"; import { KeycloakTextArea } from "./keycloak-text-area/KeycloakTextArea";
export type TextAreaControlProps< export type TextAreaControlProps<