Skip to content

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

Address PR comments

Carlos Monastyrski44ff123d0114
diff --git a/frontend/src/pages/cert-manager/CertAuthDetailsByIDPage/CertAuthDetailsByIDPage.tsx b/frontend/src/pages/cert-manager/CertAuthDetailsByIDPage/CertAuthDetailsByIDPage.tsx
index 785ec69700..9b35907012 100644
--- a/frontend/src/pages/cert-manager/CertAuthDetailsByIDPage/CertAuthDetailsByIDPage.tsx
+++ b/frontend/src/pages/cert-manager/CertAuthDetailsByIDPage/CertAuthDetailsByIDPage.tsx
@@ -144,7 +144,7 @@ const Page = () => {
</PageHeader>
<div className="flex flex-col gap-5 lg:flex-row">
<div className="w-full lg:max-w-[24rem]">
- <CaDetailsSection caId={data.id} handlePopUpOpen={handlePopUpOpen} />
+ <CaDetailsSection caId={data.id} />
<CaCertDetailsSection caId={data.id} />
</div>
<div className="flex flex-1 flex-col gap-y-5">
diff --git a/frontend/src/pages/cert-manager/CertAuthDetailsByIDPage/components/CaCertificatesSection/CaCertificatesSection.tsx b/frontend/src/pages/cert-manager/CertAuthDetailsByIDPage/components/CaCertificatesSection/CaCertificatesSection.tsx
index 1100049f48..19849a5277 100644
--- a/frontend/src/pages/cert-manager/CertAuthDetailsByIDPage/components/CaCertificatesSection/CaCertificatesSection.tsx
+++ b/frontend/src/pages/cert-manager/CertAuthDetailsByIDPage/components/CaCertificatesSection/CaCertificatesSection.tsx
@@ -45,7 +45,7 @@ export const CaCertificatesSection = ({ caId, caName, handlePopUpOpen }: Props)
{(isAllowed) => (
<Button
isDisabled={!isAllowed}
- variant="outline"
+ variant="project"
size="xs"
onClick={() => {
if (
@@ -82,7 +82,7 @@ export const CaCertificatesSection = ({ caId, caName, handlePopUpOpen }: Props)
return (
<Button
isDisabled={!isAllowed}
- variant="outline"
+ variant="project"
size="xs"
onClick={() => {
handlePopUpOpen("generateRootCaCert", {
@@ -97,7 +97,7 @@ export const CaCertificatesSection = ({ caId, caName, handlePopUpOpen }: Props)
return (
<Button
isDisabled={!isAllowed}
- variant="outline"
+ variant="project"
size="xs"
onClick={() => {
handlePopUpOpen("installCaCert", {
diff --git a/frontend/src/pages/cert-manager/CertAuthDetailsByIDPage/components/CaCertificatesSection/CaCertificatesTable.tsx b/frontend/src/pages/cert-manager/CertAuthDetailsByIDPage/components/CaCertificatesSection/CaCertificatesTable.tsx
index 012769f288..7095af161b 100644
--- a/frontend/src/pages/cert-manager/CertAuthDetailsByIDPage/components/CaCertificatesSection/CaCertificatesTable.tsx
+++ b/frontend/src/pages/cert-manager/CertAuthDetailsByIDPage/components/CaCertificatesSection/CaCertificatesTable.tsx
@@ -1,18 +1,20 @@
import { subject } from "@casl/ability";
-import { faCertificate } from "@fortawesome/free-solid-svg-icons";
import * as x509 from "@peculiar/x509";
import { format } from "date-fns";
import FileSaver from "file-saver";
import { EllipsisIcon } from "lucide-react";
import { ProjectPermissionCan } from "@app/components/permissions";
-import { EmptyState, TableSkeleton } from "@app/components/v2";
+import { Lottie } from "@app/components/v2";
import {
Badge,
UnstableDropdownMenu,
UnstableDropdownMenuContent,
UnstableDropdownMenuItem,
UnstableDropdownMenuTrigger,
+ UnstableEmpty,
+ UnstableEmptyHeader,
+ UnstableEmptyTitle,
UnstableIconButton,
UnstableTable,
UnstableTableBody,
@@ -37,95 +39,105 @@ export const CaCertificatesTable = ({ caId, caName }: Props) => {
FileSaver.saveAs(blob, filename);
};
+ if (isPending) {
+ return (
+ <div className="flex h-40 w-full items-center justify-center">
+ <Lottie icon="infisical_loading_white" isAutoPlay className="w-16" />
+ </div>
+ );
+ }
+
+ if (!caCerts?.length) {
+ return (
+ <UnstableEmpty className="border">
+ <UnstableEmptyHeader>
+ <UnstableEmptyTitle>
+ This CA does not have any CA certificates installed
+ </UnstableEmptyTitle>
+ </UnstableEmptyHeader>
+ </UnstableEmpty>
+ );
+ }
+
return (
- <>
- <UnstableTable>
- <UnstableTableHeader>
- <UnstableTableRow>
- <UnstableTableHead>CA Certificate #</UnstableTableHead>
- <UnstableTableHead>Not Before</UnstableTableHead>
- <UnstableTableHead>Not After</UnstableTableHead>
- <UnstableTableHead className="w-5" />
- </UnstableTableRow>
- </UnstableTableHeader>
- <UnstableTableBody>
- {isPending && <TableSkeleton columns={4} innerKey="ca-certificates" />}
- {!isPending &&
- caCerts?.map?.((caCert, index) => {
- const isLastItem = index === caCerts.length - 1;
- const caCertObj = new x509.X509Certificate(caCert.certificate);
- return (
- <UnstableTableRow key={`ca-cert=${caCert.serialNumber}`}>
- <UnstableTableCell>
- <div className="flex items-center gap-x-2">
- CA Certificate {caCert.version}
- {isLastItem && <Badge variant="info">Current</Badge>}
- </div>
- </UnstableTableCell>
- <UnstableTableCell>
- {format(new Date(caCertObj.notBefore), "yyyy-MM-dd")}
- </UnstableTableCell>
- <UnstableTableCell>
- {format(new Date(caCertObj.notAfter), "yyyy-MM-dd")}
- </UnstableTableCell>
- <UnstableTableCell>
- <UnstableDropdownMenu>
- <UnstableDropdownMenuTrigger asChild>
- <UnstableIconButton variant="ghost" size="xs">
- <EllipsisIcon />
- </UnstableIconButton>
- </UnstableDropdownMenuTrigger>
- <UnstableDropdownMenuContent align="end">
- <ProjectPermissionCan
- I={ProjectPermissionCertificateAuthorityActions.Read}
- a={subject(ProjectPermissionSub.CertificateAuthorities, {
- name: caName
- })}
+ <UnstableTable>
+ <UnstableTableHeader>
+ <UnstableTableRow>
+ <UnstableTableHead>CA Certificate #</UnstableTableHead>
+ <UnstableTableHead>Not Before</UnstableTableHead>
+ <UnstableTableHead>Not After</UnstableTableHead>
+ <UnstableTableHead className="w-5" />
+ </UnstableTableRow>
+ </UnstableTableHeader>
+ <UnstableTableBody>
+ {caCerts.map((caCert, index) => {
+ const isLastItem = index === caCerts.length - 1;
+ const caCertObj = new x509.X509Certificate(caCert.certificate);
+ return (
+ <UnstableTableRow key={`ca-cert=${caCert.serialNumber}`}>
+ <UnstableTableCell>
+ <div className="flex items-center gap-x-2">
+ CA Certificate {caCert.version}
+ {isLastItem && <Badge variant="info">Current</Badge>}
+ </div>
+ </UnstableTableCell>
+ <UnstableTableCell>
+ {format(new Date(caCertObj.notBefore), "yyyy-MM-dd")}
+ </UnstableTableCell>
+ <UnstableTableCell>
+ {format(new Date(caCertObj.notAfter), "yyyy-MM-dd")}
+ </UnstableTableCell>
+ <UnstableTableCell>
+ <UnstableDropdownMenu>
+ <UnstableDropdownMenuTrigger asChild>
+ <UnstableIconButton variant="ghost" size="xs">
+ <EllipsisIcon />
+ </UnstableIconButton>
+ </UnstableDropdownMenuTrigger>
+ <UnstableDropdownMenuContent align="end">
+ <ProjectPermissionCan
+ I={ProjectPermissionCertificateAuthorityActions.Read}
+ a={subject(ProjectPermissionSub.CertificateAuthorities, {
+ name: caName
+ })}
+ >
+ {(isAllowed) => (
+ <UnstableDropdownMenuItem
+ isDisabled={!isAllowed}
+ onClick={(e) => {
+ e.stopPropagation();
+ downloadTxtFile("cert.pem", caCert.certificate);
+ }}
>
- {(isAllowed) => (
- <UnstableDropdownMenuItem
- isDisabled={!isAllowed}
- onClick={(e) => {
- e.stopPropagation();
- downloadTxtFile("cert.pem", caCert.certificate);
- }}
- >
- Download CA Certificate
- </UnstableDropdownMenuItem>
- )}
- </ProjectPermissionCan>
- <ProjectPermissionCan
- I={ProjectPermissionCertificateAuthorityActions.Read}
- a={subject(ProjectPermissionSub.CertificateAuthorities, {
- name: caName
- })}
+ Download CA Certificate
+ </UnstableDropdownMenuItem>
+ )}
+ </ProjectPermissionCan>
+ <ProjectPermissionCan
+ I={ProjectPermissionCertificateAuthorityActions.Read}
+ a={subject(ProjectPermissionSub.CertificateAuthorities, {
+ name: caName
+ })}
+ >
+ {(isAllowed) => (
+ <UnstableDropdownMenuItem
+ isDisabled={!isAllowed}
+ onClick={(e) => {
+ e.stopPropagation();
+ downloadTxtFile("chain.pem", caCert.certificateChain);
+ }}
>
- {(isAllowed) => (
- <UnstableDropdownMenuItem
- isDisabled={!isAllowed}
- onClick={(e) => {
- e.stopPropagation();
- downloadTxtFile("chain.pem", caCert.certificateChain);
- }}
- >
- Download CA Certificate Chain
- </UnstableDropdownMenuItem>
- )}
- </ProjectPermissionCan>
- </UnstableDropdownMenuContent>
- </UnstableDropdownMenu>
- </UnstableTableCell>
- </UnstableTableRow>
- );
- })}
- </UnstableTableBody>
- </UnstableTable>
- {!isPending && !caCerts?.length && (
- <EmptyState
- title="This CA does not have any CA certificates installed"
- icon={faCertificate}
- />
- )}
- </>
+ Download CA Certificate Chain
+ </UnstableDropdownMenuItem>
+ )}
+ </ProjectPermissionCan>
+ </UnstableDropdownMenuContent>
+ </UnstableDropdownMenu>
+ </UnstableTableCell>
+ </UnstableTableRow>
+ );
+ })}
+ </UnstableTableBody>
+ </UnstableTable>
);
};
diff --git a/frontend/src/pages/cert-manager/CertAuthDetailsByIDPage/components/CaCrlsSection/CaCrlsTable.tsx b/frontend/src/pages/cert-manager/CertAuthDetailsByIDPage/components/CaCrlsSection/CaCrlsTable.tsx
index 35d97b7844..3e68d32c8d 100644
--- a/frontend/src/pages/cert-manager/CertAuthDetailsByIDPage/components/CaCrlsSection/CaCrlsTable.tsx
+++ b/frontend/src/pages/cert-manager/CertAuthDetailsByIDPage/components/CaCrlsSection/CaCrlsTable.tsx
@@ -1,9 +1,15 @@
-import { faCertificate } from "@fortawesome/free-solid-svg-icons";
import FileSaver from "file-saver";
-import { ClipboardListIcon, DownloadIcon } from "lucide-react";
+import { ClipboardListIcon, DownloadIcon, EllipsisIcon } from "lucide-react";
-import { EmptyState, TableSkeleton, Tooltip } from "@app/components/v2";
+import { Lottie } from "@app/components/v2";
import {
+ UnstableDropdownMenu,
+ UnstableDropdownMenuContent,
+ UnstableDropdownMenuItem,
+ UnstableDropdownMenuTrigger,
+ UnstableEmpty,
+ UnstableEmptyHeader,
+ UnstableEmptyTitle,
UnstableIconButton,
UnstableTable,
UnstableTableBody,
@@ -26,60 +32,72 @@ export const CaCrlsTable = ({ caId }: Props) => {
FileSaver.saveAs(blob, filename);
};
+ if (isPending) {
+ return (
+ <div className="flex h-40 w-full items-center justify-center">
+ <Lottie icon="infisical_loading_white" isAutoPlay className="w-16" />
+ </div>
+ );
+ }
+
+ if (!caCrls?.length) {
+ return (
+ <UnstableEmpty className="border">
+ <UnstableEmptyHeader>
+ <UnstableEmptyTitle>This CA does not have any CRLs</UnstableEmptyTitle>
+ </UnstableEmptyHeader>
+ </UnstableEmpty>
+ );
+ }
+
return (
- <>
- <UnstableTable>
- <UnstableTableHeader>
- <UnstableTableRow>
- <UnstableTableHead>Distribution Point URL</UnstableTableHead>
- <UnstableTableHead className="w-5" />
- </UnstableTableRow>
- </UnstableTableHeader>
- <UnstableTableBody>
- {isPending && <TableSkeleton columns={2} innerKey="ca-crls" />}
- {!isPending &&
- caCrls?.map(({ id, crl }) => {
- return (
- <UnstableTableRow key={`ca-crl-${id}`}>
- <UnstableTableCell className="flex items-center gap-x-2">
- {`${window.origin}/api/v1/cert-manager/crl/${id}`}
- <Tooltip content="Copy CRL URL">
- <UnstableIconButton
- variant="ghost"
- size="xs"
- onClick={(e) => {
- e.stopPropagation();
- navigator.clipboard.writeText(
- `${window.origin}/api/v1/cert-manager/crl/${id}`
- );
- }}
- >
- <ClipboardListIcon className="text-label" />
- </UnstableIconButton>
- </Tooltip>
- </UnstableTableCell>
- <UnstableTableCell>
- <Tooltip content="Download CRL">
- <UnstableIconButton
- variant="ghost"
- size="xs"
- onClick={(e) => {
- e.stopPropagation();
- downloadTxtFile("crl.pem", crl);
- }}
- >
- <DownloadIcon className="text-label" />
- </UnstableIconButton>
- </Tooltip>
- </UnstableTableCell>
- </UnstableTableRow>
- );
- })}
- </UnstableTableBody>
- </UnstableTable>
- {!isPending && !caCrls?.length && (
- <EmptyState title="This CA does not have any CRLs" icon={faCertificate} />
- )}
- </>
+ <UnstableTable>
+ <UnstableTableHeader>
+ <UnstableTableRow>
+ <UnstableTableHead>Distribution Point URL</UnstableTableHead>
+ <UnstableTableHead className="w-5" />
+ </UnstableTableRow>
+ </UnstableTableHeader>
+ <UnstableTableBody>
+ {caCrls.map(({ id, crl }) => {
+ return (
+ <UnstableTableRow key={`ca-crl-${id}`}>
+ <UnstableTableCell>{`${window.origin}/api/v1/cert-manager/crl/${id}`}</UnstableTableCell>
+ <UnstableTableCell>
+ <UnstableDropdownMenu>
+ <UnstableDropdownMenuTrigger asChild>
+ <UnstableIconButton variant="ghost" size="xs">
+ <EllipsisIcon />
+ </UnstableIconButton>
+ </UnstableDropdownMenuTrigger>
+ <UnstableDropdownMenuContent align="end">
+ <UnstableDropdownMenuItem
+ onClick={(e) => {
+ e.stopPropagation();
+ navigator.clipboard.writeText(
+ `${window.origin}/api/v1/cert-manager/crl/${id}`
+ );
+ }}
+ >
+ <ClipboardListIcon />
+ Copy CRL URL
+ </UnstableDropdownMenuItem>
+ <UnstableDropdownMenuItem
+ onClick={(e) => {
+ e.stopPropagation();
+ downloadTxtFile("crl.pem", crl);
+ }}
+ >
+ <DownloadIcon />
+ Download CRL
+ </UnstableDropdownMenuItem>
+ </UnstableDropdownMenuContent>
+ </UnstableDropdownMenu>
+ </UnstableTableCell>
+ </UnstableTableRow>
+ );
+ })}
+ </UnstableTableBody>
+ </UnstableTable>
);
};
diff --git a/frontend/src/pages/cert-manager/CertAuthDetailsByIDPage/components/CaDetailsSection.tsx b/frontend/src/pages/cert-manager/CertAuthDetailsByIDPage/components/CaDetailsSection.tsx
index 6d3d30a13c..ca07450e07 100644
--- a/frontend/src/pages/cert-manager/CertAuthDetailsByIDPage/components/CaDetailsSection.tsx
+++ b/frontend/src/pages/cert-manager/CertAuthDetailsByIDPage/components/CaDetailsSection.tsx
@@ -1,38 +1,30 @@
-import { subject } from "@casl/ability";
import { Link } from "@tanstack/react-router";
-import { CheckIcon, ClipboardListIcon, ExternalLinkIcon, PencilIcon } from "lucide-react";
+import { CheckIcon, ClipboardListIcon, ExternalLinkIcon } from "lucide-react";
-import { ProjectPermissionCan } from "@app/components/permissions";
-import { Tooltip } from "@app/components/v2";
import {
Badge,
Detail,
DetailGroup,
DetailLabel,
DetailValue,
+ Tooltip,
+ TooltipContent,
+ TooltipTrigger,
UnstableCard,
- UnstableCardAction,
UnstableCardContent,
UnstableCardHeader,
UnstableCardTitle,
UnstableIconButton
} from "@app/components/v3";
-import {
- ProjectPermissionCertificateAuthorityActions,
- ProjectPermissionSub,
- useOrganization,
- useProject
-} from "@app/context";
+import { useOrganization, useProject } from "@app/context";
import { useTimedReset } from "@app/hooks";
import { CaStatus, CaType, InternalCaType, useGetCa } from "@app/hooks/api";
import { caStatusToNameMap, caTypeToNameMap } from "@app/hooks/api/ca/constants";
import { TInternalCertificateAuthority } from "@app/hooks/api/ca/types";
import { certKeyAlgorithmToNameMap } from "@app/hooks/api/certificates/constants";
-import { UsePopUpState } from "@app/hooks/usePopUp";
type Props = {
caId: string;
- handlePopUpOpen: (popUpName: keyof UsePopUpState<["ca"]>, data?: object) => void;
};
const getStatusVariant = (status: CaStatus) => {
@@ -48,7 +40,7 @@ const getStatusVariant = (status: CaStatus) => {
}
};
-export const CaDetailsSection = ({ caId, handlePopUpOpen }: Props) => {
+export const CaDetailsSection = ({ caId }: Props) => {
const { currentOrg } = useOrganization();
const { currentProject } = useProject();
const [, isCopyingId, setCopyTextId] = useTimedReset<string>({
@@ -80,28 +72,6 @@ export const CaDetailsSection = ({ caId, handlePopUpOpen }: Props) => {
<UnstableCard className="w-full">
<UnstableCardHeader className="border-b">
<UnstableCardTitle>CA Details</UnstableCardTitle>
- <UnstableCardAction>
- <ProjectPermissionCan
- I={ProjectPermissionCertificateAuthorityActions.Edit}
- a={subject(ProjectPermissionSub.CertificateAuthorities, { name: ca.name })}
- >
- {(isAllowed) => (
- <Tooltip content="Edit CA">
- <UnstableIconButton
- isDisabled={!isAllowed}
- variant="outline"
- size="xs"
- onClick={(e) => {
- e.stopPropagation();
- handlePopUpOpen("ca", { caId: ca.id });
- }}
- >
- <PencilIcon />
- </UnstableIconButton>
- </Tooltip>
- )}
- </ProjectPermissionCan>
- </UnstableCardAction>
</UnstableCardHeader>
<UnstableCardContent>
<DetailGroup>
@@ -114,17 +84,20 @@ export const CaDetailsSection = ({ caId, handlePopUpOpen }: Props) => {
<DetailLabel>CA ID</DetailLabel>
<DetailValue className="flex items-center gap-x-1">
<span className="break-all">{ca.id}</span>
- <Tooltip content={isCopyingId ? "Copied" : "Copy ID to clipboard"}>
- <UnstableIconButton
- variant="ghost"
- size="xs"
- onClick={() => {
- navigator.clipboard.writeText(ca.id);
- setCopyTextId("Copied");
- }}
- >
- {isCopyingId ? <CheckIcon /> : <ClipboardListIcon className="text-label" />}
- </UnstableIconButton>
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <UnstableIconButton
+ variant="ghost"
+ size="xs"
+ onClick={() => {
+ navigator.clipboard.writeText(ca.id);
+ setCopyTextId("Copied");
+ }}
+ >
+ {isCopyingId ? <CheckIcon /> : <ClipboardListIcon className="text-label" />}
+ </UnstableIconButton>
+ </TooltipTrigger>
+ <TooltipContent>{isCopyingId ? "Copied" : "Copy ID to clipboard"}</TooltipContent>
</Tooltip>
</DetailValue>
</Detail>