import React, { useState, useEffect, useContext } from "react"; import { FormGroup, Form, Select, SelectVariant, SelectOption, } from "@patternfly/react-core"; import { useTranslation } from "react-i18next"; import { Controller, UseFormMethods } from "react-hook-form"; import { HttpClientContext } from "../../http-service/HttpClientContext"; import { sortProvider } from "../../util"; import { ServerInfoRepresentation } from "../models/server-info"; import { ClientDescription } from "../ClientDescription"; type Step1Props = { form: UseFormMethods; }; export const Step1 = ({ form }: Step1Props) => { const httpClient = useContext(HttpClientContext)!; const { t } = useTranslation(); const { errors, control, register } = form; const [providers, setProviders] = useState([]); const [open, isOpen] = useState(false); useEffect(() => { (async () => { const response = await httpClient.doGet( "/admin/serverinfo" ); const providers = Object.entries( response.data!.providers["login-protocol"].providers ); setProviders(["", ...new Map(providers.sort(sortProvider)).keys()]); })(); }, []); return (
( )} /> ); };