Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

improvement: revamp add member to group modal

Scott Wilsonbf41caf45c82
diff --git a/backend/src/ee/routes/v1/group-router.ts b/backend/src/ee/routes/v1/group-router.ts
index 337e6f5d9a..03bdfea9d4 100644
--- a/backend/src/ee/routes/v1/group-router.ts
+++ b/backend/src/ee/routes/v1/group-router.ts
@@ -312,10 +312,11 @@ export const registerGroupRouter = async (server: FastifyZodProvider) => {
CharacterType.AlphaNumeric,
CharacterType.Hyphen,
CharacterType.Period,
- CharacterType.At
+ CharacterType.At,
+ CharacterType.Spaces
])(val),
{
- message: "Invalid pattern: only alphanumeric characters, -, ., @ are allowed."
+ message: "Invalid pattern: only alphanumeric characters, -, ., @, and spaces are allowed."
}
)
.optional()
diff --git a/backend/src/ee/services/group/group-dal.ts b/backend/src/ee/services/group/group-dal.ts
index 4953594563..30a99a70d3 100644
--- a/backend/src/ee/services/group/group-dal.ts
+++ b/backend/src/ee/services/group/group-dal.ts
@@ -156,7 +156,9 @@ export const groupDALFactory = (db: TDbClient) => {
}
if (search) {
- void query.andWhereRaw(`CONCAT_WS(' ', "firstName", "lastName", lower("username")) ilike ?`, [`%${search}%`]);
+ void query.andWhereRaw(`CONCAT_WS(' ', "firstName", "lastName", lower("username"), lower("email")) ilike ?`, [
+ `%${search}%`
+ ]);
} else if (username) {
void query.andWhereRaw(`lower("${TableName.Users}"."username") ilike ?`, `%${username}%`);
}
diff --git a/frontend/src/pages/organization/GroupDetailsByIDPage/components/AddGroupMemberModal.tsx b/frontend/src/pages/organization/GroupDetailsByIDPage/components/AddGroupMemberModal.tsx
index 9dbd193c4e..f4d743eff8 100644
--- a/frontend/src/pages/organization/GroupDetailsByIDPage/components/AddGroupMemberModal.tsx
+++ b/frontend/src/pages/organization/GroupDetailsByIDPage/components/AddGroupMemberModal.tsx
@@ -1,20 +1,100 @@
-import { useState } from "react";
-import { faMagnifyingGlass } from "@fortawesome/free-solid-svg-icons";
-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
-import { HardDriveIcon, UserIcon } from "lucide-react";
-import { twMerge } from "tailwind-merge";
+import { useMemo, useState } from "react";
+import { Controller, useForm } from "react-hook-form";
+import { components, MultiValueGenericProps, OptionProps } from "react-select";
+import { CheckIcon, HardDriveIcon, UserIcon } from "lucide-react";
-import { Button, Input, Modal, ModalContent, Tooltip } from "@app/components/v2";
+import { createNotification } from "@app/components/notifications";
+import {
+ Alert,
+ AlertDescription,
+ Button,
+ Dialog,
+ DialogContent,
+ DialogDescription,
+ DialogFooter,
+ DialogHeader,
+ DialogTitle,
+ Field,
+ FieldError,
+ FieldLabel,
+ FilterableSelect
+} from "@app/components/v3";
import { useDebounce } from "@app/hooks";
+import {
+ useAddIdentityToGroup,
+ useAddUserToGroup,
+ useListGroupMachineIdentities,
+ useListGroupUsers
+} from "@app/hooks/api";
+import { FilterReturnedMachineIdentities, FilterReturnedUsers } from "@app/hooks/api/groups/types";
import { UsePopUpState } from "@app/hooks/usePopUp";
-import { AddGroupIdentitiesTab, AddGroupUsersTab } from "./AddGroupMemberModalTabs";
-
enum AddMemberType {
Users = "users",
MachineIdentities = "machineIdentities"
}
+// Backend caps the list endpoints at 100 rows, so the select relies on server-side
+// search (debounced input -> `search` param) rather than loading every candidate.
+// With no search we pull a smaller balanced preview per type so both groups (users +
+// machine identities) are visible up front instead of 100 users burying the identities.
+const MEMBER_SEARCH_LIMIT = 100;
+const MEMBER_PREVIEW_LIMIT = 10;
+
+// The two endpoints validate the `search` param against different character sets: users allow
+// alphanumeric + - . @ and spaces (spaces enable full-name search); machine identities allow only
+// alphanumeric + -. A single search box must respect both, so we skip a type's query (and hide its
+// options) when the query isn't valid for that type — otherwise it 400s.
+const USER_SEARCH_REGEX = /^[a-zA-Z0-9\-.@\s]+$/;
+const IDENTITY_SEARCH_REGEX = /^[a-zA-Z0-9-]+$/;
+
+type MemberOption = {
+ type: AddMemberType;
+ // `id` is the mutation argument: username for users, identity id for machine identities.
+ id: string;
+ label: string;
+ // shown inline after the label (muted), only for users (their email)
+ email?: string;
+};
+
+const getOptionIcon = (type: AddMemberType) =>
+ type === AddMemberType.Users ? UserIcon : HardDriveIcon;
+
+const getTypeLabel = (type: AddMemberType) =>
+ type === AddMemberType.Users ? "Users" : "Machine Identities";
+
+// Dropdown row: type icon + name/username with the email inline (muted). Both texts get min-w-0 +
+// truncate so a long name or email is ellipsized rather than wrapping or pushing the checkmark off.
+const MemberOptionRow = ({ isSelected, ...props }: OptionProps<MemberOption>) => {
+ const { type, label, email } = props.data;
+ const Icon = getOptionIcon(type);
+
+ return (
+ <components.Option isSelected={isSelected} {...props}>
+ <div className="flex items-center gap-2">
+ <Icon className="size-4 shrink-0 text-muted" />
+ <span className="min-w-0 truncate">{label}</span>
+ {email && email !== label && <span className="min-w-0 truncate text-muted">{email}</span>}
+ {isSelected && <CheckIcon className="ml-auto size-4 shrink-0" />}
+ </div>
+ </components.Option>
+ );
+};
+
+// Selected chip/badge: type icon + label (the remove button is left to the shared component).
+const MemberMultiValueLabel = ({ children, ...props }: MultiValueGenericProps<MemberOption>) => {
+ const Icon = getOptionIcon(props.data.type);
+
+ return (
+ <components.MultiValueLabel {...props}>
+ <div className="flex items-center gap-1">
+ <Icon className="size-3 shrink-0 text-muted" />
+ <span className="truncate">{children}</span>
+ </div>
+ </components.MultiValueLabel>
+ );
+};
+
type Props = {
popUp: UsePopUpState<["addGroupMembers"]>;
handlePopUpToggle: (popUpName: keyof UsePopUpState<["addGroupMembers"]>, state?: boolean) => void;
@@ -26,99 +106,210 @@ export const AddGroupMembersModal = ({
handlePopUpToggle,
isOidcManageGroupMembershipsEnabled
}: Props) => {
- const [addMemberType, setAddMemberType] = useState<AddMemberType>(
- isOidcManageGroupMembershipsEnabled ? AddMemberType.MachineIdentities : AddMemberType.Users
- );
+ const popUpData = popUp?.addGroupMembers?.data as { groupId: string; slug: string } | undefined;
+ const groupId = popUpData?.groupId ?? "";
+ const groupSlug = popUpData?.slug ?? "";
+ const isOpen = Boolean(popUp?.addGroupMembers?.isOpen);
+
+ const [search, setSearch] = useState("");
+ const [debouncedSearch] = useDebounce(search);
+ // Trim so a whitespace-only query isn't sent (the endpoints reject an all-spaces search).
+ const trimmedSearch = debouncedSearch.trim();
+
+ // Only send the query to an endpoint when it's valid for that endpoint's charset (and
+ // only surface that type's options then) — otherwise skip it to avoid a 400 / stale rows.
+ const isUserSearchValid = !trimmedSearch || USER_SEARCH_REGEX.test(trimmedSearch);
+ const isIdentitySearchValid = !trimmedSearch || IDENTITY_SEARCH_REGEX.test(trimmedSearch);
+ const showUsers = !isOidcManageGroupMembershipsEnabled && isUserSearchValid;
+ const showIdentities = isIdentitySearchValid;
+
+ const listLimit = trimmedSearch ? MEMBER_SEARCH_LIMIT : MEMBER_PREVIEW_LIMIT;
- const [searchMemberFilter, setSearchMemberFilter] = useState("");
- const [debouncedSearch] = useDebounce(searchMemberFilter);
+ const { mutateAsync: addUserToGroup } = useAddUserToGroup();
+ const { mutateAsync: addIdentityToGroup } = useAddIdentityToGroup();
- const popUpData = popUp?.addGroupMembers?.data as {
- groupId: string;
- slug: string;
+ const { data: usersData, isFetching: isUsersFetching } = useListGroupUsers({
+ id: groupId,
+ groupSlug,
+ offset: 0,
+ limit: listLimit,
+ search: isUserSearchValid ? trimmedSearch : "",
+ filter: FilterReturnedUsers.NON_MEMBERS
+ });
+
+ const { data: identitiesData, isFetching: isIdentitiesFetching } = useListGroupMachineIdentities({
+ id: groupId,
+ groupSlug,
+ offset: 0,
+ limit: listLimit,
+ search: isIdentitySearchValid ? trimmedSearch : "",
+ filter: FilterReturnedMachineIdentities.NON_ASSIGNED_MACHINE_IDENTITIES
+ });
+
+ const memberOptions = useMemo<MemberOption[]>(() => {
+ const users: MemberOption[] = showUsers
+ ? (usersData?.users ?? []).map((user) => {
+ const name = [user.firstName, user.lastName].filter(Boolean).join(" ").trim();
+ return {
+ type: AddMemberType.Users,
+ id: user.username,
+ // Show the user's name when set, otherwise their username; email shown inline (muted).
+ label: name || user.username,
+ email: user.email
+ };
+ })
+ : [];
+
+ const identities: MemberOption[] = showIdentities
+ ? (identitiesData?.machineIdentities ?? []).map((identity) => ({
+ type: AddMemberType.MachineIdentities,
+ id: identity.id,
+ label: identity.name
+ }))
+ : [];
+
+ return [...users, ...identities];
+ }, [usersData, identitiesData, showUsers, showIdentities]);
+
+ const {
+ control,
+ handleSubmit,
+ watch,
+ reset,
+ formState: { isSubmitting }
+ } = useForm<{ members: MemberOption[] }>({ defaultValues: { members: [] } });
+
+ const selectedCount = watch("members").length;
+
+ const resetState = () => {
+ reset({ members: [] });
+ setSearch("");
+ };
+
+ const handleOpenChange = (open: boolean) => {
+ handlePopUpToggle("addGroupMembers", open);
+ if (!open) resetState();
+ };
+
+ const onSubmit = async ({ members }: { members: MemberOption[] }) => {
+ if (!groupId || !groupSlug) {
+ createNotification({
+ text: "Some data is missing, please refresh the page and try again",
+ type: "error"
+ });
+ return;
+ }
+
+ if (!members.length) return;
+
+ const results = await Promise.allSettled(
+ members.map((member) =>
+ member.type === AddMemberType.Users
+ ? addUserToGroup({ groupId, username: member.id, slug: groupSlug })
+ : addIdentityToGroup({ groupId, identityId: member.id, slug: groupSlug })
+ )
+ );
+
+ const failedMembers = members.filter((_, idx) => results[idx].status === "rejected");
+ const succeededCount = results.length - failedMembers.length;
+
+ if (succeededCount > 0) {
+ createNotification({
+ text: `Successfully assigned ${succeededCount} member${
+ succeededCount === 1 ? "" : "s"
+ } to the group`,
+ type: "success"
+ });
+ }
+
+ // Individual failures are surfaced by the global mutation error handler.
+ if (!failedMembers.length) {
+ handleOpenChange(false);
+ } else {
+ // Keep the dialog open with only the members that failed so they can be retried.
+ reset({ members: failedMembers });
+ setSearch("");
+ }
+ };
+
+ const noOptionsMessage = () => {
+ if (trimmedSearch) return "No members match your search";
+ return isOidcManageGroupMembershipsEnabled
+ ? "All machine identities are already in the group"
+ : "All members are already in the group";
};
return (
- <Modal
- isOpen={popUp?.addGroupMembers?.isOpen}
- onOpenChange={(isOpen) => {
- handlePopUpToggle("addGroupMembers", isOpen);
- }}
- >
- <ModalContent title="Add Group Members">
- <div className="mx-auto flex w-3/4 gap-x-0.5 rounded-md border border-mineshaft-600 bg-mineshaft-800 p-1">
- <Tooltip
- className="text-center"
- content={
- isOidcManageGroupMembershipsEnabled
- ? "OIDC Group Membership Mapping Enabled. Assign users to this group in your OIDC provider."
- : undefined
- }
- >
- <div className="flex-1">
- <Button
- variant="outline_bg"
- onClick={() => {
- setAddMemberType(AddMemberType.Users);
- }}
- size="xs"
- isDisabled={isOidcManageGroupMembershipsEnabled}
- className={twMerge(
- "w-full min-w-[2.4rem] rounded border-none hover:bg-mineshaft-600",
- addMemberType === AddMemberType.Users ? "bg-mineshaft-500" : "bg-transparent"
- )}
- >
- <div className="flex items-center gap-2">
- <UserIcon size={16} />
- Users
- </div>
- </Button>
- </div>
- </Tooltip>
- <Button
- variant="outline_bg"
- onClick={() => {
- setAddMemberType(AddMemberType.MachineIdentities);
- }}
- size="xs"
- className={twMerge(
- "min-w-[2.4rem] flex-1 rounded border-none hover:bg-mineshaft-600",
- addMemberType === AddMemberType.MachineIdentities
- ? "bg-mineshaft-500"
- : "bg-transparent"
- )}
- >
- <div className="flex items-center gap-2">
- <HardDriveIcon size={16} />
- Machine Identities
- </div>
- </Button>
- </div>
- <div className="mt-4 mb-4 flex items-center justify-center gap-x-2">
- <Input
- value={searchMemberFilter}
- onChange={(e) => setSearchMemberFilter(e.target.value)}
- leftIcon={<FontAwesomeIcon icon={faMagnifyingGlass} />}
- placeholder="Search members..."
- />
- </div>
- {addMemberType === AddMemberType.Users &&
- popUpData &&
- !isOidcManageGroupMembershipsEnabled && (
- <AddGroupUsersTab
- groupId={popUpData.groupId}
- groupSlug={popUpData.slug}
- search={debouncedSearch}
- />
+ <Dialog open={isOpen} onOpenChange={handleOpenChange}>
+ <DialogContent className="overflow-visible sm:max-w-xl">
+ <DialogHeader>
+ <DialogTitle>Add Group Members</DialogTitle>
+ <DialogDescription>
+ Search for members and assign them to this group. You can select multiple at once.
+ </DialogDescription>
+ </DialogHeader>
+ <form onSubmit={handleSubmit(onSubmit)} className="flex flex-col gap-4">
+ {isOidcManageGroupMembershipsEnabled && (
+ <Alert variant="info">
+ <AlertDescription>
+ User membership for this group is managed through your OIDC provider. Assign users
+ there; only machine identities can be added here.
+ </AlertDescription>
+ </Alert>
)}
- {addMemberType === AddMemberType.MachineIdentities && popUpData && (
- <AddGroupIdentitiesTab
- groupId={popUpData.groupId}
- groupSlug={popUpData.slug}
- search={debouncedSearch}
+ <Controller
+ control={control}
+ name="members"
+ render={({ field: { value, onChange }, fieldState: { error } }) => (
+ <Field>
+ <FieldLabel htmlFor="add-group-members">
+ {isOidcManageGroupMembershipsEnabled ? "Machine Identities" : "Members"}
+ </FieldLabel>
+ <FilterableSelect
+ inputId="add-group-members"
+ isMulti
+ placeholder={
+ isOidcManageGroupMembershipsEnabled
+ ? "Search and select machine identities..."
+ : "Search and select users or machine identities..."
+ }
+ value={value}
+ onChange={onChange}
+ options={memberOptions}
+ groupBy="type"
+ getGroupHeaderLabel={getTypeLabel}
+ getOptionValue={(option) => `${option.type}:${option.id}`}
+ getOptionLabel={(option) => option.label}
+ filterOption={() => true}
+ onInputChange={(val, meta) => {
+ if (meta.action === "input-change") setSearch(val);
+ }}
+ isLoading={isUsersFetching || isIdentitiesFetching}
+ components={{ Option: MemberOptionRow, MultiValueLabel: MemberMultiValueLabel }}
+ isError={Boolean(error)}
+ noOptionsMessage={noOptionsMessage}
+ />
+ <FieldError>{error?.message}</FieldError>
+ </Field>
+ )}
/>
- )}
- </ModalContent>
- </Modal>
+ <DialogFooter>
+ <Button variant="ghost" type="button" onClick={() => handleOpenChange(false)}>
+ Cancel
+ </Button>
+ <Button
+ variant="org"
+ type="submit"
+ isPending={isSubmitting}
+ isDisabled={isSubmitting || selectedCount === 0}
+ >
+ {selectedCount > 0
+ ? `Assign ${selectedCount} Member${selectedCount === 1 ? "" : "s"}`
+ : "Assign Members"}
+ </Button>
+ </DialogFooter>
+ </form>
+ </DialogContent>
+ </Dialog>
);
};
diff --git a/frontend/src/pages/organization/GroupDetailsByIDPage/components/AddGroupMemberModalTabs/AddGroupIdentitiesTab.tsx b/frontend/src/pages/organization/GroupDetailsByIDPage/components/AddGroupMemberModalTabs/AddGroupIdentitiesTab.tsx
deleted file mode 100644
index 57179fb97d..0000000000
--- a/frontend/src/pages/organization/GroupDetailsByIDPage/components/AddGroupMemberModalTabs/AddGroupIdentitiesTab.tsx
+++ /dev/null
@@ -1,141 +0,0 @@
-import { useState } from "react";
-import { faServer } from "@fortawesome/free-solid-svg-icons";
-
-import { createNotification } from "@app/components/notifications";
-import { OrgPermissionCan } from "@app/components/permissions";
-import {
- Button,
- EmptyState,
- Pagination,
- Table,
- TableContainer,
- TableSkeleton,
- TBody,
- Td,
- Th,
- THead,
- Tr
-} from "@app/components/v2";
-import { OrgPermissionGroupActions, OrgPermissionSubjects } from "@app/context";
-import { useResetPageHelper } from "@app/hooks";
-import { useAddIdentityToGroup, useListGroupMachineIdentities } from "@app/hooks/api";
-import {
- FilterReturnedMachineIdentities,
- TGroupMachineIdentity
-} from "@app/hooks/api/groups/types";
-
-type Props = {
- groupId: string;
- groupSlug: string;
- search: string;
-};
-
-export const AddGroupIdentitiesTab = ({ groupId, groupSlug, search }: Props) => {
- const [page, setPage] = useState(1);
- const [perPage, setPerPage] = useState(10);
-
- const offset = (page - 1) * perPage;
- const { data, isPending } = useListGroupMachineIdentities({
- id: groupId,
- groupSlug,
- offset,
- limit: perPage,
- search,
- filter: FilterReturnedMachineIdentities.NON_ASSIGNED_MACHINE_IDENTITIES
- });
-
- const { totalCount = 0 } = data ?? {};
-
- useResetPageHelper({
- totalCount,
- offset,
- setPage
- });
-
- const { mutateAsync: addIdentityToGroupMutateAsync } = useAddIdentityToGroup();
-
- const handleAddIdentity = async (identityId: string) => {
- if (!groupSlug) {
- createNotification({
- text: "Some data is missing, please refresh the page and try again",
- type: "error"
- });
- return;
- }
-
- await addIdentityToGroupMutateAsync({
- groupId,
- identityId,
- slug: groupSlug
- });
-
- createNotification({
- text: "Successfully assigned machine identity to the group",
- type: "success"
- });
- };
-
- return (
- <TableContainer className="mt-4">
- <Table>
- <THead>
- <Tr>
- <Th className="w-full">Machine Identity</Th>
- <Th />
- </Tr>
- </THead>
- <TBody>
- {isPending && <TableSkeleton columns={2} innerKey="group-identities" />}
- {!isPending &&
- data?.machineIdentities?.map((identity: TGroupMachineIdentity) => {
- return (
- <Tr className="items-center" key={`group-identity-${identity.id}`}>
- <Td className="max-w-0 truncate">{identity.name}</Td>
- <Td className="flex justify-end">
- <OrgPermissionCan
- I={OrgPermissionGroupActions.Edit}
- a={OrgPermissionSubjects.Groups}
- >
- {(isAllowed) => {
- return (
- <Button
- isLoading={isPending}
- isDisabled={!isAllowed}
- colorSchema="primary"
- variant="outline_bg"
- type="submit"
- onClick={() => handleAddIdentity(identity.id)}
- >
- Assign
- </Button>
- );
- }}
- </OrgPermissionCan>
- </Td>
- </Tr>
- );
- })}
- </TBody>
- </Table>
- {!isPending && totalCount > 0 && (
- <Pagination
- count={totalCount}
- page={page}
- perPage={perPage}
- onChangePage={(newPage) => setPage(newPage)}
- onChangePerPage={(newPerPage) => setPerPage(newPerPage)}
- />
- )}
- {!isPending && !data?.machineIdentities?.length && (
- <EmptyState
- title={
- search
- ? "No machine identities match search"
- : "All machine identities are already in the group"
- }
- icon={faServer}
- />
- )}
- </TableContainer>
- );
-};
diff --git a/frontend/src/pages/organization/GroupDetailsByIDPage/components/AddGroupMemberModalTabs/AddGroupUsersTab.tsx b/frontend/src/pages/organization/GroupDetailsByIDPage/components/AddGroupMemberModalTabs/AddGroupUsersTab.tsx
deleted file mode 100644
index cba02fbd4e..0000000000
--- a/frontend/src/pages/organization/GroupDetailsByIDPage/components/AddGroupMemberModalTabs/AddGroupUsersTab.tsx
+++ /dev/null
@@ -1,137 +0,0 @@
-import { useState } from "react";
-import { faUsers } from "@fortawesome/free-solid-svg-icons";
-
-import { createNotification } from "@app/components/notifications";
-import { OrgPermissionCan } from "@app/components/permissions";
-import {
- Button,
- EmptyState,
- Pagination,
- Table,
- TableContainer,
- TableSkeleton,
- TBody,
- Td,
- Th,
- THead,
- Tr
-} from "@app/components/v2";
-import { OrgPermissionGroupActions, OrgPermissionSubjects } from "@app/context";
-import { useResetPageHelper } from "@app/hooks";
-import { useAddUserToGroup, useListGroupUsers } from "@app/hooks/api";
-import { FilterReturnedUsers } from "@app/hooks/api/groups/types";
-
-type Props = {
- groupId: string;
- groupSlug: string;
- search: string;
-};
-
-export const AddGroupUsersTab = ({ groupId, groupSlug, search }: Props) => {
- const [page, setPage] = useState(1);
- const [perPage, setPerPage] = useState(10);
-
- const offset = (page - 1) * perPage;
- const { data, isPending } = useListGroupUsers({
- id: groupId,
- groupSlug,
- offset,
- limit: perPage,
- search,
- filter: FilterReturnedUsers.NON_MEMBERS
- });
-
- const { totalCount = 0 } = data ?? {};
-
- useResetPageHelper({
- totalCount,
- offset,
- setPage
- });
-
- const { mutateAsync: addUserToGroupMutateAsync } = useAddUserToGroup();
-
- const handleAddUser = async (username: string) => {
- if (!groupSlug) {
- createNotification({
- text: "Some data is missing, please refresh the page and try again",
- type: "error"
- });
- return;
- }
-
- await addUserToGroupMutateAsync({
- groupId,
- username,
- slug: groupSlug
- });
-
- createNotification({
- text: "Successfully assigned user to the group",
- type: "success"
- });
- };
-
- return (
- <TableContainer className="mt-4">
- <Table>
- <THead>
- <Tr>
- <Th className="w-full">User</Th>
- <Th />
- </Tr>
- </THead>
- <TBody>
- {isPending && <TableSkeleton columns={2} innerKey="group-users" />}
- {!isPending &&
- data?.users?.map(({ id, firstName, lastName, username }) => {
- return (
- <Tr className="items-center" key={`group-user-${id}`}>
- <Td className="max-w-0">
- <p className="truncate">{`${firstName ?? "-"} ${lastName ?? ""}`}</p>
- <p className="truncate">{username}</p>
- </Td>
- <Td className="flex justify-end">
- <OrgPermissionCan
- I={OrgPermissionGroupActions.Edit}
- a={OrgPermissionSubjects.Groups}
- >
- {(isAllowed) => {
- return (
- <Button
- isLoading={isPending}
- isDisabled={!isAllowed}
- colorSchema="primary"
- variant="outline_bg"
- type="submit"
- onClick={() => handleAddUser(username)}
- >
- Assign
- </Button>
- );
- }}
- </OrgPermissionCan>
- </Td>
- </Tr>
- );
- })}
- </TBody>
- </Table>
- {!isPending && totalCount > 0 && (
- <Pagination
- count={totalCount}
- page={page}
- perPage={perPage}
- onChangePage={(newPage) => setPage(newPage)}
- onChangePerPage={(newPerPage) => setPerPage(newPerPage)}
- />
- )}
- {!isPending && !data?.users?.length && (
- <EmptyState
- title={search ? "No users match search" : "All users are already in the group"}
- icon={faUsers}
- />
- )}
- </TableContainer>
- );
-};
diff --git a/frontend/src/pages/organization/GroupDetailsByIDPage/components/AddGroupMemberModalTabs/index.tsx b/frontend/src/pages/organization/GroupDetailsByIDPage/components/AddGroupMemberModalTabs/index.tsx
deleted file mode 100644
index e40c6da6b7..0000000000
--- a/frontend/src/pages/organization/GroupDetailsByIDPage/components/AddGroupMemberModalTabs/index.tsx
+++ /dev/null
@@ -1,2 +0,0 @@
-export { AddGroupIdentitiesTab } from "./AddGroupIdentitiesTab";
-export { AddGroupUsersTab } from "./AddGroupUsersTab";
diff --git a/frontend/src/pages/organization/GroupDetailsByIDPage/components/GroupMembersSection/GroupMembershipUserRow.tsx b/frontend/src/pages/organization/GroupDetailsByIDPage/components/GroupMembersSection/GroupMembershipUserRow.tsx
index b74b357d56..b08c0d9fb2 100644
--- a/frontend/src/pages/organization/GroupDetailsByIDPage/components/GroupMembersSection/GroupMembershipUserRow.tsx
+++ b/frontend/src/pages/organization/GroupDetailsByIDPage/components/GroupMembersSection/GroupMembershipUserRow.tsx
@@ -40,13 +40,21 @@ export const GroupMembershipUserRow = ({
const { data: isOidcManageGroupMembershipsEnabled = false } =
useOidcManageGroupMembershipsEnabled(currentOrg.id);
+ const fullName = `${firstName ?? ""} ${lastName ?? ""}`.trim();
+
return (
<TableRow key={`group-user-${id}`}>
<TableCell>
<UserIcon size={14} className="text-mineshaft-400" />
</TableCell>
<TableCell isTruncatable>
- {`${firstName ?? "-"} ${lastName ?? ""}`} <span className="text-muted">({email})</span>
+ {fullName ? (
+ <>
+ {fullName} <span className="text-muted">({email})</span>
+ </>
+ ) : (
+ email
+ )}
</TableCell>
<TableCell>{format(new Date(joinedGroupAt), "yyyy-MM-dd")}</TableCell>
<TableCell>