added none option to attribute group (#4191)

* added none option

fixes: #4085

* small refactor
This commit is contained in:
Erik Jan de Wit 2023-01-16 08:17:00 +01:00 committed by GitHub
parent 5ba147b384
commit 4d44265ed0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 21 deletions

View file

@ -63,19 +63,15 @@ const LoginFlow = ({
aria-label={t(label)}
isOpen={open}
>
{/* The type for the children of Select are incorrect, so we need a fragment here. */}
{/* eslint-disable-next-line react/jsx-no-useless-fragment */}
<>
{defaultValue === "" && (
<SelectOption key="empty" value={defaultValue}>
{t("common:none")}
</SelectOption>
)}
</>
{/* The type for the children of Select are incorrect, so we need a fragment here. */}
{/* eslint-disable-next-line react/jsx-no-useless-fragment */}
<>
{flows?.map((option) => (
{[
...(defaultValue === ""
? [
<SelectOption key="empty" value="">
{t("common:none")}
</SelectOption>,
]
: []),
...(flows?.map((option) => (
<SelectOption
selected={option.alias === field.value}
key={option.id}
@ -83,8 +79,8 @@ const LoginFlow = ({
>
{option.alias}
</SelectOption>
))}
</>
)) || []),
]}
</Select>
)}
/>

View file

@ -145,14 +145,19 @@ export const AttributeGeneralSettings = () => {
onChange(value.toString());
setIsAttributeGroupDropdownOpen(false);
}}
selections={[value || t("common:choose")]}
selections={[value || t("common:none")]}
variant={SelectVariant.single}
>
{config?.groups?.map((group) => (
<SelectOption key={group.name} value={group.name}>
{group.name}
</SelectOption>
))}
{[
<SelectOption key="empty" value="">
{t("common:none")}
</SelectOption>,
...(config?.groups?.map((group) => (
<SelectOption key={group.name} value={group.name}>
{group.name}
</SelectOption>
)) || []),
]}
</Select>
)}
></Controller>