Skip to content

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

feat(agent-vault): inline access management in the Manage Access sheet

Scott Wilson0f737203413a
diff --git a/frontend/src/components/agent-vault/AccessBundleMemberRow.tsx b/frontend/src/components/agent-vault/AccessBundleMemberRow.tsx
new file mode 100644
index 0000000000..e72606d373
--- /dev/null
+++ b/frontend/src/components/agent-vault/AccessBundleMemberRow.tsx
@@ -0,0 +1,106 @@
+import { format } from "date-fns";
+import { BanIcon, ChevronDownIcon } from "lucide-react";
+
+import {
+ Button,
+ DropdownMenu,
+ DropdownMenuContent,
+ DropdownMenuItem,
+ DropdownMenuLabel,
+ DropdownMenuSeparator,
+ DropdownMenuTrigger
+} from "@app/components/v3";
+import { AgentVaultMemberType } from "@app/hooks/api/agentVault/enums";
+import { TAgentVaultActor, TAgentVaultProductActor } from "@app/hooks/api/agentVault/types";
+
+import { MEMBER_KIND, memberDisplayName, memberSubtitle } from "./MemberName";
+import { PendingInvitationBadge } from "./PendingInvitationBadge";
+
+const ROW_CLASS_NAME = "flex items-center gap-3 py-3";
+
+const initialsOf = (value: string) =>
+ value
+ .split(/[\s@._-]+/)
+ .filter(Boolean)
+ .slice(0, 2)
+ .map((part) => part[0]?.toUpperCase() ?? "")
+ .join("") || "?";
+
+const MemberIdentity = ({
+ member,
+ badge
+}: {
+ member: TAgentVaultActor;
+ badge?: React.ReactNode;
+}) => {
+ const name = memberDisplayName(member);
+ const { label, icon: Icon } = MEMBER_KIND[member.type];
+
+ return (
+ <>
+ <div className="flex size-8 shrink-0 items-center justify-center rounded-lg border border-border bg-neutral/10 text-xs font-semibold text-accent">
+ {member.type === AgentVaultMemberType.User ? initialsOf(name) : <Icon className="size-4" />}
+ <span className="sr-only">{label}</span>
+ </div>
+ <div className="min-w-0 flex-1">
+ <div className="flex min-w-0 items-center gap-2">
+ <p className="truncate text-sm font-medium text-foreground">{name}</p>
+ {badge}
+ </div>
+ <p className="truncate text-xs text-muted">{memberSubtitle(member)}</p>
+ </div>
+ </>
+ );
+};
+
+type MemberRowProps = {
+ member: TAgentVaultActor & { grantedAt: string };
+ isDisabled?: boolean;
+ onRevoke: () => void;
+};
+
+export const AccessBundleMemberRow = ({ member, isDisabled, onRevoke }: MemberRowProps) => (
+ <div className={ROW_CLASS_NAME}>
+ <MemberIdentity member={member} />
+ <DropdownMenu>
+ <DropdownMenuTrigger asChild>
+ <Button variant="ghost" size="sm" className="shrink-0" isDisabled={isDisabled}>
+ Has Access
+ <ChevronDownIcon />
+ </Button>
+ </DropdownMenuTrigger>
+ <DropdownMenuContent align="end" className="w-60">
+ <DropdownMenuLabel>
+ Granted {format(new Date(member.grantedAt), "MMM d, yyyy")}
+ </DropdownMenuLabel>
+ <DropdownMenuSeparator />
+ <DropdownMenuItem variant="danger" onClick={onRevoke}>
+ <BanIcon />
+ Revoke Access
+ </DropdownMenuItem>
+ </DropdownMenuContent>
+ </DropdownMenu>
+ </div>
+);
+
+type GrantRowProps = {
+ member: TAgentVaultProductActor;
+ isDisabled?: boolean;
+ onGrant: () => void;
+};
+
+export const AccessBundleGrantRow = ({ member, isDisabled, onGrant }: GrantRowProps) => (
+ <div className={ROW_CLASS_NAME}>
+ <MemberIdentity
+ member={member}
+ badge={
+ <PendingInvitationBadge
+ isPending={member.type === AgentVaultMemberType.User && member.isOrgMembershipPending}
+ />
+ }
+ />
+ <Button variant="av" size="sm" className="shrink-0" isDisabled={isDisabled} onClick={onGrant}>
+ Grant Access
+ </Button>
+ </div>
+);
diff --git a/frontend/src/components/agent-vault/GrantAccessDialog.tsx b/frontend/src/components/agent-vault/GrantAccessDialog.tsx
deleted file mode 100644
index ae95bc1d05..0000000000
--- a/frontend/src/components/agent-vault/GrantAccessDialog.tsx
+++ /dev/null
@@ -1,195 +0,0 @@
-import { useEffect, useMemo, useState } from "react";
-
-import { createNotification } from "@app/components/notifications";
-import {
- Button,
- Combobox,
- Dialog,
- DialogContent,
- DialogDescription,
- DialogFooter,
- DialogHeader,
- DialogTitle,
- Field,
- FieldContent,
- FieldDescription,
- FieldLabel
-} from "@app/components/v3";
-import { actorIdsPayload } from "@app/helpers/agentVaultMembers";
-import { useDebounce } from "@app/hooks";
-import {
- useAddAgentVaultAccessBundleMembers,
- useListAvailableAgentVaultAccessBundleMembers
-} from "@app/hooks/api/agentVault";
-import { AgentVaultMemberType } from "@app/hooks/api/agentVault/enums";
-import { TAgentVaultProductActor } from "@app/hooks/api/agentVault/types";
-
-import { MEMBER_KIND, memberDisplayName, memberSubtitle } from "./MemberName";
-import { PendingInvitationBadge } from "./PendingInvitationBadge";
-
-type Option = {
- actor: TAgentVaultProductActor;
- label: string;
- subtitle: string;
-};
-
-type Props = {
- isOpen: boolean;
- onOpenChange: (isOpen: boolean) => void;
- accessBundleId: string;
-};
-
-export const GrantAccessDialog = ({ isOpen, onOpenChange, accessBundleId }: Props) => {
- const addMembers = useAddAgentVaultAccessBundleMembers();
-
- const [selected, setSelected] = useState<Option[]>([]);
- const [search, setSearch] = useState("");
- const [debouncedSearch] = useDebounce(search);
-
- useEffect(() => {
- if (isOpen) {
- setSelected([]);
- setSearch("");
- }
- }, [isOpen]);
-
- const { data, isFetching } = useListAvailableAgentVaultAccessBundleMembers(
- accessBundleId,
- { search: debouncedSearch.trim() || undefined },
- isOpen
- );
-
- const options = useMemo<Option[]>(
- () =>
- (data?.members ?? []).map((member) => ({
- actor: member,
- label: memberDisplayName(member),
- subtitle: memberSubtitle(member)
- })),
- [data]
- );
-
- const isListTruncated = (data?.totalCount ?? 0) > options.length;
-
- const handleAdd = async () => {
- try {
- if (!selected.length) return;
-
- const { members: granted, skipped } = await addMembers.mutateAsync({
- accessBundleId,
- ...actorIdsPayload(selected.map((option) => option.actor))
- });
-
- if (!granted.length) {
- createNotification({
- text:
- selected.length === 1
- ? `"${selected[0].label}" already has this access bundle`
- : `All ${selected.length} selected members already have this access bundle`,
- type: "info"
- });
- } else {
- const grantedText =
- granted.length === 1 && selected.length === 1
- ? `Access bundle granted to "${selected[0].label}"`
- : `Access bundle granted to ${granted.length} members`;
- createNotification({
- text: skipped.length ? `${grantedText}. ${skipped.length} already had it.` : grantedText,
- type: "success"
- });
- }
- onOpenChange(false);
- } catch {
- // A failed request returns a 4xx that the global request handler surfaces as a toast
- }
- };
-
- return (
- <Dialog open={isOpen} onOpenChange={onOpenChange}>
- <DialogContent>
- <DialogHeader>
- <DialogTitle>Grant Access</DialogTitle>
- <DialogDescription>
- Whoever has access to this bundle can create sessions with it. They must already be a
- member of Agent Vault.
- </DialogDescription>
- </DialogHeader>
-
- <Field>
- <FieldLabel htmlFor="agent-vault-grant-to">Grant To</FieldLabel>
- <FieldContent>
- <Combobox
- id="agent-vault-grant-to"
- multiple
- options={options}
- value={selected}
- isLoading={isFetching}
- onSearchChange={setSearch}
- getOptionValue={(option) => `${option.actor.type}:${option.actor.id}`}
- getOptionLabel={(option) => option.label}
- placeholder="Pick users, groups, or machine identities..."
- searchPlaceholder="Pick users, groups, or machine identities..."
- searchAriaLabel="Search users, groups, and machine identities"
- emptyMessage={(inputValue) =>
- inputValue
- ? "No matches who do not already have this bundle."
- : "Everyone in Agent Vault already has this bundle."
- }
- clearAriaLabel="Clear all grantees"
- modal
- onValueChange={(next) => setSelected([...next])}
- renderValue={(option) => {
- const { icon: Icon } = MEMBER_KIND[option.actor.type];
- return (
- <span className="flex min-w-0 items-center gap-1.5">
- <Icon className="size-3.5 shrink-0 text-muted" />
- <span className="truncate">{option.label}</span>
- </span>
- );
- }}
- renderOption={(option) => {
- const { icon: Icon } = MEMBER_KIND[option.actor.type];
- return (
- <span className="flex min-w-0 items-center gap-2.5">
- <Icon className="size-4 shrink-0 text-muted" />
- <span className="min-w-0">
- <span className="block truncate">{option.label}</span>
- <span className="block truncate text-xs leading-4 text-muted">
- {option.subtitle}
- </span>
- </span>
- <PendingInvitationBadge
- isPending={
- option.actor.type === AgentVaultMemberType.User &&
- option.actor.isOrgMembershipPending
- }
- />
- </span>
- );
- }}
- />
- {isListTruncated && (
- <FieldDescription>
- Search by name to find members that are not listed.
- </FieldDescription>
- )}
- </FieldContent>
- </Field>
-
- <DialogFooter>
- <Button
- variant="av"
- isDisabled={!selected.length}
- isPending={addMembers.isPending}
- onClick={async () => handleAdd()}
- >
- Grant Access
- </Button>
- <Button variant="outline" onClick={() => onOpenChange(false)}>
- Cancel
- </Button>
- </DialogFooter>
- </DialogContent>
- </Dialog>
- );
-};
diff --git a/frontend/src/components/agent-vault/ManageAccessSheet.tsx b/frontend/src/components/agent-vault/ManageAccessSheet.tsx
index 86703058a4..54f561a334 100644
--- a/frontend/src/components/agent-vault/ManageAccessSheet.tsx
+++ b/frontend/src/components/agent-vault/ManageAccessSheet.tsx
@@ -1,9 +1,12 @@
import { useEffect, useState } from "react";
-import { format } from "date-fns";
-import { BanIcon, MoreHorizontalIcon, SearchIcon, UserPlusIcon } from "lucide-react";
+import { FilterIcon, PackageIcon, SearchIcon, UsersIcon, XIcon } from "lucide-react";
import { createNotification } from "@app/components/notifications";
import {
+ Accordion,
+ AccordionContent,
+ AccordionItem,
+ AccordionTrigger,
AlertDialog,
AlertDialogAction,
AlertDialogCancel,
@@ -12,48 +15,112 @@ import {
AlertDialogFooter,
AlertDialogHeader,
AlertDialogTitle,
- Button,
+ DocumentationLinkBadge,
DropdownMenu,
+ DropdownMenuCheckboxItem,
DropdownMenuContent,
DropdownMenuItem,
+ DropdownMenuLabel,
+ DropdownMenuSeparator,
DropdownMenuTrigger,
Empty,
EmptyDescription,
EmptyHeader,
+ EmptyMedia,
EmptyTitle,
IconButton,
InputGroup,
InputGroupAddon,
+ InputGroupButton,
InputGroupInput,
Pagination,
+ Separator,
Sheet,
SheetContent,
- SheetDescription,
+ SheetFooter,
SheetHeader,
SheetTitle,
Skeleton,
- Table,
- TableBody,
- TableCell,
- TableHead,
- TableHeader,
- TableRow
+ Tooltip,
+ TooltipContent,
+ TooltipTrigger
} from "@app/components/v3";
import { actorIdsPayload } from "@app/helpers/agentVaultMembers";
-import {
- getUserTablePreference,
- PreferenceKey,
- setUserTablePreference
-} from "@app/helpers/userTablePreferences";
import { useDebounce, useResetPageHelper } from "@app/hooks";
import {
+ useAddAgentVaultAccessBundleMembers,
useListAgentVaultAccessBundleMembers,
+ useListAvailableAgentVaultAccessBundleMembers,
useRevokeAgentVaultAccessBundleMembers
} from "@app/hooks/api/agentVault";
-import { TAgentVaultMember } from "@app/hooks/api/agentVault/types";
+import { AgentVaultMemberType } from "@app/hooks/api/agentVault/enums";
+import { TAgentVaultMember, TAgentVaultProductActor } from "@app/hooks/api/agentVault/types";
+import { AgentVaultDocsUrls } from "@app/pages/agent-vault/agent-vault-docs-urls";
+
+import { AccessBundleGrantRow, AccessBundleMemberRow } from "./AccessBundleMemberRow";
+import { MEMBER_KIND, memberDisplayName } from "./MemberName";
+
+const PER_PAGE = 20;
+// members without access are not paged, so the list is capped and search narrows it
+const AVAILABLE_PREVIEW_LIMIT = 20;
+const NO_ACCESS_SECTION = "no-access";
-import { GrantAccessDialog } from "./GrantAccessDialog";
-import { memberDisplayName, MemberName } from "./MemberName";
+const TYPE_OPTIONS = [
+ { value: AgentVaultMemberType.User, label: "Users" },
+ { value: AgentVaultMemberType.Group, label: "Groups" },
+ { value: AgentVaultMemberType.MachineIdentity, label: "Machine Identities" }
+].map((option) => ({ ...option, icon: MEMBER_KIND[option.value].icon }));
+
+const MemberTypeFilter = ({
+ value,
+ onChange
+}: {
+ value: AgentVaultMemberType[];
+ onChange: (value: AgentVaultMemberType[]) => void;
+}) => (
+ <DropdownMenu>
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <DropdownMenuTrigger asChild>
+ <IconButton
+ aria-label="Filter members"
+ size="md"
+ variant={value.length ? "av" : "outline"}
+ >
+ <FilterIcon />
+ </IconButton>
+ </DropdownMenuTrigger>
+ </TooltipTrigger>
+ <TooltipContent>Filter members</TooltipContent>
+ </Tooltip>
+ <DropdownMenuContent align="end" className="w-60">
+ <DropdownMenuLabel>Type</DropdownMenuLabel>
+ {TYPE_OPTIONS.map((option) => (
+ <DropdownMenuCheckboxItem
+ key={option.value}
+ checked={value.includes(option.value)}
+ onClick={(e) => {
+ e.preventDefault();
+ onChange(
+ value.includes(option.value)
+ ? value.filter((type) => type !== option.value)
+ : [...value, option.value]
+ );
+ }}
+ >
+ <option.icon />
+ {option.label}
+ </DropdownMenuCheckboxItem>
+ ))}
+ {Boolean(value.length) && (
+ <>
+ <DropdownMenuSeparator />
+ <DropdownMenuItem onClick={() => onChange([])}>Clear Filters</DropdownMenuItem>
+ </>
+ )}
+ </DropdownMenuContent>
+ </DropdownMenu>
+);
type Props = {
accessBundle: { id: string; name: string } | null;
@@ -61,36 +128,90 @@ type Props = {
};
export const ManageAccessSheet = ({ accessBundle, onOpenChange }: Props) => {
- const [isAddOpen, setIsAddOpen] = useState(false);
const [memberToRemove, setMemberToRemove] = useState<TAgentVaultMember | null>(null);
-
const [search, setSearch] = useState("");
const [debouncedSearch] = useDebounce(search);
const [page, setPage] = useState(1);
- const [perPage, setPerPage] = useState(() =>
- getUserTablePreference("agentVaultAccessBundleMembersTable", PreferenceKey.PerPage, 10)
- );
+ const [typeFilter, setTypeFilter] = useState<AgentVaultMemberType[]>([]);
+ const [noAccessSection, setNoAccessSection] = useState("");
- // The sheet stays mounted between opens, so a second bundle would inherit the first one's filter.
- useEffect(() => {
- setSearch("");
- setPage(1);
- }, [accessBundle?.id]);
+ const accessBundleId = accessBundle?.id ?? "";
+ const searchParam = debouncedSearch.trim() || undefined;
- const { data, isPending } = useListAgentVaultAccessBundleMembers(accessBundle?.id ?? "", {
- search: debouncedSearch.trim() || undefined,
- limit: perPage,
- offset: (page - 1) * perPage
+ const { data, isPending } = useListAgentVaultAccessBundleMembers(accessBundleId, {
+ search: searchParam,
+ limit: PER_PAGE,
+ offset: (page - 1) * PER_PAGE
});
+ const { data: available, isFetching: isAvailableFetching } =
+ useListAvailableAgentVaultAccessBundleMembers(
+ accessBundleId,
+ { search: searchParam, limit: AVAILABLE_PREVIEW_LIMIT },
+ Boolean(accessBundle)
+ );
+ const addMembers = useAddAgentVaultAccessBundleMembers();
const revokeMembers = useRevokeAgentVaultAccessBundleMembers();
- const members = data?.members ?? [];
const totalCount = data?.totalCount ?? 0;
- useResetPageHelper({ totalCount, offset: (page - 1) * perPage, setPage });
+ useResetPageHelper({ totalCount, offset: (page - 1) * PER_PAGE, setPage });
+
+ // The sheet stays mounted between opens, so a second bundle would inherit the first one's state.
+ useEffect(() => {
+ setSearch("");
+ setPage(1);
+ setTypeFilter([]);
+ setNoAccessSection("");
+ }, [accessBundleId]);
+
+ // A bundle no one holds yet has nothing above the fold, so the grant list starts open.
+ useEffect(() => {
+ if (!isPending && !totalCount && !searchParam) setNoAccessSection(NO_ACCESS_SECTION);
+ }, [accessBundleId, isPending]);
- const isFiltered = Boolean(debouncedSearch.trim());
+ const matchesType = (type: AgentVaultMemberType) =>
+ !typeFilter.length || typeFilter.includes(type);
+ const members = (data?.members ?? []).filter((member) => matchesType(member.type));
+ const candidates = (available?.members ?? []).filter((member) => matchesType(member.type));
+ const hasMoreCandidates = (available?.totalCount ?? 0) > (available?.members.length ?? 0);
+
+ const isSearching = Boolean(searchParam);
+ const isSearchMiss = isSearching && !members.length && !candidates.length;
+ // a granted candidate stays in this list until the refetch lands
+ const isGrantLocked = addMembers.isPending || isAvailableFetching;
const memberToRemoveName = memberToRemove ? memberDisplayName(memberToRemove) : "";
+ const emptyState =
+ typeFilter.length && totalCount > 0
+ ? {
+ title: "No matching access",
+ description:
+ "No one on this page matches these filters. Clear a filter, or check another page."
+ }
+ : {
+ title: "No one has access yet",
+ description:
+ "Grant access from the No Access section to let members create sessions with this bundle."
+ };
+
+ const handleGrant = async (member: TAgentVaultProductActor) => {
+ if (!accessBundle) return;
+ const name = memberDisplayName(member);
+
+ try {
+ const { members: granted } = await addMembers.mutateAsync({
+ accessBundleId: accessBundle.id,
+ ...actorIdsPayload([member])
+ });
+ createNotification(
+ granted.length
+ ? { text: `Granted "${name}" access to ${accessBundle.name}`, type: "success" }
+ : { text: `"${name}" already has this access bundle`, type: "info" }
+ );
+ } catch {
+ // A failed request returns a 4xx that the global request handler surfaces as a toast
+ }
+ };
+
const handleRemove = async () => {
try {
if (!accessBundle || !memberToRemove) return;
@@ -100,7 +221,7 @@ export const ManageAccessSheet = ({ accessBundle, onOpenChange }: Props) => {
...actorIdsPayload([memberToRemove])
});
createNotification({
- text: `Access bundle revoked from "${memberToRemoveName}"`,
+ text: `Revoked "${memberToRemoveName}" from ${accessBundle.name}`,
type: "success"
});
setMemberToRemove(null);
@@ -111,15 +232,19 @@ export const ManageAccessSheet = ({ accessBundle, onOpenChange }: Props) => {
return (
<Sheet open={Boolean(accessBundle)} onOpenChange={onOpenChange}>
- <SheetContent className="sm:max-w-[640px]">
+ <SheetContent className="gap-y-0 sm:max-w-[640px]">
<SheetHeader>
- <SheetTitle>Manage Access</SheetTitle>
- <SheetDescription>
- Manage who can create sessions with {accessBundle?.name}.
- </SheetDescription>
+ <SheetTitle className="flex items-center gap-2">
+ Manage Access
+ <DocumentationLinkBadge href={AgentVaultDocsUrls.accessBundles} />
+ </SheetTitle>
+ <div className="flex min-w-0 items-center gap-2 rounded-md border border-border bg-neutral/5 px-3 py-2 text-xs">
+ <PackageIcon className="size-3.5 shrink-0 text-muted" />
+ <span className="truncate text-foreground">{accessBundle?.name}</span>
+ </div>
</SheetHeader>
- <div className="flex min-h-0 flex-1 flex-col gap-4 overflow-y-auto p-4">
+ <div className="thin-scrollbar flex-1 space-y-4 overflow-y-auto p-4">
<div className="flex items-center gap-2">
<InputGroup className="flex-1">
<InputGroupAddon>
@@ -130,103 +255,122 @@ export const ManageAccessSheet = ({ accessBundle, onOpenChange }: Props) => {
onChange={(e) => {
setSearch(e.target.value);
setPage(1);
+ if (e.target.value.trim()) setNoAccessSection(NO_ACCESS_SECTION);
}}
- placeholder="Search members..."
+ placeholder="Search users, groups, and machine identities..."
/>
+ {search && (
+ <InputGroupAddon align="inline-end">
+ <InputGroupButton
+ aria-label="Clear search"
+ onClick={() => {
+ setSearch("");
+ setPage(1);
+ }}
+ >
+ <XIcon />
+ </InputGroupButton>
+ </InputGroupAddon>
+ )}
</InputGroup>
- <Button size="sm" variant="av" onClick={() => setIsAddOpen(true)}>
- <UserPlusIcon />
- Grant Access
- </Button>
+ <MemberTypeFilter value={typeFilter} onChange={setTypeFilter} />
</div>
- {isPending && <Skeleton className="h-16 w-full" />}
+ {isPending && (
+ <div className="space-y-2">
+ <Skeleton className="h-14 w-full" />
+ <Skeleton className="h-14 w-full" />
+ <Skeleton className="h-14 w-full" />
+ </div>
+ )}
- {!isPending && members.length === 0 && (
- <Empty className="flex-none border">
+ {!isPending && !members.length && !isSearching && (
+ <Empty className="border">
<EmptyHeader>
- <EmptyTitle>
- {isFiltered ? "No members match your search" : "No members yet"}
- </EmptyTitle>
- <EmptyDescription>
- {isFiltered
- ? "Try a different search term."
- : "Grant this bundle to a user, machine identity, or group."}
- </EmptyDescription>
+ <EmptyMedia variant="icon">
+ <UsersIcon />
+ </EmptyMedia>
+ <EmptyTitle>{emptyState.title}</EmptyTitle>
+ <EmptyDescription>{emptyState.description}</EmptyDescription>
</EmptyHeader>
</Empty>
)}
- {!isPending && members.length > 0 && (
- <Table className="overflow-hidden rounded-md border border-border">
- <TableHeader>
- <TableRow>
- <TableHead>Member</TableHead>
- <TableHead>Granted</TableHead>
- <TableHead variant="action" />
- </TableRow>
- </TableHeader>
- <TableBody>
- {members.map((member) => (
- <TableRow key={`${member.type}:${member.id}`}>
- <TableCell>
- <MemberName member={member} />
- </TableCell>
- <TableCell>{format(new Date(member.grantedAt), "MMM d, yyyy")}</TableCell>
- <TableCell variant="action">
- <DropdownMenu>
- <DropdownMenuTrigger asChild>
- <IconButton
- variant="ghost"
- size="xs"
- aria-label={`Actions for ${memberDisplayName(member)}`}
- >
- <MoreHorizontalIcon />
- </IconButton>
- </DropdownMenuTrigger>
- <DropdownMenuContent sideOffset={2} align="end">
- <DropdownMenuItem
- variant="danger"
- onClick={() => setMemberToRemove(member)}
- >
- <BanIcon />
- Revoke Access
- </DropdownMenuItem>
- </DropdownMenuContent>
- </DropdownMenu>
- </TableCell>
- </TableRow>
- ))}
- </TableBody>
- </Table>
+ {!isPending && isSearchMiss && (
+ <p className="text-sm text-muted">No members match your search and filters.</p>
+ )}
+
+ {!isPending && Boolean(members.length) && (
+ <section className="flex flex-col">
+ {members.map((member) => (
+ <AccessBundleMemberRow
+ key={`${member.type}:${member.id}`}
+ member={member}
+ onRevoke={() => setMemberToRemove(member)}
+ />
+ ))}
+ </section>
+ )}
+
+ {!isPending && (
+ <Accordion
+ type="single"
+ collapsible
+ variant="ghost"
+ value={noAccessSection}
+ onValueChange={setNoAccessSection}
+ >
+ <AccordionItem value={NO_ACCESS_SECTION}>
+ <AccordionTrigger>
+ <span className="shrink-0">No Access</span>
+ <span className="flex-1">
+ <Separator />
+ </span>
+ </AccordionTrigger>
+ <AccordionContent>
+ {!candidates.length && !isSearchMiss && (
+ <p className="py-2.5 text-xs text-muted">
+ {isSearching || typeFilter.length
+ ? "No members without access match your search and filters."
+ : "Everyone in Agent Vault already has this bundle."}
+ </p>
+ )}
+ <section className="flex flex-col">
+ {candidates.map((member) => (
+ <AccessBundleGrantRow
+ key={`${member.type}:${member.id}`}
+ member={member}
+ isDisabled={isGrantLocked}
+ onGrant={() => handleGrant(member)}
+ />
+ ))}
+ </section>
+ {hasMoreCandidates && (
+ <p className="py-2.5 text-xs text-muted">
+ Showing the first {AVAILABLE_PREVIEW_LIMIT}. Search to find someone else.
+ </p>
+ )}
+ </AccordionContent>
+ </AccordionItem>
+ </Accordion>
)}
- {totalCount > 0 && (
+ {!isPending && totalCount > PER_PAGE && (
<Pagination
count={totalCount}
page={page}
- perPage={perPage}
+ perPage={PER_PAGE}
onChangePage={setPage}
- onChangePerPage={(newPerPage) => {
- setPerPage(newPerPage);
- setPage(1);
- setUserTablePreference(
- "agentVaultAccessBundleMembersTable",
- PreferenceKey.PerPage,
- newPerPage
- );
- }}
+ onChangePerPage={() => {}}
+ perPageList={[PER_PAGE]}
+ startAdornment={<span className="text-xs text-muted">Members with access</span>}
/>
)}
</div>
- {accessBundle && (
- <GrantAccessDialog
- isOpen={isAddOpen}
- onOpenChange={setIsAddOpen}
- accessBundleId={accessBundle.id}
- />
- )}
+ <SheetFooter className="border-t">
+ <span className="text-xs text-muted">Changes save automatically</span>
+ </SheetFooter>
<AlertDialog
open={Boolean(memberToRemove)}