Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.
TypeScript acmeagentsai-agentscertificate-managementdevsecopsenvironment-variableskubernetesopen-sourcepampkipostgresprivate-caprivileged-access-managementsecret-managementsecret-managersecretssecrets-managementsecuritysecurity-toolsvault
improvement(frontend): migrate server admins modal to v3 components (#8045)
claude[bot]aa0402c3c04a
diff --git a/frontend/src/layouts/OrganizationLayout/components/NavBar/Navbar.tsx b/frontend/src/layouts/OrganizationLayout/components/NavBar/Navbar.tsxindex d6946b47a2..11d7703932 100644--- a/frontend/src/layouts/OrganizationLayout/components/NavBar/Navbar.tsx+++ b/frontend/src/layouts/OrganizationLayout/components/NavBar/Navbar.tsx@@ -42,6 +42,12 @@ import {CommandItem,CommandList,CommandSeparator,+ Dialog,+ DialogBody,+ DialogContent,+ DialogDescription,+ DialogHeader,+ DialogTitle,DropdownMenu,DropdownMenuContent,DropdownMenuItem,@@ -832,13 +838,17 @@ export const Navbar = () => {onOpenChange={setShowSubOrgForm}onCreated={({ id }) => handleOrgSelection({ organizationId: id })}/>- <Modal isOpen={showAdminsModal} onOpenChange={setShowAdminsModal}>- <ModalContent title="Server Administrators" subTitle="View all server administrators">- <div className="mb-2">+ <Dialog open={showAdminsModal} onOpenChange={setShowAdminsModal}>+ <DialogContent>+ <DialogHeader>+ <DialogTitle>Server Administrators</DialogTitle>+ <DialogDescription>View all server administrators</DialogDescription>+ </DialogHeader>+ <DialogBody className="flex flex-col overflow-visible"><ServerAdminsPanel />- </div>- </ModalContent>- </Modal>+ </DialogBody>+ </DialogContent>+ </Dialog></div>);};diff --git a/frontend/src/layouts/OrganizationLayout/components/ServerAdminsPanel/ServerAdminsPanel.tsx b/frontend/src/layouts/OrganizationLayout/components/ServerAdminsPanel/ServerAdminsPanel.tsxindex e319c4e7e6..31891f4daa 100644--- a/frontend/src/layouts/OrganizationLayout/components/ServerAdminsPanel/ServerAdminsPanel.tsx+++ b/frontend/src/layouts/OrganizationLayout/components/ServerAdminsPanel/ServerAdminsPanel.tsx@@ -1,18 +1,22 @@import { useState } from "react";-import { faMagnifyingGlass } from "@fortawesome/free-solid-svg-icons";-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";+import { SearchIcon } from "lucide-react";import {- Input,+ Empty,+ EmptyDescription,+ EmptyHeader,+ EmptyTitle,+ InputGroup,+ InputGroupAddon,+ InputGroupInput,+ Skeleton,Table,- TableContainer,- TableSkeleton,- TBody,- Td,- Th,- THead,- Tr-} from "@app/components/v2";+ TableBody,+ TableCell,+ TableHead,+ TableHeader,+ TableRow+} from "@app/components/v3";import { useOrganization } from "@app/context";import { useDebounce } from "@app/hooks";import { useGetOrgUsers } from "@app/hooks/api";@@ -24,61 +28,79 @@ export const ServerAdminsPanel = () => {const { data: orgUsers, isPending } = useGetOrgUsers(currentOrg?.id || "");- const adminUsers = orgUsers?.filter((orgUser) => {- const isSuperAdmin = orgUser.user.superAdmin;- const matchesSearch = debouncedSearchTerm- ? orgUser.user.email?.toLowerCase().includes(debouncedSearchTerm.toLowerCase()) ||- orgUser.user.firstName?.toLowerCase().includes(debouncedSearchTerm.toLowerCase()) ||- orgUser.user.lastName?.toLowerCase().includes(debouncedSearchTerm.toLowerCase())- : true;- return isSuperAdmin && matchesSearch;+ const serverAdmins = orgUsers?.filter((orgUser) => orgUser.user.superAdmin) ?? [];++ const adminUsers = serverAdmins.filter((orgUser) => {+ if (!debouncedSearchTerm) return true;+ const term = debouncedSearchTerm.toLowerCase();+ return (+ orgUser.user.email?.toLowerCase().includes(term) ||+ orgUser.user.firstName?.toLowerCase().includes(term) ||+ orgUser.user.lastName?.toLowerCase().includes(term)+ );});- const isEmpty = !isPending && (!adminUsers || adminUsers.length === 0);+ const isEmpty = !isPending && adminUsers.length === 0;return (- <div className="flex h-full flex-col">- <div className="mb-4 px-4">- <Input+ <div className="flex min-h-0 flex-1 flex-col gap-4">+ <InputGroup>+ <InputGroupAddon>+ <SearchIcon />+ </InputGroupAddon>+ <InputGroupInputvalue={searchUserFilter}onChange={(e) => setSearchUserFilter(e.target.value)}- leftIcon={<FontAwesomeIcon icon={faMagnifyingGlass} />}placeholder="Search server admins..."- className="w-full"/>- </div>- <div className="flex-1 px-2">- <TableContainer className="flex max-h-[30vh] flex-col overflow-auto">- <Table className="w-full">- <THead className="sticky top-0 bg-bunker-800">- <Tr>- <Th className="w-1/2">Name</Th>- <Th className="w-1/2">Email</Th>- </Tr>- </THead>- <TBody>- {isPending && <TableSkeleton columns={2} innerKey="admins" />}- {!isPending &&- adminUsers?.map(({ user }) => {- const name =- user.firstName || user.lastName- ? `${user.firstName ?? ""} ${user.lastName ?? ""}`.trim()- : user.username;- return (- <Tr key={`admin-${user.id}`}>- <Td className="w-1/2 break-words">{name}</Td>- <Td className="w-1/2 break-words">{user.email}</Td>- </Tr>- );- })}- </TBody>+ </InputGroup>+ <div className="min-h-0 thin-scrollbar flex-1 overflow-y-auto">+ {isPending && (+ <div className="flex flex-col gap-2">+ {Array.from({ length: 3 }).map((_, idx) => (+ // eslint-disable-next-line react/no-array-index-key+ <Skeleton key={`server-admins-skeleton-${idx}`} className="h-10 w-full" />+ ))}+ </div>+ )}+ {isEmpty && (+ <Empty className="border">+ <EmptyHeader>+ <EmptyTitle>+ {serverAdmins.length ? "No server admins match your search" : "No server admins"}+ </EmptyTitle>+ <EmptyDescription>+ {serverAdmins.length+ ? "Try a different name or email."+ : "Promote a user to server admin in the Admin Console to see them listed here."}+ </EmptyDescription>+ </EmptyHeader>+ </Empty>+ )}+ {!isPending && adminUsers.length > 0 && (+ <Table>+ <TableHeader>+ <TableRow>+ <TableHead className="w-1/2">Name</TableHead>+ <TableHead className="w-1/2">Email</TableHead>+ </TableRow>+ </TableHeader>+ <TableBody>+ {adminUsers.map(({ user }) => {+ const name =+ user.firstName || user.lastName+ ? `${user.firstName ?? ""} ${user.lastName ?? ""}`.trim()+ : user.username;+ return (+ <TableRow key={`admin-${user.id}`}>+ <TableCell className="w-1/2 break-words">{name}</TableCell>+ <TableCell className="w-1/2 break-words">{user.email}</TableCell>+ </TableRow>+ );+ })}+ </TableBody></Table>- {isEmpty && (- <div className="flex h-32 items-center justify-center text-sm text-mineshaft-400">- No server administrators found- </div>- )}- </TableContainer>+ )}</div></div>);