Skip to content

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

improvement(cert-manager): make simple table rows real links (#8930)

Andrew Huang5a79c60cc59f
diff --git a/frontend/src/components/v3/generic/RowLink/RowLink.tsx b/frontend/src/components/v3/generic/RowLink/RowLink.tsx
index 69a767613e..4b4e55d37c 100644
--- a/frontend/src/components/v3/generic/RowLink/RowLink.tsx
+++ b/frontend/src/components/v3/generic/RowLink/RowLink.tsx
@@ -15,7 +15,7 @@ const rowLinkContainerClassName = cn(
);
const rowLinkClassName =
- "block truncate outline-0 after:absolute after:inset-0 after:content-[''] focus-visible:after:ring-2 focus-visible:after:ring-ring";
+ "block truncate outline-0 after:absolute after:inset-0 after:z-[1] after:content-[''] focus-visible:after:ring-2 focus-visible:after:ring-ring";
type RowLinkAnchorProps = React.ComponentProps<"a"> & { disabled?: boolean };
diff --git a/frontend/src/pages/cert-manager/AlertingPage/components/PkiCollectionTable.tsx b/frontend/src/pages/cert-manager/AlertingPage/components/PkiCollectionTable.tsx
index 98bd978cbf..22cd6b6116 100644
--- a/frontend/src/pages/cert-manager/AlertingPage/components/PkiCollectionTable.tsx
+++ b/frontend/src/pages/cert-manager/AlertingPage/components/PkiCollectionTable.tsx
@@ -1,6 +1,5 @@
import { faEllipsis } from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
-import { useNavigate } from "@tanstack/react-router";
import { ProjectPermissionCan } from "@app/components/permissions";
import {
@@ -12,6 +11,7 @@ import {
EmptyHeader,
EmptyTitle,
IconButton,
+ RowLink,
Table,
TableBody,
TableCell,
@@ -20,12 +20,8 @@ import {
TableRow,
TableSkeletonRows
} from "@app/components/v3";
-import {
- ProjectPermissionActions,
- ProjectPermissionSub,
- useOrganization,
- useProject
-} from "@app/context";
+import { ProjectPermissionActions, ProjectPermissionSub, useProject } from "@app/context";
+import { getInstancePinningLink } from "@app/helpers/project";
import { useListWorkspacePkiCollections } from "@app/hooks/api";
import { UsePopUpState } from "@app/hooks/usePopUp";
@@ -37,8 +33,6 @@ type Props = {
};
export const PkiCollectionTable = ({ handlePopUpOpen }: Props) => {
- const { currentOrg } = useOrganization();
- const navigate = useNavigate();
const { currentProject } = useProject();
const projectId = currentProject?.id || "";
@@ -71,19 +65,18 @@ export const PkiCollectionTable = ({ handlePopUpOpen }: Props) => {
{!isPending &&
data?.collections.map((pkiCollection) => {
return (
- <TableRow
- key={`pki-collection-${pkiCollection.id}`}
- onClick={() =>
- navigate({
- to: "/organizations/$orgId/cert-manager/pki-collections/$collectionId",
- params: {
- orgId: currentOrg.id,
- collectionId: pkiCollection.id
- }
- })
- }
- >
- <TableCell>{pkiCollection.name}</TableCell>
+ <TableRow key={`pki-collection-${pkiCollection.id}`} linked>
+ <TableCell>
+ <RowLink
+ {...getInstancePinningLink(
+ currentProject.orgId,
+ currentProject,
+ `pki-collections/${pkiCollection.id}`
+ )!}
+ >
+ {pkiCollection.name}
+ </RowLink>
+ </TableCell>
<TableCell>
{pkiCollection.description ? pkiCollection.description : "-"}
</TableCell>
diff --git a/frontend/src/pages/cert-manager/ApplicationsPage/ApplicationsPage.tsx b/frontend/src/pages/cert-manager/ApplicationsPage/ApplicationsPage.tsx
index 03f8ae41ff..ce0a5be54f 100644
--- a/frontend/src/pages/cert-manager/ApplicationsPage/ApplicationsPage.tsx
+++ b/frontend/src/pages/cert-manager/ApplicationsPage/ApplicationsPage.tsx
@@ -1,5 +1,4 @@
import { useState } from "react";
-import { useNavigate, useParams } from "@tanstack/react-router";
import { InfoIcon, MoreHorizontalIcon, PlusIcon, SlidersHorizontalIcon } from "lucide-react";
import { PageTitle } from "@app/components/PageTitle";
@@ -25,6 +24,7 @@ import {
PageLoader,
Pagination,
ResourceIcon,
+ RowLink,
Table,
TableBody,
TableCell,
@@ -35,7 +35,8 @@ import {
TooltipContent,
TooltipTrigger
} from "@app/components/v3";
-import { useProjectPermission } from "@app/context";
+import { useProject, useProjectPermission } from "@app/context";
+import { getInstancePinningLink } from "@app/helpers/project";
import {
getUserTablePreference,
PreferenceKey,
@@ -53,8 +54,7 @@ import { PkiApplicationModal } from "./components/PkiApplicationModal";
const APPLICATIONS_TABLE = "pkiApplicationsTable";
export const ApplicationsPage = () => {
- const { orgId } = useParams({ strict: false });
- const navigate = useNavigate();
+ const { currentProject } = useProject();
const [page, setPage] = useState(1);
const [perPage, setPerPage] = useState(() =>
getUserTablePreference(APPLICATIONS_TABLE, PreferenceKey.PerPage, 20)
@@ -108,23 +108,19 @@ export const ApplicationsPage = () => {
</TableHeader>
<TableBody>
{applications.map((app) => (
- <TableRow
- key={app.id}
- className="cursor-pointer"
- onClick={() =>
- navigate({
- to: "/organizations/$orgId/cert-manager/applications/$applicationName",
- params: {
- orgId: orgId ?? "",
- applicationName: app.name
- }
- })
- }
- >
+ <TableRow key={app.id} linked>
<TableCell className="w-full">
<div className="flex items-center gap-x-2 font-mono">
<ResourceIcon className="size-4 shrink-0 text-project" />
- <span>{app.name}</span>
+ <RowLink
+ {...getInstancePinningLink(
+ currentProject.orgId,
+ currentProject,
+ `applications/${app.name}`
+ )!}
+ >
+ {app.name}
+ </RowLink>
{app.description?.length ? (
<Tooltip>
<TooltipTrigger asChild>
diff --git a/frontend/src/pages/cert-manager/ApprovalsPage/components/RequestsTab/RequestsTab.tsx b/frontend/src/pages/cert-manager/ApprovalsPage/components/RequestsTab/RequestsTab.tsx
index b5c5bd770b..7ff1c01e93 100644
--- a/frontend/src/pages/cert-manager/ApprovalsPage/components/RequestsTab/RequestsTab.tsx
+++ b/frontend/src/pages/cert-manager/ApprovalsPage/components/RequestsTab/RequestsTab.tsx
@@ -7,7 +7,6 @@ import {
} from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { useQuery } from "@tanstack/react-query";
-import { useNavigate } from "@tanstack/react-router";
import { formatDistance } from "date-fns";
import {
@@ -36,6 +35,7 @@ import {
InputGroupAddon,
InputGroupInput,
Pagination,
+ RowLink,
Table,
TableBody,
TableCell,
@@ -44,7 +44,8 @@ import {
TableRow,
TableSkeletonRows
} from "@app/components/v3";
-import { useOrganization, useProject, useProjectPermission, useUser } from "@app/context";
+import { useProject, useProjectPermission, useUser } from "@app/context";
+import { getInstancePinningLink } from "@app/helpers/project";
import { getUserTablePreference, PreferenceKey } from "@app/helpers/userTablePreferences";
import { usePagination } from "@app/hooks";
import {
@@ -101,12 +102,10 @@ const checkIfUserNeedsToApprove = (
export const RequestsTab = () => {
const { currentProject } = useProject();
- const { currentOrg } = useOrganization();
const { memberships } = useProjectPermission();
const { user } = useUser();
const [search, setSearch] = useState("");
const [filter, setFilter] = useState(ApprovalRequestStatus.Pending);
- const navigate = useNavigate();
const projectId = currentProject?.id || "";
const userId = user?.id || "";
@@ -239,27 +238,24 @@ export const RequestsTab = () => {
const requestData = request.requestData.requestData as CertRequestRequestData;
return (
- <TableRow
- key={request.id}
- className="cursor-pointer"
- onClick={() =>
- navigate({
- to: "/organizations/$orgId/cert-manager/approvals/$approvalRequestId",
- params: {
- orgId: currentOrg.id,
- approvalRequestId: request.id
- },
- search: {
- policyType: ApprovalPolicyType.CertRequest
- }
- })
- }
- >
+ <TableRow key={request.id} linked>
<TableCell>
<div>
- <div className="text-sm font-medium text-foreground">
+ <RowLink
+ {...getInstancePinningLink(
+ currentProject.orgId,
+ currentProject,
+ `approvals/${request.id}`
+ )!}
+ search={
+ {
+ policyType: ApprovalPolicyType.CertRequest
+ } as never
+ }
+ className="text-sm font-medium text-foreground"
+ >
{request.requesterName || "Unknown"}
- </div>
+ </RowLink>
<div className="text-xs text-muted">{request.requesterEmail}</div>
</div>
</TableCell>
diff --git a/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/CaTable.tsx b/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/CaTable.tsx
index fcb48536e2..d3b0544568 100644
--- a/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/CaTable.tsx
+++ b/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/CaTable.tsx
@@ -1,5 +1,4 @@
import { subject } from "@casl/ability";
-import { useNavigate } from "@tanstack/react-router";
import { format } from "date-fns";
import { BanIcon, MoreHorizontalIcon, ScrollTextIcon, Trash2Icon } from "lucide-react";
import { twMerge } from "tailwind-merge";
@@ -15,6 +14,7 @@ import {
EmptyHeader,
EmptyTitle,
IconButton,
+ RowLink,
Skeleton,
Table,
TableBody,
@@ -26,9 +26,10 @@ import {
import {
ProjectPermissionCertificateAuthorityActions,
ProjectPermissionSub,
- useOrganization,
+ useProject,
useProjectPermission
} from "@app/context";
+import { getInstancePinningLink } from "@app/helpers/project";
import { CaStatus, CaType, useListCasByTypeAndProjectId } from "@app/hooks/api";
import {
caStatusToNameMap,
@@ -51,8 +52,7 @@ type Props = {
};
export const CaTable = ({ handlePopUpOpen }: Props) => {
- const navigate = useNavigate();
- const { currentOrg } = useOrganization();
+ const { currentProject } = useProject();
const { permission } = useProjectPermission();
const { data, isPending } = useListCasByTypeAndProjectId(CaType.INTERNAL);
const cas = data as TInternalCertificateAuthority[];
@@ -101,18 +101,16 @@ export const CaTable = ({ handlePopUpOpen }: Props) => {
<TableRow
className={twMerge(!canReadCa && "cursor-not-allowed opacity-60")}
key={`ca-${ca.id}`}
- onClick={() =>
- canReadCa &&
- navigate({
- to: "/organizations/$orgId/cert-manager/ca/$caId",
- params: {
- orgId: currentOrg.id,
- caId: ca.id
- }
- })
- }
+ linked={canReadCa}
>
- <TableCell>{ca.name}</TableCell>
+ <TableCell>
+ <RowLink
+ {...getInstancePinningLink(currentProject.orgId, currentProject, `ca/${ca.id}`)!}
+ disabled={!canReadCa}
+ >
+ {ca.name}
+ </RowLink>
+ </TableCell>
<TableCell>
<Badge variant={getCaStatusBadgeVariant(ca.status)}>
{caStatusToNameMap[ca.status]}
@@ -128,7 +126,7 @@ export const CaTable = ({ handlePopUpOpen }: Props) => {
</p>
</div>
</TableCell>
- <TableCell className="text-right" onClick={(e) => e.stopPropagation()}>
+ <TableCell className="text-right" data-row-interactive>
<DropdownMenu>
<DropdownMenuTrigger asChild>
<IconButton variant="ghost" size="xs" aria-label="CA actions">
diff --git a/frontend/src/pages/cert-manager/CertificateDetailsByIDPage/components/CertificateInstallationsSection.tsx b/frontend/src/pages/cert-manager/CertificateDetailsByIDPage/components/CertificateInstallationsSection.tsx
index 4ab1d1698c..404454e44c 100644
--- a/frontend/src/pages/cert-manager/CertificateDetailsByIDPage/components/CertificateInstallationsSection.tsx
+++ b/frontend/src/pages/cert-manager/CertificateDetailsByIDPage/components/CertificateInstallationsSection.tsx
@@ -1,5 +1,4 @@
import { useState } from "react";
-import { useNavigate, useParams } from "@tanstack/react-router";
import { format } from "date-fns";
import {
@@ -10,6 +9,7 @@ import {
CardTitle,
Loader,
Pagination,
+ RowLink,
Table,
TableBody,
TableCell,
@@ -18,6 +18,7 @@ import {
TableRow
} from "@app/components/v3";
import { useProject } from "@app/context";
+import { getInstancePinningLink } from "@app/helpers/project";
import { useListPkiInstallations } from "@app/hooks/api";
import { getEndpoint, getGatewayLabel } from "@app/pages/cert-manager/pki-discovery-utils";
@@ -28,12 +29,8 @@ type Props = {
const PER_PAGE_INIT = 10;
export const CertificateInstallationsSection = ({ certificateId }: Props) => {
- const navigate = useNavigate();
const { currentProject } = useProject();
const projectId = currentProject.id;
- const { orgId } = useParams({
- from: "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/cert-manager/_cert-manager-layout/certificates/$certificateId"
- });
const [page, setPage] = useState(1);
const [perPage, setPerPage] = useState(PER_PAGE_INIT);
@@ -86,19 +83,18 @@ export const CertificateInstallationsSection = ({ certificateId }: Props) => {
</TableHeader>
<TableBody>
{paginatedInstallations.map((installation) => (
- <TableRow
- key={installation.id}
- onClick={() =>
- navigate({
- to: "/organizations/$orgId/cert-manager/discovery/installations/$installationId",
- params: {
- orgId,
- installationId: installation.id
- }
- })
- }
- >
- <TableCell>{installation.name || getEndpoint(installation)}</TableCell>
+ <TableRow key={installation.id} linked>
+ <TableCell>
+ <RowLink
+ {...getInstancePinningLink(
+ currentProject.orgId,
+ currentProject,
+ `discovery/installations/${installation.id}`
+ )!}
+ >
+ {installation.name || getEndpoint(installation)}
+ </RowLink>
+ </TableCell>
<TableCell>{getGatewayLabel(installation) || "N/A"}</TableCell>
<TableCell>
{format(new Date(installation.lastSeenAt), "MMM dd, yyyy HH:mm")}
diff --git a/frontend/src/pages/cert-manager/CodeSigningPage/components/SignersTable.tsx b/frontend/src/pages/cert-manager/CodeSigningPage/components/SignersTable.tsx
index 2f22ddab01..e3d9548566 100644
--- a/frontend/src/pages/cert-manager/CodeSigningPage/components/SignersTable.tsx
+++ b/frontend/src/pages/cert-manager/CodeSigningPage/components/SignersTable.tsx
@@ -1,5 +1,4 @@
import { useState } from "react";
-import { useNavigate } from "@tanstack/react-router";
import { format } from "date-fns";
import { AlertTriangleIcon, PlusIcon, SearchIcon } from "lucide-react";
@@ -23,6 +22,7 @@ import {
InputGroupAddon,
InputGroupInput,
Pagination,
+ RowLink,
Table,
TableBody,
TableCell,
@@ -36,9 +36,10 @@ import {
import {
ProjectPermissionCodeSigningActions,
ProjectPermissionSub,
- useOrganization,
+ useProject,
useSubscription
} from "@app/context";
+import { getInstancePinningLink } from "@app/helpers/project";
import {
getSignerStatusBadgeVariant,
SIGNER_TABLE_PAGE_SIZE,
@@ -56,8 +57,7 @@ type Props = {
};
export const SignersTable = ({ projectId, onCreateSigner }: Props) => {
- const navigate = useNavigate();
- const { currentOrg } = useOrganization();
+ const { currentProject } = useProject();
const { subscription } = useSubscription();
const { openUpgradeGate, upgradeGate } = useUpgradeGate();
@@ -138,21 +138,19 @@ export const SignersTable = ({ projectId, onCreateSigner }: Props) => {
<TableBody>
{!isLoading &&
signers.map((signer) => (
- <TableRow
- key={signer.id}
- className="cursor-pointer hover:bg-surface-hover"
- onClick={() =>
- navigate({
- to: "/organizations/$orgId/cert-manager/code-signing/$signerId",
- params: {
- orgId: currentOrg.id,
- signerId: signer.id
- }
- })
- }
- >
- <TableCell>{signer.name}</TableCell>
- <TableCell onClick={(e) => e.stopPropagation()} className="cursor-default">
+ <TableRow key={signer.id} className="hover:bg-surface-hover" linked>
+ <TableCell>
+ <RowLink
+ {...getInstancePinningLink(
+ currentProject.orgId,
+ currentProject,
+ `code-signing/${signer.id}`
+ )!}
+ >
+ {signer.name}
+ </RowLink>
+ </TableCell>
+ <TableCell data-row-interactive className="cursor-default">
{signer.certificateFailureReason &&
(signer.status === SignerStatus.Failed ||
signer.status === SignerStatus.Pending) ? (
diff --git a/frontend/src/pages/cert-manager/DiscoveryDetailsByIDPage/components/DiscoveryInstallationsSection.tsx b/frontend/src/pages/cert-manager/DiscoveryDetailsByIDPage/components/DiscoveryInstallationsSection.tsx
index 4b0170e9b8..e52fbb580a 100644
--- a/frontend/src/pages/cert-manager/DiscoveryDetailsByIDPage/components/DiscoveryInstallationsSection.tsx
+++ b/frontend/src/pages/cert-manager/DiscoveryDetailsByIDPage/components/DiscoveryInstallationsSection.tsx
@@ -1,5 +1,4 @@
import { useState } from "react";
-import { useNavigate, useParams } from "@tanstack/react-router";
import { format } from "date-fns";
import {
@@ -14,6 +13,7 @@ import {
EmptyTitle,
Loader,
Pagination,
+ RowLink,
Table,
TableBody,
TableCell,
@@ -21,6 +21,8 @@ import {
TableHeader,
TableRow
} from "@app/components/v3";
+import { useProject } from "@app/context";
+import { getInstancePinningLink } from "@app/helpers/project";
import { useListPkiInstallations } from "@app/hooks/api";
import { getEndpoint, getGatewayLabel } from "@app/pages/cert-manager/pki-discovery-utils";
@@ -34,12 +36,9 @@ const PER_PAGE_INIT = 10;
const SCAN_IN_FLIGHT_POLL_MS = 5000;
export const DiscoveryInstallationsSection = ({ discoveryId, projectId, isScanRunning }: Props) => {
- const navigate = useNavigate();
const [page, setPage] = useState(1);
const [perPage, setPerPage] = useState(PER_PAGE_INIT);
- const { orgId } = useParams({
- from: "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/cert-manager/_cert-manager-layout/discovery/$discoveryId"
- });
+ const { currentProject } = useProject();
const { data, isPending } = useListPkiInstallations(
{
@@ -87,19 +86,18 @@ export const DiscoveryInstallationsSection = ({ discoveryId, projectId, isScanRu
</TableHeader>
<TableBody>
{installations.map((installation) => (
- <TableRow
- key={installation.id}
- onClick={() =>
- navigate({
- to: "/organizations/$orgId/cert-manager/discovery/installations/$installationId",
- params: {
- orgId,
- installationId: installation.id
- }
- })
- }
- >
- <TableCell>{installation.name || getEndpoint(installation)}</TableCell>
+ <TableRow key={installation.id} linked>
+ <TableCell>
+ <RowLink
+ {...getInstancePinningLink(
+ currentProject.orgId,
+ currentProject,
+ `discovery/installations/${installation.id}`
+ )!}
+ >
+ {installation.name || getEndpoint(installation)}
+ </RowLink>
+ </TableCell>
<TableCell>{installation.primaryCertName || "N/A"}</TableCell>
<TableCell>{getGatewayLabel(installation) || "N/A"}</TableCell>
<TableCell>
diff --git a/frontend/src/pages/cert-manager/DiscoveryPage/components/DiscoveryJobsTab.tsx b/frontend/src/pages/cert-manager/DiscoveryPage/components/DiscoveryJobsTab.tsx
index 1fcb74b03e..27bdd3a3bd 100644
--- a/frontend/src/pages/cert-manager/DiscoveryPage/components/DiscoveryJobsTab.tsx
+++ b/frontend/src/pages/cert-manager/DiscoveryPage/components/DiscoveryJobsTab.tsx
@@ -1,5 +1,4 @@
import { useEffect, useState } from "react";
-import { useNavigate } from "@tanstack/react-router";
import { format } from "date-fns";
import { MoreHorizontalIcon, PlusIcon, RefreshCwIcon, SearchIcon } from "lucide-react";
@@ -30,6 +29,7 @@ import {
InputGroupInput,
OverflowBadgeList,
Pagination,
+ RowLink,
Skeleton,
Table,
TableBody,
@@ -41,10 +41,11 @@ import {
import {
ProjectPermissionPkiDiscoveryActions,
ProjectPermissionSub,
- useOrganization,
+ useProject,
useSubscription
} from "@app/context";
import { PKI_DISCOVERY_TYPE_MAP } from "@app/helpers/pkiDiscovery";
+import { getInstancePinningLink } from "@app/helpers/project";
import {
PkiDiscoveryScanStatus,
PkiDiscoveryType,
@@ -87,8 +88,7 @@ const getTargetItems = (discovery: TPkiDiscovery) => {
};
export const DiscoveryJobsTab = ({ projectId }: Props) => {
- const navigate = useNavigate();
- const { currentOrg } = useOrganization();
+ const { currentProject } = useProject();
const [page, setPage] = useState(1);
const [searchFilter, setSearchFilter] = useState("");
const [debouncedSearch] = useDebounce(searchFilter, 300);
@@ -213,20 +213,18 @@ export const DiscoveryJobsTab = ({ projectId }: Props) => {
</TableHeader>
<TableBody>
{discoveries.map((discovery) => (
- <TableRow
- key={discovery.id}
- className="cursor-pointer"
- onClick={() =>
- navigate({
- to: "/organizations/$orgId/cert-manager/discovery/$discoveryId",
- params: {
- orgId: currentOrg.id,
- discoveryId: discovery.id
- }
- })
- }
- >
- <TableCell>{discovery.name}</TableCell>
+ <TableRow key={discovery.id} linked>
+ <TableCell>
+ <RowLink
+ {...getInstancePinningLink(
+ currentProject.orgId,
+ currentProject,
+ `discovery/${discovery.id}`
+ )!}
+ >
+ {discovery.name}
+ </RowLink>
+ </TableCell>
<TableCell>
<div className="flex items-center gap-2">
<DiscoveryTypeIcon type={discovery.discoveryType} className="size-4" />
@@ -259,7 +257,7 @@ export const DiscoveryJobsTab = ({ projectId }: Props) => {
? format(new Date(discovery.lastScannedAt), "MMM dd, yyyy HH:mm")
: "Never"}
</TableCell>
- <TableCell onClick={(e) => e.stopPropagation()}>
+ <TableCell data-row-interactive>
<DropdownMenu>
<DropdownMenuTrigger asChild>
<IconButton variant="ghost" size="xs">
diff --git a/frontend/src/pages/cert-manager/DiscoveryPage/components/InstallationsTab.tsx b/frontend/src/pages/cert-manager/DiscoveryPage/components/InstallationsTab.tsx
index 0b44d017d1..15e030db70 100644
--- a/frontend/src/pages/cert-manager/DiscoveryPage/components/InstallationsTab.tsx
+++ b/frontend/src/pages/cert-manager/DiscoveryPage/components/InstallationsTab.tsx
@@ -1,5 +1,4 @@
import { useEffect, useState } from "react";
-import { useNavigate } from "@tanstack/react-router";
import { format } from "date-fns";
import { MoreHorizontalIcon, SearchIcon } from "lucide-react";
@@ -23,6 +22,7 @@ import {
InputGroupAddon,
InputGroupInput,
Pagination,
+ RowLink,
Skeleton,
Table,
TableBody,
@@ -34,8 +34,9 @@ import {
import {
ProjectPermissionPkiCertificateInstallationActions,
ProjectPermissionSub,
- useOrganization
+ useProject
} from "@app/context";
+import { getInstancePinningLink } from "@app/helpers/project";
import {
TPkiInstallation,
useDeletePkiInstallation,
@@ -69,8 +70,7 @@ type Props = {
const PAGE_SIZE = 25;
export const InstallationsTab = ({ projectId }: Props) => {
- const navigate = useNavigate();
- const { currentOrg } = useOrganization();
+ const { currentProject } = useProject();
const [page, setPage] = useState(1);
const [searchFilter, setSearchFilter] = useState("");
const [debouncedSearch] = useDebounce(searchFilter, 300);
@@ -182,19 +182,7 @@ export const InstallationsTab = ({ projectId }: Props) => {
</TableHeader>
<TableBody>
{installations.map((installation) => (
- <TableRow
- key={installation.id}
- className="cursor-pointer"
- onClick={() =>
- navigate({
- to: "/organizations/$orgId/cert-manager/discovery/installations/$installationId",
- params: {
- orgId: currentOrg.id,
- installationId: installation.id
- }
- })
- }
- >
+ <TableRow key={installation.id} linked>
<TableCell>
<div className="flex items-center gap-2">
<DiscoveryTypeIcon
@@ -205,9 +193,15 @@ export const InstallationsTab = ({ projectId }: Props) => {
}
className="size-4 shrink-0"
/>
- <span className="truncate">
+ <RowLink
+ {...getInstancePinningLink(
+ currentProject.orgId,
+ currentProject,
+ `discovery/installations/${installation.id}`
+ )!}
+ >
{installation.name || getEndpoint(installation)}
- </span>
+ </RowLink>
{getKeystoreStatusBadge(installation)}
</div>
</TableCell>
@@ -221,7 +215,7 @@ export const InstallationsTab = ({ projectId }: Props) => {
<TableCell>
{format(new Date(installation.lastSeenAt), "MMM dd, yyyy HH:mm")}
</TableCell>
- <TableCell onClick={(e) => e.stopPropagation()}>
+ <TableCell data-row-interactive>
<DropdownMenu>
<DropdownMenuTrigger asChild>
<IconButton variant="ghost" size="xs">
diff --git a/frontend/src/pages/cert-manager/HsmConnectorDetailsByIDPage/components/HsmConnectorLinkedResourcesSection.tsx b/frontend/src/pages/cert-manager/HsmConnectorDetailsByIDPage/components/HsmConnectorLinkedResourcesSection.tsx
index b8470a7659..e476d98f6f 100644
--- a/frontend/src/pages/cert-manager/HsmConnectorDetailsByIDPage/components/HsmConnectorLinkedResourcesSection.tsx
+++ b/frontend/src/pages/cert-manager/HsmConnectorDetailsByIDPage/components/HsmConnectorLinkedResourcesSection.tsx
@@ -1,5 +1,4 @@
import { useState } from "react";
-import { useNavigate } from "@tanstack/react-router";
import { format } from "date-fns";
import {
@@ -14,6 +13,7 @@ import {
EmptyHeader,
EmptyTitle,
Pagination,
+ RowLink,
Skeleton,
Table,
TableBody,
@@ -26,6 +26,7 @@ import {
TooltipTrigger
} from "@app/components/v3";
import { useOrganization, useProject } from "@app/context";
+import { getInstancePinningLink } from "@app/helpers/project";
import { CaStatus } from "@app/hooks/api/ca/enums";
import { CertStatus } from "@app/hooks/api/certificates/enums";
import { useListHsmConnectorLinkedResources } from "@app/hooks/api/hsmConnectors";
@@ -42,24 +43,15 @@ export const HsmConnectorLinkedResourcesSection = ({ connectorId }: Props) => {
const linked = data?.certificates ?? [];
const linkedCas = data?.certificateAuthorities ?? [];
const totalCount = data?.totalCount ?? 0;
- const navigate = useNavigate();
const { currentProject } = useProject();
const { currentOrg } = useOrganization();
+ const canOpenCert = Boolean(currentProject?.id && currentOrg?.id);
const handlePerPageChange = (newPerPage: number) => {
setPerPage(newPerPage);
setPage(1);
};
- const openCert = (certificateId: string) => {
- if (!currentProject?.id || !currentOrg?.id) return;
- navigate({
- to: "/organizations/$orgId/cert-manager/certificates/$certificateId",
- params: { orgId: currentOrg.id, certificateId },
- search: { fromHsmConnector: connectorId }
- });
- };
-
return (
<Card className="w-full">
<CardHeader className="border-b">
@@ -141,12 +133,20 @@ export const HsmConnectorLinkedResourcesSection = ({ connectorId }: Props) => {
</TableHeader>
<TableBody>
{linked.map((c) => (
- <TableRow
- key={c.id}
- className="cursor-pointer hover:bg-surface-hover"
- onClick={() => openCert(c.id)}
- >
- <TableCell className="font-medium">{c.commonName}</TableCell>
+ <TableRow key={c.id} className="hover:bg-surface-hover" linked={canOpenCert}>
+ <TableCell className="font-medium">
+ <RowLink
+ {...getInstancePinningLink(
+ currentProject.orgId,
+ currentProject,
+ `certificates/${c.id}`
+ )!}
+ search={{ fromHsmConnector: connectorId } as never}
+ disabled={!canOpenCert}
+ >
+ {c.commonName}
+ </RowLink>
+ </TableCell>
<TableCell>
<Badge variant={c.status === CertStatus.ACTIVE ? "success" : "outline"}>
{c.status}
diff --git a/frontend/src/pages/cert-manager/InstallationDetailsByIDPage/components/InstallationCertificatesSection.tsx b/frontend/src/pages/cert-manager/InstallationDetailsByIDPage/components/InstallationCertificatesSection.tsx
index aac6751181..3651c9b6a1 100644
--- a/frontend/src/pages/cert-manager/InstallationDetailsByIDPage/components/InstallationCertificatesSection.tsx
+++ b/frontend/src/pages/cert-manager/InstallationDetailsByIDPage/components/InstallationCertificatesSection.tsx
@@ -1,6 +1,5 @@
/* eslint-disable no-nested-ternary */
import { ReactNode } from "react";
-import { useNavigate, useParams } from "@tanstack/react-router";
import { format } from "date-fns";
import { truncateSerialNumber } from "@app/components/utilities/serialNumberUtils";
@@ -15,6 +14,7 @@ import {
EmptyDescription,
EmptyHeader,
EmptyTitle,
+ RowLink,
Table,
TableBody,
TableCell,
@@ -22,6 +22,8 @@ import {
TableHeader,
TableRow
} from "@app/components/v3";
+import { useProject } from "@app/context";
+import { getInstancePinningLink } from "@app/helpers/project";
import { TPkiInstallationCert } from "@app/hooks/api";
import { getCertValidUntilBadgeDetails } from "../../CertificatesPage/components/CertificatesTable.utils";
@@ -32,10 +34,7 @@ type Props = {
};
export const InstallationCertificatesSection = ({ certificates, emptyState }: Props) => {
- const navigate = useNavigate();
- const { orgId } = useParams({
- from: "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/cert-manager/_cert-manager-layout/discovery/installations/$installationId"
- });
+ const { currentProject } = useProject();
return (
<Card>
@@ -71,19 +70,18 @@ export const InstallationCertificatesSection = ({ certificates, emptyState }: Pr
: null;
return (
- <TableRow
- key={cert.id}
- onClick={() =>
- navigate({
- to: "/organizations/$orgId/cert-manager/certificates/$certificateId",
- params: {
- orgId,
- certificateId: cert.certificateId
- }
- })
- }
- >
- <TableCell>{cert.commonName || "N/A"}</TableCell>
+ <TableRow key={cert.id} linked>
+ <TableCell>
+ <RowLink
+ {...getInstancePinningLink(
+ currentProject.orgId,
+ currentProject,
+ `certificates/${cert.certificateId}`
+ )!}
+ >
+ {cert.commonName || "N/A"}
+ </RowLink>
+ </TableCell>
<TableCell>
{expiryDetails ? (
<Badge variant={expiryDetails.variant}>{expiryDetails.label}</Badge>
diff --git a/frontend/src/pages/cert-manager/IntegrationsListPage/components/PkiSyncsTab/PkiSyncTable/PkiSyncRow.tsx b/frontend/src/pages/cert-manager/IntegrationsListPage/components/PkiSyncsTab/PkiSyncTable/PkiSyncRow.tsx
index ffb251d160..9aaf46c7bb 100644
--- a/frontend/src/pages/cert-manager/IntegrationsListPage/components/PkiSyncsTab/PkiSyncTable/PkiSyncRow.tsx
+++ b/frontend/src/pages/cert-manager/IntegrationsListPage/components/PkiSyncsTab/PkiSyncTable/PkiSyncRow.tsx
@@ -1,5 +1,4 @@
import { useCallback } from "react";
-import { useNavigate } from "@tanstack/react-router";
import {
BanIcon,
CheckIcon,
@@ -29,15 +28,16 @@ import {
DropdownMenuTrigger,
IconButton,
ProviderIcon,
+ RowLink,
TableCell,
TableRow,
Tooltip,
TooltipContent,
TooltipTrigger
} from "@app/components/v3";
-import { ROUTE_PATHS } from "@app/const/routes";
-import { useOrganization } from "@app/context";
+import { useProject } from "@app/context";
import { PKI_SYNC_MAP } from "@app/helpers/pkiSyncs";
+import { getInstancePinningLink } from "@app/helpers/project";
import { useToggle } from "@app/hooks";
import {
PkiSyncStatus,
@@ -67,7 +67,6 @@ export const PkiSyncRow = ({
onToggleEnable,
applicationName
}: Props) => {
- const navigate = useNavigate();
const {
id,
lastSyncMessage,
@@ -82,7 +81,7 @@ export const PkiSyncRow = ({
const { syncOption } = usePkiSyncOption(destination);
- const { currentOrg } = useOrganization();
+ const { currentProject } = useProject();
const [isIdCopied, setIsIdCopied] = useToggle(false);
const {
@@ -111,23 +110,11 @@ export const PkiSyncRow = ({
return (
<TableRow
- onClick={() => {
- if (!canReadSync) {
- return;
- }
- navigate({
- to: ROUTE_PATHS.CertManager.PkiSyncDetailsByIDPage.path,
- params: {
- syncId: id,
- orgId: currentOrg.id
- },
- search: applicationName ? { applicationName } : undefined
- });
- }}
+ linked={canReadSync}
className={twMerge(
"group h-14 transition-colors duration-100 [&>td]:py-2",
syncStatus === PkiSyncStatus.Failed && "bg-danger/5 hover:bg-danger/10",
- canReadSync ? "cursor-pointer" : "cursor-not-allowed"
+ !canReadSync && "cursor-not-allowed"
)}
key={`sync-${id}`}
>
@@ -141,7 +128,17 @@ export const PkiSyncRow = ({
<TableCell className="max-w-0 min-w-32!">
<div>
<div className="flex w-full items-center">
- <p className="truncate">{name}</p>
+ <RowLink
+ {...getInstancePinningLink(
+ currentProject.orgId,
+ currentProject,
+ `integrations/${id}`
+ )!}
+ search={(applicationName ? { applicationName } : undefined) as never}
+ disabled={!canReadSync}
+ >
+ {name}
+ </RowLink>
{description && (
<Tooltip>
<TooltipTrigger asChild>
diff --git a/frontend/src/pages/cert-manager/IntegrationsListPage/components/PkiSyncsTab/PkiSyncTable/PkiSyncTableCell.tsx b/frontend/src/pages/cert-manager/IntegrationsListPage/components/PkiSyncsTab/PkiSyncTable/PkiSyncTableCell.tsx
index b1bc5f74d6..6445e6e85e 100644
--- a/frontend/src/pages/cert-manager/IntegrationsListPage/components/PkiSyncsTab/PkiSyncTable/PkiSyncTableCell.tsx
+++ b/frontend/src/pages/cert-manager/IntegrationsListPage/components/PkiSyncsTab/PkiSyncTable/PkiSyncTableCell.tsx
@@ -25,7 +25,7 @@ export const PkiSyncTableCell = ({
<TableCell className="max-w-0 min-w-32!">
<Tooltip>
<TooltipTrigger asChild>
- <div>
+ <div className="w-fit max-w-full">
<p className={twMerge("truncate text-sm", primaryClassName)}>
{primaryText}
{infoBadge === "primary" && (
diff --git a/frontend/src/pages/cert-manager/PkiSubscribersPage/components/PkiSubscribersTable.tsx b/frontend/src/pages/cert-manager/PkiSubscribersPage/components/PkiSubscribersTable.tsx
index b6962e50ff..971f52b64c 100644
--- a/frontend/src/pages/cert-manager/PkiSubscribersPage/components/PkiSubscribersTable.tsx
+++ b/frontend/src/pages/cert-manager/PkiSubscribersPage/components/PkiSubscribersTable.tsx
@@ -1,6 +1,5 @@
import { faBan, faEllipsis, faPencil, faTrash } from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
-import { useNavigate } from "@tanstack/react-router";
import { ProjectPermissionCan } from "@app/components/permissions";
import {
@@ -13,6 +12,7 @@ import {
EmptyHeader,
EmptyTitle,
IconButton,
+ RowLink,
Table,
TableBody,
TableCell,
@@ -24,9 +24,9 @@ import {
import {
ProjectPermissionPkiSubscriberActions,
ProjectPermissionSub,
- useOrganization,
useProject
} from "@app/context";
+import { getInstancePinningLink } from "@app/helpers/project";
import { useListWorkspacePkiSubscribers } from "@app/hooks/api";
import {
getPkiSubscriberStatusBadgeVariant,
@@ -43,8 +43,6 @@ type Props = {
};
export const PkiSubscribersTable = ({ handlePopUpOpen }: Props) => {
- const navigate = useNavigate();
- const { currentOrg } = useOrganization();
const { currentProject } = useProject();
const { data, isPending } = useListWorkspacePkiSubscribers(currentProject?.id || "");
if (!isPending && !data?.length) {
@@ -75,19 +73,18 @@ export const PkiSubscribersTable = ({ handlePopUpOpen }: Props) => {
data.length > 0 &&
data.map((subscriber) => {
return (
- <TableRow
- key={`pki-subscriber-${subscriber.id}`}
- onClick={() =>
- navigate({
- to: "/organizations/$orgId/cert-manager/subscribers/$subscriberName",
- params: {
- orgId: currentOrg.id,
- subscriberName: subscriber.name
- }
- })
- }
- >
- <TableCell>{subscriber.name}</TableCell>
+ <TableRow key={`pki-subscriber-${subscriber.id}`} linked>
+ <TableCell>
+ <RowLink
+ {...getInstancePinningLink(
+ currentProject.orgId,
+ currentProject,
+ `subscribers/${subscriber.name}`
+ )!}
+ >
+ {subscriber.name}
+ </RowLink>
+ </TableCell>
<TableCell>
<Badge variant={getPkiSubscriberStatusBadgeVariant(subscriber.status)}>
{pkiSubscriberStatusToNameMap[subscriber.status]}
diff --git a/frontend/src/pages/cert-manager/PoliciesPage/components/CertificatePoliciesTab/PolicyList.tsx b/frontend/src/pages/cert-manager/PoliciesPage/components/CertificatePoliciesTab/PolicyList.tsx
index b4303d79d5..a0fed5da91 100644
--- a/frontend/src/pages/cert-manager/PoliciesPage/components/CertificatePoliciesTab/PolicyList.tsx
+++ b/frontend/src/pages/cert-manager/PoliciesPage/components/CertificatePoliciesTab/PolicyList.tsx
@@ -1,6 +1,5 @@
import { useCallback } from "react";
import { subject } from "@casl/ability";
-import { Link, useNavigate } from "@tanstack/react-router";
import {
CheckIcon,
CopyIcon,
@@ -22,6 +21,7 @@ import {
EmptyHeader,
EmptyTitle,
IconButton,
+ RowLink,
Skeleton,
Table,
TableBody,
@@ -33,11 +33,12 @@ import {
TooltipContent,
TooltipTrigger
} from "@app/components/v3";
-import { useOrganization, useProject } from "@app/context";
+import { useProject } from "@app/context";
import {
ProjectPermissionCertificatePolicyActions,
ProjectPermissionSub
} from "@app/context/ProjectPermissionContext/types";
+import { getInstancePinningLink } from "@app/helpers/project";
import { useToggle } from "@app/hooks";
import { TCertificatePolicy, useListCertificatePolicies } from "@app/hooks/api/certificatePolicies";
@@ -48,8 +49,6 @@ interface Props {
export const PolicyList = ({ onEditPolicy, onDeletePolicy }: Props) => {
const { currentProject } = useProject();
- const { currentOrg } = useOrganization();
- const navigate = useNavigate();
const [isIdCopied, setIsIdCopied] = useToggle(false);
const { data, isLoading } = useListCertificatePolicies({
@@ -114,31 +113,19 @@ export const PolicyList = ({ onEditPolicy, onDeletePolicy }: Props) => {
</TableHeader>
<TableBody>
{policies.map((policy) => (
- <TableRow
- key={policy.id}
- onClick={() =>
- navigate({
- to: "/organizations/$orgId/cert-manager/certificate-policies/$policyId",
- params: {
- orgId: currentOrg.id,
- policyId: policy.id
- }
- })
- }
- >
+ <TableRow key={policy.id} linked>
<TableCell>
<div className="flex items-center gap-2">
- <Link
- to="/organizations/$orgId/cert-manager/certificate-policies/$policyId"
- params={{
- orgId: currentOrg.id,
- policyId: policy.id
- }}
- className="rounded-sm hover:underline focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none"
- onClick={(e) => e.stopPropagation()}
+ <RowLink
+ {...getInstancePinningLink(
+ currentProject.orgId,
+ currentProject,
+ `certificate-policies/${policy.id}`
+ )!}
+ className="hover:underline"
>
{policy.name}
- </Link>
+ </RowLink>
{policy.description && (
<Tooltip>
<TooltipTrigger asChild>
@@ -152,7 +139,7 @@ export const PolicyList = ({ onEditPolicy, onDeletePolicy }: Props) => {
<TableCell>
<span className="text-sm">{formatDate(policy.createdAt)}</span>
</TableCell>
- <TableCell className="text-right" onClick={(e) => e.stopPropagation()}>
+ <TableCell className="text-right" data-row-interactive>
<DropdownMenu>
<DropdownMenuTrigger asChild>
<IconButton variant="ghost" size="xs" aria-label="Policy actions">
diff --git a/frontend/src/pages/cert-manager/PoliciesPage/components/CertificateProfilesTab/ProfileRow.tsx b/frontend/src/pages/cert-manager/PoliciesPage/components/CertificateProfilesTab/ProfileRow.tsx
index 6fa62dd835..e075012c87 100644
--- a/frontend/src/pages/cert-manager/PoliciesPage/components/CertificateProfilesTab/ProfileRow.tsx
+++ b/frontend/src/pages/cert-manager/PoliciesPage/components/CertificateProfilesTab/ProfileRow.tsx
@@ -1,7 +1,7 @@
/* eslint-disable no-nested-ternary */
import { useCallback } from "react";
import { subject } from "@casl/ability";
-import { Link, useNavigate } from "@tanstack/react-router";
+import { Link } from "@tanstack/react-router";
import {
CheckIcon,
CopyIcon,
@@ -20,17 +20,19 @@ import {
DropdownMenuItem,
DropdownMenuTrigger,
IconButton,
+ RowLink,
TableCell,
TableRow,
Tooltip,
TooltipContent,
TooltipTrigger
} from "@app/components/v3";
-import { useOrganization } from "@app/context";
+import { useProject } from "@app/context";
import {
ProjectPermissionCertificateProfileActions,
ProjectPermissionSub
} from "@app/context/ProjectPermissionContext/types";
+import { getInstancePinningLink } from "@app/helpers/project";
import { useToggle } from "@app/hooks";
import { useGetInternalCaById } from "@app/hooks/api/ca/queries";
import { useGetCertificatePolicyById } from "@app/hooks/api/certificatePolicies";
@@ -44,8 +46,7 @@ interface Props {
}
export const ProfileRow = ({ profile, onEditProfile, onCloneProfile, onDeleteProfile }: Props) => {
- const { currentOrg } = useOrganization();
- const navigate = useNavigate();
+ const { currentProject } = useProject();
const isInternalCa = !profile.certificateAuthority?.isExternal;
const { data: caData } = useGetInternalCaById(isInternalCa ? (profile.caId ?? "") : "");
@@ -68,31 +69,19 @@ export const ProfileRow = ({ profile, onEditProfile, onCloneProfile, onDeletePro
});
return (
- <TableRow
- key={profile.id}
- onClick={() =>
- navigate({
- to: "/organizations/$orgId/cert-manager/certificate-profiles/$profileId",
- params: {
- orgId: currentOrg.id,
- profileId: profile.id
- }
- })
- }
- >
+ <TableRow key={profile.id} linked>
<TableCell>
<div className="flex items-center gap-2">
- <Link
- to="/organizations/$orgId/cert-manager/certificate-profiles/$profileId"
- params={{
- orgId: currentOrg.id,
- profileId: profile.id
- }}
- className="rounded-sm hover:underline focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none"
- onClick={(e) => e.stopPropagation()}
+ <RowLink
+ {...getInstancePinningLink(
+ currentProject.orgId,
+ currentProject,
+ `certificate-profiles/${profile.id}`
+ )!}
+ className="hover:underline"
>
{profile.slug}
- </Link>
+ </RowLink>
{profile.description && (
<Tooltip>
<TooltipTrigger asChild>
@@ -114,19 +103,19 @@ export const ProfileRow = ({ profile, onEditProfile, onCloneProfile, onDeletePro
profile.caId}
</span>
</TableCell>
- <TableCell onClick={(e) => e.stopPropagation()}>
+ <TableCell data-row-interactive>
<Link
- to="/organizations/$orgId/cert-manager/certificate-policies/$policyId"
- params={{
- orgId: currentOrg.id,
- policyId: profile.certificatePolicyId
- }}
+ {...getInstancePinningLink(
+ currentProject.orgId,
+ currentProject,
+ `certificate-policies/${profile.certificatePolicyId}`
+ )!}
className="text-sm hover:underline"
>
{policyData?.name || profile.certificatePolicyId}
</Link>
</TableCell>
- <TableCell className="text-right" onClick={(e) => e.stopPropagation()}>
+ <TableCell className="text-right" data-row-interactive>
<DropdownMenu>
<DropdownMenuTrigger asChild>
<IconButton variant="ghost" size="xs" aria-label="Profile actions">
diff --git a/frontend/src/pages/cert-manager/RequestsPage/RequestsPage.tsx b/frontend/src/pages/cert-manager/RequestsPage/RequestsPage.tsx
index 734cdab522..3f24052dee 100644
--- a/frontend/src/pages/cert-manager/RequestsPage/RequestsPage.tsx
+++ b/frontend/src/pages/cert-manager/RequestsPage/RequestsPage.tsx
@@ -25,6 +25,7 @@ import {
InputGroupAddon,
InputGroupInput,
PageHeader,
+ RowLink,
Table,
TableBody,
TableCell,
@@ -37,6 +38,7 @@ import {
TabsTrigger
} from "@app/components/v3";
import { useProject } from "@app/context";
+import { getInstancePinningLink } from "@app/helpers/project";
import { useDebounce } from "@app/hooks";
import { ApprovalPolicyScope, ApprovalPolicyType } from "@app/hooks/api/approvalPolicies";
import {
@@ -377,37 +379,34 @@ export const RequestsPage = () => {
};
return (
- <TableRow
- key={r.id}
- className="cursor-pointer [&>td]:py-3"
- onClick={() =>
- navigate({
- to: "/organizations/$orgId/cert-manager/approvals/$approvalRequestId",
- params: {
- orgId: orgId ?? "",
- approvalRequestId: r.id
- },
- search: {
- policyType: ApprovalPolicyType.CertRequest,
- from: "root-requests"
- }
- })
- }
- >
+ <TableRow key={r.id} className="[&>td]:py-3" linked>
<TableCell isTruncatable className="font-mono">
- {cn}
+ <RowLink
+ {...getInstancePinningLink(
+ currentProject.orgId,
+ currentProject,
+ `approvals/${r.id}`
+ )!}
+ search={
+ {
+ policyType: ApprovalPolicyType.CertRequest,
+ from: "root-requests"
+ } as never
+ }
+ >
+ {cn}
+ </RowLink>
</TableCell>
<TableCell className="font-mono text-xs">{profile}</TableCell>
<TableCell className="font-mono text-xs">
{app ? (
<Link
- to="/organizations/$orgId/cert-manager/applications/$applicationName"
- params={{
- orgId: orgId ?? "",
- applicationName: app.name
- }}
+ {...getInstancePinningLink(
+ currentProject.orgId,
+ currentProject,
+ `applications/${app.name}`
+ )!}
className="text-foreground hover:text-project"
- onClick={(e) => e.stopPropagation()}
>
{app.name}
</Link>
@@ -525,25 +524,23 @@ export const RequestsPage = () => {
};
return (
- <TableRow
- key={r.id}
- className="cursor-pointer [&>td]:py-3"
- onClick={() =>
- navigate({
- to: "/organizations/$orgId/cert-manager/approvals/$approvalRequestId",
- params: {
- orgId: orgId ?? "",
- approvalRequestId: r.id
- },
- search: {
- policyType: ApprovalPolicyType.CertCodeSigning,
- from: "root-requests"
- }
- })
- }
- >
+ <TableRow key={r.id} className="[&>td]:py-3" linked>
<TableCell isTruncatable className="font-mono">
- {signerName}
+ <RowLink
+ {...getInstancePinningLink(
+ currentProject.orgId,
+ currentProject,
+ `approvals/${r.id}`
+ )!}
+ search={
+ {
+ policyType: ApprovalPolicyType.CertCodeSigning,
+ from: "root-requests"
+ } as never
+ }
+ >
+ {signerName}
+ </RowLink>
</TableCell>
<TableCell>{r.requesterName || r.requesterEmail || "—"}</TableCell>
<TableCell>
diff --git a/frontend/src/pages/cert-manager/SettingsPage/components/HsmConnectorsTab/HsmConnectorsTab.tsx b/frontend/src/pages/cert-manager/SettingsPage/components/HsmConnectorsTab/HsmConnectorsTab.tsx
index 8f6f7396ff..144f16aeed 100644
--- a/frontend/src/pages/cert-manager/SettingsPage/components/HsmConnectorsTab/HsmConnectorsTab.tsx
+++ b/frontend/src/pages/cert-manager/SettingsPage/components/HsmConnectorsTab/HsmConnectorsTab.tsx
@@ -1,6 +1,6 @@
import { useMemo, useState } from "react";
import { useQuery } from "@tanstack/react-query";
-import { useNavigate, useParams } from "@tanstack/react-router";
+import { useParams } from "@tanstack/react-router";
import { format } from "date-fns";
import {
CheckCircle2Icon,
@@ -37,6 +37,7 @@ import {
InputGroup,
InputGroupAddon,
InputGroupInput,
+ RowLink,
Skeleton,
Table,
TableBody,
@@ -50,6 +51,7 @@ import {
ProjectPermissionHsmConnectorActions,
ProjectPermissionSub
} from "@app/context/ProjectPermissionContext/types";
+import { getInstancePinningLink } from "@app/helpers/project";
import { useTimedReset } from "@app/hooks";
import { useListGatewayPools } from "@app/hooks/api/gateway-pools";
import { gatewaysQueryKeys } from "@app/hooks/api/gateways/queries";
@@ -65,7 +67,6 @@ import { DeleteHsmConnectorDialog } from "./DeleteHsmConnectorDialog";
import { EditHsmConnectorSheet } from "./EditHsmConnectorSheet";
export const HsmConnectorsTab = () => {
- const navigate = useNavigate();
const { orgId } = useParams({ strict: false });
const { currentProject } = useProject();
const projectId = currentProject.id;
@@ -79,13 +80,7 @@ export const HsmConnectorsTab = () => {
const [copiedId, , setCopiedId] = useTimedReset<string>({ initialState: "" });
const [upgradeOpen, setUpgradeOpen] = useState(false);
- const openDetail = (connectorId: string) => {
- if (!orgId || !projectId) return;
- navigate({
- to: "/organizations/$orgId/cert-manager/hsm-connectors/$connectorId",
- params: { orgId, connectorId }
- });
- };
+ const canOpenDetail = Boolean(orgId && projectId);
const { data: connectors = [], isPending } = useListHsmConnectors({
enabled: isLicensed
@@ -224,16 +219,23 @@ export const HsmConnectorsTab = () => {
</TableHeader>
<TableBody>
{filtered.map((c) => (
- <TableRow
- key={c.id}
- className="cursor-pointer hover:bg-surface-hover"
- onClick={() => openDetail(c.id)}
- >
- <TableCell>{c.name}</TableCell>
+ <TableRow key={c.id} className="hover:bg-surface-hover" linked={canOpenDetail}>
+ <TableCell>
+ <RowLink
+ {...getInstancePinningLink(
+ currentProject.orgId,
+ currentProject,
+ `hsm-connectors/${c.id}`
+ )!}
+ disabled={!canOpenDetail}
+ >
+ {c.name}
+ </RowLink>
+ </TableCell>
<TableCell>{reachedFromLabel(c)}</TableCell>
<TableCell>{c.slotLabel}</TableCell>
<TableCell>{format(new Date(c.createdAt), "MMM d, yyyy")}</TableCell>
- <TableCell onClick={(e) => e.stopPropagation()} className="cursor-default">
+ <TableCell data-row-interactive className="cursor-default">
<DropdownMenu>
<DropdownMenuTrigger asChild>
<IconButton aria-label="Actions" variant="ghost">
diff --git a/frontend/src/pages/cert-manager/SignerDetailPage/components/SignerRequestsTab/SignerRequestsTab.tsx b/frontend/src/pages/cert-manager/SignerDetailPage/components/SignerRequestsTab/SignerRequestsTab.tsx
index 3cee1085d7..5124ffe869 100644
--- a/frontend/src/pages/cert-manager/SignerDetailPage/components/SignerRequestsTab/SignerRequestsTab.tsx
+++ b/frontend/src/pages/cert-manager/SignerDetailPage/components/SignerRequestsTab/SignerRequestsTab.tsx
@@ -1,5 +1,4 @@
import { useEffect, useMemo, useState } from "react";
-import { useNavigate } from "@tanstack/react-router";
import { format } from "date-fns";
import { FilterIcon, MessageSquareTextIcon, XIcon } from "lucide-react";
import { twMerge } from "tailwind-merge";
@@ -25,6 +24,7 @@ import {
IconButton,
PageLoader,
Pagination,
+ RowLink,
Table,
TableBody,
TableCell,
@@ -36,7 +36,8 @@ import {
TooltipProvider,
TooltipTrigger
} from "@app/components/v3";
-import { useOrganization } from "@app/context";
+import { useProject } from "@app/context";
+import { getInstancePinningLink } from "@app/helpers/project";
import { ApprovalPolicyType } from "@app/hooks/api/approvalPolicies";
import {
SIGNER_TABLE_PAGE_SIZE,
@@ -70,8 +71,7 @@ type Props = {
};
export const SignerRequestsTab = ({ signerId, canPreApprove, canRequestSign }: Props) => {
- const navigate = useNavigate();
- const { currentOrg } = useOrganization();
+ const { currentProject } = useProject();
const [statusFilters, setStatusFilters] = useState<Set<FilterStatus>>(new Set());
const [isRequestOpen, setIsRequestOpen] = useState(false);
const [isPreApproveOpen, setIsPreApproveOpen] = useState(false);
@@ -250,20 +250,8 @@ export const SignerRequestsTab = ({ signerId, canPreApprove, canRequestSign }: P
return (
<TableRow
key={req.id}
- className="group cursor-pointer transition-colors hover:bg-surface-hover [&>td]:py-3"
- onClick={() =>
- navigate({
- to: "/organizations/$orgId/cert-manager/approvals/$approvalRequestId",
- params: {
- orgId: currentOrg.id,
- approvalRequestId: req.id
- },
- search: {
- policyType: ApprovalPolicyType.CertCodeSigning,
- signerId
- }
- })
- }
+ className="group transition-colors hover:bg-surface-hover [&>td]:py-3"
+ linked
>
<TableCell isTruncatable>
<div className="flex items-start gap-2">
@@ -271,7 +259,22 @@ export const SignerRequestsTab = ({ signerId, canPreApprove, canRequestSign }: P
<KindIcon kind={member.kind} />
</div>
<div className="min-w-0 flex-1">
- <div className="truncate text-foreground">{member.label}</div>
+ <RowLink
+ {...getInstancePinningLink(
+ currentProject.orgId,
+ currentProject,
+ `approvals/${req.id}`
+ )!}
+ search={
+ {
+ policyType: ApprovalPolicyType.CertCodeSigning,
+ signerId
+ } as never
+ }
+ className="text-foreground"
+ >
+ {member.label}
+ </RowLink>
{req.justification && (
<div className="mt-0.5 max-w-full text-xs text-muted">
<Tooltip>
@@ -315,7 +318,7 @@ export const SignerRequestsTab = ({ signerId, canPreApprove, canRequestSign }: P
<TableCell className="text-accent">
<ExpiresCell req={req} />
</TableCell>
- <TableCell onClick={(e) => e.stopPropagation()}>
+ <TableCell data-row-interactive>
{isRevocable && canPreApprove && (
<Tooltip>
<TooltipTrigger asChild>