Skip to content

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

improvement(ui): make certificate and signing operation rows real links (#8932)

Andrew Huang9391a6327ad1
diff --git a/frontend/src/pages/cert-manager/CertificatesPage/components/CertificatesTable.tsx b/frontend/src/pages/cert-manager/CertificatesPage/components/CertificatesTable.tsx
index be410ed0ef..52eb7db319 100644
--- a/frontend/src/pages/cert-manager/CertificatesPage/components/CertificatesTable.tsx
+++ b/frontend/src/pages/cert-manager/CertificatesPage/components/CertificatesTable.tsx
@@ -1,7 +1,6 @@
/* eslint-disable no-nested-ternary */
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
import { subject } from "@casl/ability";
-import { useNavigate } from "@tanstack/react-router";
import { format } from "date-fns";
import {
ArrowDownIcon,
@@ -44,6 +43,7 @@ import {
Popover,
PopoverContent,
PopoverTrigger,
+ RowLink,
Skeleton,
Table,
TableBody,
@@ -60,7 +60,6 @@ import {
ProjectPermissionCertificateActions,
ProjectPermissionPkiSyncActions,
ProjectPermissionSub,
- useOrganization,
useProject,
useProjectPermission,
useUser
@@ -92,6 +91,7 @@ import { useListWorkspaceCertificates } from "@app/hooks/api/projects";
import { useDebounce } from "@app/hooks/useDebounce";
import { UsePopUpState } from "@app/hooks/usePopUp";
+import { getCertManagerLink } from "../../cert-manager-link";
import { ActiveFilterChips } from "./ActiveFilterChips";
import { AssignCertificateToApplicationModal } from "./AssignCertificateToApplicationModal";
import {
@@ -271,8 +271,6 @@ export const CertificatesTable = ({
return () => clearTimeout(timeoutId);
}, [search]);
- const navigate = useNavigate();
- const { currentOrg } = useOrganization();
const { currentProject } = useProject();
const { permission, hasProjectRole } = useProjectPermission();
@@ -943,34 +941,32 @@ export const CertificatesTable = ({
!isExpired &&
!isExpiringWithinDay
);
- const { originalDisplayName } = getCertificateDisplayName(
+ const { originalDisplayName, isTruncated } = getCertificateDisplayName(
certificate,
64,
certificate.id
);
+ const detailLink = getCertManagerLink(
+ currentProject,
+ `certificates/${certificate.id}`,
+ applicationName ? { fromApplication: applicationName } : undefined
+ );
+
return (
- <TableRow
- className="group"
- key={`certificate-${certificate.id}`}
- onClick={() => {
- navigate({
- to: "/organizations/$orgId/cert-manager/certificates/$certificateId",
- params: {
- orgId: currentOrg.id,
- certificateId: certificate.id
- },
- search: applicationName ? { fromApplication: applicationName } : undefined
- });
- }}
- >
+ <TableRow key={`certificate-${certificate.id}`} linked>
{visibleColumns.has("sanCn") && (
<TableCell isTruncatable>
- <CertificateDisplayName
- cert={certificate}
- maxLength={64}
- fallback={certificate.id}
- />
+ <RowLink
+ {...detailLink}
+ title={isTruncated ? undefined : originalDisplayName}
+ >
+ <CertificateDisplayName
+ cert={certificate}
+ maxLength={64}
+ fallback={certificate.id}
+ />
+ </RowLink>
</TableCell>
)}
{visibleColumns.has("serialNumber") && (
@@ -1043,6 +1039,9 @@ export const CertificatesTable = ({
</TableCell>
)}
<TableCell>
+ {!visibleColumns.has("sanCn") && (
+ <RowLink {...detailLink} aria-label={`View ${originalDisplayName}`} />
+ )}
<div className="flex items-center justify-end gap-2">
<div
className={`transition-opacity ${(() => {
diff --git a/frontend/src/pages/cert-manager/SignerDetailPage/components/SigningOperationsTable.tsx b/frontend/src/pages/cert-manager/SignerDetailPage/components/SigningOperationsTable.tsx
index eda65e5b7a..062efc7608 100644
--- a/frontend/src/pages/cert-manager/SignerDetailPage/components/SigningOperationsTable.tsx
+++ b/frontend/src/pages/cert-manager/SignerDetailPage/components/SigningOperationsTable.tsx
@@ -1,9 +1,8 @@
import { useState } from "react";
-import { useNavigate } from "@tanstack/react-router";
+import { Link } from "@tanstack/react-router";
import { format } from "date-fns";
import { HardDriveIcon, UserIcon } from "lucide-react";
-import { createNotification } from "@app/components/notifications";
import {
Badge,
Button,
@@ -18,6 +17,7 @@ import {
EmptyHeader,
EmptyTitle,
Pagination,
+ RowLink,
Table,
TableBody,
TableCell,
@@ -28,7 +28,7 @@ import {
TooltipContent,
TooltipTrigger
} from "@app/components/v3";
-import { useOrganization } from "@app/context";
+import { useProject } from "@app/context";
import {
getSigningOperationStatusBadgeVariant,
SIGNER_TABLE_PAGE_SIZE,
@@ -40,6 +40,7 @@ import {
useListSigningOperations
} from "@app/hooks/api/signers";
+import { getCertManagerLink } from "../../cert-manager-link";
import { ConnectToSignerDrawer } from "./ConnectToSignerDrawer";
type Props = {
@@ -64,8 +65,7 @@ export const SigningOperationsTable = ({ signer, signerId }: Props) => {
const [page, setPage] = useState(1);
const [perPage, setPerPage] = useState(SIGNER_TABLE_PAGE_SIZE);
const [isConnectOpen, setIsConnectOpen] = useState(false);
- const navigate = useNavigate();
- const { currentOrg } = useOrganization();
+ const { currentProject } = useProject();
const { data, isLoading } = useListSigningOperations({
signerId,
@@ -76,44 +76,31 @@ export const SigningOperationsTable = ({ signer, signerId }: Props) => {
const operations = data?.operations ?? [];
const totalCount = data?.totalCount ?? 0;
- const handleActorClick = (op: TSigningOperation) => {
- if (op.actorType === SigningActorType.User) {
- if (!op.actorMembershipId) {
- createNotification({
- type: "info",
- text: "This user is no longer a member of this organization."
- });
- return;
- }
- navigate({
- to: "/organizations/$orgId/cert-manager/members/$membershipId",
- params: {
- orgId: currentOrg.id,
- membershipId: op.actorId
- }
- });
- } else if (op.actorType === SigningActorType.Identity) {
- if (!op.actorName) {
- createNotification({
- type: "info",
- text: "This identity is no longer a member of this organization."
- });
- return;
- }
- navigate({
- to: "/organizations/$orgId/cert-manager/identities/$identityId",
- params: {
- orgId: currentOrg.id,
- identityId: op.actorId
- }
- });
- }
- };
+ const renderActorName = (op: TSigningOperation) => {
+ const actorName = getActorDisplayName(op.actorType, op.actorName);
+ const linkClassName = "font-medium text-accent underline";
- const isActorClickable = (op: TSigningOperation) => {
- if (op.actorType === SigningActorType.User) return Boolean(op.actorMembershipId);
- if (op.actorType === SigningActorType.Identity) return Boolean(op.actorName);
- return false;
+ if (op.actorType === SigningActorType.User && op.actorMembershipId) {
+ return (
+ <Link
+ {...getCertManagerLink(currentProject, `members/${op.actorId}`)}
+ className={linkClassName}
+ >
+ {actorName}
+ </Link>
+ );
+ }
+ if (op.actorType === SigningActorType.Identity && op.actorName) {
+ return (
+ <Link
+ {...getCertManagerLink(currentProject, `identities/${op.actorId}`)}
+ className={linkClassName}
+ >
+ {actorName}
+ </Link>
+ );
+ }
+ return <span className="text-muted">{actorName}</span>;
};
return (
@@ -157,20 +144,18 @@ export const SigningOperationsTable = ({ signer, signerId }: Props) => {
operations.map((op) => (
<TableRow
key={op.id}
- className="cursor-pointer transition-colors hover:bg-surface-hover [&>td]:py-3"
- onClick={() =>
- navigate({
- to: "/organizations/$orgId/cert-manager/code-signing/$signerId/operations/$operationId",
- params: {
- orgId: currentOrg.id,
- signerId,
- operationId: op.id
- }
- })
- }
+ linked
+ className="transition-colors hover:bg-surface-hover [&>td]:py-3"
>
<TableCell>
- {format(new Date(op.createdAt), "MMM d, yyyy HH:mm:ss")}
+ <RowLink
+ {...getCertManagerLink(
+ currentProject,
+ `code-signing/${signerId}/operations/${op.id}`
+ )}
+ >
+ {format(new Date(op.createdAt), "MMM d, yyyy HH:mm:ss")}
+ </RowLink>
</TableCell>
<TableCell>
<Badge variant={getSigningOperationStatusBadgeVariant(op.status)}>
@@ -183,7 +168,7 @@ export const SigningOperationsTable = ({ signer, signerId }: Props) => {
<TableCell className="max-w-[120px] truncate font-mono text-xs">
{op.dataHash}
</TableCell>
- <TableCell onClick={(e) => e.stopPropagation()}>
+ <TableCell>
<Tooltip>
<TooltipTrigger asChild>
<div className="flex items-center gap-1.5">
@@ -192,19 +177,7 @@ export const SigningOperationsTable = ({ signer, signerId }: Props) => {
) : (
<HardDriveIcon className="size-3.5 text-muted" />
)}
- <button
- type="button"
- onClick={
- isActorClickable(op) ? () => handleActorClick(op) : undefined
- }
- className={
- isActorClickable(op)
- ? "cursor-pointer font-medium text-accent underline"
- : "text-muted"
- }
- >
- {getActorDisplayName(op.actorType, op.actorName)}
- </button>
+ {renderActorName(op)}
</div>
</TooltipTrigger>
<TooltipContent>{op.actorName ?? op.actorId}</TooltipContent>
diff --git a/frontend/src/pages/cert-manager/cert-manager-link.ts b/frontend/src/pages/cert-manager/cert-manager-link.ts
new file mode 100644
index 0000000000..2d9301d040
--- /dev/null
+++ b/frontend/src/pages/cert-manager/cert-manager-link.ts
@@ -0,0 +1,13 @@
+import { getInstancePinningLink } from "@app/helpers/project";
+import { Project } from "@app/hooks/api/projects/types";
+
+export const getCertManagerLink = (
+ project: Pick<Project, "id" | "type" | "orgId">,
+ path: string,
+ search?: Record<string, string>
+) => {
+ const pinnedLink = getInstancePinningLink(project.orgId, project, path);
+ if (!pinnedLink) throw new Error("The link needs a Certificate Manager project");
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
+ return { ...pinnedLink, search: search as any };
+};