show hide dn and pw
This commit is contained in:
parent
8e1a1c57bd
commit
ac664a2f54
1 changed files with 87 additions and 74 deletions
|
@ -9,8 +9,9 @@ import {
|
||||||
} from "@patternfly/react-core";
|
} from "@patternfly/react-core";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import React, { useState } from "react";
|
import React, { useState } from "react";
|
||||||
|
import _ from "lodash";
|
||||||
import { HelpItem } from "../../components/help-enabler/HelpItem";
|
import { HelpItem } from "../../components/help-enabler/HelpItem";
|
||||||
import { Controller, UseFormMethods } from "react-hook-form";
|
import { Controller, UseFormMethods, useWatch } from "react-hook-form";
|
||||||
import { FormAccess } from "../../components/form-access/FormAccess";
|
import { FormAccess } from "../../components/form-access/FormAccess";
|
||||||
import { WizardSectionHeader } from "../../components/wizard-section-header/WizardSectionHeader";
|
import { WizardSectionHeader } from "../../components/wizard-section-header/WizardSectionHeader";
|
||||||
import { PasswordInput } from "../../components/password-input/PasswordInput";
|
import { PasswordInput } from "../../components/password-input/PasswordInput";
|
||||||
|
@ -36,6 +37,11 @@ export const LdapSettingsConnection = ({
|
||||||
|
|
||||||
const [isBindTypeDropdownOpen, setIsBindTypeDropdownOpen] = useState(false);
|
const [isBindTypeDropdownOpen, setIsBindTypeDropdownOpen] = useState(false);
|
||||||
|
|
||||||
|
const ldapBindType = useWatch({
|
||||||
|
control: form.control,
|
||||||
|
name: "config.authType",
|
||||||
|
});
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{showSectionHeading && (
|
{showSectionHeading && (
|
||||||
|
@ -231,12 +237,15 @@ export const LdapSettingsConnection = ({
|
||||||
variant={SelectVariant.single}
|
variant={SelectVariant.single}
|
||||||
data-testid="ldap-bind-type"
|
data-testid="ldap-bind-type"
|
||||||
>
|
>
|
||||||
<SelectOption key={3} value="simple" />
|
<SelectOption key={0} value="simple" />
|
||||||
<SelectOption key={4} value="none" />
|
<SelectOption key={1} value="none" isPlaceholder />
|
||||||
</Select>
|
</Select>
|
||||||
)}
|
)}
|
||||||
></Controller>
|
></Controller>
|
||||||
</FormGroup>
|
</FormGroup>
|
||||||
|
|
||||||
|
{_.isEqual(ldapBindType, ["simple"]) ? (
|
||||||
|
<>
|
||||||
<FormGroup
|
<FormGroup
|
||||||
label={t("bindDn")}
|
label={t("bindDn")}
|
||||||
labelIcon={
|
labelIcon={
|
||||||
|
@ -308,6 +317,10 @@ export const LdapSettingsConnection = ({
|
||||||
{t("common:test")}
|
{t("common:test")}
|
||||||
</Button>
|
</Button>
|
||||||
</FormGroup>
|
</FormGroup>
|
||||||
|
</>
|
||||||
|
) : (
|
||||||
|
<></>
|
||||||
|
)}
|
||||||
</FormAccess>
|
</FormAccess>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in a new issue