Fix broken flow binding dialog (#26336)
Closes #26335 Signed-off-by: Jon Koops <jonkoops@gmail.com>
This commit is contained in:
parent
229cbb5429
commit
972d198c45
2 changed files with 17 additions and 6 deletions
|
@ -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 (
|
||||
<Modal
|
||||
title={t("bindFlow")}
|
||||
|
@ -71,13 +75,15 @@ export const BindFlowDialog = ({ flowAlias, onClose }: BindFlowDialogProps) => {
|
|||
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"
|
||||
/>
|
||||
</FormProvider>
|
||||
</Form>
|
||||
|
|
|
@ -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={
|
||||
|
|
Loading…
Reference in a new issue