import React, { useState } from "react"; import { Control, Controller } from "react-hook-form"; import { useTranslation } from "react-i18next"; import _ from "lodash"; import { ActionGroup, Button, FormGroup, Select, SelectOption, SelectVariant, } from "@patternfly/react-core"; import { FormAccess } from "../../components/form-access/FormAccess"; import { HelpItem } from "../../components/help-enabler/HelpItem"; import { useFetch, useAdminClient } from "../../context/auth/AdminClient"; type AuthenticationOverridesProps = { control: Control>; save: () => void; reset: () => void; protocol?: string; }; export const AuthenticationOverrides = ({ protocol, control, save, reset, }: AuthenticationOverridesProps) => { const adminClient = useAdminClient(); const { t } = useTranslation("clients"); const [flows, setFlows] = useState([]); const [browserFlowOpen, setBrowserFlowOpen] = useState(false); const [directGrantOpen, setDirectGrantOpen] = useState(false); useFetch( () => adminClient.authenticationManagement.getFlows(), (flows) => { let filteredFlows = [ ...flows.filter((flow) => flow.providerId !== "client-flow"), ]; filteredFlows = _.sortBy(filteredFlows, [(f) => f.alias]); setFlows([ {t("common:choose")} , ...filteredFlows.map((flow) => ( {flow.alias} )), ]); }, [] ); return ( } > ( )} /> {protocol === "openid-connect" && ( } > ( )} /> )} ); };