import { Form, FormGroup, Select, SelectOption, SelectVariant, TextInput, } from "@patternfly/react-core"; import { useTranslation } from "react-i18next"; 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" >
); };