diff --git a/src/user-federation/LdapSettingsAdvanced.tsx b/src/user-federation/LdapSettingsAdvanced.tsx index cd20d2f0de..b964f69638 100644 --- a/src/user-federation/LdapSettingsAdvanced.tsx +++ b/src/user-federation/LdapSettingsAdvanced.tsx @@ -2,14 +2,21 @@ import { Form, FormGroup, Switch } from "@patternfly/react-core"; import { useTranslation } from "react-i18next"; import React from "react"; import { HelpItem } from "../components/help-enabler/HelpItem"; +import { useForm, Controller } from "react-hook-form"; +import ComponentRepresentation from "keycloak-admin/lib/defs/componentRepresentation"; export const LdapSettingsAdvanced = () => { const { t } = useTranslation("user-federation"); const helpText = useTranslation("user-federation-help").t; + const { handleSubmit, control } = useForm(); + const onSubmit = (data: ComponentRepresentation) => { + console.log(data); + }; + return ( <> -
+ { fieldId="kc-enable-ldapv3-password" hasNoPaddingTop > - undefined as any} - label={t("common:on")} - labelOff={t("common:off")} - /> + ( + + )} + > { fieldId="kc-validate-password-policy" hasNoPaddingTop > - undefined as any} - label={t("common:on")} - labelOff={t("common:off")} - /> + ( + + )} + > { fieldId="kc-trust-email" hasNoPaddingTop > - undefined as any} - label={t("common:on")} - labelOff={t("common:off")} - /> + ( + + )} + > + +
); diff --git a/src/user-federation/LdapSettingsCache.tsx b/src/user-federation/LdapSettingsCache.tsx index 7e32514025..5339441252 100644 --- a/src/user-federation/LdapSettingsCache.tsx +++ b/src/user-federation/LdapSettingsCache.tsx @@ -1,16 +1,61 @@ -import { Form, FormGroup, Select, SelectOption } from "@patternfly/react-core"; +import { + Form, + FormGroup, + Select, + SelectOption, + SelectVariant, + TextInput, +} from "@patternfly/react-core"; import { useTranslation } from "react-i18next"; -import React from "react"; +import React, { useState } from "react"; import { HelpItem } from "../components/help-enabler/HelpItem"; +import { useForm, Controller } from "react-hook-form"; +import ComponentRepresentation from "keycloak-admin/lib/defs/componentRepresentation"; export const LdapSettingsCache = () => { const { t } = useTranslation("user-federation"); const helpText = useTranslation("user-federation-help").t; + const [isCachePolicyDropdownOpen, setIsCachePolicyDropdownOpen] = useState( + false + ); + + const [isEvictionHourDropdownOpen, setIsEvictionHourDropdownOpen] = useState( + false + ); + const [ + isEvictionMinuteDropdownOpen, + setIsEvictionMinuteDropdownOpen, + ] = useState(false); + const [isEvictionDayDropdownOpen, setIsEvictionDayDropdownOpen] = useState( + false + ); + + const { handleSubmit, control, register } = useForm< + ComponentRepresentation + >(); + const onSubmit = (data: ComponentRepresentation) => { + console.log(data); + }; + + const hourOptions = [ + , + ]; + for (let index = 1; index <= 24; index++) { + hourOptions.push(); + } + + const minuteOptions = [ + , + ]; + for (let index = 1; index <= 60; index++) { + minuteOptions.push(); + } + return ( <> {/* Cache settings */} -
+ { } fieldId="kc-cache-policy" > - + ( + + )} + > + + {/* TODO: Field shows only if cache policy is EVICT_WEEKLY */} + + } + fieldId="kc-eviction-day" + > + ( + + )} + > + + + {/* TODO: Field shows only if cache policy is EVICT_WEEKLY or EVICT_DAILY */} + {/* TODO: Investigate whether this should be a number field instead of a dropdown/text field */} + + } + fieldId="kc-eviction-hour" + > + ( + + )} + > + + + {/* TODO: Field shows only if cache policy is EVICT_WEEKLY or EVICT_DAILY */} + {/* TODO: Investigate whether this should be a number field instead of a dropdown/text field */} + + } + fieldId="kc-eviction-minute" + > + ( + + )} + > + + + {/* TODO: Field shows only if cache policy is MAX_LIFESPAN */} + + } + fieldId="kc-max-lifespan" + > + + + +
); diff --git a/src/user-federation/LdapSettingsConnection.tsx b/src/user-federation/LdapSettingsConnection.tsx index b198b4b850..548a2fa40b 100644 --- a/src/user-federation/LdapSettingsConnection.tsx +++ b/src/user-federation/LdapSettingsConnection.tsx @@ -5,64 +5,85 @@ import { InputGroup, Select, SelectOption, + SelectVariant, Switch, TextInput, } from "@patternfly/react-core"; import { useTranslation } from "react-i18next"; -import React from "react"; +import React, { useState } from "react"; import { HelpItem } from "../components/help-enabler/HelpItem"; +import { Controller, useForm } from "react-hook-form"; +import ComponentRepresentation from "keycloak-admin/lib/defs/componentRepresentation"; import { EyeIcon } from "@patternfly/react-icons"; export const LdapSettingsConnection = () => { const { t } = useTranslation("user-federation"); const helpText = useTranslation("user-federation-help").t; + const [ + isTruststoreSpiDropdownOpen, + setIsTruststoreSpiDropdownOpen, + ] = useState(false); + const [isBindTypeDropdownOpen, setIsBindTypeDropdownOpen] = useState(false); + const { register, handleSubmit, control } = useForm< + ComponentRepresentation + >(); + const onSubmit = (data: ComponentRepresentation) => { + console.log(data); + }; + return ( <> {/* Cache settings */} -
+ } - fieldId="kc-connection-url" + fieldId="kc-console-connection-url" isRequired > } fieldId="kc-enable-start-tls" hasNoPaddingTop > - undefined as any} - label={t("common:on")} - labelOff={t("common:off")} - /> + ( + + )} + > { } fieldId="kc-use-truststore-spi" > - + ( + + )} + > { fieldId="kc-connection-pooling" hasNoPaddingTop > - undefined as any} - label={t("common:on")} - labelOff={t("common:off")} - /> + ( + + )} + > { } - fieldId="kc-connection-timeout" + fieldId="kc-console-connection-timeout" > @@ -155,19 +186,35 @@ export const LdapSettingsConnection = () => { fieldId="kc-bind-type" isRequired > - + ( + + )} + > { } - fieldId="kc-bind-dn" + fieldId="kc-console-bind-dn" > @@ -196,19 +242,19 @@ export const LdapSettingsConnection = () => { } - fieldId="kc-bind-credentials" + fieldId="kc-console-bind-credentials" isRequired > - + + + + + + ); diff --git a/src/user-federation/LdapSettingsGeneral.tsx b/src/user-federation/LdapSettingsGeneral.tsx index c8214c8104..2a855f8eac 100644 --- a/src/user-federation/LdapSettingsGeneral.tsx +++ b/src/user-federation/LdapSettingsGeneral.tsx @@ -1,16 +1,33 @@ -import { Form, FormGroup, Select, TextInput } from "@patternfly/react-core"; +import { + Form, + FormGroup, + Select, + SelectOption, + SelectVariant, + TextInput, +} from "@patternfly/react-core"; import { useTranslation } from "react-i18next"; -import React from "react"; +import React, { useState } from "react"; import { HelpItem } from "../components/help-enabler/HelpItem"; +import { useForm, Controller } from "react-hook-form"; +import ComponentRepresentation from "keycloak-admin/lib/defs/componentRepresentation"; export const LdapSettingsGeneral = () => { const { t } = useTranslation("user-federation"); const helpText = useTranslation("user-federation-help").t; + const [isVendorDropdownOpen, setIsVendorDropdownOpen] = useState(false); + const { register, handleSubmit, control } = useForm< + ComponentRepresentation + >(); + const onSubmit = (data: ComponentRepresentation) => { + console.log(data); + }; + return ( <> {/* Cache settings */} -
+ { isRequired type="text" id="kc-console-display-name" - name="kc-console-display-name" - // value={value1} - // onChange={this.handleTextInputChange1} + name="displayName" + ref={register} /> @@ -45,21 +61,36 @@ export const LdapSettingsGeneral = () => { fieldId="kc-vendor" isRequired > - + ( + + )} + > +
); diff --git a/src/user-federation/LdapSettingsKerberosIntegration.tsx b/src/user-federation/LdapSettingsKerberosIntegration.tsx index d62ed7aa44..dc45ce0b69 100644 --- a/src/user-federation/LdapSettingsKerberosIntegration.tsx +++ b/src/user-federation/LdapSettingsKerberosIntegration.tsx @@ -2,15 +2,22 @@ import { Form, FormGroup, Switch } from "@patternfly/react-core"; import { useTranslation } from "react-i18next"; import React from "react"; import { HelpItem } from "../components/help-enabler/HelpItem"; +import { useForm, Controller } from "react-hook-form"; +import ComponentRepresentation from "keycloak-admin/lib/defs/componentRepresentation"; export const LdapSettingsKerberosIntegration = () => { const { t } = useTranslation("user-federation"); const helpText = useTranslation("user-federation-help").t; + const { handleSubmit, control } = useForm(); + const onSubmit = (data: ComponentRepresentation) => { + console.log(data); + }; + return ( <> {/* Kerberos integration */} -
+ { fieldId="kc-allow-kerberos-authentication" hasNoPaddingTop > - undefined as any} - label={t("common:on")} - labelOff={t("common:off")} - /> + ( + + )} + > { fieldId="kc-use-kerberos-password-authentication" hasNoPaddingTop > - undefined as any} - label={t("common:on")} - labelOff={t("common:off")} - /> + ( + + )} + > + +
); diff --git a/src/user-federation/LdapSettingsSearching.tsx b/src/user-federation/LdapSettingsSearching.tsx index 95cef95bd3..729ce9d198 100644 --- a/src/user-federation/LdapSettingsSearching.tsx +++ b/src/user-federation/LdapSettingsSearching.tsx @@ -3,21 +3,40 @@ import { FormGroup, Select, SelectOption, + SelectVariant, Switch, TextInput, } from "@patternfly/react-core"; import { useTranslation } from "react-i18next"; -import React from "react"; +import React, { useState } from "react"; import { HelpItem } from "../components/help-enabler/HelpItem"; +import { useForm, Controller } from "react-hook-form"; +import ComponentRepresentation from "keycloak-admin/lib/defs/componentRepresentation"; export const LdapSettingsSearching = () => { const { t } = useTranslation("user-federation"); const helpText = useTranslation("user-federation-help").t; + const [isEditModeDropdownOpen, setIsEditModeDropdownOpen] = useState(false); + const [ + isUserLdapFilterModeDropdownOpen, + setIsUserLdapFilterModeDropdownOpen, + ] = useState(false); + const [isSearchScopeDropdownOpen, setIsSearchScopeDropdownOpen] = useState( + false + ); + + const { register, handleSubmit, control } = useForm< + ComponentRepresentation + >(); + const onSubmit = (data: ComponentRepresentation) => { + console.log(data); + }; + return ( <> {/* Cache settings */} -
+ { } fieldId="kc-edit-mode" > - + ( + + )} + > { isRequired type="text" id="kc-console-users-dn" - name="kc-console-users-dn" - // value={value1} - // onChange={this.handleTextInputChange1} + name="usersDn" + ref={register} /> @@ -92,9 +115,8 @@ export const LdapSettingsSearching = () => { isRequired type="text" id="kc-username-ldap-attribute" - name="kc-username-ldap-attribute" - // value={value1} - // onChange={this.handleTextInputChange1} + name="usernameLdapAttribute" + ref={register} /> @@ -114,9 +136,8 @@ export const LdapSettingsSearching = () => { isRequired type="text" id="kc-rdn-ldap-attribute" - name="kc-rdn-ldap-attribute" - // value={value1} - // onChange={this.handleTextInputChange1} + name="rdnLdapAttribute" + ref={register} /> @@ -136,9 +157,8 @@ export const LdapSettingsSearching = () => { isRequired type="text" id="kc-uuid-ldap-attribute" - name="kc-uuid-ldap-attribute" - // value={value1} - // onChange={this.handleTextInputChange1} + name="uuidLdapAttribute" + ref={register} /> @@ -158,9 +178,8 @@ export const LdapSettingsSearching = () => { isRequired type="text" id="kc-user-object-classes" - name="kc-user-object-classes" - // value={value1} - // onChange={this.handleTextInputChange1} + name="userObjectClasses" + ref={register} /> @@ -175,29 +194,32 @@ export const LdapSettingsSearching = () => { } fieldId="kc-user-ldap-filter" > - + ( + + )} + > { } fieldId="kc-search-scope" > - + ( + + )} + > { @@ -268,15 +292,24 @@ export const LdapSettingsSearching = () => { fieldId="kc-console-pagination" hasNoPaddingTop > - undefined as any} - label={t("common:on")} - labelOff={t("common:off")} - /> + ( + + )} + > + + ); diff --git a/src/user-federation/LdapSettingsSynchronization.tsx b/src/user-federation/LdapSettingsSynchronization.tsx index 68b5447bdd..b804a63a81 100644 --- a/src/user-federation/LdapSettingsSynchronization.tsx +++ b/src/user-federation/LdapSettingsSynchronization.tsx @@ -2,15 +2,24 @@ import { Form, FormGroup, Switch, TextInput } from "@patternfly/react-core"; import { useTranslation } from "react-i18next"; import React from "react"; import { HelpItem } from "../components/help-enabler/HelpItem"; +import { useForm, Controller } from "react-hook-form"; +import ComponentRepresentation from "keycloak-admin/lib/defs/componentRepresentation"; export const LdapSettingsSynchronization = () => { const { t } = useTranslation("user-federation"); const helpText = useTranslation("user-federation-help").t; + const { register, handleSubmit, control } = useForm< + ComponentRepresentation + >(); + const onSubmit = (data: ComponentRepresentation) => { + console.log(data); + }; + return ( <> {/* Synchronization settings */} -
+ { fieldId="kc-import-users" hasNoPaddingTop > - undefined as any} //TODO: switch shows/hides other fields - label={t("common:on")} - labelOff={t("common:off")} - /> + ( + + )} + > - { } fieldId="kc-batch-size" > - + - { fieldId="kc-periodic-full-sync" hasNoPaddingTop > - undefined as any} - /> + ( + + )} + > - { fieldId="kc-periodic-changed-users-sync" hasNoPaddingTop > - undefined as any} - label={t("common:on")} - labelOff={t("common:off")} - /> + ( + + )} + > +
);