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,
|
ButtonVariant,
|
||||||
Form,
|
Form,
|
||||||
Modal,
|
Modal,
|
||||||
|
SelectVariant,
|
||||||
} from "@patternfly/react-core";
|
} from "@patternfly/react-core";
|
||||||
import { FormProvider, useForm } from "react-hook-form";
|
import { FormProvider, useForm } from "react-hook-form";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { SelectControl } from "ui-shared";
|
import { SelectControl } from "ui-shared";
|
||||||
|
|
||||||
import { adminClient } from "../admin-client";
|
import { adminClient } from "../admin-client";
|
||||||
import { useAlerts } from "../components/alert/Alerts";
|
import { useAlerts } from "../components/alert/Alerts";
|
||||||
import { useRealm } from "../context/realm-context/RealmContext";
|
import { useRealm } from "../context/realm-context/RealmContext";
|
||||||
|
@ -45,6 +47,8 @@ export const BindFlowDialog = ({ flowAlias, onClose }: BindFlowDialogProps) => {
|
||||||
onClose();
|
onClose();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const flowKeys = Array.from(REALM_FLOWS.keys());
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Modal
|
<Modal
|
||||||
title={t("bindFlow")}
|
title={t("bindFlow")}
|
||||||
|
@ -71,13 +75,15 @@ export const BindFlowDialog = ({ flowAlias, onClose }: BindFlowDialogProps) => {
|
||||||
id="chooseBindingType"
|
id="chooseBindingType"
|
||||||
name="bindingType"
|
name="bindingType"
|
||||||
label={t("chooseBindingType")}
|
label={t("chooseBindingType")}
|
||||||
options={[...REALM_FLOWS.keys()]
|
options={flowKeys
|
||||||
.filter((f) => f !== "dockerAuthenticationFlow")
|
.filter((f) => f !== "dockerAuthenticationFlow")
|
||||||
.map((key) => ({
|
.map((key) => ({
|
||||||
key,
|
key,
|
||||||
value: t(`flow.${REALM_FLOWS.get(key)}`),
|
value: t(`flow.${REALM_FLOWS.get(key)}`),
|
||||||
}))}
|
}))}
|
||||||
controller={{ defaultValue: "" }}
|
controller={{ defaultValue: flowKeys[0] }}
|
||||||
|
variant={SelectVariant.single}
|
||||||
|
menuAppendTo="parent"
|
||||||
/>
|
/>
|
||||||
</FormProvider>
|
</FormProvider>
|
||||||
</Form>
|
</Form>
|
||||||
|
|
|
@ -11,6 +11,7 @@ import {
|
||||||
Select,
|
Select,
|
||||||
SelectOption,
|
SelectOption,
|
||||||
SelectProps,
|
SelectProps,
|
||||||
|
SelectVariant,
|
||||||
ValidatedOptions,
|
ValidatedOptions,
|
||||||
} from "@patternfly/react-core";
|
} from "@patternfly/react-core";
|
||||||
import { FormLabel } from "./FormLabel";
|
import { FormLabel } from "./FormLabel";
|
||||||
|
@ -89,10 +90,14 @@ export const SelectControl = <
|
||||||
setOpen(false);
|
setOpen(false);
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
onClear={(event) => {
|
onClear={
|
||||||
|
variant !== SelectVariant.single
|
||||||
|
? (event) => {
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
onChange([]);
|
onChange([]);
|
||||||
}}
|
}
|
||||||
|
: undefined
|
||||||
|
}
|
||||||
isOpen={open}
|
isOpen={open}
|
||||||
variant={variant}
|
variant={variant}
|
||||||
validated={
|
validated={
|
||||||
|
|
Loading…
Reference in a new issue