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 "../../context/http-service/HttpClientContext"; import { sortProvider } from "../../util"; import { ServerInfoRepresentation } from "../models/server-info"; import { ClientDescription } from "../ClientDescription"; type GeneralSettingsProps = { form: UseFormMethods; }; export const GeneralSettings = ({ form }: GeneralSettingsProps) => { 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 (
( )} /> ); };