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
fix: more ui patches
Sheen Capadngand407aee1e878
diff --git a/backend/src/ee/services/pam-access-request/pam-access-request-service.ts b/backend/src/ee/services/pam-access-request/pam-access-request-service.tsindex e40479acbc..9502c74c01 100644--- a/backend/src/ee/services/pam-access-request/pam-access-request-service.ts+++ b/backend/src/ee/services/pam-access-request/pam-access-request-service.ts@@ -257,8 +257,8 @@ export const pamAccessRequestServiceFactory = ({folderName: folder?.name ?? "",comment: params.comment,// Decided requests leave the approver inbox, so decision messages link to the- // requester-facing My Access page (same destination as the in-app notification)- approvalUrl: `${cfg.SITE_URL}/organizations/${params.orgId}/pam/access`+ // unified PAM Accounts page (same destination as the in-app notification)+ approvalUrl: `${cfg.SITE_URL}/organizations/${params.orgId}/pam/accounts`}}});@@ -953,7 +953,7 @@ export const pamAccessRequestServiceFactory = ({body: `Your access request for **${accountName ?? "a PAM account"}** was ${approved ? "approved" : "denied"}.${comment ? ` Reviewer comment: "${comment}"` : ""}`,- link: `/organizations/${request.organizationId}/pam/access`+ link: `/organizations/${request.organizationId}/pam/accounts`}]);} catch (err) {diff --git a/frontend/src/hooks/api/pam/mutations.tsx b/frontend/src/hooks/api/pam/mutations.tsxindex 9b3fc1835f..688e967fd3 100644--- a/frontend/src/hooks/api/pam/mutations.tsx+++ b/frontend/src/hooks/api/pam/mutations.tsx@@ -773,7 +773,9 @@ export const useCreatePamAccessRequest = () => {},onSuccess: () => {queryClient.invalidateQueries({ queryKey: pamKeys.accessRequest() });- queryClient.invalidateQueries({ queryKey: [...pamKeys.account(), "accessible"] });+ // Refresh every account list variant (accessible + admin-list) so the row's access status+ // and its icon flip to pending as soon as the request is submitted.+ queryClient.invalidateQueries({ queryKey: pamKeys.account() });}});};@@ -804,7 +806,7 @@ export const useReviewPamAccessRequest = () => {},onSuccess: () => {queryClient.invalidateQueries({ queryKey: pamKeys.accessRequest() });- queryClient.invalidateQueries({ queryKey: [...pamKeys.account(), "accessible"] });+ queryClient.invalidateQueries({ queryKey: pamKeys.account() });}});};@@ -818,7 +820,7 @@ export const useRevokePamAccessRequest = () => {},onSuccess: () => {queryClient.invalidateQueries({ queryKey: pamKeys.accessRequest() });- queryClient.invalidateQueries({ queryKey: [...pamKeys.account(), "accessible"] });+ queryClient.invalidateQueries({ queryKey: pamKeys.account() });}});};diff --git a/frontend/src/hooks/api/pam/queries.tsx b/frontend/src/hooks/api/pam/queries.tsxindex 47027be50a..4e0f6a21e9 100644--- a/frontend/src/hooks/api/pam/queries.tsx+++ b/frontend/src/hooks/api/pam/queries.tsx@@ -228,7 +228,7 @@ type TAdminListAccountsParams = {search?: string;};-type TAdminAccountListItem = {+export type TAdminAccountListItem = {id: string;name: string;description: string | null;diff --git a/frontend/src/pages/pam/PamAccessPage/components/AccountRow.tsx b/frontend/src/pages/pam/PamAccessPage/components/AccountRow.tsxindex d5d7809c18..b1a565f800 100644--- a/frontend/src/pages/pam/PamAccessPage/components/AccountRow.tsx+++ b/frontend/src/pages/pam/PamAccessPage/components/AccountRow.tsx@@ -1,59 +1,6 @@-import { useSyncExternalStore } from "react";-import { Clock, LockKeyhole, Rocket } from "lucide-react";+import { PamAccessStatus, PamAccountType, TAccessiblePamAccount } from "@app/hooks/api/pam";-import { HighlightText } from "@app/components/v2/HighlightText";-import {- Badge,- Button,- TableCell,- TableRow,- Tooltip,- TooltipContent,- TooltipTrigger-} from "@app/components/v3";-import {- PamAccessStatus,- PamAccountType,- TAccessiblePamAccount,- usePamAccountTypeMap-} from "@app/hooks/api/pam";--import { AccountPlatformIcon } from "./AccountPlatformIcon";--// One shared 30s ticker for every row's countdown; the interval only runs while rows are mounted-const tickListeners = new Set<() => void>();-let tickNow = Date.now();-let tickTimer: ReturnType<typeof setInterval> | null = null;-const subscribeToTick = (listener: () => void) => {- tickListeners.add(listener);- if (!tickTimer) {- tickTimer = setInterval(() => {- tickNow = Date.now();- tickListeners.forEach((notify) => notify());- }, 30_000);- }- return () => {- tickListeners.delete(listener);- if (tickListeners.size === 0 && tickTimer) {- clearInterval(tickTimer);- tickTimer = null;- }- };-};-const useNow = () => useSyncExternalStore(subscribeToTick, () => tickNow);--// Compact remaining time for the grant-expiry badge, e.g. "3h 41m"-const formatRemaining = (expiresAt: string, now: number) => {- const remainingMs = new Date(expiresAt).getTime() - now;- if (remainingMs <= 0) return "Expired";- const totalMinutes = Math.floor(remainingMs / 60000);- const days = Math.floor(totalMinutes / 1440);- const hours = Math.floor((totalMinutes % 1440) / 60);- const minutes = totalMinutes % 60;- if (days > 0) return `${days}d ${hours}h`;- if (hours > 0) return `${hours}h ${minutes}m`;- return `${minutes}m`;-};+import { PamAccountRow } from "./PamAccountRow";type Props = {account: TAccessiblePamAccount;@@ -64,128 +11,29 @@ type Props = {};export const AccountRow = ({ account, search, onLaunch, onRequestAccess, indented }: Props) => {- const now = useNow();- const { map } = usePamAccountTypeMap();- const typeName = map[account.accountType as PamAccountType]?.name ?? account.accountType;const { canLaunch, requiresApproval, accessStatus, grantExpiresAt, disabledReason } = account;const isDisabled = !!disabledReason;const isGranted = accessStatus === PamAccessStatus.Granted;// Approval is a layer on top of standing access: only users who could launch the account may// request a grant, and launching a gated account requires both the permission and the grant.- const needsApproval = requiresApproval && !isGranted && !isDisabled && canLaunch;- const isPending = accessStatus === PamAccessStatus.Pending;+ const needsApproval = Boolean(requiresApproval && !isGranted && !isDisabled && canLaunch);const canLaunchNow = canLaunch && (!requiresApproval || isGranted);- // Row click mirrors the action button: launch when possible, otherwise open the request sheet- const rowAction = (() => {- if (isDisabled) return undefined;- if (needsApproval) return () => onRequestAccess(account);- if (canLaunchNow) return () => onLaunch(account);- return undefined;- })();-- const renderAction = () => {- if (isDisabled) {- return (- <Tooltip>- <TooltipTrigger asChild>- <div>- <Button variant="neutral" size="xs" isDisabled>- <Rocket className="size-3" />- Launch- </Button>- </div>- </TooltipTrigger>- <TooltipContent>{disabledReason}</TooltipContent>- </Tooltip>- );- }-- if (needsApproval) {- return (- <Tooltip>- <TooltipTrigger asChild>- <div>- <Button- variant="neutral"- size="xs"- onClick={(e) => {- e.stopPropagation();- onRequestAccess(account);- }}- >- {isPending ? (- <>- <Clock className="size-3" />- Pending Approval- </>- ) : (- <>- <LockKeyhole className="size-3" />- Request Access- </>- )}- </Button>- </div>- </TooltipTrigger>- {isPending && (- <TooltipContent>- Your access request is awaiting approval. Click for details.- </TooltipContent>- )}- </Tooltip>- );- }-- return (- <Tooltip>- <TooltipTrigger asChild>- <div>- <Button- variant="pam"- size="xs"- onClick={(e) => {- e.stopPropagation();- onLaunch(account);- }}- isDisabled={!canLaunchNow}- >- <Rocket className="size-3" />- Launch- </Button>- </div>- </TooltipTrigger>- {!canLaunchNow && (- <TooltipContent>- You don't have permission to launch sessions for this account- </TooltipContent>- )}- </Tooltip>- );- };return (- <TableRow className={rowAction ? "cursor-pointer" : ""} onClick={rowAction}>- <TableCell>- <div className={`flex items-center gap-2.5 ${indented ? "pl-[26px]" : ""}`}>- <AccountPlatformIcon accountType={account.accountType} size={20} />- <span className="font-medium text-foreground">- <HighlightText text={account.name} highlight={search} />- </span>- <Badge variant="neutral">{typeName}</Badge>- </div>- </TableCell>- <TableCell className="w-32">- <div className="flex items-center justify-end gap-2.5">- {isGranted && grantExpiresAt && (- <Badge variant="success">- <Clock className="mr-1 size-3" />- Expires in {formatRemaining(grantExpiresAt, now)}- </Badge>- )}- {renderAction()}- </div>- </TableCell>- </TableRow>+ <PamAccountRow+ name={account.name}+ accountType={account.accountType as PamAccountType}+ search={search}+ accessStatus={accessStatus ?? PamAccessStatus.None}+ grantExpiresAt={grantExpiresAt ?? null}+ needsApproval={needsApproval}+ canLaunchNow={canLaunchNow}+ isDisabled={isDisabled}+ disabledReason={disabledReason ?? undefined}+ onLaunch={() => onLaunch(account)}+ onRequestAccess={() => onRequestAccess(account)}+ indented={indented}+ />);};diff --git a/frontend/src/pages/pam/PamAccessPage/components/PamAccountRow.tsx b/frontend/src/pages/pam/PamAccessPage/components/PamAccountRow.tsxnew file mode 100644index 0000000000..2c1c6fada7--- /dev/null+++ b/frontend/src/pages/pam/PamAccessPage/components/PamAccountRow.tsx@@ -0,0 +1,232 @@+import { ReactNode, useSyncExternalStore } from "react";+import { Clock, KeyRound, Rocket } from "lucide-react";++import { HighlightText } from "@app/components/v2/HighlightText";+import {+ Badge,+ IconButton,+ TableCell,+ TableRow,+ Tooltip,+ TooltipContent,+ TooltipTrigger+} from "@app/components/v3";+import { PamAccessStatus, PamAccountType, usePamAccountTypeMap } from "@app/hooks/api/pam";++import { AccountPlatformIcon } from "./AccountPlatformIcon";++// One shared 30s ticker for every row's countdown; the interval only runs while rows are mounted+const tickListeners = new Set<() => void>();+let tickNow = Date.now();+let tickTimer: ReturnType<typeof setInterval> | null = null;+const subscribeToTick = (listener: () => void) => {+ tickListeners.add(listener);+ if (!tickTimer) {+ tickTimer = setInterval(() => {+ tickNow = Date.now();+ tickListeners.forEach((notify) => notify());+ }, 30_000);+ }+ return () => {+ tickListeners.delete(listener);+ if (tickListeners.size === 0 && tickTimer) {+ clearInterval(tickTimer);+ tickTimer = null;+ }+ };+};+const useNow = () => useSyncExternalStore(subscribeToTick, () => tickNow);++// Compact remaining time for the grant-expiry badge, e.g. "3h 41m"+const formatRemaining = (expiresAt: string, now: number) => {+ const remainingMs = new Date(expiresAt).getTime() - now;+ if (remainingMs <= 0) return "Expired";+ const totalMinutes = Math.floor(remainingMs / 60000);+ const days = Math.floor(totalMinutes / 1440);+ const hours = Math.floor((totalMinutes % 1440) / 60);+ const minutes = totalMinutes % 60;+ if (days > 0) return `${days}d ${hours}h`;+ if (hours > 0) return `${hours}h ${minutes}m`;+ return `${minutes}m`;+};++type Props = {+ name: string;+ accountType: PamAccountType;+ search: string;+ accessStatus: PamAccessStatus;+ grantExpiresAt: string | null;+ // Action eligibility — each caller (admin vs regular user) computes these from its own data source+ // so the rendered row stays identical regardless of who is viewing it.+ needsApproval: boolean;+ canLaunchNow: boolean;+ // Hard-disabled (account not ready); takes precedence over every other action state.+ isDisabled?: boolean;+ disabledReason?: string;+ // Tooltip shown when the launch icon is disabled purely for lack of permission/readiness.+ launchDisabledReason?: string;+ onLaunch: () => void;+ onRequestAccess: () => void;+ // Optional slots layered on top of the shared row (e.g. the admin "..." menu / accessibility badge).+ actions?: ReactNode;+ accessibilityBadge?: ReactNode;+ indented?: boolean;+};++export const PamAccountRow = ({+ name,+ accountType,+ search,+ accessStatus,+ grantExpiresAt,+ needsApproval,+ canLaunchNow,+ isDisabled = false,+ disabledReason,+ launchDisabledReason = "You don't have permission to launch sessions for this account",+ onLaunch,+ onRequestAccess,+ actions,+ accessibilityBadge,+ indented+}: Props) => {+ const now = useNow();+ const { map } = usePamAccountTypeMap();+ const typeName = map[accountType]?.name ?? accountType;++ const isGranted = accessStatus === PamAccessStatus.Granted;+ const isPending = accessStatus === PamAccessStatus.Pending;++ // Row click mirrors the primary action icon, and only fires when the user can actually act.+ const rowAction = (() => {+ if (isDisabled) return undefined;+ if (isPending || needsApproval) return onRequestAccess;+ if (canLaunchNow) return onLaunch;+ return undefined;+ })();++ const renderAction = () => {+ if (isDisabled) {+ return (+ <Tooltip>+ <TooltipTrigger asChild>+ <div>+ <IconButton+ variant="ghost"+ size="xs"+ aria-label="Launch session"+ className="text-muted hover:text-foreground"+ isDisabled+ >+ <Rocket className="size-4" />+ </IconButton>+ </div>+ </TooltipTrigger>+ <TooltipContent>{disabledReason}</TooltipContent>+ </Tooltip>+ );+ }++ if (isPending) {+ return (+ <Tooltip>+ <TooltipTrigger asChild>+ <div>+ <IconButton+ variant="ghost"+ size="xs"+ aria-label="Request pending"+ className="text-warning hover:text-warning"+ onClick={(e) => {+ e.stopPropagation();+ onRequestAccess();+ }}+ >+ <Clock className="size-4" />+ </IconButton>+ </div>+ </TooltipTrigger>+ <TooltipContent>+ Your access request is awaiting approval. Click for details.+ </TooltipContent>+ </Tooltip>+ );+ }++ if (needsApproval) {+ return (+ <Tooltip>+ <TooltipTrigger asChild>+ <div>+ <IconButton+ variant="ghost"+ size="xs"+ aria-label="Request access"+ className="text-muted hover:text-foreground"+ onClick={(e) => {+ e.stopPropagation();+ onRequestAccess();+ }}+ >+ <KeyRound className="size-4" />+ </IconButton>+ </div>+ </TooltipTrigger>+ <TooltipContent>Request access to launch sessions for this account</TooltipContent>+ </Tooltip>+ );+ }++ return (+ <Tooltip>+ <TooltipTrigger asChild>+ <div>+ <IconButton+ variant="ghost"+ size="xs"+ aria-label="Launch session"+ className="text-muted hover:text-foreground"+ isDisabled={!canLaunchNow}+ onClick={(e) => {+ e.stopPropagation();+ onLaunch();+ }}+ >+ <Rocket className="size-4" />+ </IconButton>+ </div>+ </TooltipTrigger>+ <TooltipContent>{canLaunchNow ? "Launch session" : launchDisabledReason}</TooltipContent>+ </Tooltip>+ );+ };++ return (+ <TableRow className={rowAction ? "cursor-pointer" : ""} onClick={rowAction}>+ <TableCell>+ <div className={`flex items-center gap-2.5 ${indented ? "pl-[26px]" : ""}`}>+ <AccountPlatformIcon accountType={accountType} size={20} />+ <span className="font-medium text-foreground">+ <HighlightText text={name} highlight={search} />+ </span>+ <Badge variant="neutral">{typeName}</Badge>+ {accessibilityBadge}+ </div>+ </TableCell>+ <TableCell className="w-40">+ <div className="flex items-center justify-end gap-2.5">+ {isGranted && grantExpiresAt && (+ <Badge variant="success">+ <Clock className="mr-1 size-3" />+ Expires in {formatRemaining(grantExpiresAt, now)}+ </Badge>+ )}+ <div className="flex items-center gap-0.5">+ {renderAction()}+ {actions}+ </div>+ </div>+ </TableCell>+ </TableRow>+ );+};diff --git a/frontend/src/pages/pam/PamAccountsPage/PamAccountsPage.tsx b/frontend/src/pages/pam/PamAccountsPage/PamAccountsPage.tsxindex f7abaa1b08..a0fa37e7fe 100644--- a/frontend/src/pages/pam/PamAccountsPage/PamAccountsPage.tsx+++ b/frontend/src/pages/pam/PamAccountsPage/PamAccountsPage.tsx@@ -47,8 +47,6 @@ import {useDeletePamAccount,useDeletePamFolder,useGetPamAccessCapabilities,- useListAccessiblePamFolders,- useListPamAccountTemplates,useListPamAccountTypes,useListPamFoldersAdmin} from "@app/hooks/api/pam";@@ -57,8 +55,6 @@ import { usePamSheetState } from "@app/hooks/usePamSheetState";import { usePopUp } from "@app/hooks/usePopUp";import { PamDocsUrls } from "../pam-docs-urls";-import { AccountPlatformIcon } from "../PamAccessPage/components/AccountPlatformIcon";-import { FolderAccountGroup } from "../PamAccessPage/components/FolderAccountGroup";import { LaunchSessionSheet } from "../PamAccessPage/components/LaunchSessionSheet";import { RequestAccessSheet } from "../PamAccessPage/components/RequestAccessSheet";import { AccountDetailSheet } from "./components/AccountDetailSheet";@@ -75,36 +71,24 @@ export const PamAccountsPage = () => {const { t } = useTranslation();const [searchInput, setSearchInput] = useState("");const [selectedFolderId, setSelectedFolderId] = useState<string>("");- const [selectedTemplateId, setSelectedTemplateId] = useState<string>("");const [selectedAccountType, setSelectedAccountType] = useState<string>("");const [expandedFolders, setExpandedFolders] = useState<Set<string>>(new Set());const [resultCounts, setResultCounts] = useState<Record<string, number>>({});- // Check user capabilities to determine admin vs regular user view- const { data: capabilities, isLoading: isLoadingCapabilities } = useGetPamAccessCapabilities();- const isAdmin = Boolean(capabilities?.isProductAdmin || capabilities?.isResourceAdmin);+ // Every role sees the same folder/account structure; permissions only disable actions on a row,+ // never hide it. Capabilities just drive the create affordances and the empty-state copy.+ const { data: capabilities } = useGetPamAccessCapabilities();- // Admin users see all folders; regular users see only accessible folders- // Only enable the relevant hook once capabilities are loaded to avoid duplicate/failing requests- const capabilitiesLoaded = !isLoadingCapabilities && capabilities !== undefined;- const { data: adminFolders = [], isLoading: isLoadingAdminFolders } = useListPamFoldersAdmin(- undefined,- { enabled: capabilitiesLoaded && isAdmin }- );- const { data: userFolders = [], isLoading: isLoadingUserFolders } = useListAccessiblePamFolders({- enabled: capabilitiesLoaded && !isAdmin- });- const isLoadingFolders =- isLoadingCapabilities || (isAdmin ? isLoadingAdminFolders : isLoadingUserFolders);+ // Backed by ReadAccounts/ReadFolder, so every role gets its visible subset (not a 403).+ const { data: folders = [], isLoading: isLoadingFolders } = useListPamFoldersAdmin();- // Fetch folders where user can create accounts (for "Add Account" button visibility)- const { data: creatableFolders = [] } = useListPamFoldersAdmin(- { filterByAction: PamResourcePermissionActions.CreateAccounts },- { enabled: capabilitiesLoaded && isAdmin }- );+ // Folders where the user can create accounts — gates the "Add Account" affordance.+ const { data: creatableFolders = [] } = useListPamFoldersAdmin({+ filterByAction: PamResourcePermissionActions.CreateAccounts+ });+ const canManage = creatableFolders.length > 0 || Boolean(capabilities?.isProductAdmin);- // Admin: filter by templates; Users: filter by account types- const { data: templates = [] } = useListPamAccountTemplates();+ // Both admin and regular users filter by account type for a consistent viewconst { data: accountTypes = [] } = useListPamAccountTypes();const deleteAccount = useDeletePamAccount();@@ -127,13 +111,8 @@ export const PamAccountsPage = () => {const query = searchInput.trim();// Active filters force-open every folder so matches surface; otherwise folders load lazily on open- // Admin uses template filter; regular users use account type filter- const filterActive = isAdmin- ? Boolean(query || selectedTemplateId)- : Boolean(query || selectedAccountType);- const hasActiveFilters = isAdmin- ? Boolean(query || selectedFolderId || selectedTemplateId)- : Boolean(query || selectedFolderId || selectedAccountType);+ const filterActive = Boolean(query || selectedAccountType);+ const hasActiveFilters = Boolean(query || selectedFolderId || selectedAccountType);const toggleFolder = useCallback((folderId: string) => {setExpandedFolders((prev) => {@@ -151,31 +130,20 @@ export const PamAccountsPage = () => {// Reset result counts when filters change so folder groups recompute counts for new filteruseEffect(() => {setResultCounts({});- }, [query, selectedTemplateId, selectedAccountType]);-- // Compute visible folders separately for admin and user views (for proper typing)- const visibleAdminFolders = selectedFolderId- ? adminFolders.filter((folder) => folder.id === selectedFolderId)- : adminFolders;-- // For regular users, only show folders that have accounts they can access- const nonEmptyUserFolders = userFolders.filter((folder) => folder.accountCount > 0);- const visibleUserFolders = selectedFolderId- ? nonEmptyUserFolders.filter((folder) => folder.id === selectedFolderId)- : nonEmptyUserFolders;+ }, [query, selectedAccountType]);- // For folder dropdown, use the appropriate list- const folderDropdownOptions = isAdmin ? adminFolders : nonEmptyUserFolders;+ const visibleFolders = selectedFolderId+ ? folders.filter((folder) => folder.id === selectedFolderId)+ : folders;+ const folderDropdownOptions = folders;const isFolderOpen = (folderId: string) =>filterActive || folderId === selectedFolderId || expandedFolders.has(folderId);- const visibleFolderCount = isAdmin ? visibleAdminFolders.length : visibleUserFolders.length;- const visibleFolders = isAdmin ? visibleAdminFolders : visibleUserFolders;const filterSettled = visibleFolders.every((f) => resultCounts[f.id] !== undefined);const filterHasMatches = visibleFolders.some((f) => (resultCounts[f.id] ?? 0) > 0);const showNoMatches = filterActive && filterSettled && !filterHasMatches;- const showEmpty = !isLoadingFolders && (visibleFolderCount === 0 || showNoMatches);+ const showEmpty = !isLoadingFolders && (visibleFolders.length === 0 || showNoMatches);// Compute empty state messages to avoid nested ternarieslet emptyTitle: string;@@ -183,7 +151,7 @@ export const PamAccountsPage = () => {if (hasActiveFilters) {emptyTitle = "No accounts match your filters";emptyDescription = "Try adjusting your search or filters.";- } else if (isAdmin) {+ } else if (canManage) {emptyTitle = "No accounts yet";emptyDescription ="Create your first account to get started. You'll need at least one account template.";@@ -244,7 +212,7 @@ export const PamAccountsPage = () => {<CardDescription>Launch sessions for accounts you have access to, or manage account settings.</CardDescription>- {isAdmin && (creatableFolders.length > 0 || capabilities?.isProductAdmin) && (+ {canManage && (<CardAction><ButtonGroup>{creatableFolders.length > 0 && (@@ -316,51 +284,28 @@ export const PamAccountsPage = () => {</SelectContent></Select>- {isAdmin ? (- <Select- value={selectedTemplateId}- onValueChange={(val) => setSelectedTemplateId(val === "all" ? "" : val)}- >- <SelectTrigger>- {!selectedTemplateId && <Layers className="mr-1.5 size-4 text-muted" />}- <SelectValue placeholder="All templates" />- </SelectTrigger>- <SelectContent position="popper">- <SelectItem value="all">All templates</SelectItem>- {templates.map((tpl) => (- <SelectItem key={tpl.id} value={tpl.id}>- <span className="flex items-center gap-1.5">- <AccountPlatformIcon accountType={tpl.type} size={16} />- {tpl.name}- </span>- </SelectItem>- ))}- </SelectContent>- </Select>- ) : (- <Select- value={selectedAccountType}- onValueChange={(val) => setSelectedAccountType(val === "all" ? "" : val)}- >- <SelectTrigger>- {!selectedAccountType && <Layers className="mr-1.5 size-4 text-muted" />}- <SelectValue placeholder="All types" />- </SelectTrigger>- <SelectContent position="popper" align="end" sideOffset={4}>- <SelectItem value="all">All types</SelectItem>- {accountTypes.map((meta) => (- <SelectItem key={meta.type} value={meta.type}>- <img- src={`/images/integrations/${meta.icon}`}- alt={meta.name}- className="mr-1.5 inline-block size-4 rounded-sm"- />- {meta.name}- </SelectItem>- ))}- </SelectContent>- </Select>- )}+ <Select+ value={selectedAccountType}+ onValueChange={(val) => setSelectedAccountType(val === "all" ? "" : val)}+ >+ <SelectTrigger>+ {!selectedAccountType && <Layers className="mr-1.5 size-4 text-muted" />}+ <SelectValue placeholder="All types" />+ </SelectTrigger>+ <SelectContent position="popper" align="end" sideOffset={4}>+ <SelectItem value="all">All types</SelectItem>+ {accountTypes.map((meta) => (+ <SelectItem key={meta.type} value={meta.type}>+ <img+ src={`/images/integrations/${meta.icon}`}+ alt={meta.name}+ className="mr-1.5 inline-block size-4 rounded-sm"+ />+ {meta.name}+ </SelectItem>+ ))}+ </SelectContent>+ </Select></CardContent>{isLoadingFolders && (@@ -393,125 +338,105 @@ export const PamAccountsPage = () => {</TableRow></TableHeader><TableBody>- {isAdmin- ? visibleAdminFolders.map((folder) => (- <FolderAccountRows- key={folder.id}- folder={folder}- isOpen={isFolderOpen(folder.id)}- onToggle={() => toggleFolder(folder.id)}- search={searchInput}- templateId={selectedTemplateId}- filterActive={filterActive}- onOpenAccount={(id, tab) => accountSheet.openSheet(id, tab)}- onLaunchAccount={setLaunchAccount}- onRequestAccess={setRequestAccount}- onDeleteAccount={(accountId, accountName, accountType) =>- handlePopUpOpen("deleteAccount", { accountId, accountName, accountType })- }- onOpenFolder={(tab) => folderSheet.openSheet(folder.id, tab)}- onFolderAddAccount={() =>- handlePopUpOpen("createAccount", { folderId: folder.id })- }- onFolderDelete={() =>- handlePopUpOpen("deleteFolder", {- folderId: folder.id,- folderName: folder.name,- accountCount: folder.accountCount- })- }- onResultCount={handleResultCount}- />- ))- : visibleUserFolders.map((folder) => (- <FolderAccountGroup- key={folder.id}- folder={folder}- isOpen={isFolderOpen(folder.id)}- onToggle={() => toggleFolder(folder.id)}- search={searchInput}- accountType={selectedAccountType}- filterActive={filterActive}- onLaunch={setLaunchAccount}- onRequestAccess={setRequestAccount}- onResultCount={handleResultCount}- />- ))}+ {visibleFolders.map((folder) => (+ <FolderAccountRows+ key={folder.id}+ folder={folder}+ isOpen={isFolderOpen(folder.id)}+ onToggle={() => toggleFolder(folder.id)}+ search={searchInput}+ accountType={selectedAccountType}+ filterActive={filterActive}+ onOpenAccount={(id, tab) => accountSheet.openSheet(id, tab)}+ onLaunchAccount={setLaunchAccount}+ onRequestAccess={setRequestAccount}+ onDeleteAccount={(accountId, accountName, accountType) =>+ handlePopUpOpen("deleteAccount", { accountId, accountName, accountType })+ }+ onOpenFolder={(tab) => folderSheet.openSheet(folder.id, tab)}+ onFolderAddAccount={() =>+ handlePopUpOpen("createAccount", { folderId: folder.id })+ }+ onFolderDelete={() =>+ handlePopUpOpen("deleteFolder", {+ folderId: folder.id,+ folderName: folder.name,+ accountCount: folder.accountCount+ })+ }+ onResultCount={handleResultCount}+ />+ ))}</TableBody></Table>)}</Card>- {/* Admin-only modals and sheets */}- {isAdmin && (- <>- <CreateAccountSheet- isOpen={popUp.createAccount.isOpen}- defaultFolderId={- (popUp.createAccount.data as { folderId?: string } | undefined)?.folderId- }- onOpenChange={(open) => {- if (!open) handlePopUpClose("createAccount");- }}- onCreated={(accountId) => accountSheet.openSheet(accountId)}- />-- <CreateFolderModal- isOpen={popUp.createFolder.isOpen}- onOpenChange={(open) => {- if (!open) handlePopUpClose("createFolder");- }}- />-- <AccountDetailSheet- isOpen={accountSheet.isOpen}- accountId={accountSheet.selectedId}- onOpenChange={(open) => {- if (!open) accountSheet.closeSheet();- }}- />-- <FolderDetailSheet- isOpen={folderSheet.isOpen}- folder={adminFolders.find((f) => f.id === folderSheet.selectedId)}- activeTab={folderSheet.tab}- onTabChange={folderSheet.setTab}- onOpenChange={(open) => {- if (!open) folderSheet.closeSheet();- }}- />-- <DeleteAccountModal- isOpen={popUp.deleteAccount.isOpen}- accountName={- (popUp.deleteAccount.data as { accountName: string } | undefined)?.accountName ?? ""- }- accountType={- (popUp.deleteAccount.data as { accountType: PamAccountType } | undefined)?.accountType- }- isLoading={deleteAccount.isPending}- onConfirm={handleDelete}- onOpenChange={(open) => {- if (!open) handlePopUpClose("deleteAccount");- }}- />-- <DeleteFolderModal- isOpen={popUp.deleteFolder.isOpen}- folderName={- (popUp.deleteFolder.data as { folderName: string } | undefined)?.folderName ?? ""- }- accountCount={- (popUp.deleteFolder.data as { accountCount: number } | undefined)?.accountCount- }- isLoading={deleteFolder.isPending}- onConfirm={handleDeleteFolder}- onOpenChange={(open) => {- if (!open) handlePopUpClose("deleteFolder");- }}- />- </>- )}+ {/* Modals and sheets are rendered for every role; their contents are permission-gated+ internally, and the actions that open them are disabled when the user lacks access. */}+ <CreateAccountSheet+ isOpen={popUp.createAccount.isOpen}+ defaultFolderId={(popUp.createAccount.data as { folderId?: string } | undefined)?.folderId}+ onOpenChange={(open) => {+ if (!open) handlePopUpClose("createAccount");+ }}+ onCreated={(accountId) => accountSheet.openSheet(accountId)}+ />++ <CreateFolderModal+ isOpen={popUp.createFolder.isOpen}+ onOpenChange={(open) => {+ if (!open) handlePopUpClose("createFolder");+ }}+ />++ <AccountDetailSheet+ isOpen={accountSheet.isOpen}+ accountId={accountSheet.selectedId}+ onOpenChange={(open) => {+ if (!open) accountSheet.closeSheet();+ }}+ />++ <FolderDetailSheet+ isOpen={folderSheet.isOpen}+ folder={folders.find((f) => f.id === folderSheet.selectedId)}+ activeTab={folderSheet.tab}+ onTabChange={folderSheet.setTab}+ onOpenChange={(open) => {+ if (!open) folderSheet.closeSheet();+ }}+ />++ <DeleteAccountModal+ isOpen={popUp.deleteAccount.isOpen}+ accountName={+ (popUp.deleteAccount.data as { accountName: string } | undefined)?.accountName ?? ""+ }+ accountType={+ (popUp.deleteAccount.data as { accountType: PamAccountType } | undefined)?.accountType+ }+ isLoading={deleteAccount.isPending}+ onConfirm={handleDelete}+ onOpenChange={(open) => {+ if (!open) handlePopUpClose("deleteAccount");+ }}+ />++ <DeleteFolderModal+ isOpen={popUp.deleteFolder.isOpen}+ folderName={+ (popUp.deleteFolder.data as { folderName: string } | undefined)?.folderName ?? ""+ }+ accountCount={+ (popUp.deleteFolder.data as { accountCount: number } | undefined)?.accountCount+ }+ isLoading={deleteFolder.isPending}+ onConfirm={handleDeleteFolder}+ onOpenChange={(open) => {+ if (!open) handlePopUpClose("deleteFolder");+ }}+ />{/* Shared components */}<LaunchSessionSheetdiff --git a/frontend/src/pages/pam/PamAccountsPage/components/AccountActionsMenu.tsx b/frontend/src/pages/pam/PamAccountsPage/components/AccountActionsMenu.tsxindex 68e5b6d908..e2337938e7 100644--- a/frontend/src/pages/pam/PamAccountsPage/components/AccountActionsMenu.tsx+++ b/frontend/src/pages/pam/PamAccountsPage/components/AccountActionsMenu.tsx@@ -1,4 +1,4 @@-import { KeyRound, MoreHorizontal, Rocket, Trash2 } from "lucide-react";+import { Clock, KeyRound, MoreHorizontal, Rocket, Trash2 } from "lucide-react";import {DropdownMenu,@@ -92,7 +92,7 @@ export const AccountActionsMenu = ({<TooltipTrigger asChild><div><DropdownMenuItem isDisabled={isPending} onClick={onRequestAccess}>- <KeyRound className="size-4" />+ {isPending ? <Clock className="size-4" /> : <KeyRound className="size-4" />}{isPending ? "Request Pending" : "Request Access"}</DropdownMenuItem></div>diff --git a/frontend/src/pages/pam/PamAccountsPage/components/AccountRowActions.tsx b/frontend/src/pages/pam/PamAccountsPage/components/AccountRowActions.tsxdeleted file mode 100644index 69a1f576e1..0000000000--- a/frontend/src/pages/pam/PamAccountsPage/components/AccountRowActions.tsx+++ /dev/null@@ -1,103 +0,0 @@-import { KeyRound, Rocket } from "lucide-react";--import { IconButton } from "@app/components/v3";-import {- PamAccessStatus,- PamAccountType,- PamResourcePermissionActions,- usePamAccountActions-} from "@app/hooks/api/pam";-import { PamSheetTab } from "@app/hooks/usePamSheetState";--import { AccountActionsMenu } from "./AccountActionsMenu";--type Props = {- accountId: string;- accountType: PamAccountType;- isAccessible: boolean;- requiresApproval: boolean;- accessStatus: PamAccessStatus;- onLaunch: () => void;- onRequestAccess: () => void;- onOpenTab: (tab: PamSheetTab) => void;- onDelete: () => void;-};--export const AccountRowActions = ({- accountId,- accountType,- isAccessible,- requiresApproval,- accessStatus,- onLaunch,- onRequestAccess,- onOpenTab,- onDelete-}: Props) => {- const { can } = usePamAccountActions(accountId, true);- const canLaunch = can(PamResourcePermissionActions.LaunchSessions);-- const isGranted = accessStatus === PamAccessStatus.Granted;- const isPending = accessStatus === PamAccessStatus.Pending;- // Only offer request access for accounts that can actually launch once granted; an account that- // isn't ready (missing credentials/gateway/recording/approval config) should surface the disabled- // launch state instead, matching the accessible-account flow.- const needsApproval = requiresApproval && !isGranted && canLaunch && isAccessible;-- // Launch requires: account is provisioned AND user has permission AND (no approval needed OR already granted)- const canLaunchNow = isAccessible && canLaunch && (!requiresApproval || isGranted);-- if (needsApproval) {- return (- <div className="flex items-center gap-0.5">- <IconButton- variant="ghost"- size="xs"- aria-label={isPending ? "Request pending" : "Request access"}- className="text-muted hover:text-foreground"- isDisabled={isPending}- onClick={onRequestAccess}- >- <KeyRound className="size-4" />- </IconButton>- <AccountActionsMenu- accountId={accountId}- accountType={accountType}- isAccessible={isAccessible}- requiresApproval={requiresApproval}- accessStatus={accessStatus}- onLaunch={onLaunch}- onRequestAccess={onRequestAccess}- onOpenTab={onOpenTab}- onDelete={onDelete}- />- </div>- );- }-- return (- <div className="flex items-center gap-0.5">- <IconButton- variant="ghost"- size="xs"- aria-label="Launch session"- className="text-muted hover:text-foreground"- isDisabled={!canLaunchNow}- onClick={onLaunch}- >- <Rocket className="size-4" />- </IconButton>- <AccountActionsMenu- accountId={accountId}- accountType={accountType}- isAccessible={isAccessible}- requiresApproval={requiresApproval}- accessStatus={accessStatus}- onLaunch={onLaunch}- onRequestAccess={onRequestAccess}- onOpenTab={onOpenTab}- onDelete={onDelete}- />- </div>- );-};diff --git a/frontend/src/pages/pam/PamAccountsPage/components/FolderAccountRow.tsx b/frontend/src/pages/pam/PamAccountsPage/components/FolderAccountRow.tsxnew file mode 100644index 0000000000..cfa089df4f--- /dev/null+++ b/frontend/src/pages/pam/PamAccountsPage/components/FolderAccountRow.tsx@@ -0,0 +1,97 @@+import {+ PamAccessStatus,+ PamAccountType,+ PamResourcePermissionActions,+ TAccessiblePamAccount,+ TAdminAccountListItem,+ usePamAccountActions+} from "@app/hooks/api/pam";+import { PamSheetTab } from "@app/hooks/usePamSheetState";++import { PamAccountRow } from "../../PamAccessPage/components/PamAccountRow";+import { AccountAccessibilityBadgeWithPermission } from "./AccountAccessibilityBadgeWithPermission";+import { AccountActionsMenu } from "./AccountActionsMenu";++type Props = {+ account: TAdminAccountListItem;+ search: string;+ onOpenAccount: (accountId: string, tab?: PamSheetTab) => void;+ onLaunchAccount: (account: TAccessiblePamAccount) => void;+ onRequestAccess: (account: TAccessiblePamAccount) => void;+ onDeleteAccount: (accountId: string, accountName: string, accountType: PamAccountType) => void;+};++export const FolderAccountRow = ({+ account,+ search,+ onOpenAccount,+ onLaunchAccount,+ onRequestAccess,+ onDeleteAccount+}: Props) => {+ const { can } = usePamAccountActions(account.id, true);+ const canLaunch = can(PamResourcePermissionActions.LaunchSessions);++ const accountType = account.accountType as PamAccountType;+ const { requiresApproval, accessStatus } = account;+ const isGranted = accessStatus === PamAccessStatus.Granted;++ const needsApproval = requiresApproval && !isGranted && canLaunch && account.isAccessible;+ const canLaunchNow = account.isAccessible && canLaunch && (!requiresApproval || isGranted);+ const launchDisabledReason = canLaunch+ ? "This account is not ready to launch"+ : "You don't have permission to launch sessions";++ const launchableAccount: TAccessiblePamAccount = {+ id: account.id,+ name: account.name,+ description: account.description,+ folderId: account.folderId,+ folderName: account.folderName ?? "",+ templateId: account.templateId,+ templateName: account.templateName,+ accountType,+ canLaunch: canLaunchNow,+ requiresApproval,+ requireReason: account.requireReason,+ accessStatus,+ grantExpiresAt: account.grantExpiresAt,+ createdAt: account.createdAt,+ updatedAt: account.updatedAt+ };++ return (+ <PamAccountRow+ name={account.name}+ accountType={accountType}+ search={search}+ accessStatus={accessStatus}+ grantExpiresAt={account.grantExpiresAt}+ needsApproval={needsApproval}+ canLaunchNow={canLaunchNow}+ launchDisabledReason={launchDisabledReason}+ onLaunch={() => onLaunchAccount(launchableAccount)}+ onRequestAccess={() => onRequestAccess(launchableAccount)}+ indented+ accessibilityBadge={+ <AccountAccessibilityBadgeWithPermission+ accountId={account.id}+ issues={account.accessibilityIssues}+ />+ }+ actions={+ <AccountActionsMenu+ accountId={account.id}+ accountType={accountType}+ isAccessible={account.isAccessible}+ requiresApproval={requiresApproval}+ accessStatus={accessStatus}+ onLaunch={() => onLaunchAccount(launchableAccount)}+ onRequestAccess={() => onRequestAccess(launchableAccount)}+ onOpenTab={(tab) => onOpenAccount(account.id, tab)}+ onDelete={() => onDeleteAccount(account.id, account.name, accountType)}+ />+ }+ />+ );+};diff --git a/frontend/src/pages/pam/PamAccountsPage/components/FolderAccountRows.tsx b/frontend/src/pages/pam/PamAccountsPage/components/FolderAccountRows.tsxindex 640ed17a00..1e63ed9ae5 100644--- a/frontend/src/pages/pam/PamAccountsPage/components/FolderAccountRows.tsx+++ b/frontend/src/pages/pam/PamAccountsPage/components/FolderAccountRows.tsx@@ -1,22 +1,17 @@import { useEffect, useMemo } from "react";import { ChevronRight, Folder, FolderOpen } from "lucide-react";-import { HighlightText } from "@app/components/v2/HighlightText";-import { Badge, TableCell, TableRow } from "@app/components/v3";+import { TableCell, TableRow } from "@app/components/v3";import { Skeleton } from "@app/components/v3/generic/Skeleton";import {- PamAccessStatus,PamAccountType,TAccessiblePamAccount,TPamFolderWithCount,- useListPamAccountsAdmin,- usePamAccountTypeMap+ useListPamAccountsAdmin} from "@app/hooks/api/pam";import { PamSheetTab } from "@app/hooks/usePamSheetState";-import { AccountPlatformIcon } from "../../PamAccessPage/components/AccountPlatformIcon";-import { AccountAccessibilityBadgeWithPermission } from "./AccountAccessibilityBadgeWithPermission";-import { AccountRowActions } from "./AccountRowActions";+import { FolderAccountRow } from "./FolderAccountRow";import { FolderActionsMenu } from "./FolderActionsMenu";type Props = {@@ -24,7 +19,7 @@ type Props = {isOpen: boolean;onToggle: () => void;search: string;- templateId: string;+ accountType: string;filterActive: boolean;onOpenAccount: (accountId: string, tab?: PamSheetTab) => void;onLaunchAccount: (account: TAccessiblePamAccount) => void;@@ -41,7 +36,7 @@ export const FolderAccountRows = ({isOpen,onToggle,search,- templateId,+ accountType,filterActive,onOpenAccount,onLaunchAccount,@@ -52,7 +47,6 @@ export const FolderAccountRows = ({onFolderDelete,onResultCount}: Props) => {- const { map } = usePamAccountTypeMap();// Only fetch this folder's accounts once it's open (lazy load per folder)const { data, isLoading } = useListPamAccountsAdmin({ folderId: folder.id }, { enabled: isOpen });const accounts = data ?? [];@@ -60,15 +54,15 @@ export const FolderAccountRows = ({const q = search.trim().toLowerCase();const hasQuery = q.length > 0;- // Client-side filtering keeps search/template instant once a folder's accounts are loaded+ // Client-side filtering keeps search/type instant once a folder's accounts are loadedconst accountsToShow = useMemo(() => {let list = accounts;- if (templateId) list = list.filter((a) => a.templateId === templateId);+ if (accountType) list = list.filter((a) => a.accountType === accountType);if (hasQuery) {list = list.filter((a) => `${a.name} ${a.description ?? ""}`.toLowerCase().includes(q));}return list;- }, [accounts, templateId, q, hasQuery]);+ }, [accounts, accountType, q, hasQuery]);useEffect(() => {if (isOpen && !isLoading) onResultCount(folder.id, accountsToShow.length);@@ -128,63 +122,17 @@ export const FolderAccountRows = ({{isOpen &&!isLoading &&- accountsToShow.map((account) => {- const accountType = account.accountType as PamAccountType;- const { requiresApproval, accessStatus } = account;- const isGranted = accessStatus === PamAccessStatus.Granted;- const needsApproval = requiresApproval && !isGranted;-- const launchableAccount: TAccessiblePamAccount = {- id: account.id,- name: account.name,- description: account.description,- folderId: account.folderId,- folderName: account.folderName ?? "",- templateId: account.templateId,- templateName: account.templateName,- accountType,- canLaunch: account.isAccessible && !needsApproval,- requiresApproval,- requireReason: account.requireReason,- accessStatus,- grantExpiresAt: account.grantExpiresAt,- createdAt: account.createdAt,- updatedAt: account.updatedAt- };-- return (- <TableRow key={account.id}>- <TableCell>- <div className="flex items-center gap-2.5 pl-[26px]">- <AccountPlatformIcon accountType={accountType} size={20} />- <span className="font-medium text-foreground">- <HighlightText text={account.name} highlight={search} />- </span>- <Badge variant="neutral">{map[accountType]?.name ?? account.accountType}</Badge>- <AccountAccessibilityBadgeWithPermission- accountId={account.id}- issues={account.accessibilityIssues}- />- </div>- </TableCell>- <TableCell className="w-20">- <div className="flex items-center justify-end">- <AccountRowActions- accountId={account.id}- accountType={accountType}- isAccessible={account.isAccessible}- requiresApproval={requiresApproval}- accessStatus={accessStatus}- onLaunch={() => onLaunchAccount(launchableAccount)}- onRequestAccess={() => onRequestAccess(launchableAccount)}- onOpenTab={(tab) => onOpenAccount(account.id, tab)}- onDelete={() => onDeleteAccount(account.id, account.name, accountType)}- />- </div>- </TableCell>- </TableRow>- );- })}+ accountsToShow.map((account) => (+ <FolderAccountRow+ key={account.id}+ account={account}+ search={search}+ onOpenAccount={onOpenAccount}+ onLaunchAccount={onLaunchAccount}+ onRequestAccess={onRequestAccess}+ onDeleteAccount={onDeleteAccount}+ />+ ))}</>);};