diff --git a/js/apps/admin-ui/src/authentication/BindFlowDialog.tsx b/js/apps/admin-ui/src/authentication/BindFlowDialog.tsx index 5ba85cee92..ae21c037c7 100644 --- a/js/apps/admin-ui/src/authentication/BindFlowDialog.tsx +++ b/js/apps/admin-ui/src/authentication/BindFlowDialog.tsx @@ -5,10 +5,12 @@ import { ButtonVariant, Form, Modal, + SelectVariant, } from "@patternfly/react-core"; import { FormProvider, useForm } from "react-hook-form"; import { useTranslation } from "react-i18next"; import { SelectControl } from "ui-shared"; + import { adminClient } from "../admin-client"; import { useAlerts } from "../components/alert/Alerts"; import { useRealm } from "../context/realm-context/RealmContext"; @@ -45,6 +47,8 @@ export const BindFlowDialog = ({ flowAlias, onClose }: BindFlowDialogProps) => { onClose(); }; + const flowKeys = Array.from(REALM_FLOWS.keys()); + return ( { id="chooseBindingType" name="bindingType" label={t("chooseBindingType")} - options={[...REALM_FLOWS.keys()] + options={flowKeys .filter((f) => f !== "dockerAuthenticationFlow") .map((key) => ({ key, value: t(`flow.${REALM_FLOWS.get(key)}`), }))} - controller={{ defaultValue: "" }} + controller={{ defaultValue: flowKeys[0] }} + variant={SelectVariant.single} + menuAppendTo="parent" /> diff --git a/js/libs/ui-shared/src/controls/SelectControl.tsx b/js/libs/ui-shared/src/controls/SelectControl.tsx index 7ed342146b..cf3fb93b69 100644 --- a/js/libs/ui-shared/src/controls/SelectControl.tsx +++ b/js/libs/ui-shared/src/controls/SelectControl.tsx @@ -11,6 +11,7 @@ import { Select, SelectOption, SelectProps, + SelectVariant, ValidatedOptions, } from "@patternfly/react-core"; import { FormLabel } from "./FormLabel"; @@ -89,10 +90,14 @@ export const SelectControl = < setOpen(false); } }} - onClear={(event) => { - event.stopPropagation(); - onChange([]); - }} + onClear={ + variant !== SelectVariant.single + ? (event) => { + event.stopPropagation(); + onChange([]); + } + : undefined + } isOpen={open} variant={variant} validated={