Make dropdown groups unique (#24137)

fixes: #24067
This commit is contained in:
Erik Jan de Wit 2023-10-19 12:17:38 +02:00 committed by GitHub
parent 1e9bb37065
commit b7ce04eb50
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -11,10 +11,10 @@ import {
ToolbarItem,
} from "@patternfly/react-core";
import { FilterIcon } from "@patternfly/react-icons";
import { uniqBy } from "lodash-es";
import { useState } from "react";
import { useTranslation } from "react-i18next";
import { Link, useNavigate } from "react-router-dom";
import { DraggableTable } from "../../authentication/components/DraggableTable";
import { useConfirmDialog } from "../../components/confirm-dialog/ConfirmDialog";
import { KeycloakSpinner } from "../../components/keycloak-spinner/KeycloakSpinner";
@ -134,15 +134,16 @@ export const AttributesTab = () => {
>
{t("allGroups")}
</SelectOption>,
...config
.attributes!.filter((attr) => !!attr.group)
.map((attr) => (
<SelectOption
key={attr.group}
data-testid={`${attr.group}-option`}
value={attr.group}
/>
)),
...uniqBy(
config.attributes!.filter((attr) => !!attr.group),
"group",
).map((attr) => (
<SelectOption
key={attr.group}
data-testid={`${attr.group}-option`}
value={attr.group}
/>
)),
]}
</Select>
</ToolbarItem>