import { FormGroup, Select, SelectOption, SelectVariant, Switch, } from "@patternfly/react-core"; import { useState } from "react"; import { Controller, UseFormReturn } from "react-hook-form"; import { useTranslation } from "react-i18next"; import { FormAccess } from "../../components/form-access/FormAccess"; import { HelpItem } from "ui-shared"; import { KeycloakTextInput } from "../../components/keycloak-text-input/KeycloakTextInput"; import { WizardSectionHeader } from "../../components/wizard-section-header/WizardSectionHeader"; export type LdapSettingsSearchingProps = { form: UseFormReturn; showSectionHeading?: boolean; showSectionDescription?: boolean; }; export const LdapSettingsSearching = ({ form, showSectionHeading = false, showSectionDescription = false, }: LdapSettingsSearchingProps) => { const { t } = useTranslation("user-federation"); const { t: helpText } = useTranslation("user-federation-help"); const [isSearchScopeDropdownOpen, setIsSearchScopeDropdownOpen] = useState(false); const [isEditModeDropdownOpen, setIsEditModeDropdownOpen] = useState(false); return ( <> {showSectionHeading && ( )} } fieldId="kc-edit-mode" isRequired validated={ (form.formState.errors.config as any)?.editMode?.[0] ? "error" : "default" } helperTextInvalid={ (form.formState.errors.config as any)?.editMode?.[0].message } > ( )} /> } fieldId="kc-ui-users-dn" isRequired validated={ (form.formState.errors.config as any)?.usersDn?.[0] ? "error" : "default" } helperTextInvalid={ (form.formState.errors.config as any)?.usersDn?.[0].message } > } fieldId="kc-username-ldap-attribute" isRequired validated={ (form.formState.errors.config as any)?.usernameLDAPAttribute?.[0] ? "error" : "default" } helperTextInvalid={ (form.formState.errors.config as any)?.usernameLDAPAttribute?.[0] .message } > } fieldId="kc-rdn-ldap-attribute" isRequired validated={ (form.formState.errors.config as any)?.rdnLDAPAttribute?.[0] ? "error" : "default" } helperTextInvalid={ (form.formState.errors.config as any)?.rdnLDAPAttribute?.[0].message } > } fieldId="kc-uuid-ldap-attribute" isRequired validated={ (form.formState.errors.config as any)?.uuidLDAPAttribute?.[0] ? "error" : "default" } helperTextInvalid={ (form.formState.errors.config as any)?.uuidLDAPAttribute?.[0] .message } > } fieldId="kc-user-object-classes" isRequired validated={ (form.formState.errors.config as any)?.userObjectClasses?.[0] ? "error" : "default" } helperTextInvalid={ (form.formState.errors.config as any)?.userObjectClasses?.[0] .message } > } fieldId="kc-user-ldap-filter" validated={ (form.formState.errors.config as any)?.customUserSearchFilter?.[0] ? "error" : "default" } helperTextInvalid={ (form.formState.errors.config as any)?.customUserSearchFilter?.[0] .message } > } fieldId="kc-search-scope" > ( )} > } fieldId="kc-read-timeout" > } fieldId="kc-ui-pagination" hasNoPaddingTop > ( field.onChange([`${value}`])} isChecked={field.value[0] === "true"} label={t("common:on")} labelOff={t("common:off")} aria-label={t("pagination")} /> )} > ); };