Skip to content

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

PKI UI improvements

Carlos Monastyrskic503debcab90
diff --git a/frontend/src/components/v2/PageHeader/PageHeader.tsx b/frontend/src/components/v2/PageHeader/PageHeader.tsx
index 22184e692c..50cdf9e752 100644
--- a/frontend/src/components/v2/PageHeader/PageHeader.tsx
+++ b/frontend/src/components/v2/PageHeader/PageHeader.tsx
@@ -12,6 +12,7 @@ type Props = {
children?: ReactNode;
className?: string;
scope: "org" | "namespace" | "instance" | ProjectType | null;
+ icon?: LucideIcon;
};
const SCOPE_BADGE: Record<NonNullable<Props["scope"]>, { icon: LucideIcon; className: string }> = {
@@ -27,31 +28,35 @@ const SCOPE_BADGE: Record<NonNullable<Props["scope"]>, { icon: LucideIcon; class
instance: { className: "text-neutral", icon: InstanceIcon }
};
-export const PageHeader = ({ title, description, children, className, scope }: Props) => (
- <div className={twMerge("mb-10 w-full", className)}>
- <div className="flex w-full justify-between">
- <div className="mr-4 flex min-w-0 flex-1 items-center">
- <h1
- className={twMerge(
- "truncate text-2xl font-medium text-white underline underline-offset-4",
- scope === "org" && "decoration-org/90",
- scope === "instance" && "decoration-neutral/90",
- scope === "namespace" && "decoration-sub-org/90",
- Object.values(ProjectType).includes((scope as ProjectType) ?? "") &&
- "decoration-project/90",
- !scope && "no-underline"
- )}
- >
- {scope &&
- createElement(SCOPE_BADGE[scope].icon, {
- size: 26,
- className: twMerge(SCOPE_BADGE[scope].className, "mr-3 mb-1 inline-block")
- })}
- {title}
- </h1>
+export const PageHeader = ({ title, description, children, className, scope, icon }: Props) => {
+ const resolvedIcon = icon ?? (scope ? SCOPE_BADGE[scope].icon : null);
+ const iconClassName = scope ? SCOPE_BADGE[scope].className : "";
+ return (
+ <div className={twMerge("mb-10 w-full", className)}>
+ <div className="flex w-full justify-between">
+ <div className="mr-4 flex min-w-0 flex-1 items-center">
+ <h1
+ className={twMerge(
+ "truncate text-2xl font-medium text-white underline underline-offset-4",
+ scope === "org" && "decoration-org/90",
+ scope === "instance" && "decoration-neutral/90",
+ scope === "namespace" && "decoration-sub-org/90",
+ Object.values(ProjectType).includes((scope as ProjectType) ?? "") &&
+ "decoration-project/90",
+ !scope && "no-underline"
+ )}
+ >
+ {resolvedIcon &&
+ createElement(resolvedIcon, {
+ size: 26,
+ className: twMerge(iconClassName, "mr-3 mb-1 inline-block")
+ })}
+ {title}
+ </h1>
+ </div>
+ <div className="flex items-center gap-2">{children}</div>
</div>
- <div className="flex items-center gap-2">{children}</div>
+ <div className="mt-1.5 text-mineshaft-300">{description}</div>
</div>
- <div className="mt-1.5 text-mineshaft-300">{description}</div>
- </div>
-);
+ );
+};
diff --git a/frontend/src/components/v3/platform/ScopeIcons.tsx b/frontend/src/components/v3/platform/ScopeIcons.tsx
index 9f21ce2502..359187afe2 100644
--- a/frontend/src/components/v3/platform/ScopeIcons.tsx
+++ b/frontend/src/components/v3/platform/ScopeIcons.tsx
@@ -4,5 +4,6 @@ export {
ServerIcon as InstanceIcon,
Building2Icon as OrgIcon,
BoxIcon as ProjectIcon,
+ BoxIcon as ResourceIcon,
BoxesIcon as SubOrgIcon
};
diff --git a/frontend/src/layouts/OrganizationLayout/components/NavBar/Navbar.tsx b/frontend/src/layouts/OrganizationLayout/components/NavBar/Navbar.tsx
index ef35564319..40522494ed 100644
--- a/frontend/src/layouts/OrganizationLayout/components/NavBar/Navbar.tsx
+++ b/frontend/src/layouts/OrganizationLayout/components/NavBar/Navbar.tsx
@@ -84,7 +84,10 @@ import { getAuthToken } from "@app/hooks/api/reactQuery";
import { SubscriptionPlanTypes } from "@app/hooks/api/subscriptions/types";
import { Organization, SubscriptionPlan } from "@app/hooks/api/types";
import { AuthMethod } from "@app/hooks/api/users/types";
-import { ProjectSelect } from "@app/layouts/ProjectLayout/components/ProjectSelect";
+import {
+ ApplicationSelect,
+ ProjectSelect
+} from "@app/layouts/ProjectLayout/components/ProjectSelect";
import { TypeSelect } from "@app/layouts/ProjectLayout/components/TypeSelect";
import { navigateUserToOrg } from "@app/pages/auth/LoginPage/Login.utils";
@@ -545,6 +548,7 @@ export const Navbar = () => {
<>
<TypeSelect />
<ProjectSelect />
+ <ApplicationSelect />
</>
)}
</>
diff --git a/frontend/src/layouts/OrganizationLayout/components/OrgSidebar/CertManagerNav.tsx b/frontend/src/layouts/OrganizationLayout/components/OrgSidebar/CertManagerNav.tsx
index 6c80ef44ad..d34f385d66 100644
--- a/frontend/src/layouts/OrganizationLayout/components/OrgSidebar/CertManagerNav.tsx
+++ b/frontend/src/layouts/OrganizationLayout/components/OrgSidebar/CertManagerNav.tsx
@@ -1,7 +1,6 @@
import { useQuery } from "@tanstack/react-query";
import {
Bell,
- Boxes,
FileKey,
FileText,
GitCompare,
@@ -14,10 +13,12 @@ import {
ShieldCheck
} from "lucide-react";
-import { SidebarCollapsibleGroup } from "@app/components/v3";
+import { ResourceIcon, SidebarCollapsibleGroup } from "@app/components/v3";
import { useProject, useProjectPermission } from "@app/context";
import { useListWorkspacePkiAlerts } from "@app/hooks/api";
import { approvalPolicyQuery, ApprovalPolicyType } from "@app/hooks/api/approvalPolicies";
+import { approvalRequestQuery } from "@app/hooks/api/approvalRequests";
+import { ApprovalRequestStatus } from "@app/hooks/api/approvalRequests/types";
import { useGetPkiAlertsV2 } from "@app/hooks/api/pkiAlertsV2";
import { useListPkiSyncs } from "@app/hooks/api/pkiSyncs";
@@ -49,6 +50,11 @@ export const CertManagerNav = ({
...approvalPolicyQuery.list({ projectId, policyType: ApprovalPolicyType.CertRequest }),
enabled: isCertManagerAdmin && Boolean(projectId)
});
+ const { data: pendingRequestsCount = 0 } = useQuery({
+ ...approvalRequestQuery.list({ projectId, policyType: ApprovalPolicyType.CertRequest }),
+ enabled: Boolean(projectId),
+ select: (requests) => requests.filter((r) => r.status === ApprovalRequestStatus.Pending).length
+ });
const hasLegacyAlerts =
Boolean(v2AlertsData?.alerts?.some((a) => !a.applicationId)) ||
@@ -60,11 +66,17 @@ export const CertManagerNav = ({
const overviewItems: NavItem[] = [
{ label: "Dashboard", icon: LayoutDashboard, pathSuffix: "overview" },
{ label: "Inventory", icon: FileKey, pathSuffix: "inventory" },
- { label: "Discovery", icon: Search, pathSuffix: "discovery", activeMatch: /\/discovery/ }
+ { label: "Discovery", icon: Search, pathSuffix: "discovery", activeMatch: /\/discovery/ },
+ {
+ label: "Requests",
+ icon: Inbox,
+ pathSuffix: "requests",
+ badgeCount: pendingRequestsCount || undefined
+ }
];
const applicationItems: NavItem[] = [
- { label: "Applications", icon: Boxes, pathSuffix: "applications" }
+ { label: "Applications", icon: ResourceIcon, pathSuffix: "applications" }
];
const codeSigningItems: NavItem[] = [
@@ -76,12 +88,6 @@ export const CertManagerNav = ({
}
];
- const workflowItems: NavItem[] = [{ label: "Requests", icon: Inbox, pathSuffix: "requests" }];
-
- const complianceItems: NavItem[] = [
- { label: "Audit Logs", icon: FileText, pathSuffix: "audit-logs" }
- ];
-
const legacyItems: NavItem[] = [
{ label: "Alerts", icon: Bell, pathSuffix: "alerting", hidden: !hasLegacyAlerts },
{
@@ -100,7 +106,7 @@ export const CertManagerNav = ({
}
];
- const configurationItems: NavItem[] = [
+ const administrationItems: NavItem[] = [
{
label: "Access",
icon: Shield,
@@ -112,35 +118,32 @@ export const CertManagerNav = ({
label: "Settings",
icon: Settings,
pathSuffix: "settings"
- }
+ },
+ { label: "Audit Logs", icon: FileText, pathSuffix: "audit-logs" }
];
+ const generalItemsForRole = isCertManagerAdmin
+ ? overviewItems
+ : overviewItems.filter((item) => item.pathSuffix === "requests");
+
return (
<>
- {isCertManagerAdmin ? (
- <SidebarCollapsibleGroup label="General">
- <ProjectNavList items={overviewItems} onSubmenuOpen={onSubmenuOpen} />
- </SidebarCollapsibleGroup>
- ) : null}
+ <SidebarCollapsibleGroup label="General">
+ <ProjectNavList items={generalItemsForRole} onSubmenuOpen={onSubmenuOpen} />
+ </SidebarCollapsibleGroup>
<SidebarCollapsibleGroup label="Applications">
<ProjectNavList items={applicationItems} onSubmenuOpen={onSubmenuOpen} />
</SidebarCollapsibleGroup>
<SidebarCollapsibleGroup label="Code Signing">
<ProjectNavList items={codeSigningItems} onSubmenuOpen={onSubmenuOpen} />
</SidebarCollapsibleGroup>
- <SidebarCollapsibleGroup label="Workflows">
- <ProjectNavList items={workflowItems} onSubmenuOpen={onSubmenuOpen} />
- </SidebarCollapsibleGroup>
- <SidebarCollapsibleGroup label="Compliance">
- <ProjectNavList items={complianceItems} onSubmenuOpen={onSubmenuOpen} />
- </SidebarCollapsibleGroup>
{isCertManagerAdmin && hasAnyLegacy ? (
- <SidebarCollapsibleGroup label="Legacy">
+ <SidebarCollapsibleGroup label="Legacy" defaultOpen={false}>
<ProjectNavList items={legacyItems} onSubmenuOpen={onSubmenuOpen} />
</SidebarCollapsibleGroup>
) : null}
- <SidebarCollapsibleGroup label="Configuration">
- <ProjectNavList items={configurationItems} onSubmenuOpen={onSubmenuOpen} />
+ <SidebarCollapsibleGroup label="Administration">
+ <ProjectNavList items={administrationItems} onSubmenuOpen={onSubmenuOpen} />
</SidebarCollapsibleGroup>
</>
);
diff --git a/frontend/src/layouts/OrganizationLayout/components/OrgSidebar/ProjectNavLink.tsx b/frontend/src/layouts/OrganizationLayout/components/OrgSidebar/ProjectNavLink.tsx
index c848ba6ac8..8f682491fc 100644
--- a/frontend/src/layouts/OrganizationLayout/components/OrgSidebar/ProjectNavLink.tsx
+++ b/frontend/src/layouts/OrganizationLayout/components/OrgSidebar/ProjectNavLink.tsx
@@ -70,13 +70,13 @@ export const ProjectNavLink = ({
>
<item.icon className="size-4" />
<span>{item.label}</span>
+ {Boolean(item.badgeCount) && (
+ <Badge variant="warning" isSquare>
+ {item.badgeCount}
+ </Badge>
+ )}
</Link>
</SidebarMenuButton>
- {Boolean(item.badgeCount) && (
- <Badge variant="warning" className="absolute top-[10.5px] right-4">
- {item.badgeCount}
- </Badge>
- )}
</SidebarMenuItem>
);
};
diff --git a/frontend/src/layouts/PkiManagerLayout/components/ActiveInstanceModal.tsx b/frontend/src/layouts/PkiManagerLayout/components/ActiveInstanceModal.tsx
index 20a3181d65..636a60c12e 100644
--- a/frontend/src/layouts/PkiManagerLayout/components/ActiveInstanceModal.tsx
+++ b/frontend/src/layouts/PkiManagerLayout/components/ActiveInstanceModal.tsx
@@ -1,7 +1,6 @@
import { useState } from "react";
import { createNotification } from "@app/components/notifications";
-import { Spinner } from "@app/components/v2";
import {
Badge,
Button,
@@ -14,6 +13,7 @@ import {
EmptyDescription,
EmptyHeader,
EmptyTitle,
+ PageLoader,
Table,
TableBody,
TableCell,
@@ -57,8 +57,8 @@ export const ActiveInstanceModal = ({ popUp, handlePopUpToggle }: Props) => {
const renderInstances = () => {
if (isPending || !data) {
return (
- <div className="flex items-center justify-center p-8">
- <Spinner />
+ <div className="h-48">
+ <PageLoader lottieClassName="w-16" />
</div>
);
}
@@ -78,24 +78,26 @@ export const ActiveInstanceModal = ({ popUp, handlePopUpToggle }: Props) => {
<Table>
<TableHeader>
<TableRow>
- <TableHead>Name</TableHead>
- <TableHead className="text-right">Certificates</TableHead>
- <TableHead className="text-right">Syncs</TableHead>
- <TableHead className="text-right">Alerts</TableHead>
- <TableHead className="text-right">Action</TableHead>
+ <TableHead className="w-full">Name</TableHead>
+ <TableHead className="text-right whitespace-nowrap">Certificates</TableHead>
+ <TableHead className="text-right whitespace-nowrap">Syncs</TableHead>
+ <TableHead className="text-right whitespace-nowrap">Alerts</TableHead>
+ <TableHead className="text-right whitespace-nowrap">Action</TableHead>
</TableRow>
</TableHeader>
<TableBody>
{data.instances.map((i) => (
<TableRow key={i.id}>
- <TableCell isTruncatable>
- <div className="font-medium text-foreground">{i.name}</div>
- <div className="font-mono text-xs text-accent">{i.slug}</div>
+ <TableCell className="w-full">
+ <div className="flex flex-wrap items-baseline gap-x-2 gap-y-0.5">
+ <span className="font-medium text-foreground">{i.name}</span>
+ <span className="font-mono text-xs text-accent">{i.slug}</span>
+ </div>
</TableCell>
- <TableCell className="text-right">{i.certificateCount}</TableCell>
- <TableCell className="text-right">{i.syncCount}</TableCell>
- <TableCell className="text-right">{i.alertCount}</TableCell>
- <TableCell className="text-right">
+ <TableCell className="text-right whitespace-nowrap">{i.certificateCount}</TableCell>
+ <TableCell className="text-right whitespace-nowrap">{i.syncCount}</TableCell>
+ <TableCell className="text-right whitespace-nowrap">{i.alertCount}</TableCell>
+ <TableCell className="text-right whitespace-nowrap">
{i.isActive ? (
<Badge variant="success">Active</Badge>
) : (
diff --git a/frontend/src/layouts/PkiManagerLayout/components/CertManagerInstanceBanner.tsx b/frontend/src/layouts/PkiManagerLayout/components/CertManagerInstanceBanner.tsx
index 07b1dc5b78..0488955df5 100644
--- a/frontend/src/layouts/PkiManagerLayout/components/CertManagerInstanceBanner.tsx
+++ b/frontend/src/layouts/PkiManagerLayout/components/CertManagerInstanceBanner.tsx
@@ -1,7 +1,7 @@
import { useParams } from "@tanstack/react-router";
-import { InfoIcon } from "lucide-react";
+import { Info } from "lucide-react";
-import { Button } from "@app/components/v3";
+import { Alert, Button } from "@app/components/v3";
import { useOrgPermission } from "@app/context";
import {
OrgPermissionCertManagerActions,
@@ -28,35 +28,25 @@ export const CertManagerInstanceBanner = () => {
const otherCount = Math.max(0, data.projects.length - 1);
const isViewingActive = activeProject?.id === projectId;
+ const variant = isViewingActive ? "info" : "warning";
+ const message = isViewingActive
+ ? `Your organization has ${otherCount} other Cert Manager ${otherCount === 1 ? "workspace" : "workspaces"}, consolidate to a single workspace, multi-project Cert Manager will be deprecated soon.`
+ : `Legacy Cert Manager instance (active is ${activeProject?.name ?? "not set"}) — consolidate to a single instance, multi-project Cert Manager will be deprecated soon.`;
+
return (
<>
- <div className="flex items-start gap-3 border-b border-mineshaft-600 bg-mineshaft-800 px-12 py-3 text-sm text-mineshaft-200">
- <InfoIcon size={16} className="mt-0.5 text-warning" />
- <div className="flex-1">
- {isViewingActive ? (
- <>
- You&apos;re viewing the active instance
- {activeProject ? (
- <span className="text-mineshaft-100"> — {activeProject.name}</span>
- ) : null}
- . Your org has <span className="text-mineshaft-100">{otherCount} other</span> Cert
- Manager
- {otherCount === 1 ? " instance" : " instances"} from the legacy multi-project model.
- </>
- ) : (
- <>
- This is a legacy Cert Manager instance. The active instance is{" "}
- <span className="text-mineshaft-100">{activeProject?.name ?? "not set"}</span>; new
- API requests without a <code>projectId</code> resolve there.
- </>
+ <div className="px-12 py-3">
+ <Alert variant={variant} className="flex items-center justify-between gap-3 py-2">
+ <div className="flex items-center gap-2 text-sm">
+ <Info className="size-4 shrink-0" />
+ <span>{message}</span>
+ </div>
+ {canManage && (
+ <Button size="xs" variant="outline" onClick={() => handlePopUpOpen("activeInstance")}>
+ Manage instances
+ </Button>
)}
- <span className="ml-1">We&apos;re moving Cert Manager to a single-instance model.</span>
- </div>
- {canManage && (
- <Button size="xs" variant="outline" onClick={() => handlePopUpOpen("activeInstance")}>
- Manage instances
- </Button>
- )}
+ </Alert>
</div>
<ActiveInstanceModal popUp={popUp} handlePopUpToggle={handlePopUpToggle} />
diff --git a/frontend/src/layouts/ProjectLayout/components/ProjectSelect/ApplicationSelect.tsx b/frontend/src/layouts/ProjectLayout/components/ProjectSelect/ApplicationSelect.tsx
new file mode 100644
index 0000000000..ce734bfe44
--- /dev/null
+++ b/frontend/src/layouts/ProjectLayout/components/ProjectSelect/ApplicationSelect.tsx
@@ -0,0 +1,110 @@
+import { useState } from "react";
+import { Link, useNavigate, useParams } from "@tanstack/react-router";
+import { Check, ChevronsUpDown } from "lucide-react";
+
+import {
+ Badge,
+ Command,
+ CommandEmpty,
+ CommandGroup,
+ CommandInput,
+ CommandItem,
+ CommandList,
+ IconButton,
+ Popover,
+ PopoverAnchor,
+ PopoverContent,
+ PopoverTrigger,
+ ResourceIcon
+} from "@app/components/v3";
+import { useListPkiApplications } from "@app/hooks/api/pkiApplications";
+
+const ApplicationSelectInner = ({
+ applicationName,
+ projectId,
+ orgId
+}: {
+ applicationName: string;
+ projectId: string;
+ orgId: string;
+}) => {
+ const [open, setOpen] = useState(false);
+ const navigate = useNavigate();
+ const { data: applications = [] } = useListPkiApplications();
+
+ const current = applications.find((a) => a.name === applicationName);
+ const displayName = current?.name ?? applicationName;
+
+ const handleSelect = (nextName: string) => {
+ setOpen(false);
+ if (nextName === applicationName) return;
+ navigate({
+ to: `/organizations/${orgId}/projects/cert-manager/${projectId}/applications/${nextName}` as never
+ } as never);
+ };
+
+ return (
+ <div className="mr-2 flex min-w-16 items-center gap-1 pr-1 pl-1">
+ <Popover open={open} onOpenChange={setOpen}>
+ <PopoverAnchor className="absolute left-18" />
+ <Link
+ to={
+ `/organizations/${orgId}/projects/cert-manager/${projectId}/applications/${applicationName}` as never
+ }
+ className="group flex cursor-pointer items-center gap-x-2 overflow-hidden text-sm text-white"
+ >
+ <ResourceIcon className="size-[14px] shrink-0 text-project" />
+ <span className="truncate">{displayName}</span>
+ <Badge variant="project" className="hidden lg:inline-flex">
+ Application
+ </Badge>
+ </Link>
+ <PopoverTrigger asChild>
+ <IconButton variant="ghost" size="xs" aria-label="switch-application">
+ <ChevronsUpDown />
+ </IconButton>
+ </PopoverTrigger>
+ <PopoverContent align="start" sideOffset={20} className="w-96 p-0">
+ <Command>
+ <CommandInput placeholder="Search applications..." />
+ <CommandList>
+ <CommandEmpty>No applications found.</CommandEmpty>
+ <CommandGroup heading="Applications">
+ {applications.map((app) => (
+ <CommandItem
+ key={app.id}
+ value={app.name}
+ onSelect={() => handleSelect(app.name)}
+ className="gap-2"
+ >
+ <Check className={app.name === applicationName ? "opacity-100" : "opacity-0"} />
+ <div className="flex min-w-0 flex-1 flex-col">
+ <span className="truncate text-sm">{app.name}</span>
+ <span className="truncate text-[11px] text-muted">
+ {app.description || "No description"}
+ </span>
+ </div>
+ </CommandItem>
+ ))}
+ </CommandGroup>
+ </CommandList>
+ </Command>
+ </PopoverContent>
+ </Popover>
+ </div>
+ );
+};
+
+export const ApplicationSelect = () => {
+ const params = useParams({ strict: false }) as {
+ applicationName?: string;
+ projectId?: string;
+ orgId?: string;
+ };
+ const { applicationName, projectId, orgId } = params;
+ if (!applicationName || !projectId || !orgId) return null;
+
+ return (
+ <ApplicationSelectInner applicationName={applicationName} projectId={projectId} orgId={orgId} />
+ );
+};
diff --git a/frontend/src/layouts/ProjectLayout/components/ProjectSelect/index.ts b/frontend/src/layouts/ProjectLayout/components/ProjectSelect/index.ts
index d0be7c2035..a33b200142 100644
--- a/frontend/src/layouts/ProjectLayout/components/ProjectSelect/index.ts
+++ b/frontend/src/layouts/ProjectLayout/components/ProjectSelect/index.ts
@@ -1 +1,2 @@
+export * from "./ApplicationSelect";
export * from "./ProjectSelect";
diff --git a/frontend/src/layouts/ProjectLayout/components/TypeSelect/TypeSelect.tsx b/frontend/src/layouts/ProjectLayout/components/TypeSelect/TypeSelect.tsx
index e72e7586f6..40b9821736 100644
--- a/frontend/src/layouts/ProjectLayout/components/TypeSelect/TypeSelect.tsx
+++ b/frontend/src/layouts/ProjectLayout/components/TypeSelect/TypeSelect.tsx
@@ -165,8 +165,16 @@ export const TypeSelect = () => {
if (params.projectId) {
const project = projects.find((p) => p.id === params.projectId);
if (project) {
+ const hasApplicationSelect =
+ project.type === ProjectType.CertificateManager &&
+ Boolean((params as { applicationName?: string }).applicationName);
const hasSiblingProjectSelect = project.type !== ProjectType.CertificateManager;
- return <TypeSelectInner currentType={project.type} showDivider={hasSiblingProjectSelect} />;
+ return (
+ <TypeSelectInner
+ currentType={project.type}
+ showDivider={hasSiblingProjectSelect || hasApplicationSelect}
+ />
+ );
}
}
diff --git a/frontend/src/pages/cert-manager/ApplicationDetailsByIDPage/ApplicationDetailsByIDPage.tsx b/frontend/src/pages/cert-manager/ApplicationDetailsByIDPage/ApplicationDetailsByIDPage.tsx
index 8792d6b6af..b7fb5a007e 100644
--- a/frontend/src/pages/cert-manager/ApplicationDetailsByIDPage/ApplicationDetailsByIDPage.tsx
+++ b/frontend/src/pages/cert-manager/ApplicationDetailsByIDPage/ApplicationDetailsByIDPage.tsx
@@ -2,24 +2,19 @@ import { useState } from "react";
import { Helmet } from "react-helmet";
import { faCheck, faCopy, faEllipsisVertical, faTrash } from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
-import { useNavigate, useParams, useSearch } from "@tanstack/react-router";
+import { Link, useNavigate, useParams, useSearch } from "@tanstack/react-router";
+import { ChevronLeftIcon } from "lucide-react";
import { createNotification } from "@app/components/notifications";
-import {
- DeleteActionModal,
- PageHeader,
- Spinner,
- Tab,
- TabList,
- TabPanel,
- Tabs
-} from "@app/components/v2";
+import { DeleteActionModal, PageHeader, Tab, TabList, TabPanel, Tabs } from "@app/components/v2";
import {
Button,
DropdownMenu,
DropdownMenuContent,
DropdownMenuItem,
- DropdownMenuTrigger
+ DropdownMenuTrigger,
+ PageLoader,
+ ResourceIcon
} from "@app/components/v3";
import { useToggle } from "@app/hooks";
import {
@@ -79,11 +74,7 @@ export const ApplicationDetailsByIDPage = () => {
};
if (isPending) {
- return (
- <div className="flex items-center justify-center p-12 text-muted">
- <Spinner />
- </div>
- );
+ return <PageLoader />;
}
if (!application) {
@@ -98,8 +89,20 @@ export const ApplicationDetailsByIDPage = () => {
<div className="h-full bg-bunker-800">
<div className="mx-auto flex flex-col text-white">
<div className="mx-auto mb-6 w-full max-w-8xl">
+ <div className="mb-4">
+ <Link
+ to={
+ `/organizations/${orgId ?? ""}/projects/cert-manager/${projectId ?? ""}/applications` as never
+ }
+ className="flex w-fit items-center gap-x-1 text-sm text-mineshaft-400 transition duration-100 hover:text-mineshaft-400/80"
+ >
+ <ChevronLeftIcon size={16} />
+ Back to Applications
+ </Link>
+ </div>
<PageHeader
scope={ProjectType.CertificateManager}
+ icon={ResourceIcon}
title={application.name}
description={application.description ?? undefined}
>
diff --git a/frontend/src/pages/cert-manager/ApplicationDetailsByIDPage/components/AddApplicationMemberModal.tsx b/frontend/src/pages/cert-manager/ApplicationDetailsByIDPage/components/AddApplicationMemberModal.tsx
index 534ee55383..33710e9211 100644
--- a/frontend/src/pages/cert-manager/ApplicationDetailsByIDPage/components/AddApplicationMemberModal.tsx
+++ b/frontend/src/pages/cert-manager/ApplicationDetailsByIDPage/components/AddApplicationMemberModal.tsx
@@ -1,43 +1,38 @@
import { useMemo, useState } from "react";
-import { HardDriveIcon, SearchIcon, UserIcon, UsersIcon } from "lucide-react";
+import { HardDriveIcon, UserIcon, UsersIcon } from "lucide-react";
import { twMerge } from "tailwind-merge";
+import { z } from "zod";
import { createNotification } from "@app/components/notifications";
-import { Spinner } from "@app/components/v2";
+import { FilterableSelect, FormControl } from "@app/components/v2";
+import { CreatableSelect } from "@app/components/v2/CreatableSelect";
import {
Button,
- Checkbox,
Dialog,
DialogContent,
DialogDescription,
DialogFooter,
DialogHeader,
DialogTitle,
- Empty,
- EmptyDescription,
- EmptyHeader,
- EmptyTitle,
- InputGroup,
- InputGroupAddon,
- InputGroupInput,
Select,
SelectContent,
SelectItem,
SelectTrigger,
- SelectValue,
- Table,
- TableBody,
- TableCell,
- TableHead,
- TableHeader,
- TableRow
+ SelectValue
} from "@app/components/v3";
+import { apiRequest } from "@app/config/request";
import { useOrganization } from "@app/context";
import {
useGetIdentityMembershipOrgs,
useGetOrganizationGroups
} from "@app/hooks/api/organization";
+import { useCreateOrgIdentity } from "@app/hooks/api/orgIdentity";
import { TPkiApplicationMember, useAddPkiApplicationMember } from "@app/hooks/api/pkiApplications";
+import {
+ useCreateProjectIdentityMembership,
+ useListProjectIdentityMemberships
+} from "@app/hooks/api/projectIdentityMembership";
+import { ProjectType } from "@app/hooks/api/projects/types";
import { useGetOrgUsers } from "@app/hooks/api/users";
type ActorType = "user" | "identity" | "group";
@@ -49,12 +44,39 @@ type Props = {
existingMembers: TPkiApplicationMember[];
};
-const PLACEHOLDER: Record<ActorType, string> = {
- user: "Search users by name or email…",
- identity: "Search identities by name…",
- group: "Search groups by name…"
+type Option = { value: string; label: string; isNew?: boolean };
+
+const APP_ROLES = [
+ { slug: "admin", label: "Admin" },
+ { slug: "operator", label: "Operator" },
+ { slug: "auditor", label: "Auditor" }
+];
+
+type CertManagerInviteResponse = {
+ memberships: Array<{ id: string; userId: string }>;
+};
+
+const runSequential = async <T,>(items: T[], fn: (item: T) => Promise<void>): Promise<void> => {
+ await items.reduce<Promise<void>>(async (prev, item) => {
+ await prev;
+ await fn(item);
+ }, Promise.resolve());
};
+const NoUserOptions = () => (
+ <p>
+ No matching org members. Type a full email to invite a new user — they&apos;ll receive an email
+ and be added to this Application.
+ </p>
+);
+
+const NoIdentityOptions = () => (
+ <p>
+ No matching identities. Type a name to create a new machine identity in the org and attach it to
+ this Application.
+ </p>
+);
+
export const AddApplicationMemberModal = ({
applicationId,
isOpen,
@@ -63,18 +85,32 @@ export const AddApplicationMemberModal = ({
}: Props) => {
const { currentOrg } = useOrganization();
const orgId = currentOrg?.id ?? "";
+
const [type, setType] = useState<ActorType>("user");
- const [search, setSearch] = useState("");
- const [selectedActorId, setSelectedActorId] = useState<string | null>(null);
+ const [selectedUsers, setSelectedUsers] = useState<Option[]>([]);
+ const [selectedIdentities, setSelectedIdentities] = useState<Option[]>([]);
+ const [selectedGroups, setSelectedGroups] = useState<Option[]>([]);
const [role, setRole] = useState("operator");
- const addMember = useAddPkiApplicationMember();
+ const [submitting, setSubmitting] = useState(false);
- // Cert Manager projects don't use project-level memberships, so eligible
- // members are scoped to the organization rather than the project.
const usersQuery = useGetOrgUsers(orgId);
const identitiesQuery = useGetIdentityMembershipOrgs({ organizationId: orgId, limit: 100 });
const groupsQuery = useGetOrganizationGroups(orgId);
+ const projectIdentitiesQuery = useListProjectIdentityMemberships({
+ projectId: "",
+ projectType: ProjectType.CertificateManager,
+ limit: 1000
+ });
+ const identityIdsAlreadyInProject = useMemo(() => {
+ const memberships = projectIdentitiesQuery.data?.identityMemberships ?? [];
+ return new Set(memberships.map((m) => m.identity.id));
+ }, [projectIdentitiesQuery.data]);
+
+ const addMember = useAddPkiApplicationMember();
+ const createIdentity = useCreateOrgIdentity();
+ const addIdentityToProject = useCreateProjectIdentityMembership();
+
const taken = useMemo(() => {
const set = new Set<string>();
existingMembers.forEach((m) => {
@@ -85,69 +121,39 @@ export const AddApplicationMemberModal = ({
return set;
}, [existingMembers]);
- const items: { id: string; primary: string; secondary?: string }[] = useMemo(() => {
- const norm = search.trim().toLowerCase();
-
- if (type === "user") {
- const users = usersQuery.data ?? [];
- return users
- .filter((u) => !taken.has(`user:${u.user.id}`))
- .map((u) => ({
- id: u.user.id,
- primary:
- [u.user.firstName, u.user.lastName].filter(Boolean).join(" ").trim() ||
- u.user.username ||
- u.user.email ||
- u.user.id,
- secondary: u.user.email ?? u.user.username ?? undefined
- }))
- .filter(
- (i) =>
- !norm ||
- i.primary.toLowerCase().includes(norm) ||
- (i.secondary?.toLowerCase().includes(norm) ?? false)
- );
- }
+ const userOptions: Option[] = useMemo(() => {
+ const users = usersQuery.data ?? [];
+ return users
+ .filter((u) => !taken.has(`user:${u.user.id}`))
+ .map((u) => ({
+ value: u.user.id,
+ label:
+ [u.user.firstName, u.user.lastName].filter(Boolean).join(" ").trim() ||
+ u.user.username ||
+ u.user.email ||
+ u.user.id
+ }));
+ }, [usersQuery.data, taken]);
- if (type === "identity") {
- const memberships = identitiesQuery.data?.identityMemberships ?? [];
- return memberships
- .filter((im) => !taken.has(`identity:${im.identity.id}`))
- .map((im) => ({
- id: im.identity.id,
- primary: im.identity.name,
- secondary: im.identity.authMethods?.[0] ?? undefined
- }))
- .filter((i) => !norm || i.primary.toLowerCase().includes(norm));
- }
+ const identityOptions: Option[] = useMemo(() => {
+ const memberships = identitiesQuery.data?.identityMemberships ?? [];
+ return memberships
+ .filter((im) => !taken.has(`identity:${im.identity.id}`))
+ .map((im) => ({ value: im.identity.id, label: im.identity.name }));
+ }, [identitiesQuery.data, taken]);
+ const groupOptions: Option[] = useMemo(() => {
const groups = groupsQuery.data ?? [];
return groups
.filter((g) => !taken.has(`group:${g.id}`))
- .map((g) => ({
- id: g.id,
- primary: g.name,
- secondary: g.slug
- }))
- .filter(
- (i) =>
- !norm ||
- i.primary.toLowerCase().includes(norm) ||
- (i.secondary?.toLowerCase().includes(norm) ?? false)
- );
- }, [type, search, taken, usersQuery.data, identitiesQuery.data, groupsQuery.data]);
-
- const isLoadingByType: Record<ActorType, boolean> = {
- user: usersQuery.isPending,
- identity: identitiesQuery.isPending,
- group: groupsQuery.isPending
- };
- const isLoading = isLoadingByType[type];
+ .map((g) => ({ value: g.id, label: g.name }));
+ }, [groupsQuery.data, taken]);
const reset = () => {
setType("user");
- setSearch("");
- setSelectedActorId(null);
+ setSelectedUsers([]);
+ setSelectedIdentities([]);
+ setSelectedGroups([]);
setRole("operator");
};
@@ -156,27 +162,104 @@ export const AddApplicationMemberModal = ({
onOpenChange(open);
};
- const handleTypeChange = (next: ActorType) => {
- setType(next);
- setSelectedActorId(null);
- setSearch("");
+ const submitUsers = async () => {
+ if (selectedUsers.length === 0) return;
+ const orgUsers = usersQuery.data ?? [];
+ const existing = selectedUsers.filter((u) => !u.isNew);
+ const newInviteEmails = selectedUsers.filter((u) => u.isNew).map((u) => u.value);
+
+ let invitedMemberships: CertManagerInviteResponse["memberships"] = [];
+ if (newInviteEmails.length > 0 || existing.length > 0) {
+ const usernames = [
+ ...newInviteEmails,
+ ...existing
+ .map((u) => {
+ const o = orgUsers.find((x) => x.user.id === u.value);
+ return o?.user.username || o?.user.email || null;
+ })
+ .filter((x): x is string => Boolean(x))
+ ];
+ const { data } = await apiRequest.post<CertManagerInviteResponse>(
+ "/api/v1/cert-manager/access/users",
+ { usernames, roleSlugs: ["member"] }
+ );
+ invitedMemberships = data.memberships ?? [];
+ }
+
+ const userIds: string[] = [];
+ existing.forEach((u) => userIds.push(u.value));
+ if (newInviteEmails.length > 0) {
+ const refreshed = (await usersQuery.refetch()).data ?? [];
+ newInviteEmails.forEach((email) => {
+ const fromResponse = invitedMemberships.find((m) => Boolean(m.userId));
+ const fromOrg = refreshed.find(
+ (o) => o.user.email === email || o.user.username === email || o.inviteEmail === email
+ );
+ if (fromOrg?.user.id) userIds.push(fromOrg.user.id);
+ else if (fromResponse?.userId) userIds.push(fromResponse.userId);
+ });
+ }
+
+ await runSequential(userIds, async (userId) => {
+ await addMember.mutateAsync({ applicationId, userId, role });
+ });
+ };
+
+ const submitIdentities = async () => {
+ if (selectedIdentities.length === 0) return;
+ const identityIds: string[] = [];
+ await runSequential(selectedIdentities, async (item) => {
+ if (item.isNew) {
+ const created = await createIdentity.mutateAsync({
+ organizationId: orgId,
+ name: item.value,
+ hasDeleteProtection: false
+ });
+ identityIds.push(created.id);
+ } else {
+ identityIds.push(item.value);
+ }
+ });
+
+ const idsNeedingProjectMembership = identityIds.filter(
+ (id) => !identityIdsAlreadyInProject.has(id)
+ );
+ await runSequential(idsNeedingProjectMembership, async (identityId) => {
+ await addIdentityToProject.mutateAsync({
+ identityId,
+ projectId: "",
+ projectType: ProjectType.CertificateManager,
+ role: "member"
+ });
+ });
+
+ await runSequential(identityIds, async (identityId) => {
+ await addMember.mutateAsync({ applicationId, identityId, role });
+ });
+ };
+
+ const submitGroups = async () => {
+ if (selectedGroups.length === 0) return;
+ await runSequential(selectedGroups, async (item) => {
+ await addMember.mutateAsync({ applicationId, groupId: item.value, role });
+ });
};
const handleSubmit = async () => {
- if (!selectedActorId) return;
+ setSubmitting(true);
try {
- await addMember.mutateAsync({
- applicationId,
- role,
- userId: type === "user" ? selectedActorId : undefined,
- identityId: type === "identity" ? selectedActorId : undefined,
- groupId: type === "group" ? selectedActorId : undefined
- });
- createNotification({ type: "success", text: "Member added" });
+ if (type === "user") await submitUsers();
+ if (type === "identity") await submitIdentities();
+ if (type === "group") await submitGroups();
+ createNotification({ type: "success", text: "Members added" });
handleClose(false);
} catch (err) {
- const detail = err instanceof Error ? err.message : "Failed to add member.";
- createNotification({ type: "error", text: detail });
+ createNotification({
+ type: "error",
+ text: err instanceof Error ? err.message : "Failed to add members"
+ });
+ } finally {
+ setSubmitting(false);
}
};
@@ -186,17 +269,28 @@ export const AddApplicationMemberModal = ({
{ value: "group", label: "Groups", icon: UsersIcon }
];
+ const isEmail = (s: string) => z.string().email().safeParse(s).success;
+ const isIdentityName = (s: string) => s.trim().length > 0;
+
+ const selectedByType: Record<ActorType, number> = {
+ user: selectedUsers.length,
+ identity: selectedIdentities.length,
+ group: selectedGroups.length
+ };
+ const selectedCount = selectedByType[type];
+
return (
<Dialog open={isOpen} onOpenChange={handleClose}>
- <DialogContent className="max-w-2xl">
+ <DialogContent className="max-w-2xl overflow-visible">
<DialogHeader>
<DialogTitle>Add Member</DialogTitle>
<DialogDescription>
- Grant access to this Application. Only organization members are eligible.
+ Grant access to this Application. Select one or more existing org members to attach
+ them, or type a new email/identity name to create and attach in one step.
</DialogDescription>
</DialogHeader>
- <div className="space-y-3">
+ <div className="space-y-4">
<div className="flex gap-1 rounded-md border border-mineshaft-600 bg-mineshaft-800 p-1">
{TYPE_OPTIONS.map((opt) => {
const Icon = opt.icon;
@@ -205,7 +299,7 @@ export const AddApplicationMemberModal = ({
<button
key={opt.value}
type="button"
- onClick={() => handleTypeChange(opt.value)}
+ onClick={() => setType(opt.value)}
className={twMerge(
"flex flex-1 items-center justify-center gap-2 rounded px-3 py-1.5 text-sm transition-colors",
active
@@ -220,75 +314,73 @@ export const AddApplicationMemberModal = ({
})}
</div>
- <InputGroup>
- <InputGroupAddon>
- <SearchIcon />
- </InputGroupAddon>
- <InputGroupInput
- value={search}
- onChange={(e) => setSearch(e.target.value)}
- placeholder={PLACEHOLDER[type]}
- />
- </InputGroup>
-
- <div className="max-h-72 overflow-y-auto rounded-md border border-border">
- {isLoading && (
- <div className="flex items-center justify-center p-6">
- <Spinner />
- </div>
- )}
- {!isLoading && items.length === 0 && (
- <Empty>
- <EmptyHeader>
- <EmptyTitle>Nothing to add</EmptyTitle>
- <EmptyDescription>
- Every eligible {type} is already a member of this Application.
- </EmptyDescription>
- </EmptyHeader>
- </Empty>
- )}
- {!isLoading && items.length > 0 && (
- <Table>
- <TableHeader>
- <TableRow>
- <TableHead className="w-full">Name</TableHead>
- <TableHead className="w-10 text-right">Selected</TableHead>
- </TableRow>
- </TableHeader>
- <TableBody>
- {items.map((item) => {
- const isSelected = selectedActorId === item.id;
- return (
- <TableRow
- key={item.id}
- onClick={() => setSelectedActorId(isSelected ? null : item.id)}
- className={twMerge(
- "cursor-pointer",
- isSelected && "bg-mineshaft-700 hover:bg-mineshaft-700"
- )}
- >
- <TableCell isTruncatable>
- <div className="min-w-0">
- <div className="truncate">{item.primary}</div>
- {item.secondary ? (
- <div className="truncate text-xs text-accent">{item.secondary}</div>
- ) : null}
- </div>
- </TableCell>
- <TableCell className="text-right" onClick={(e) => e.stopPropagation()}>
- <Checkbox
- isChecked={isSelected}
- onCheckedChange={() => setSelectedActorId(isSelected ? null : item.id)}
- aria-label={`Select ${item.primary}`}
- />
- </TableCell>
- </TableRow>
- );
- })}
- </TableBody>
- </Table>
- )}
- </div>
+ {type === "user" && (
+ <FormControl
+ label="Users"
+ helperText="Pick existing organization members or type a new email to invite + add."
+ >
+ <CreatableSelect
+ isMulti
+ isLoading={usersQuery.isPending}
+ options={userOptions}
+ value={selectedUsers}
+ onChange={(v) => setSelectedUsers((v ?? []) as Option[])}
+ placeholder="Select users or type an email…"
+ onCreateOption={(input) => {
+ if (!isEmail(input)) return;
+ setSelectedUsers((prev) => [
+ ...prev,
+ { value: input, label: input, isNew: true }
+ ]);
+ }}
+ isValidNewOption={(input) => isEmail(input)}
+ formatCreateLabel={(input) => `Invite "${input}"`}
+ noOptionsMessage={NoUserOptions}
+ />
+ </FormControl>
+ )}
+
+ {type === "identity" && (
+ <FormControl
+ label="Machine Identities"
+ helperText="Pick existing identities or type a new name to create + add."
+ >
+ <CreatableSelect
+ isMulti
+ isLoading={identitiesQuery.isPending}
+ options={identityOptions}
+ value={selectedIdentities}
+ onChange={(v) => setSelectedIdentities((v ?? []) as Option[])}
+ placeholder="Select identities or type a new name…"
+ onCreateOption={(input) => {
+ if (!isIdentityName(input)) return;
+ setSelectedIdentities((prev) => [
+ ...prev,
+ { value: input.trim(), label: input.trim(), isNew: true }
+ ]);
+ }}
+ isValidNewOption={(input) => isIdentityName(input)}
+ formatCreateLabel={(input) => `Create identity "${input}"`}
+ noOptionsMessage={NoIdentityOptions}
+ />
+ </FormControl>
+ )}
+
+ {type === "group" && (
+ <FormControl
+ label="Groups"
+ helperText="Pick one or more organization groups to grant access through."
+ >
+ <FilterableSelect
+ isMulti
+ isLoading={groupsQuery.isPending}
+ options={groupOptions}
+ value={selectedGroups}
+ onChange={(v) => setSelectedGroups((v ?? []) as Option[])}
+ placeholder="Select groups…"
+ />
+ </FormControl>
+ )}
<div className="flex items-center gap-2">
<span className="text-sm text-accent">Role:</span>
@@ -297,9 +389,11 @@ export const AddApplicationMemberModal = ({
<SelectValue />
</SelectTrigger>
<SelectContent>
- <SelectItem value="admin">Admin</SelectItem>
- <SelectItem value="operator">Operator</SelectItem>
- <SelectItem value="auditor">Auditor</SelectItem>
+ {APP_ROLES.map((r) => (
+ <SelectItem key={r.slug} value={r.slug}>
+ {r.label}
+ </SelectItem>
+ ))}
</SelectContent>
</Select>
</div>
@@ -311,11 +405,11 @@ export const AddApplicationMemberModal = ({
</Button>
<Button
variant="project"
- isDisabled={!selectedActorId || addMember.isPending}
- isPending={addMember.isPending}
+ isDisabled={selectedCount === 0 || submitting}
+ isPending={submitting}
onClick={handleSubmit}
>
- Add Member
+ Add Member{selectedCount > 1 ? "s" : ""}
</Button>
</DialogFooter>
</DialogContent>
diff --git a/frontend/src/pages/cert-manager/ApplicationDetailsByIDPage/components/ApplicationSettingsTab.tsx b/frontend/src/pages/cert-manager/ApplicationDetailsByIDPage/components/ApplicationSettingsTab.tsx
index 4fc1e3e46a..5c52de936c 100644
--- a/frontend/src/pages/cert-manager/ApplicationDetailsByIDPage/components/ApplicationSettingsTab.tsx
+++ b/frontend/src/pages/cert-manager/ApplicationDetailsByIDPage/components/ApplicationSettingsTab.tsx
@@ -465,7 +465,7 @@ export const ApplicationSettingsTab = ({ application, profiles }: Props) => {
return (
<div className="grid grid-cols-1 gap-4 lg:grid-cols-12">
- <div className="space-y-4 lg:col-span-3">
+ <div className="space-y-4 lg:order-2 lg:col-span-3">
<Card>
<CardHeader className="grid-cols-[1fr_auto]">
<CardTitle>General</CardTitle>
@@ -498,7 +498,7 @@ export const ApplicationSettingsTab = ({ application, profiles }: Props) => {
</Card>
</div>
- <div className="space-y-4 lg:col-span-9">
+ <div className="space-y-4 lg:order-1 lg:col-span-9">
<Card>
<CardHeader>
<CardTitle>Enrollment Methods</CardTitle>
diff --git a/frontend/src/pages/cert-manager/ApplicationDetailsByIDPage/components/ApplicationSyncsTab.tsx b/frontend/src/pages/cert-manager/ApplicationDetailsByIDPage/components/ApplicationSyncsTab.tsx
index fcdb3a4808..5f0094dd7c 100644
--- a/frontend/src/pages/cert-manager/ApplicationDetailsByIDPage/components/ApplicationSyncsTab.tsx
+++ b/frontend/src/pages/cert-manager/ApplicationDetailsByIDPage/components/ApplicationSyncsTab.tsx
@@ -2,7 +2,6 @@ import { useMemo, useState } from "react";
import { PlusIcon } from "lucide-react";
import { CreatePkiSyncModal } from "@app/components/pki-syncs";
-import { Spinner } from "@app/components/v2";
import {
Button,
Card,
@@ -10,7 +9,8 @@ import {
CardContent,
CardDescription,
CardHeader,
- CardTitle
+ CardTitle,
+ PageLoader
} from "@app/components/v3";
import { useListPkiSyncs } from "@app/hooks/api/pkiSyncs";
@@ -48,9 +48,7 @@ export const ApplicationSyncsTab = ({ applicationId, applicationName, projectId
</CardHeader>
<CardContent>
{isPending ? (
- <div className="flex items-center justify-center p-8">
- <Spinner />
- </div>
+ <PageLoader />
) : (
<PkiSyncsTable pkiSyncs={applicationSyncs} applicationName={applicationName} />
)}
diff --git a/frontend/src/pages/cert-manager/ApplicationDetailsByIDPage/components/ConfigureEnrollmentModal.tsx b/frontend/src/pages/cert-manager/ApplicationDetailsByIDPage/components/ConfigureEnrollmentModal.tsx
index 443f3b1fd1..787beb120a 100644
--- a/frontend/src/pages/cert-manager/ApplicationDetailsByIDPage/components/ConfigureEnrollmentModal.tsx
+++ b/frontend/src/pages/cert-manager/ApplicationDetailsByIDPage/components/ConfigureEnrollmentModal.tsx
@@ -2,17 +2,25 @@ import { useEffect, useState } from "react";
import { Controller, useForm } from "react-hook-form";
import { faCheck, faCopy, faDownload } from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
+import { Plus } from "lucide-react";
import { createNotification } from "@app/components/notifications";
import { Spinner, Tab, TabList, TabPanel, Tabs } from "@app/components/v2";
import {
- Badge,
Button,
Dialog,
DialogContent,
DialogDescription,
DialogHeader,
DialogTitle,
+ DropdownMenu,
+ DropdownMenuContent,
+ DropdownMenuItem,
+ DropdownMenuTrigger,
+ Empty,
+ EmptyDescription,
+ EmptyHeader,
+ EmptyTitle,
Field,
FieldContent,
FieldDescription,
@@ -150,7 +158,7 @@ const ApiPanel = ({
return (
<div className="space-y-4">
<p className="text-sm text-mineshaft-300">
- API enrollment lets clients request certificates by calling the project API with this
+ API enrollment lets clients request certificates by calling the Infisical API with this
profile.
</p>
<Controller
@@ -789,6 +797,22 @@ const ScepPanel = ({
);
};
+type EnrollmentMethod = "api" | "est" | "acme" | "scep";
+
+const METHOD_LABELS: Record<EnrollmentMethod, string> = {
+ api: "API",
+ est: "EST",
+ acme: "ACME",
+ scep: "SCEP"
+};
+
+const METHOD_DESCRIPTIONS: Record<EnrollmentMethod, string> = {
+ api: "Clients call the Infisical API directly to request certificates.",
+ est: "Clients use the EST protocol (RFC 7030) over HTTPS.",
+ acme: "Clients use the ACME protocol (RFC 8555) — same flow as Let's Encrypt.",
+ scep: "Network devices use the SCEP protocol over HTTPS."
+};
+
export const ConfigureEnrollmentModal = ({
isOpen,
onOpenChange,
@@ -798,6 +822,51 @@ export const ConfigureEnrollmentModal = ({
const profileId = profile?.profileId ?? "";
const { data, isLoading } = useGetPkiApplicationEnrollment(applicationId, profileId);
+ const configuredMethods: EnrollmentMethod[] = [];
+ if (data?.api) configuredMethods.push("api");
+ if (data?.estConfigured) configuredMethods.push("est");
+ if (data?.acmeConfigured) configuredMethods.push("acme");
+ if (data?.scepConfigured) configuredMethods.push("scep");
+
+ const [pendingMethod, setPendingMethod] = useState<EnrollmentMethod | null>(null);
+ const [activeTab, setActiveTab] = useState<EnrollmentMethod | "">("");
+
+ const ALL_ORDER: EnrollmentMethod[] = ["api", "est", "acme", "scep"];
+ const visibleMethods = ALL_ORDER.filter(
+ (m) => configuredMethods.includes(m) || pendingMethod === m
+ );
+ const addableMethods = ALL_ORDER.filter(
+ (m) => !configuredMethods.includes(m) && pendingMethod !== m
+ );
+
+ useEffect(() => {
+ if (!isOpen) {
+ setPendingMethod(null);
+ setActiveTab("");
+ }
+ }, [isOpen, profileId]);
+
+ useEffect(() => {
+ if (visibleMethods.length === 0) {
+ setActiveTab("");
+ return;
+ }
+ if (!activeTab || !visibleMethods.includes(activeTab as EnrollmentMethod)) {
+ setActiveTab(visibleMethods[0]);
+ }
+ }, [visibleMethods, activeTab]);
+
+ useEffect(() => {
+ if (pendingMethod && configuredMethods.includes(pendingMethod)) {
+ setPendingMethod(null);
+ }
+ }, [pendingMethod, data]);
+
+ const handleAdd = (method: EnrollmentMethod) => {
+ setPendingMethod(method);
+ setActiveTab(method);
+ };
+
return (
<Dialog open={isOpen} onOpenChange={onOpenChange}>
<DialogContent className="max-w-2xl overflow-visible">
@@ -816,67 +885,101 @@ export const ConfigureEnrollmentModal = ({
<Spinner size="sm" />
</div>
) : (
- <Tabs defaultValue="api">
- <TabList>
- <Tab value="api">
- <span className="inline-flex items-center gap-2">
- API
- {data?.api ? <Badge variant="success">active</Badge> : null}
- </span>
- </Tab>
- <Tab value="est">
- <span className="inline-flex items-center gap-2">
- EST
- {data?.estConfigured ? <Badge variant="success">active</Badge> : null}
- </span>
- </Tab>
- <Tab value="acme">
- <span className="inline-flex items-center gap-2">
- ACME
- {data?.acmeConfigured ? <Badge variant="success">active</Badge> : null}
- </span>
- </Tab>
- <Tab value="scep">
- <span className="inline-flex items-center gap-2">
- SCEP
- {data?.scepConfigured ? <Badge variant="success">active</Badge> : null}
- </span>
- </Tab>
- </TabList>
- <TabPanel value="api">
- <ApiPanel
- applicationId={applicationId}
- profileId={profileId}
- enabled={Boolean(data?.api)}
- initial={data?.api ?? null}
- />
- </TabPanel>
- <TabPanel value="est">
- <EstPanel
- applicationId={applicationId}
- profileId={profileId}
- enabled={Boolean(data?.estConfigured)}
- initial={data?.est ?? null}
- />
- </TabPanel>
- <TabPanel value="acme">
- <AcmePanel
- applicationId={applicationId}
- profileId={profileId}
- enabled={Boolean(data?.acmeConfigured)}
- initial={data?.acme ?? null}
- />
- </TabPanel>
- <TabPanel value="scep">
- <ScepPanel
- applicationId={applicationId}
- profileId={profileId}
- profileSlug={profile?.profileSlug ?? ""}
- enabled={Boolean(data?.scepConfigured)}
- initial={data?.scep ?? null}
- />
- </TabPanel>
- </Tabs>
+ <>
+ <div className="flex items-center justify-between gap-2 border-b border-border">
+ {visibleMethods.length > 0 ? (
+ <Tabs value={activeTab} onValueChange={(v) => setActiveTab(v as EnrollmentMethod)}>
+ <TabList className="border-b-0">
+ {visibleMethods.map((m) => (
+ <Tab key={m} value={m}>
+ {METHOD_LABELS[m]}
+ </Tab>
+ ))}
+ </TabList>
+ </Tabs>
+ ) : (
+ <div />
+ )}
+ {addableMethods.length > 0 ? (
+ <DropdownMenu>
+ <DropdownMenuTrigger asChild>
+ <Button variant="outline" size="sm" className="mb-2">
+ <Plus className="size-4" />
+ Add enrollment method
+ </Button>
+ </DropdownMenuTrigger>
+ <DropdownMenuContent align="end">
+ {addableMethods.map((m) => (
+ <DropdownMenuItem key={m} onClick={() => handleAdd(m)}>
+ <div className="flex flex-col">
+ <span className="font-medium">{METHOD_LABELS[m]}</span>
+ <span className="text-muted-foreground text-xs">
+ {METHOD_DESCRIPTIONS[m]}
+ </span>
+ </div>
+ </DropdownMenuItem>
+ ))}
+ </DropdownMenuContent>
+ </DropdownMenu>
+ ) : null}
+ </div>
+
+ {visibleMethods.length === 0 ? (
+ <Empty className="border">
+ <EmptyHeader>
+ <EmptyTitle>No enrollment methods configured</EmptyTitle>
+ <EmptyDescription>
+ Click <span className="font-medium">Add enrollment method</span> above to let
+ clients request certificates from this Profile.
+ </EmptyDescription>
+ </EmptyHeader>
+ </Empty>
+ ) : (
+ <Tabs value={activeTab} onValueChange={(v) => setActiveTab(v as EnrollmentMethod)}>
+ {visibleMethods.includes("api") ? (
+ <TabPanel value="api">
+ <ApiPanel
+ applicationId={applicationId}
+ profileId={profileId}
+ enabled={Boolean(data?.api)}
+ initial={data?.api ?? null}
+ />
+ </TabPanel>
+ ) : null}
+ {visibleMethods.includes("est") ? (
+ <TabPanel value="est">
+ <EstPanel
+ applicationId={applicationId}
+ profileId={profileId}
+ enabled={Boolean(data?.estConfigured)}
+ initial={data?.est ?? null}
+ />
+ </TabPanel>
+ ) : null}
+ {visibleMethods.includes("acme") ? (
+ <TabPanel value="acme">
+ <AcmePanel
+ applicationId={applicationId}
+ profileId={profileId}
+ enabled={Boolean(data?.acmeConfigured)}
+ initial={data?.acme ?? null}
+ />
+ </TabPanel>
+ ) : null}
+ {visibleMethods.includes("scep") ? (
+ <TabPanel value="scep">
+ <ScepPanel
+ applicationId={applicationId}
+ profileId={profileId}
+ profileSlug={profile?.profileSlug ?? ""}
+ enabled={Boolean(data?.scepConfigured)}
+ initial={data?.scep ?? null}
+ />
+ </TabPanel>
+ ) : null}
+ </Tabs>
+ )}
+ </>
)}
</DialogContent>
</Dialog>
diff --git a/frontend/src/pages/cert-manager/ApplicationsPage/ApplicationsPage.tsx b/frontend/src/pages/cert-manager/ApplicationsPage/ApplicationsPage.tsx
index 4c2a70b818..d884e0c6e4 100644
--- a/frontend/src/pages/cert-manager/ApplicationsPage/ApplicationsPage.tsx
+++ b/frontend/src/pages/cert-manager/ApplicationsPage/ApplicationsPage.tsx
@@ -1,16 +1,9 @@
import { Helmet } from "react-helmet";
import { useNavigate, useParams } from "@tanstack/react-router";
-import {
- Hexagon,
- InfoIcon,
- MoreHorizontalIcon,
- PencilIcon,
- PlusIcon,
- Trash2Icon
-} from "lucide-react";
+import { InfoIcon, MoreHorizontalIcon, PencilIcon, PlusIcon, Trash2Icon } from "lucide-react";
import { createNotification } from "@app/components/notifications";
-import { DeleteActionModal, PageHeader, Spinner } from "@app/components/v2";
+import { DeleteActionModal, PageHeader } from "@app/components/v2";
import {
Button,
Card,
@@ -27,6 +20,8 @@ import {
EmptyHeader,
EmptyTitle,
IconButton,
+ PageLoader,
+ ResourceIcon,
Table,
TableBody,
TableCell,
@@ -60,11 +55,7 @@ export const ApplicationsPage = () => {
const renderApplications = () => {
if (isPending) {
- return (
- <div className="flex items-center justify-center p-8">
- <Spinner />
- </div>
- );
+ return <PageLoader />;
}
if (!applications || applications.length === 0) {
return (
@@ -103,7 +94,7 @@ export const ApplicationsPage = () => {
>
<TableCell className="w-full">
<div className="flex items-center gap-x-2 font-mono">
- <Hexagon className="size-4 shrink-0 text-primary" strokeWidth={1.75} />
+ <ResourceIcon className="size-4 shrink-0 text-primary" />
<span>{app.name}</span>
{app.description?.length ? (
<Tooltip>
@@ -170,6 +161,7 @@ export const ApplicationsPage = () => {
<div className="mx-auto mb-6 w-full max-w-8xl">
<PageHeader
scope={ProjectType.CertificateManager}
+ icon={ResourceIcon}
title="Applications"
description="Applications attach one or more Profiles and a team. Each Application has its own members, roles, certificates, alerts, and approval policies."
/>
diff --git a/frontend/src/pages/cert-manager/CertManagerAccessPage/CertManagerAccessPage.tsx b/frontend/src/pages/cert-manager/CertManagerAccessPage/CertManagerAccessPage.tsx
index 4654f305fc..250bc78230 100644
--- a/frontend/src/pages/cert-manager/CertManagerAccessPage/CertManagerAccessPage.tsx
+++ b/frontend/src/pages/cert-manager/CertManagerAccessPage/CertManagerAccessPage.tsx
@@ -1,7 +1,8 @@
import { Helmet } from "react-helmet";
import { useNavigate, useParams, useSearch } from "@tanstack/react-router";
-import { EmptyState, PageHeader, Spinner, Tab, TabList, TabPanel, Tabs } from "@app/components/v2";
+import { EmptyState, PageHeader, Tab, TabList, TabPanel, Tabs } from "@app/components/v2";
+import { PageLoader } from "@app/components/v3";
import { useOrganization } from "@app/context";
import { useGetOrgUsers } from "@app/hooks/api";
import { ProjectType } from "@app/hooks/api/projects/types";
@@ -35,11 +36,7 @@ export const CertManagerAccessPage = () => {
const renderUsersPanel = () => {
if (isPending) {
- return (
- <div className="flex items-center justify-center p-6">
- <Spinner />
- </div>
- );
+ return <PageLoader />;
}
if (certManagerUsers.length === 0) {
return (
diff --git a/frontend/src/pages/cert-manager/CertificatesPage/components/CertificatesSection.tsx b/frontend/src/pages/cert-manager/CertificatesPage/components/CertificatesSection.tsx
index 582108d58a..440f578c67 100644
--- a/frontend/src/pages/cert-manager/CertificatesPage/components/CertificatesSection.tsx
+++ b/frontend/src/pages/cert-manager/CertificatesPage/components/CertificatesSection.tsx
@@ -128,9 +128,7 @@ export const CertificatesSection = ({
Certificates
<DocumentationLinkBadge href="https://infisical.com/docs/documentation/platform/pki/certificates/overview" />
</CardTitle>
- <CardDescription>
- View, filter, and manage all certificates across your project.
- </CardDescription>
+ <CardDescription>View, filter, and manage all certificates.</CardDescription>
<CardAction>
<ProjectPermissionCan
I={ProjectPermissionCertificateActions.Import}
diff --git a/frontend/src/pages/cert-manager/IntegrationsListPage/components/PkiSyncsTab/PkiSyncTable/PkiSyncsTable.tsx b/frontend/src/pages/cert-manager/IntegrationsListPage/components/PkiSyncsTab/PkiSyncTable/PkiSyncsTable.tsx
index 7a13c507e5..db91cd187e 100644
--- a/frontend/src/pages/cert-manager/IntegrationsListPage/components/PkiSyncsTab/PkiSyncTable/PkiSyncsTable.tsx
+++ b/frontend/src/pages/cert-manager/IntegrationsListPage/components/PkiSyncsTab/PkiSyncTable/PkiSyncsTable.tsx
@@ -416,9 +416,7 @@ export const PkiSyncsTable = ({ pkiSyncs, applicationName }: Props) => {
)}
{!filteredPkiSyncs?.length && (
<EmptyState
- title={
- pkiSyncs.length ? "No syncs match search..." : "This project has no syncs configured"
- }
+ title={pkiSyncs.length ? "No syncs match search..." : "No syncs configured yet"}
icon={pkiSyncs.length ? faSearch : faRotate}
/>
)}
diff --git a/frontend/src/pages/cert-manager/IntegrationsListPage/components/PkiSyncsTab/PkiSyncsTab.tsx b/frontend/src/pages/cert-manager/IntegrationsListPage/components/PkiSyncsTab/PkiSyncsTab.tsx
index cd6cb3fc83..542a9b76e5 100644
--- a/frontend/src/pages/cert-manager/IntegrationsListPage/components/PkiSyncsTab/PkiSyncsTab.tsx
+++ b/frontend/src/pages/cert-manager/IntegrationsListPage/components/PkiSyncsTab/PkiSyncsTab.tsx
@@ -2,8 +2,7 @@ import { useCallback, useEffect, useMemo } from "react";
import { useNavigate, useSearch } from "@tanstack/react-router";
import { CreatePkiSyncModal } from "@app/components/pki-syncs";
-import { Spinner } from "@app/components/v2";
-import { DocumentationLinkBadge } from "@app/components/v3";
+import { DocumentationLinkBadge, PageLoader } from "@app/components/v3";
import { ROUTE_PATHS } from "@app/const/routes";
import { useOrganization, useProject } from "@app/context";
import { usePopUp } from "@app/hooks";
@@ -87,12 +86,7 @@ export const PkiSyncsTab = () => {
}
);
- if (isPkiSyncsPending)
- return (
- <div className="flex h-[60vh] flex-col items-center justify-center gap-2">
- <Spinner />
- </div>
- );
+ if (isPkiSyncsPending) return <PageLoader />;
return (
<>
diff --git a/frontend/src/pages/cert-manager/RequestsPage/RequestsPage.tsx b/frontend/src/pages/cert-manager/RequestsPage/RequestsPage.tsx
index c3bec25849..9c85895ac9 100644
--- a/frontend/src/pages/cert-manager/RequestsPage/RequestsPage.tsx
+++ b/frontend/src/pages/cert-manager/RequestsPage/RequestsPage.tsx
@@ -2,7 +2,7 @@ import { useMemo, useState } from "react";
import { Helmet } from "react-helmet";
import { useQuery } from "@tanstack/react-query";
import { Link, useNavigate, useParams, useSearch } from "@tanstack/react-router";
-import { SearchIcon } from "lucide-react";
+import { FilterIcon, SearchIcon } from "lucide-react";
import { PageHeader, Tab, TabList, TabPanel, Tabs } from "@app/components/v2";
import {
@@ -12,10 +12,16 @@ import {
CardDescription,
CardHeader,
CardTitle,
+ DropdownMenu,
+ DropdownMenuCheckboxItem,
+ DropdownMenuContent,
+ DropdownMenuLabel,
+ DropdownMenuTrigger,
Empty,
EmptyDescription,
EmptyHeader,
EmptyTitle,
+ IconButton,
InputGroup,
InputGroupAddon,
InputGroupInput,
@@ -37,23 +43,15 @@ import {
import { useListPkiApplications } from "@app/hooks/api/pkiApplications";
import { ProjectType } from "@app/hooks/api/projects/types";
-type StatusFilter = "pending" | "approved" | "rejected" | "all";
+type StatusFilter = "pending" | "approved" | "rejected";
-const STATUS_TABS: {
+const STATUS_FILTERS: {
key: StatusFilter;
label: string;
matches: (s: ApprovalRequestStatus) => boolean;
}[] = [
- {
- key: "pending",
- label: "Pending",
- matches: (s) => s === ApprovalRequestStatus.Pending
- },
- {
- key: "approved",
- label: "Approved",
- matches: (s) => s === ApprovalRequestStatus.Approved
- },
+ { key: "pending", label: "Pending", matches: (s) => s === ApprovalRequestStatus.Pending },
+ { key: "approved", label: "Approved", matches: (s) => s === ApprovalRequestStatus.Approved },
{
key: "rejected",
label: "Rejected",
@@ -61,8 +59,7 @@ const STATUS_TABS: {
s === ApprovalRequestStatus.Rejected ||
s === ApprovalRequestStatus.Cancelled ||
s === ApprovalRequestStatus.Expired
- },
- { key: "all", label: "All", matches: () => true }
+ }
];
const STATUS_BADGE: Record<
@@ -106,10 +103,22 @@ export const RequestsPage = () => {
const navigate = useNavigate();
const selectedTab = search.selectedTab ?? "application-requests";
- const [activeStatus, setActiveStatus] = useState<StatusFilter>("pending");
+ const [statusFilters, setStatusFilters] = useState<Set<StatusFilter>>(
+ () => new Set<StatusFilter>(["pending"])
+ );
const [searchInput, setSearchInput] = useState("");
const [debouncedSearch] = useDebounce(searchInput, 300);
+ const toggleStatusFilter = (key: StatusFilter) => {
+ setStatusFilters((prev) => {
+ const next = new Set(prev);
+ if (next.has(key)) next.delete(key);
+ else next.add(key);
+ return next;
+ });
+ };
+ const isFiltered = statusFilters.size > 0;
+
const { data: requests = [], isPending: isRequestsLoading } = useQuery(
approvalRequestQuery.list({
policyType: ApprovalPolicyType.CertRequest,
@@ -125,11 +134,13 @@ export const RequestsPage = () => {
}, [apps]);
const filtered = useMemo(() => {
- const tab = STATUS_TABS.find((t) => t.key === activeStatus) ?? STATUS_TABS[0];
const norm = debouncedSearch.trim().toLowerCase();
+ const activeFilters = STATUS_FILTERS.filter((f) => statusFilters.has(f.key));
+ const matchesStatus = (s: ApprovalRequestStatus) =>
+ activeFilters.length === 0 || activeFilters.some((f) => f.matches(s));
return (requests as TApprovalRequest[])
- .filter((r) => tab.matches(r.status as ApprovalRequestStatus))
+ .filter((r) => matchesStatus(r.status as ApprovalRequestStatus))
.filter((r) => {
if (!norm) return true;
const cn = isCertRequestData(r.requestData)
@@ -145,15 +156,10 @@ export const RequestsPage = () => {
requester.toLowerCase().includes(norm)
);
});
- }, [requests, activeStatus, debouncedSearch]);
+ }, [requests, statusFilters, debouncedSearch]);
const counts = useMemo(() => {
- const result: Record<StatusFilter, number> = {
- pending: 0,
- approved: 0,
- rejected: 0,
- all: requests.length
- };
+ const result: Record<StatusFilter, number> = { pending: 0, approved: 0, rejected: 0 };
(requests as TApprovalRequest[]).forEach((r) => {
const s = r.status as ApprovalRequestStatus;
if (s === ApprovalRequestStatus.Pending) result.pending += 1;
@@ -209,135 +215,141 @@ export const RequestsPage = () => {
</CardDescription>
</CardHeader>
<CardContent>
- <Tabs
- value={activeStatus}
- onValueChange={(v) => setActiveStatus(v as StatusFilter)}
- >
- <TabList>
- {STATUS_TABS.map((t) => (
- <Tab key={t.key} value={t.key} variant="project">
- {t.label} ({counts[t.key]})
- </Tab>
- ))}
- </TabList>
- {STATUS_TABS.map((t) => (
- <TabPanel key={t.key} value={t.key}>
- <div className="my-4">
- <InputGroup>
- <InputGroupAddon>
- <SearchIcon />
- </InputGroupAddon>
- <InputGroupInput
- placeholder="Search by common name, profile, or requester…"
- value={searchInput}
- onChange={(e) => setSearchInput(e.target.value)}
- />
- </InputGroup>
- </div>
+ <div className="my-4 flex gap-2">
+ <InputGroup className="flex-1">
+ <InputGroupAddon>
+ <SearchIcon />
+ </InputGroupAddon>
+ <InputGroupInput
+ placeholder="Search by common name, profile, or requester…"
+ value={searchInput}
+ onChange={(e) => setSearchInput(e.target.value)}
+ />
+ </InputGroup>
+ <DropdownMenu>
+ <DropdownMenuTrigger asChild>
+ <IconButton
+ aria-label="Filter by status"
+ variant={isFiltered ? "project" : "outline"}
+ >
+ <FilterIcon className="size-4" />
+ </IconButton>
+ </DropdownMenuTrigger>
+ <DropdownMenuContent align="end">
+ <DropdownMenuLabel>Filter by status</DropdownMenuLabel>
+ {STATUS_FILTERS.map((f) => (
+ <DropdownMenuCheckboxItem
+ key={f.key}
+ checked={statusFilters.has(f.key)}
+ onClick={(e) => {
+ e.preventDefault();
+ toggleStatusFilter(f.key);
+ }}
+ >
+ {f.label} ({counts[f.key]})
+ </DropdownMenuCheckboxItem>
+ ))}
+ </DropdownMenuContent>
+ </DropdownMenu>
+ </div>
- {isRequestsLoading && (
- <Empty>
- <EmptyHeader>
- <EmptyTitle>Loading…</EmptyTitle>
- </EmptyHeader>
- </Empty>
- )}
- {!isRequestsLoading && filtered.length === 0 && (
- <Empty className="border">
- <EmptyHeader>
- <EmptyTitle>
- {activeStatus === "pending"
- ? "No requests pending review"
- : "No requests"}
- </EmptyTitle>
- <EmptyDescription>
- Cert-request approval workflows from any Application in this
- project will appear here.
- </EmptyDescription>
- </EmptyHeader>
- </Empty>
- )}
- {!isRequestsLoading && filtered.length > 0 && (
- <Table>
- <TableHeader>
- <TableRow>
- <TableHead>Common Name</TableHead>
- <TableHead>Profile</TableHead>
- <TableHead>Application</TableHead>
- <TableHead>Requester</TableHead>
- <TableHead>Status</TableHead>
- <TableHead>Requested</TableHead>
- </TableRow>
- </TableHeader>
- <TableBody>
- {filtered.map((r) => {
- const certData = isCertRequestData(r.requestData)
- ? r.requestData.requestData
- : null;
- const cn = certData?.certificateRequest?.commonName ?? "—";
- const profile = certData?.profileName ?? "—";
- const app = r.applicationId ? appById.get(r.applicationId) : null;
- const badge = STATUS_BADGE[r.status as ApprovalRequestStatus] ?? {
- label: r.status,
- variant: "neutral" as const
- };
+ {isRequestsLoading && (
+ <Empty>
+ <EmptyHeader>
+ <EmptyTitle>Loading…</EmptyTitle>
+ </EmptyHeader>
+ </Empty>
+ )}
+ {!isRequestsLoading && filtered.length === 0 && (
+ <Empty className="border">
+ <EmptyHeader>
+ <EmptyTitle>
+ {statusFilters.size === 1 && statusFilters.has("pending")
+ ? "No requests pending review"
+ : "No requests"}
+ </EmptyTitle>
+ <EmptyDescription>
+ Cert-request approval workflows from any Application will appear here.
+ </EmptyDescription>
+ </EmptyHeader>
+ </Empty>
+ )}
+ {!isRequestsLoading && filtered.length > 0 && (
+ <Table>
+ <TableHeader>
+ <TableRow>
+ <TableHead>Common Name</TableHead>
+ <TableHead>Profile</TableHead>
+ <TableHead>Application</TableHead>
+ <TableHead>Requester</TableHead>
+ <TableHead>Status</TableHead>
+ <TableHead>Requested</TableHead>
+ </TableRow>
+ </TableHeader>
+ <TableBody>
+ {filtered.map((r) => {
+ const certData = isCertRequestData(r.requestData)
+ ? r.requestData.requestData
+ : null;
+ const cn = certData?.certificateRequest?.commonName ?? "—";
+ const profile = certData?.profileName ?? "—";
+ const app = r.applicationId ? appById.get(r.applicationId) : null;
+ const badge = STATUS_BADGE[r.status as ApprovalRequestStatus] ?? {
+ label: r.status,
+ variant: "neutral" as const
+ };
- return (
- <TableRow
- key={r.id}
- className="cursor-pointer"
- onClick={() =>
- navigate({
- to: `/organizations/${orgId}/projects/cert-manager/${projectId}/approvals/${r.id}` as never,
- search: {
- policyType: ApprovalPolicyType.CertRequest,
- from: "root-requests"
- } as never
- } as never)
+ return (
+ <TableRow
+ key={r.id}
+ className="cursor-pointer"
+ onClick={() =>
+ navigate({
+ to: `/organizations/${orgId}/projects/cert-manager/${projectId}/approvals/${r.id}` as never,
+ search: {
+ policyType: ApprovalPolicyType.CertRequest,
+ from: "root-requests"
+ } as never
+ } as never)
+ }
+ >
+ <TableCell isTruncatable className="font-mono">
+ {cn}
+ </TableCell>
+ <TableCell className="font-mono text-xs">{profile}</TableCell>
+ <TableCell className="font-mono text-xs">
+ {app ? (
+ <Link
+ to={
+ `/organizations/${orgId}/projects/cert-manager/${projectId}/applications/${app.name}` as never
}
+ className="text-foreground hover:text-project"
+ onClick={(e) => e.stopPropagation()}
>
- <TableCell isTruncatable className="font-mono">
- {cn}
- </TableCell>
- <TableCell className="font-mono text-xs">{profile}</TableCell>
- <TableCell className="font-mono text-xs">
- {app ? (
- <Link
- to={
- `/organizations/${orgId}/projects/cert-manager/${projectId}/applications/${app.name}` as never
- }
- className="text-foreground hover:text-project"
- onClick={(e) => e.stopPropagation()}
- >
- {app.name}
- </Link>
- ) : (
- <span className="text-accent">—</span>
- )}
- </TableCell>
- <TableCell>
- <div>{r.requesterName || "—"}</div>
- {r.requesterEmail ? (
- <div className="text-xs text-accent">
- {r.requesterEmail}
- </div>
- ) : null}
- </TableCell>
- <TableCell>
- <Badge variant={badge.variant}>{badge.label}</Badge>
- </TableCell>
- <TableCell className="text-accent">
- {formatRelative(r.createdAt)}
- </TableCell>
- </TableRow>
- );
- })}
- </TableBody>
- </Table>
- )}
- </TabPanel>
- ))}
- </Tabs>
+ {app.name}
+ </Link>
+ ) : (
+ <span className="text-accent">—</span>
+ )}
+ </TableCell>
+ <TableCell>
+ <div>{r.requesterName || "—"}</div>
+ {r.requesterEmail ? (
+ <div className="text-xs text-accent">{r.requesterEmail}</div>
+ ) : null}
+ </TableCell>
+ <TableCell>
+ <Badge variant={badge.variant}>{badge.label}</Badge>
+ </TableCell>
+ <TableCell className="text-accent">
+ {formatRelative(r.createdAt)}
+ </TableCell>
+ </TableRow>
+ );
+ })}
+ </TableBody>
+ </Table>
+ )}
</CardContent>
</Card>
</TabPanel>
diff --git a/frontend/src/pages/cert-manager/SignerDetailPage/components/SigningOperationsTable.tsx b/frontend/src/pages/cert-manager/SignerDetailPage/components/SigningOperationsTable.tsx
index 5c1707c54f..45896dca6b 100644
--- a/frontend/src/pages/cert-manager/SignerDetailPage/components/SigningOperationsTable.tsx
+++ b/frontend/src/pages/cert-manager/SignerDetailPage/components/SigningOperationsTable.tsx
@@ -99,7 +99,7 @@ export const SigningOperationsTable = ({ signerId, projectId }: Props) => {
if (!op.actorMembershipId) {
createNotification({
type: "info",
- text: "This user is no longer a member of this project."
+ text: "This user is no longer a member of this organization."
});
return;
}
@@ -115,7 +115,7 @@ export const SigningOperationsTable = ({ signerId, projectId }: Props) => {
if (!op.actorName) {
createNotification({
type: "info",
- text: "This identity is no longer a member of this project."
+ text: "This identity is no longer a member of this organization."
});
return;
}
diff --git a/frontend/src/pages/organization/SettingsPage/components/OrgCertManagerTab/OrgCertManagerTab.tsx b/frontend/src/pages/organization/SettingsPage/components/OrgCertManagerTab/OrgCertManagerTab.tsx
index 774c8407ce..f103707a63 100644
--- a/frontend/src/pages/organization/SettingsPage/components/OrgCertManagerTab/OrgCertManagerTab.tsx
+++ b/frontend/src/pages/organization/SettingsPage/components/OrgCertManagerTab/OrgCertManagerTab.tsx
@@ -1,7 +1,6 @@
import { useState } from "react";
import { createNotification } from "@app/components/notifications";
-import { Spinner } from "@app/components/v2";
import {
Badge,
Button,
@@ -14,6 +13,7 @@ import {
EmptyDescription,
EmptyHeader,
EmptyTitle,
+ PageLoader,
Table,
TableBody,
TableCell,
@@ -48,11 +48,7 @@ export const OrgCertManagerTab = () => {
};
if (isPending || !data) {
- return (
- <div className="flex items-center justify-center p-8">
- <Spinner />
- </div>
- );
+ return <PageLoader />;
}
return (