Display disabled information from user in group assignment

Closes #30682

Signed-off-by: npriebe <npriebe@avides.com>
This commit is contained in:
npriebe 2024-06-26 08:47:16 +02:00 committed by Alexander Schwartz
parent 57daad34ca
commit 02217b0331
2 changed files with 27 additions and 3 deletions

View file

@ -9,8 +9,9 @@ import {
DropdownList,
MenuToggle,
ToolbarItem,
Label,
} from "@patternfly/react-core";
import { EllipsisVIcon } from "@patternfly/react-icons";
import { EllipsisVIcon, InfoCircleIcon } from "@patternfly/react-icons";
import { uniqBy } from "lodash-es";
import { useState } from "react";
import { useTranslation } from "react-i18next";
@ -52,9 +53,15 @@ const MemberOfRenderer = (member: MembersOf) => {
const UserDetailLink = (user: MembersOf) => {
const { realm } = useRealm();
const { t } = useTranslation();
return (
<Link key={user.id} to={toUser({ realm, id: user.id!, tab: "settings" })}>
{user.username}
{user.username}{" "}
{!user.enabled && (
<Label color="red" icon={<InfoCircleIcon />}>
{t("disabled")}
</Label>
)}
</Link>
);
};

View file

@ -1,5 +1,6 @@
import type UserRepresentation from "@keycloak/keycloak-admin-client/lib/defs/userRepresentation";
import { Button, Modal, ModalVariant } from "@patternfly/react-core";
import { Button, Modal, ModalVariant, Label } from "@patternfly/react-core";
import { InfoCircleIcon } from "@patternfly/react-icons";
import { differenceBy } from "lodash-es";
import { useState } from "react";
import { useTranslation } from "react-i18next";
@ -15,6 +16,20 @@ type MemberModalProps = {
onClose: () => void;
};
const UserDetail = (user: UserRepresentation) => {
const { t } = useTranslation();
return (
<>
{user.username}{" "}
{!user.enabled && (
<Label color="red" icon={<InfoCircleIcon />}>
{t("disabled")}
</Label>
)}
</>
);
};
export const MemberModal = ({
membersQuery,
onAdd,
@ -88,10 +103,12 @@ export const MemberModal = ({
{
name: "username",
displayKey: "username",
cellRenderer: UserDetail,
},
{
name: "email",
displayKey: "email",
cellFormatters: [emptyFormatter()],
},
{
name: "lastName",