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