Skip to content

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

first batch of review fixes

x032205099e3242da34
diff --git a/backend/src/ee/services/pam-account/pam-account-schemas.ts b/backend/src/ee/services/pam-account/pam-account-schemas.ts
index 1f7e37b3b0..65363b0634 100644
--- a/backend/src/ee/services/pam-account/pam-account-schemas.ts
+++ b/backend/src/ee/services/pam-account/pam-account-schemas.ts
@@ -1,4 +1,5 @@
/* eslint-disable no-underscore-dangle */
+import RE2 from "re2";
import { z } from "zod";
import { PamAccountType } from "../pam/pam-enums";
@@ -41,8 +42,15 @@ export const ACCOUNT_TYPE_CONFIGS = {
sanitizedCredentials: z.object({ username: z.string().optional() }),
ui: {
sslEnabled: { label: "SSL Enabled" },
- sslRejectUnauthorized: { label: "Reject Unauthorized" },
- sslCertificate: { label: "SSL Certificate", widget: PamFieldWidget.Textarea },
+ sslRejectUnauthorized: {
+ label: "Reject Unauthorized",
+ showWhen: { field: "sslEnabled", equals: true }
+ },
+ sslCertificate: {
+ label: "SSL Certificate",
+ widget: PamFieldWidget.Textarea,
+ showWhen: { field: "sslEnabled", equals: true }
+ },
password: { widget: PamFieldWidget.Password, secret: true }
}
},
@@ -74,8 +82,15 @@ export const ACCOUNT_TYPE_CONFIGS = {
sanitizedCredentials: z.object({ username: z.string().optional() }),
ui: {
sslEnabled: { label: "SSL Enabled" },
- sslRejectUnauthorized: { label: "Reject Unauthorized" },
- sslCertificate: { label: "SSL Certificate", widget: PamFieldWidget.Textarea },
+ sslRejectUnauthorized: {
+ label: "Reject Unauthorized",
+ showWhen: { field: "sslEnabled", equals: true }
+ },
+ sslCertificate: {
+ label: "SSL Certificate",
+ widget: PamFieldWidget.Textarea,
+ showWhen: { field: "sslEnabled", equals: true }
+ },
password: { widget: PamFieldWidget.Password, secret: true }
}
},
@@ -133,7 +148,15 @@ export const ACCOUNT_TYPE_CONFIGS = {
connectionDetails: z.ZodTypeAny;
credentials: z.ZodTypeAny;
sanitizedCredentials: z.ZodTypeAny;
- ui?: Record<string, { label?: string; widget?: PamFieldWidget; secret?: boolean }>;
+ ui?: Record<
+ string,
+ {
+ label?: string;
+ widget?: PamFieldWidget;
+ secret?: boolean;
+ showWhen?: { field: string; equals: string | boolean };
+ }
+ >;
internalMetadata?: z.ZodTypeAny;
}
>
@@ -208,8 +231,8 @@ export const PamFieldDescriptorSchema = z.object({
secret: z.boolean(),
options: z.array(z.object({ label: z.string(), value: z.string() })).optional(),
- // Only render when the discriminator field equals this value
- showWhen: z.object({ field: z.string(), equals: z.string() }).optional()
+ // Only render when the referenced field equals this value
+ showWhen: z.object({ field: z.string(), equals: z.union([z.string(), z.boolean()]) }).optional()
});
type PamFieldDescriptor = z.infer<typeof PamFieldDescriptorSchema>;
@@ -224,13 +247,17 @@ export const PamAccountTypeMetadataSchema = z.object({
type PamAccountTypeMetadata = z.infer<typeof PamAccountTypeMetadataSchema>;
-type TFieldUiHint = { label?: string; widget?: PamFieldWidget; secret?: boolean };
+type TFieldUiHint = {
+ label?: string;
+ widget?: PamFieldWidget;
+ secret?: boolean;
+ showWhen?: PamFieldDescriptor["showWhen"];
+};
-const humanizeKey = (key: string) =>
- key
- .replace(/([A-Z])/g, " $1")
- .replace(/^./, (c) => c.toUpperCase())
- .trim();
+const humanizeKey = (key: string) => {
+ const spaced = key.replace(new RE2(/([A-Z])/g), " $1").trim();
+ return spaced.charAt(0).toUpperCase() + spaced.slice(1);
+};
const unwrapField = (schema: z.ZodTypeAny): { base: z.ZodTypeAny; required: boolean } => {
let current = schema;
@@ -269,6 +296,7 @@ const describeField = (
const hint = ui[key] ?? {};
const widget = hint.widget ?? widgetForBase(base);
const enumValues = (base._def as { values?: string[] }).values;
+ const resolvedShowWhen = hint.showWhen ?? showWhen;
return {
key,
@@ -279,7 +307,7 @@ const describeField = (
...(widget === PamFieldWidget.Select && enumValues
? { options: enumValues.map((v) => ({ label: humanizeKey(v), value: v })) }
: {}),
- ...(showWhen ? { showWhen } : {})
+ ...(resolvedShowWhen ? { showWhen: resolvedShowWhen } : {})
};
};
diff --git a/frontend/src/hooks/api/pam/queries.tsx b/frontend/src/hooks/api/pam/queries.tsx
index 68e0b03dbf..2c5480d210 100644
--- a/frontend/src/hooks/api/pam/queries.tsx
+++ b/frontend/src/hooks/api/pam/queries.tsx
@@ -56,6 +56,8 @@ export const pamKeys = {
[...pamKeys.account(), "admin-list", params] as const,
accountMembers: (accountId: string) => [...pamKeys.all, "account-members", accountId] as const,
folderMembers: (folderId: string) => [...pamKeys.all, "folder-members", folderId] as const,
+ productMembers: () => [...pamKeys.all, "product-members"] as const,
+ productGroups: () => [...pamKeys.all, "product-groups"] as const,
resourceRoles: () => [...pamKeys.all, "resource-roles"] as const,
accessCapabilities: () => [...pamKeys.all, "access-capabilities"] as const,
accountTypes: () => [...pamKeys.all, "account-types"] as const
@@ -328,6 +330,30 @@ export const useListFolderMembers = (folderId: string) => {
});
};
+export const useListPamProductMembers = () => {
+ return useQuery({
+ queryKey: pamKeys.productMembers(),
+ queryFn: async () => {
+ const { data } = await apiRequest.get<{ members: TPamMember[] }>(
+ "/api/v1/pam/memberships/users"
+ );
+ return data.members;
+ }
+ });
+};
+
+export const useListPamProductGroups = () => {
+ return useQuery({
+ queryKey: pamKeys.productGroups(),
+ queryFn: async () => {
+ const { data } = await apiRequest.get<{ members: TPamMember[] }>(
+ "/api/v1/pam/memberships/groups"
+ );
+ return data.members;
+ }
+ });
+};
+
export const useListPamResourceRoles = () => {
return useQuery({
queryKey: pamKeys.resourceRoles(),
diff --git a/frontend/src/hooks/api/pam/types/index.ts b/frontend/src/hooks/api/pam/types/index.ts
index 26911a3dd7..82c254a3d9 100644
--- a/frontend/src/hooks/api/pam/types/index.ts
+++ b/frontend/src/hooks/api/pam/types/index.ts
@@ -30,7 +30,7 @@ export type TPamFieldDescriptor = {
required: boolean;
secret: boolean;
options?: { label: string; value: string }[];
- showWhen?: { field: string; equals: string };
+ showWhen?: { field: string; equals: string | boolean };
};
export type TPamAccountTypeMetadata = {
diff --git a/frontend/src/pages/pam/PamAccessPage/components/FolderAccountGroup.tsx b/frontend/src/pages/pam/PamAccessPage/components/FolderAccountGroup.tsx
index c840f47629..d1be935e16 100644
--- a/frontend/src/pages/pam/PamAccessPage/components/FolderAccountGroup.tsx
+++ b/frontend/src/pages/pam/PamAccessPage/components/FolderAccountGroup.tsx
@@ -23,8 +23,6 @@ type Props = {
onResultCount: (folderId: string, count: number) => void;
};
-const SKELETON_KEYS = ["a", "b", "c"];
-
export const FolderAccountGroup = ({
folder,
isOpen,
@@ -104,12 +102,12 @@ export const FolderAccountGroup = ({
<TableCell className="w-20" />
</TableRow>
- {isOpen && isLoading && (
+ {isOpen && isLoading && folder.accountCount > 0 && (
<TableRow>
<TableCell colSpan={2}>
<div className="flex flex-col gap-2 pl-[26px]">
- {SKELETON_KEYS.map((key) => (
- <Skeleton key={key} className="h-8 w-full rounded-md" />
+ {Array.from({ length: folder.accountCount }).map((_, i) => (
+ <Skeleton key={`skeleton-${i + 1}`} className="h-8 w-full rounded-md" />
))}
</div>
</TableCell>
diff --git a/frontend/src/pages/pam/PamAccessPage/components/LaunchSessionSheet.tsx b/frontend/src/pages/pam/PamAccessPage/components/LaunchSessionSheet.tsx
index dfd47d6d59..ed917ec9b1 100644
--- a/frontend/src/pages/pam/PamAccessPage/components/LaunchSessionSheet.tsx
+++ b/frontend/src/pages/pam/PamAccessPage/components/LaunchSessionSheet.tsx
@@ -1,4 +1,4 @@
-import { useState } from "react";
+import { ReactNode, useState } from "react";
import { Link } from "@tanstack/react-router";
import { FolderOpen, Globe, Rocket, Terminal } from "lucide-react";
@@ -16,7 +16,12 @@ import {
RadioGroupItem
} from "@app/components/v3";
import { useOrganization } from "@app/context";
-import { TAccessiblePamAccount, usePamAccountTypeMap } from "@app/hooks/api/pam";
+import {
+ TAccessiblePamAccount,
+ TPamFieldDescriptor,
+ useGetPamAccountById,
+ usePamAccountTypeMap
+} from "@app/hooks/api/pam";
import { PamSheetTab } from "@app/hooks/usePamSheetState";
import { PamDetailSheet } from "../../components/PamDetailSheet";
@@ -27,6 +32,13 @@ type Props = {
onOpenChange: (open: boolean) => void;
};
+const formatFieldValue = (value: unknown): ReactNode => {
+ if (typeof value === "boolean") return value ? "Enabled" : "Disabled";
+ const str = String(value);
+ if (str.length > 48) return "Provided";
+ return <span className="font-mono">{str}</span>;
+};
+
const LaunchTab = ({ account }: { account: TAccessiblePamAccount }) => {
const { currentOrg } = useOrganization();
const [method, setMethod] = useState("browser");
@@ -95,6 +107,7 @@ const LaunchTab = ({ account }: { account: TAccessiblePamAccount }) => {
export const LaunchSessionSheet = ({ account, isOpen, onOpenChange }: Props) => {
const { map } = usePamAccountTypeMap();
+ const { data: fullAccount } = useGetPamAccountById(isOpen ? account?.id : undefined);
if (!account) return null;
@@ -107,9 +120,21 @@ export const LaunchSessionSheet = ({ account, isOpen, onOpenChange }: Props) =>
</span>
) : undefined;
- const metadata = account.description
- ? [{ label: "Description", value: account.description }]
- : [];
+ const typeMeta = map[account.accountType];
+ const conn = (fullAccount?.connectionDetails ?? {}) as Record<string, unknown>;
+ const credentials = (fullAccount?.credentials ?? {}) as Record<string, unknown>;
+
+ const fieldRows = (fields: TPamFieldDescriptor[] | undefined, source: Record<string, unknown>) =>
+ (fields ?? [])
+ .filter((f) => !f.secret)
+ .filter((f) => source[f.key] !== undefined && source[f.key] !== null && source[f.key] !== "")
+ .map((f) => ({ label: f.label, value: formatFieldValue(source[f.key]) }));
+
+ const metadata = [
+ ...(account.description ? [{ label: "Description", value: account.description }] : []),
+ ...fieldRows(typeMeta?.connectionFields, conn),
+ ...fieldRows(typeMeta?.credentialFields, credentials)
+ ];
return (
<PamDetailSheet
diff --git a/frontend/src/pages/pam/PamAccountAccessPage/DisconnectedScreen.tsx b/frontend/src/pages/pam/PamAccountAccessPage/DisconnectedScreen.tsx
index 0f78f09761..eead16f0a6 100644
--- a/frontend/src/pages/pam/PamAccountAccessPage/DisconnectedScreen.tsx
+++ b/frontend/src/pages/pam/PamAccountAccessPage/DisconnectedScreen.tsx
@@ -1,13 +1,8 @@
import { PlugZap } from "lucide-react";
-import {
- Button,
- Card,
- CardContent,
- CardDescription,
- CardHeader,
- CardTitle
-} from "@app/components/v3";
+import { Button } from "@app/components/v3";
+
+import { WebAccessStatusCard } from "./WebAccessStatusCard";
type Props = {
onReconnect: () => void;
@@ -19,23 +14,10 @@ export const DisconnectedScreen = ({
onReconnect,
title = "Session disconnected",
description = "This session has ended. Reconnect to start a new one."
-}: Props) => {
- return (
- <div className="absolute inset-0 z-10 flex items-center justify-center bg-background p-4">
- <Card className="w-full max-w-md">
- <CardHeader className="flex items-center gap-3">
- <PlugZap className="size-6 shrink-0 text-product-pam" />
- <div className="flex flex-col gap-1">
- <CardTitle className="text-base">{title}</CardTitle>
- <CardDescription>{description}</CardDescription>
- </div>
- </CardHeader>
- <CardContent>
- <Button variant="pam" isFullWidth onClick={onReconnect}>
- Reconnect
- </Button>
- </CardContent>
- </Card>
- </div>
- );
-};
+}: Props) => (
+ <WebAccessStatusCard overlay icon={PlugZap} title={title} description={description}>
+ <Button variant="pam" isFullWidth onClick={onReconnect}>
+ Reconnect
+ </Button>
+ </WebAccessStatusCard>
+);
diff --git a/frontend/src/pages/pam/PamAccountAccessPage/PamAccountAccessPage.tsx b/frontend/src/pages/pam/PamAccountAccessPage/PamAccountAccessPage.tsx
index c8cb69fedc..954e38c791 100644
--- a/frontend/src/pages/pam/PamAccountAccessPage/PamAccountAccessPage.tsx
+++ b/frontend/src/pages/pam/PamAccountAccessPage/PamAccountAccessPage.tsx
@@ -1,6 +1,7 @@
import { useState } from "react";
import { Helmet } from "react-helmet";
import { useParams } from "@tanstack/react-router";
+import { TriangleAlert } from "lucide-react";
import { PamAccountType, TPamAccount, useGetPamAccountById } from "@app/hooks/api/pam";
import { PamDataExplorerPage } from "@app/pages/pam/PamDataExplorerPage/PamDataExplorerPage";
@@ -8,6 +9,7 @@ import { PamDataExplorerPage } from "@app/pages/pam/PamDataExplorerPage/PamDataE
import { DisconnectedScreen } from "./DisconnectedScreen";
import { SessionAccessGate } from "./ReasonGate";
import { useWebAccessSession } from "./useWebAccessSession";
+import { WebAccessStatusCard } from "./WebAccessStatusCard";
const TerminalContent = ({
account,
@@ -100,9 +102,12 @@ const PageContent = () => {
if (!account) {
return (
- <div className="flex h-screen w-screen items-center justify-center bg-background">
- <p className="text-muted">Could not find account with ID {accountId}</p>
- </div>
+ <WebAccessStatusCard
+ tone="danger"
+ icon={TriangleAlert}
+ title="Account not found"
+ description={`Could not find an account with ID ${accountId}.`}
+ />
);
}
diff --git a/frontend/src/pages/pam/PamAccountAccessPage/RdpContent.tsx b/frontend/src/pages/pam/PamAccountAccessPage/RdpContent.tsx
index 9c5a02b624..f2762bd182 100644
--- a/frontend/src/pages/pam/PamAccountAccessPage/RdpContent.tsx
+++ b/frontend/src/pages/pam/PamAccountAccessPage/RdpContent.tsx
@@ -1,12 +1,13 @@
import { useState } from "react";
-import { faPlugCircleXmark } from "@fortawesome/free-solid-svg-icons";
-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
+import { TriangleAlert } from "lucide-react";
import { ContentLoader } from "@app/components/v2";
+import { Button } from "@app/components/v3";
import { TPamAccount } from "@app/hooks/api/pam";
import { DisconnectedScreen } from "./DisconnectedScreen";
import { useRdpSession } from "./useRdpSession";
+import { WebAccessStatusCard } from "./WebAccessStatusCard";
type RdpContentProps = {
account: TPamAccount;
@@ -65,20 +66,17 @@ export const RdpContent = ({
/>
)}
{error && (
- <div className="absolute inset-0 z-10 flex flex-col items-center justify-center gap-4">
- <FontAwesomeIcon icon={faPlugCircleXmark} size="3x" className="text-danger/80" />
- <div className="flex flex-col items-center gap-1">
- <p className="text-sm font-medium text-foreground">Connection failed</p>
- <p className="max-w-md text-center text-xs text-muted">{error}</p>
- </div>
- <button
- type="button"
- onClick={handleReconnect}
- className="mt-2 rounded border border-border px-4 py-1.5 text-xs text-muted transition-colors hover:border-success hover:text-success"
- >
+ <WebAccessStatusCard
+ overlay
+ tone="danger"
+ icon={TriangleAlert}
+ title="Connection failed"
+ description={error}
+ >
+ <Button variant="pam" isFullWidth onClick={handleReconnect}>
Reconnect
- </button>
- </div>
+ </Button>
+ </WebAccessStatusCard>
)}
{sessionEnded && !error && <DisconnectedScreen onReconnect={handleReconnect} />}
</div>
diff --git a/frontend/src/pages/pam/PamAccountAccessPage/WebAccessStatusCard.tsx b/frontend/src/pages/pam/PamAccountAccessPage/WebAccessStatusCard.tsx
new file mode 100644
index 0000000000..dbd5880771
--- /dev/null
+++ b/frontend/src/pages/pam/PamAccountAccessPage/WebAccessStatusCard.tsx
@@ -0,0 +1,41 @@
+import { ReactNode } from "react";
+import { LucideIcon } from "lucide-react";
+
+import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@app/components/v3";
+
+type Props = {
+ icon: LucideIcon;
+ title: string;
+ description?: ReactNode;
+ tone?: "pam" | "danger";
+ overlay?: boolean;
+ children?: ReactNode;
+};
+
+export const WebAccessStatusCard = ({
+ icon: Icon,
+ title,
+ description,
+ tone = "pam",
+ overlay = false,
+ children
+}: Props) => (
+ <div
+ className={`flex items-center justify-center bg-background p-4 ${
+ overlay ? "absolute inset-0 z-10" : "h-dvh w-screen"
+ }`}
+ >
+ <Card className="w-full max-w-md">
+ <CardHeader className="flex items-center gap-3">
+ <Icon
+ className={`size-6 shrink-0 ${tone === "danger" ? "text-danger" : "text-product-pam"}`}
+ />
+ <div className="flex min-w-0 flex-col gap-1">
+ <CardTitle className="text-base">{title}</CardTitle>
+ {description && <CardDescription>{description}</CardDescription>}
+ </div>
+ </CardHeader>
+ {children && <CardContent className="flex flex-col gap-3">{children}</CardContent>}
+ </Card>
+ </div>
+);
diff --git a/frontend/src/pages/pam/PamAccountsPage/PamAccountsPage.tsx b/frontend/src/pages/pam/PamAccountsPage/PamAccountsPage.tsx
index 6d473f014f..5b6f5c6c37 100644
--- a/frontend/src/pages/pam/PamAccountsPage/PamAccountsPage.tsx
+++ b/frontend/src/pages/pam/PamAccountsPage/PamAccountsPage.tsx
@@ -1,4 +1,6 @@
import { useCallback, useEffect, useState } from "react";
+import { Helmet } from "react-helmet";
+import { useTranslation } from "react-i18next";
import { ChevronDown, FolderOpen, FolderPlus, Layers, Plus, Search } from "lucide-react";
import { createNotification } from "@app/components/notifications";
@@ -55,6 +57,7 @@ import { FolderDetailSheet } from "./components/FolderDetailSheet";
const SKELETON_KEYS = ["s1", "s2", "s3", "s4", "s5"];
export const PamAccountsPage = () => {
+ const { t } = useTranslation();
const [searchInput, setSearchInput] = useState("");
const [selectedFolderId, setSelectedFolderId] = useState<string>("");
const [selectedTemplateId, setSelectedTemplateId] = useState<string>("");
@@ -144,9 +147,12 @@ export const PamAccountsPage = () => {
return (
<div className="mx-auto mb-6 w-full max-w-8xl">
+ <Helmet>
+ <title>{t("common.head-title", { title: "Accounts" })}</title>
+ </Helmet>
<PageHeader
title="Accounts"
- description="Privileged accounts grouped by folder."
+ description="Privileged accounts grouped into folders."
scope={ProjectType.PAM}
icon={FolderOpen}
/>
diff --git a/frontend/src/pages/pam/PamAccountsPage/components/AccountDetailSheet.tsx b/frontend/src/pages/pam/PamAccountsPage/components/AccountDetailSheet.tsx
index d57ecd4e35..72da88b071 100644
--- a/frontend/src/pages/pam/PamAccountsPage/components/AccountDetailSheet.tsx
+++ b/frontend/src/pages/pam/PamAccountsPage/components/AccountDetailSheet.tsx
@@ -1,8 +1,8 @@
import { type ReactNode, useEffect, useMemo, useState } from "react";
import { useForm } from "react-hook-form";
-import { useNavigate } from "@tanstack/react-router";
+import { useQuery } from "@tanstack/react-query";
+import { Link, useNavigate } from "@tanstack/react-router";
import {
- FolderInput,
FolderOpen,
Layers2,
MoreHorizontal,
@@ -41,6 +41,8 @@ import {
} from "@app/components/v3";
import { Skeleton } from "@app/components/v3/generic/Skeleton";
import { useOrganization, useUser } from "@app/context";
+import { gatewayPoolsQueryKeys } from "@app/hooks/api/gateway-pools/queries";
+import { gatewaysQueryKeys } from "@app/hooks/api/gateways/queries";
import { useGetOrganizationGroups } from "@app/hooks/api/organization/queries";
import {
PamAccountType,
@@ -48,6 +50,7 @@ import {
TPamMember,
useDeletePamAccount,
useGetPamAccountById,
+ useGetPamAccountTemplate,
useListAccountMembers,
useListFolderMembers,
useListPamResourceRoles,
@@ -253,7 +256,10 @@ const PermissionsTab = ({
/>
<Card>
<CardHeader className="border-b">
- <CardTitle className="text-base">Direct Permissions</CardTitle>
+ <CardTitle className="text-base">
+ Direct Permissions
+ <Badge variant="pam">{directMembers.length}</Badge>
+ </CardTitle>
<CardDescription>
Users and groups granted access directly on this account.
</CardDescription>
@@ -352,7 +358,10 @@ const PermissionsTab = ({
{inheritedMembers.length > 0 && (
<Card>
<CardHeader className="border-b">
- <CardTitle className="text-base">Inherited Permissions</CardTitle>
+ <CardTitle className="text-base">
+ Inherited Permissions
+ <Badge variant="pam">{inheritedMembers.length}</Badge>
+ </CardTitle>
<CardDescription>
Access inherited from the{" "}
<button
@@ -360,9 +369,9 @@ const PermissionsTab = ({
className="font-medium text-foreground hover:underline"
onClick={goToFolderPermissions}
>
- {folderName ?? "parent"} folder
- </button>
- . Manage these on the folder.
+ {folderName ?? "parent"}
+ </button>{" "}
+ folder. Manage these on the folder.
</CardDescription>
</CardHeader>
<CardContent>
@@ -372,7 +381,6 @@ const PermissionsTab = ({
<TableHead>Assignee</TableHead>
<TableHead>Role</TableHead>
<TableHead>Expiry</TableHead>
- <TableHead>Source</TableHead>
</TableRow>
</TableHeader>
<TableBody>
@@ -390,16 +398,6 @@ const PermissionsTab = ({
<TableCell>
<MemberExpiry expiresAt={rm.member.expiresAt} />
</TableCell>
- <TableCell>
- <button
- type="button"
- className="flex items-center gap-1.5 text-sm text-muted hover:text-foreground hover:underline"
- onClick={goToFolderPermissions}
- >
- <FolderInput className="size-3.5" />
- from {folderName ?? "Folder"} folder
- </button>
- </TableCell>
</TableRow>
))}
</TableBody>
@@ -421,6 +419,9 @@ const SettingsTab = ({
onDirtyChange?: (isDirty: boolean) => void;
}) => {
const { data: account, isLoading } = useGetPamAccountById(accountId);
+ const { data: template } = useGetPamAccountTemplate(account?.templateId);
+ const { data: gateways } = useQuery(gatewaysQueryKeys.list());
+ const { data: gatewayPools } = useQuery(gatewayPoolsQueryKeys.list());
const updateAccount = useUpdatePamAccount();
const [showGatewayPicker, setShowGatewayPicker] = useState(false);
@@ -461,6 +462,13 @@ const SettingsTab = ({
const gatewayPoolId = watch("gatewayPoolId");
const isOverriding = Boolean(gatewayId || gatewayPoolId) || showGatewayPicker;
+ const resolveGatewayLabel = (gwId?: string | null, poolId?: string | null) => {
+ if (poolId) return gatewayPools?.find((p) => p.id === poolId)?.name ?? "Gateway pool";
+ if (gwId) return gateways?.find((g) => g.id === gwId)?.name ?? "Gateway";
+ return "No gateway";
+ };
+ const inheritedGatewayLabel = resolveGatewayLabel(template?.gatewayId, template?.gatewayPoolId);
+
const setGateway = (value: OverridesForm) => {
setValue("gatewayId", value.gatewayId, { shouldDirty: true });
setValue("gatewayPoolId", value.gatewayPoolId, { shouldDirty: true });
@@ -515,8 +523,8 @@ const SettingsTab = ({
</p>
<p className="text-sm text-muted">
{isOverriding
- ? "Overriding the template default for this account."
- : `Inherited from ${account.templateName}`}
+ ? `Overriding the template default (${inheritedGatewayLabel}) for this account.`
+ : `Inherited from ${account.templateName}: ${inheritedGatewayLabel}`}
</p>
</div>
</div>
@@ -585,6 +593,7 @@ const buildConnectionMetadata = (connectionDetails: Record<string, unknown>) =>
export const AccountDetailSheet = ({ isOpen, accountId, onOpenChange }: Props) => {
const { data: account, isLoading } = useGetPamAccountById(isOpen ? accountId : undefined);
const { tab, setTab } = usePamSheetState("accountId");
+ const { currentOrg } = useOrganization();
const deleteAccount = useDeletePamAccount();
const [isDeleteOpen, setIsDeleteOpen] = useState(false);
@@ -648,9 +657,29 @@ export const AccountDetailSheet = ({ isOpen, accountId, onOpenChange }: Props) =
...(account.description ? [{ label: "Description", value: account.description }] : []),
{
label: "Template",
- value: <Badge variant="neutral">{account.templateName ?? "None"}</Badge>
+ value: account.templateId ? (
+ <Link
+ to="/organizations/$orgId/pam/templates"
+ params={{ orgId: currentOrg.id }}
+ search={{ templateId: account.templateId }}
+ >
+ <Badge variant="neutral" className="cursor-pointer hover:bg-container-hover">
+ {account.templateName ?? "Template"}
+ </Badge>
+ </Link>
+ ) : (
+ <Badge variant="neutral">None</Badge>
+ )
},
...buildConnectionMetadata(conn),
+ ...(account.credentials?.username
+ ? [
+ {
+ label: "Username",
+ value: <span className="font-mono">{String(account.credentials.username)}</span>
+ }
+ ]
+ : []),
{ label: "Created", value: formatDetailDate(account.createdAt) }
]
: [];
diff --git a/frontend/src/pages/pam/PamAccountsPage/components/AssignAccessModal.tsx b/frontend/src/pages/pam/PamAccountsPage/components/AssignAccessModal.tsx
index f36be0a1f0..5a92e36325 100644
--- a/frontend/src/pages/pam/PamAccountsPage/components/AssignAccessModal.tsx
+++ b/frontend/src/pages/pam/PamAccountsPage/components/AssignAccessModal.tsx
@@ -28,6 +28,8 @@ import {
useAddAccountMember,
useAddFolderGroupMember,
useAddFolderMember,
+ useListPamProductGroups,
+ useListPamProductMembers,
useListPamResourceRoles,
useUpdateAccountGroupMemberRole,
useUpdateAccountMemberRole,
@@ -118,6 +120,8 @@ export const AssignAccessModal = ({
const { currentOrg } = useOrganization();
const { data: orgUsers } = useGetOrgUsers(currentOrg.id);
const { data: orgGroups } = useGetOrganizationGroups(currentOrg.id);
+ const { data: productMembers } = useListPamProductMembers();
+ const { data: productGroups } = useListPamProductGroups();
const { data: resourceRoles } = useListPamResourceRoles();
const addAccountUser = useAddAccountMember();
@@ -135,11 +139,14 @@ export const AssignAccessModal = ({
const [roleSlug, setRoleSlug] = useState<string>("");
const [expiry, setExpiry] = useState<string>("none");
- // Roles come ordered most-to-least privileged, so the last one is the safe default
- const defaultRoleSlug = useMemo(
- () => (resourceRoles?.length ? resourceRoles[resourceRoles.length - 1].slug : ""),
- [resourceRoles]
- );
+ // Default to Requester
+ const defaultRoleSlug = useMemo(() => {
+ if (!resourceRoles?.length) return "";
+ return (
+ resourceRoles.find((r) => r.slug === "requester")?.slug ??
+ resourceRoles[resourceRoles.length - 1].slug
+ );
+ }, [resourceRoles]);
const effectiveRoleSlug = roleSlug || editMember?.role || defaultRoleSlug;
const lockedActor = useMemo<AssigneeOption | null>(
@@ -155,13 +162,22 @@ export const AssignAccessModal = ({
[editMember]
);
+ const pamUserIds = useMemo(
+ () => new Set((productMembers ?? []).map((m) => m.userId).filter(Boolean) as string[]),
+ [productMembers]
+ );
+ const pamGroupIds = useMemo(
+ () => new Set((productGroups ?? []).map((m) => m.groupId).filter(Boolean) as string[]),
+ [productGroups]
+ );
+
const assigneeOptions = useMemo<AssigneeOption[]>(() => {
const groups: AssigneeOption[] = (orgGroups ?? [])
- .filter((g) => !existingGroupIds.has(g.id))
+ .filter((g) => pamGroupIds.has(g.id) && !existingGroupIds.has(g.id))
.map((g) => ({ value: g.id, label: g.name, kind: PamMemberKind.Group, subtitle: "Group" }));
const users: AssigneeOption[] = (orgUsers ?? [])
- .filter((ou) => ou.user.id && !existingUserIds.has(ou.user.id))
+ .filter((ou) => ou.user.id && pamUserIds.has(ou.user.id) && !existingUserIds.has(ou.user.id))
.map((ou) => {
const name = [ou.user.firstName, ou.user.lastName].filter(Boolean).join(" ");
return {
@@ -173,7 +189,7 @@ export const AssignAccessModal = ({
});
return [...groups, ...users];
- }, [orgGroups, orgUsers, existingGroupIds, existingUserIds]);
+ }, [orgGroups, orgUsers, pamGroupIds, pamUserIds, existingGroupIds, existingUserIds]);
const selectedRole = (resourceRoles ?? []).find((r) => r.slug === effectiveRoleSlug) ?? null;
diff --git a/frontend/src/pages/pam/PamAccountsPage/components/CreateAccountSheet.tsx b/frontend/src/pages/pam/PamAccountsPage/components/CreateAccountSheet.tsx
index 1cf0f3d340..aaba7dfd11 100644
--- a/frontend/src/pages/pam/PamAccountsPage/components/CreateAccountSheet.tsx
+++ b/frontend/src/pages/pam/PamAccountsPage/components/CreateAccountSheet.tsx
@@ -166,6 +166,15 @@ export const CreateAccountSheet = ({ isOpen, onOpenChange, defaultFolderId }: Pr
return;
}
+ const knownFields = new Set<string>([
+ "name",
+ "description",
+ "folderId",
+ "templateId",
+ ...selectedMetadata.connectionFields.map((f) => `connectionDetails.${f.key}`),
+ ...selectedMetadata.credentialFields.map((f) => `credentials.${f.key}`)
+ ]);
+
createAccount.mutate(
{
accountType: values.accountType,
@@ -181,7 +190,16 @@ export const CreateAccountSheet = ({ isOpen, onOpenChange, defaultFolderId }: Pr
createNotification({ text: "Account created", type: "success" });
onOpenChange(false);
},
- onError: (error) => applyServerValidationErrors(error, setError)
+ onError: (error) => {
+ const unmapped = applyServerValidationErrors(error, setError, knownFields);
+ if (unmapped.length) {
+ createNotification({
+ type: "error",
+ title: "Validation Error",
+ text: unmapped.join(", ")
+ });
+ }
+ }
}
);
};
@@ -345,11 +363,17 @@ export const CreateAccountSheet = ({ isOpen, onOpenChange, defaultFolderId }: Pr
<Controller
control={control}
name="description"
- render={({ field }) => (
+ render={({ field, fieldState }) => (
<Field>
<FieldLabel>Description</FieldLabel>
<FieldContent>
- <TextArea {...field} placeholder="Optional description" rows={2} />
+ <TextArea
+ {...field}
+ placeholder="Optional description"
+ rows={2}
+ isError={!!fieldState.error}
+ />
+ <FieldError>{fieldState.error?.message}</FieldError>
</FieldContent>
</Field>
)}
diff --git a/frontend/src/pages/pam/PamAccountsPage/components/CreateFolderModal.tsx b/frontend/src/pages/pam/PamAccountsPage/components/CreateFolderModal.tsx
index 3fc320c03a..a14118e6c9 100644
--- a/frontend/src/pages/pam/PamAccountsPage/components/CreateFolderModal.tsx
+++ b/frontend/src/pages/pam/PamAccountsPage/components/CreateFolderModal.tsx
@@ -90,8 +90,10 @@ export const CreateFolderModal = ({ isOpen, onOpenChange }: Props) => {
id="folder-description"
placeholder="What lives in this folder?"
rows={3}
+ isError={!!errors.description}
{...register("description")}
/>
+ <FieldError>{errors.description?.message}</FieldError>
</FieldContent>
</Field>
diff --git a/frontend/src/pages/pam/PamAccountsPage/components/EditAccountForm.tsx b/frontend/src/pages/pam/PamAccountsPage/components/EditAccountForm.tsx
index 8917f3da58..5b809d1ed7 100644
--- a/frontend/src/pages/pam/PamAccountsPage/components/EditAccountForm.tsx
+++ b/frontend/src/pages/pam/PamAccountsPage/components/EditAccountForm.tsx
@@ -144,6 +144,15 @@ export const EditAccountForm = ({ accountId, onDirtyChange }: Props) => {
// Drop unchanged secrets (sentinel) so they're preserved server-side; send the rest
const filteredCredentials = filterUnchangedCredentials(values.credentials);
+ const knownFields = new Set<string>([
+ "name",
+ "description",
+ "folderId",
+ "templateId",
+ ...metadata.connectionFields.map((f) => `connectionDetails.${f.key}`),
+ ...metadata.credentialFields.map((f) => `credentials.${f.key}`)
+ ]);
+
updateAccount.mutate(
{
accountId,
@@ -157,7 +166,16 @@ export const EditAccountForm = ({ accountId, onDirtyChange }: Props) => {
},
{
onSuccess: () => createNotification({ text: "Account updated", type: "success" }),
- onError: (error) => applyServerValidationErrors(error, setError)
+ onError: (error) => {
+ const unmapped = applyServerValidationErrors(error, setError, knownFields);
+ if (unmapped.length) {
+ createNotification({
+ type: "error",
+ title: "Validation Error",
+ text: unmapped.join(", ")
+ });
+ }
+ }
}
);
};
@@ -177,7 +195,7 @@ export const EditAccountForm = ({ accountId, onDirtyChange }: Props) => {
<Card>
<CardHeader className="border-b">
<CardTitle className="text-base">General</CardTitle>
- <CardDescription>Name, location, and template for this account.</CardDescription>
+ <CardDescription>General settings for this account.</CardDescription>
</CardHeader>
<CardContent className="flex flex-col gap-4">
<Controller
@@ -199,11 +217,12 @@ export const EditAccountForm = ({ accountId, onDirtyChange }: Props) => {
<Controller
control={control}
name="description"
- render={({ field }) => (
+ render={({ field, fieldState }) => (
<Field>
<FieldLabel>Description</FieldLabel>
<FieldContent>
- <TextArea {...field} rows={2} />
+ <TextArea {...field} rows={2} isError={!!fieldState.error} />
+ <FieldError>{fieldState.error?.message}</FieldError>
</FieldContent>
</Field>
)}
diff --git a/frontend/src/pages/pam/PamAccountsPage/components/FolderAccountRows.tsx b/frontend/src/pages/pam/PamAccountsPage/components/FolderAccountRows.tsx
index 407a60268e..d9886d6179 100644
--- a/frontend/src/pages/pam/PamAccountsPage/components/FolderAccountRows.tsx
+++ b/frontend/src/pages/pam/PamAccountsPage/components/FolderAccountRows.tsx
@@ -34,8 +34,6 @@ type Props = {
onResultCount: (folderId: string, count: number) => void;
};
-const SKELETON_KEYS = ["a", "b", "c"];
-
export const FolderAccountRows = ({
folder,
isOpen,
@@ -92,8 +90,10 @@ export const FolderAccountRows = ({
) : (
<Folder className="size-5 shrink-0 text-product-pam" />
)}
- <span className="font-medium text-foreground">{folder.name}</span>
- {folder.description && <span className="text-muted">{folder.description}</span>}
+ <span className="shrink-0 font-medium text-foreground">{folder.name}</span>
+ {folder.description && (
+ <span className="max-w-md truncate text-muted">{folder.description}</span>
+ )}
</div>
</TableCell>
<TableCell className="w-20">
@@ -109,12 +109,12 @@ export const FolderAccountRows = ({
</TableCell>
</TableRow>
- {isOpen && isLoading && (
+ {isOpen && isLoading && folder.accountCount > 0 && (
<TableRow>
<TableCell colSpan={2}>
<div className="flex flex-col gap-2 pl-[26px]">
- {SKELETON_KEYS.map((key) => (
- <Skeleton key={key} className="h-8 w-full rounded-md" />
+ {Array.from({ length: folder.accountCount }).map((_, i) => (
+ <Skeleton key={`skeleton-${i + 1}`} className="h-8 w-full rounded-md" />
))}
</div>
</TableCell>
diff --git a/frontend/src/pages/pam/PamAccountsPage/components/FolderDetailSheet.tsx b/frontend/src/pages/pam/PamAccountsPage/components/FolderDetailSheet.tsx
index 52a36d82dc..77f2c3f60f 100644
--- a/frontend/src/pages/pam/PamAccountsPage/components/FolderDetailSheet.tsx
+++ b/frontend/src/pages/pam/PamAccountsPage/components/FolderDetailSheet.tsx
@@ -6,7 +6,6 @@ import {
MoreHorizontal,
Pencil,
Settings,
- SquarePen,
Trash2,
UserPlus,
Users
@@ -149,11 +148,12 @@ const GeneralTab = ({
<Controller
control={control}
name="description"
- render={({ field }) => (
+ render={({ field, fieldState }) => (
<Field>
<FieldLabel>Description</FieldLabel>
<FieldContent>
- <TextArea {...field} rows={3} />
+ <TextArea {...field} rows={3} isError={!!fieldState.error} />
+ <FieldError>{fieldState.error?.message}</FieldError>
</FieldContent>
</Field>
)}
@@ -296,7 +296,10 @@ const PermissionsTab = ({ folderId }: { folderId: string }) => {
/>
<Card>
<CardHeader className="border-b">
- <CardTitle className="text-base">Permissions</CardTitle>
+ <CardTitle className="text-base">
+ Permissions
+ <Badge variant="pam">{resolvedMembers.length}</Badge>
+ </CardTitle>
<CardDescription>
Users and groups with access to this folder and its accounts.
</CardDescription>
@@ -319,7 +322,6 @@ const PermissionsTab = ({ folderId }: { folderId: string }) => {
<TableHead>Assignee</TableHead>
<TableHead>Role</TableHead>
<TableHead>Expiry</TableHead>
- <TableHead>Source</TableHead>
<TableHead className="w-12" />
</TableRow>
</TableHeader>
@@ -345,12 +347,6 @@ const PermissionsTab = ({ folderId }: { folderId: string }) => {
<TableCell>
<MemberExpiry expiresAt={rm.member.expiresAt} />
</TableCell>
- <TableCell>
- <span className="flex items-center gap-1.5 text-sm text-muted">
- <SquarePen className="size-3.5" />
- Manual
- </span>
- </TableCell>
<TableCell>
{!isOwnMembership && (
<DropdownMenu>
diff --git a/frontend/src/pages/pam/PamAccountsPage/components/accountFormSchema.ts b/frontend/src/pages/pam/PamAccountsPage/components/accountFormSchema.ts
index 34fd723e31..244aff1753 100644
--- a/frontend/src/pages/pam/PamAccountsPage/components/accountFormSchema.ts
+++ b/frontend/src/pages/pam/PamAccountsPage/components/accountFormSchema.ts
@@ -55,20 +55,24 @@ export const getMissingRequiredFields = (
})
.map((field) => field.key);
-// Maps backend validation issues onto form fields
+// Maps backend validation issues onto the known form fields and returns the messages of any issues that couldn't be mapped
export const applyServerValidationErrors = <T extends FieldValues>(
error: unknown,
- setError: UseFormSetError<T>
-): boolean => {
- if (!axios.isAxiosError(error)) return false;
+ setError: UseFormSetError<T>,
+ knownFields: Set<string>
+): string[] => {
+ if (!axios.isAxiosError(error)) return [];
const data = error.response?.data as TApiErrors | undefined;
- if (data?.error !== ApiErrorTypes.ValidationError) return false;
+ if (data?.error !== ApiErrorTypes.ValidationError) return [];
- let mapped = false;
+ const unmapped: string[] = [];
data.message.forEach((issue) => {
- if (!issue.path.length) return;
- setError(issue.path.join(".") as Path<T>, { type: "server", message: issue.message });
- mapped = true;
+ const name = issue.path.join(".");
+ if (name && knownFields.has(name)) {
+ setError(name as Path<T>, { type: "server", message: issue.message });
+ } else {
+ unmapped.push(issue.message);
+ }
});
- return mapped;
+ return unmapped;
};
diff --git a/frontend/src/pages/pam/PamDataExplorerPage/PamDataExplorerPage.tsx b/frontend/src/pages/pam/PamDataExplorerPage/PamDataExplorerPage.tsx
index de872bc02b..184609705b 100644
--- a/frontend/src/pages/pam/PamDataExplorerPage/PamDataExplorerPage.tsx
+++ b/frontend/src/pages/pam/PamDataExplorerPage/PamDataExplorerPage.tsx
@@ -3,6 +3,7 @@ import { useParams } from "@tanstack/react-router";
import {
AlertTriangleIcon,
DatabaseIcon,
+ PlugZap,
PlusIcon,
ShieldCheckIcon,
TableIcon,
@@ -15,7 +16,7 @@ import { Button } from "@app/components/v3/generic/Button";
import { cn } from "@app/components/v3/utils";
import { useGetPamAccountById } from "@app/hooks/api/pam";
-import { DisconnectedScreen } from "../PamAccountAccessPage/DisconnectedScreen";
+import { WebAccessStatusCard } from "../PamAccountAccessPage/WebAccessStatusCard";
import { DataExplorerGrid } from "./components/DataExplorerGrid";
import { DataExplorerSidebar } from "./components/DataExplorerSidebar";
import { QueryPanel } from "./components/QueryPanel";
@@ -287,36 +288,34 @@ export const PamDataExplorerPage = ({ reason }: Props = {}) => {
if (mfaState?.required) {
return (
- <div className="flex h-screen w-screen flex-col items-center justify-center gap-3 bg-background">
- <ShieldCheckIcon className="size-8 text-muted" />
- <h2 className="text-sm font-medium text-foreground">MFA Verification Required</h2>
- <p className="max-w-sm text-center text-xs text-muted">
- Multi-factor authentication is required to access this database account.
- </p>
+ <WebAccessStatusCard
+ icon={ShieldCheckIcon}
+ title="MFA Verification Required"
+ description="Multi-factor authentication is required to access this database account."
+ >
{mfaState.verifying ? (
- <div className="flex items-center gap-2 text-xs text-muted">
+ <div className="flex items-center justify-center gap-2 text-xs text-muted">
<Spinner className="h-4 w-4" />
Waiting for verification...
</div>
) : (
- <Button variant="outline" size="xs" onClick={handleMfaVerification}>
+ <Button variant="pam" isFullWidth onClick={handleMfaVerification}>
Verify MFA
</Button>
)}
- </div>
+ </WebAccessStatusCard>
);
}
if (approvalState?.required) {
return (
- <div className="flex h-screen w-screen flex-col items-center justify-center gap-3 bg-background">
- <AlertTriangleIcon className="size-8 text-muted" />
- <h2 className="text-sm font-medium text-foreground">Approval Required</h2>
- <p className="max-w-sm text-center text-xs text-muted">
- This account is protected by policy: {approvalState.policyName ?? "Unknown"}
- </p>
+ <WebAccessStatusCard
+ icon={AlertTriangleIcon}
+ title="Approval Required"
+ description={`This account is protected by policy: ${approvalState.policyName ?? "Unknown"}`}
+ >
{approvalState.submitted ? (
- <div className="flex flex-col items-center gap-2">
+ <>
<p className="text-xs text-muted">Approval request created successfully.</p>
{approvalRequestUrl && (
<a
@@ -328,12 +327,12 @@ export const PamDataExplorerPage = ({ reason }: Props = {}) => {
View approval request
</a>
)}
- <Button variant="outline" size="xs" onClick={handleReconnect}>
+ <Button variant="pam" isFullWidth onClick={handleReconnect}>
Reconnect
</Button>
- </div>
+ </>
) : (
- <div className="flex w-full max-w-sm flex-col gap-2">
+ <>
<textarea
className="w-full rounded border border-border bg-container px-3 py-2 text-xs text-foreground placeholder:text-muted focus:border-border focus:outline-none"
placeholder="Justification (optional)"
@@ -344,43 +343,46 @@ export const PamDataExplorerPage = ({ reason }: Props = {}) => {
{approvalState.errorMessage && (
<p className="text-xs text-danger">{approvalState.errorMessage}</p>
)}
- <div className="flex justify-center gap-2">
- <Button
- variant="outline"
- size="xs"
- isPending={approvalState.creating}
- onClick={() => submitApprovalRequest(approvalJustification)}
- >
- Create Approval Request
- </Button>
- </div>
- </div>
+ <Button
+ variant="pam"
+ isFullWidth
+ isPending={approvalState.creating}
+ onClick={() => submitApprovalRequest(approvalJustification)}
+ >
+ Create Approval Request
+ </Button>
+ </>
)}
- </div>
+ </WebAccessStatusCard>
);
}
if (errorMessage && !isConnected) {
return (
- <div className="flex h-screen w-screen flex-col items-center justify-center gap-3 bg-background">
- <AlertTriangleIcon className="size-8 text-muted" />
- <h2 className="text-sm font-medium text-foreground">Connection Error</h2>
- <p className="max-w-sm text-center text-xs text-muted">{errorMessage}</p>
- <Button variant="outline" size="xs" onClick={handleReconnect}>
+ <WebAccessStatusCard
+ tone="danger"
+ icon={AlertTriangleIcon}
+ title="Connection Error"
+ description={errorMessage}
+ >
+ <Button variant="pam" isFullWidth onClick={handleReconnect}>
Try Again
</Button>
- </div>
+ </WebAccessStatusCard>
);
}
if (hasDisconnected && !isConnected && !isConnecting) {
return (
- <div className="relative h-screen w-screen bg-background">
- <DisconnectedScreen
- onReconnect={handleReconnect}
- description={disconnectReason ?? "The database connection was closed."}
- />
- </div>
+ <WebAccessStatusCard
+ icon={PlugZap}
+ title="Disconnected"
+ description={disconnectReason ?? "The database connection was closed."}
+ >
+ <Button variant="pam" isFullWidth onClick={handleReconnect}>
+ Reconnect
+ </Button>
+ </WebAccessStatusCard>
);
}
diff --git a/frontend/src/pages/pam/PamTemplatesPage/components/CreateTemplateModal.tsx b/frontend/src/pages/pam/PamTemplatesPage/components/CreateTemplateModal.tsx
index cb63574386..9c93df9cce 100644
--- a/frontend/src/pages/pam/PamTemplatesPage/components/CreateTemplateModal.tsx
+++ b/frontend/src/pages/pam/PamTemplatesPage/components/CreateTemplateModal.tsx
@@ -115,7 +115,7 @@ export const CreateTemplateModal = ({ isOpen, onOpenChange, onCreated }: Props)
}
>
<SelectTrigger className="w-full" isError={!!errors.type}>
- <SelectValue placeholder="Select a platform type" />
+ <SelectValue placeholder="Select an account type" />
</SelectTrigger>
<SelectContent position="popper" sideOffset={4}>
{accountTypes.map((meta) => (
@@ -141,8 +141,10 @@ export const CreateTemplateModal = ({ isOpen, onOpenChange, onCreated }: Props)
id="template-description"
placeholder="What is this template for?"
rows={3}
+ isError={!!errors.description}
{...register("description")}
/>
+ <FieldError>{errors.description?.message}</FieldError>
</FieldContent>
</Field>
diff --git a/frontend/src/pages/pam/PamTemplatesPage/components/DeleteTemplateModal.tsx b/frontend/src/pages/pam/PamTemplatesPage/components/DeleteTemplateModal.tsx
index 5f7ce2a7de..5ea93ad5b8 100644
--- a/frontend/src/pages/pam/PamTemplatesPage/components/DeleteTemplateModal.tsx
+++ b/frontend/src/pages/pam/PamTemplatesPage/components/DeleteTemplateModal.tsx
@@ -46,8 +46,9 @@ export const DeleteTemplateModal = ({
<div className="grid gap-4">
<p className="text-sm text-muted">
<span className="font-medium text-foreground">{templateName}</span> is used by{" "}
- {accountCount} account{accountCount === 1 ? "" : "s"}. Move or delete{" "}
- {accountCount === 1 ? "it" : "them"} before this template can be deleted.
+ {accountCount} account{accountCount === 1 ? "" : "s"}. Update them to use a different
+ template or delete {accountCount === 1 ? "it" : "them"} before this template can be
+ deleted.
</p>
<DialogFooter>
<Button type="button" variant="outline" onClick={() => onOpenChange(false)}>
diff --git a/frontend/src/pages/pam/PamTemplatesPage/components/TemplateDetailSheet.tsx b/frontend/src/pages/pam/PamTemplatesPage/components/TemplateDetailSheet.tsx
index c81b237ee2..fe479c4bd2 100644
--- a/frontend/src/pages/pam/PamTemplatesPage/components/TemplateDetailSheet.tsx
+++ b/frontend/src/pages/pam/PamTemplatesPage/components/TemplateDetailSheet.tsx
@@ -145,11 +145,12 @@ const ConfigurationTab = ({
<Controller
control={control}
name="description"
- render={({ field }) => (
+ render={({ field, fieldState }) => (
<Field>
<FieldLabel>Description</FieldLabel>
<FieldContent>
- <TextArea {...field} rows={3} />
+ <TextArea {...field} rows={3} isError={!!fieldState.error} />
+ <FieldError>{fieldState.error?.message}</FieldError>
</FieldContent>
</Field>
)}