Skip to content

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

improvement(agent-vault): show service icons in the Used By column

Scott Wilson590900b4dc6f
diff --git a/frontend/src/components/agent-vault/ServiceIconStack.tsx b/frontend/src/components/agent-vault/ServiceIconStack.tsx
index 6d26ed11e2..3882111530 100644
--- a/frontend/src/components/agent-vault/ServiceIconStack.tsx
+++ b/frontend/src/components/agent-vault/ServiceIconStack.tsx
@@ -5,6 +5,7 @@ import { Tooltip, TooltipContent, TooltipTrigger } from "@app/components/v3";
import { ProviderIcon } from "@app/components/v3/platform/ProviderIcon";
import { cn } from "@app/components/v3/utils";
import { findTemplateForHostPattern } from "@app/helpers/agentVaultTemplates";
+import { TAgentVaultService } from "@app/hooks/api/agentVault/types";
type TServiceIcon = {
label: string;
@@ -80,20 +81,34 @@ export const ServiceIcon = ({
return <ServiceChip icon={icon} className={className} />;
};
+// Host patterns collapse to one chip per provider. Services keep a chip each under their own name,
+// since two services on one provider are still two services.
type Props = {
- hostPatterns: string[];
maxVisible?: number;
emptyPlaceholder?: ReactNode;
className?: string;
-};
+} & (
+ | { hostPatterns: string[]; services?: never }
+ | { services: Pick<TAgentVaultService, "name" | "hostPattern">[]; hostPatterns?: never }
+);
export const ServiceIconStack = ({
hostPatterns,
+ services,
maxVisible = 4,
emptyPlaceholder = <span className="text-muted">&mdash;</span>,
className
}: Props) => {
- const icons = useMemo(() => iconsFromHostPatterns(hostPatterns), [hostPatterns]);
+ const icons = useMemo(
+ () =>
+ services
+ ? services.map((service) => ({
+ label: service.name,
+ image: findTemplateForHostPattern(service.hostPattern)?.image
+ }))
+ : iconsFromHostPatterns(hostPatterns),
+ [hostPatterns, services]
+ );
if (icons.length === 0) return emptyPlaceholder;
diff --git a/frontend/src/pages/agent-vault/AgentVaultAccessBundleDetailPage/components/VariablesCard.tsx b/frontend/src/pages/agent-vault/AgentVaultAccessBundleDetailPage/components/VariablesCard.tsx
index a1305fa827..84c64c14be 100644
--- a/frontend/src/pages/agent-vault/AgentVaultAccessBundleDetailPage/components/VariablesCard.tsx
+++ b/frontend/src/pages/agent-vault/AgentVaultAccessBundleDetailPage/components/VariablesCard.tsx
@@ -12,6 +12,7 @@ import {
} from "lucide-react";
import { twMerge } from "tailwind-merge";
+import { ServiceIconStack } from "@app/components/agent-vault/ServiceIconStack";
import { VariableFormDialog } from "@app/components/agent-vault/VariableFormDialog";
import {
Button,
@@ -271,13 +272,10 @@ export const VariablesCard = ({ accessBundleId, services }: Props) => {
)}
</TableCell>
<TableCell>
- {usedBy.length === 0 ? (
- <span className="text-sm text-muted">Unused</span>
- ) : (
- <span className="block truncate text-sm">
- {usedBy.map((service) => service.name).join(", ")}
- </span>
- )}
+ <ServiceIconStack
+ services={usedBy}
+ emptyPlaceholder={<span className="text-sm text-muted">Unused</span>}
+ />
</TableCell>
<TableCell variant="action">
<DropdownMenu>