Skip to content

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

improvement(cert-manager): migrate PKI tables, menus and form fields to V3 (#8597)

Andrew Huang2b7d21d2f7f6
diff --git a/frontend/src/pages/cert-manager/AlertingPage/components/PkiAlertRow.tsx b/frontend/src/pages/cert-manager/AlertingPage/components/PkiAlertRow.tsx
index bd4b644075..1f95acf5c1 100644
--- a/frontend/src/pages/cert-manager/AlertingPage/components/PkiAlertRow.tsx
+++ b/frontend/src/pages/cert-manager/AlertingPage/components/PkiAlertRow.tsx
@@ -1,6 +1,4 @@
-import { faEllipsis } from "@fortawesome/free-solid-svg-icons";
-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
-import { twMerge } from "tailwind-merge";
+import { MoreHorizontalIcon } from "lucide-react";
import { ProjectPermissionCan } from "@app/components/permissions";
import {
@@ -8,9 +6,10 @@ import {
DropdownMenuContent,
DropdownMenuItem,
DropdownMenuTrigger,
- Td,
- Tr
-} from "@app/components/v2";
+ IconButton,
+ TableCell,
+ TableRow
+} from "@app/components/v3";
import { ProjectPermissionActions, ProjectPermissionSub } from "@app/context";
import { useGetPkiCollectionById } from "@app/hooks/api";
import { TPkiAlert } from "@app/hooks/api/pkiAlerts/types";
@@ -27,34 +26,31 @@ type Props = {
export const PkiAlertRow = ({ alert, handlePopUpOpen }: Props) => {
const { data: pkiCollection } = useGetPkiCollectionById(alert.pkiCollectionId || "");
return (
- <Tr className="h-10" key={`pki-alert-${alert.id}`}>
- <Td>{alert.name}</Td>
- <Td>{alert.alertBeforeDays}</Td>
- <Td>{pkiCollection ? pkiCollection.name : "-"}</Td>
- <Td>
+ <TableRow key={`pki-alert-${alert.id}`}>
+ <TableCell>{alert.name}</TableCell>
+ <TableCell>{alert.alertBeforeDays}</TableCell>
+ <TableCell>{pkiCollection ? pkiCollection.name : "-"}</TableCell>
+ <TableCell>
<DropdownMenu>
- <DropdownMenuTrigger asChild className="rounded-lg">
- <div className="hover:text-project data-[state=open]:text-project">
- <FontAwesomeIcon size="sm" icon={faEllipsis} />
- </div>
+ <DropdownMenuTrigger asChild>
+ <IconButton variant="ghost" size="xs" aria-label="Alert options">
+ <MoreHorizontalIcon />
+ </IconButton>
</DropdownMenuTrigger>
- <DropdownMenuContent align="start" className="p-1">
+ <DropdownMenuContent align="start">
<ProjectPermissionCan
I={ProjectPermissionActions.Edit}
a={ProjectPermissionSub.PkiAlerts}
>
{(isAllowed) => (
<DropdownMenuItem
- className={twMerge(
- !isAllowed && "pointer-events-none cursor-not-allowed opacity-50"
- )}
onClick={(e) => {
e.stopPropagation();
handlePopUpOpen("pkiAlert", {
alertId: alert.id
});
}}
- disabled={!isAllowed}
+ isDisabled={!isAllowed}
>
Edit Alert
</DropdownMenuItem>
@@ -66,11 +62,7 @@ export const PkiAlertRow = ({ alert, handlePopUpOpen }: Props) => {
>
{(isAllowed) => (
<DropdownMenuItem
- className={twMerge(
- isAllowed
- ? "hover:bg-danger! hover:text-white!"
- : "pointer-events-none cursor-not-allowed opacity-50"
- )}
+ variant="danger"
onClick={(e) => {
e.stopPropagation();
handlePopUpOpen("deletePkiAlert", {
@@ -78,7 +70,7 @@ export const PkiAlertRow = ({ alert, handlePopUpOpen }: Props) => {
name: alert.name
});
}}
- disabled={!isAllowed}
+ isDisabled={!isAllowed}
>
Delete Alert
</DropdownMenuItem>
@@ -86,7 +78,7 @@ export const PkiAlertRow = ({ alert, handlePopUpOpen }: Props) => {
</ProjectPermissionCan>
</DropdownMenuContent>
</DropdownMenu>
- </Td>
- </Tr>
+ </TableCell>
+ </TableRow>
);
};
diff --git a/frontend/src/pages/cert-manager/AlertingPage/components/PkiAlertsTable.tsx b/frontend/src/pages/cert-manager/AlertingPage/components/PkiAlertsTable.tsx
index 4ddbd46713..a30598ce9e 100644
--- a/frontend/src/pages/cert-manager/AlertingPage/components/PkiAlertsTable.tsx
+++ b/frontend/src/pages/cert-manager/AlertingPage/components/PkiAlertsTable.tsx
@@ -1,15 +1,17 @@
-import { faExclamationCircle } from "@fortawesome/free-solid-svg-icons";
+import { CircleAlertIcon } from "lucide-react";
import {
- EmptyState,
+ Empty,
+ EmptyHeader,
+ EmptyMedia,
+ EmptyTitle,
Table,
- TableContainer,
- TableSkeleton,
- TBody,
- Th,
- THead,
- Tr
-} from "@app/components/v2";
+ TableBody,
+ TableHead,
+ TableHeader,
+ TableRow,
+ TableSkeletonRows
+} from "@app/components/v3";
import { useProject } from "@app/context";
import { useListWorkspacePkiAlerts } from "@app/hooks/api";
import { UsePopUpState } from "@app/hooks/usePopUp";
@@ -31,37 +33,42 @@ export const PkiAlertsTable = ({ handlePopUpOpen }: Props) => {
projectId
});
+ if (!isPending && !data?.alerts?.length) {
+ return (
+ <Empty className="border">
+ <EmptyHeader>
+ <EmptyMedia variant="icon">
+ <CircleAlertIcon />
+ </EmptyMedia>
+ <EmptyTitle>No alerts have been created for any certificate collections</EmptyTitle>
+ </EmptyHeader>
+ </Empty>
+ );
+ }
+
return (
- <TableContainer>
- <Table>
- <THead>
- <Tr>
- <Th>Alert Name</Th>
- <Th>Alert Before Days</Th>
- <Th>Certificate Collection</Th>
- <Th className="w-5" />
- </Tr>
- </THead>
- <TBody>
- {isPending && <TableSkeleton columns={4} innerKey="project-pki-alerts" />}
- {!isPending &&
- data?.alerts.map((alert) => {
- return (
- <PkiAlertRow
- key={`alert-${alert.id}`}
- alert={alert}
- handlePopUpOpen={handlePopUpOpen}
- />
- );
- })}
- </TBody>
- </Table>
- {!isPending && !data?.alerts?.length && (
- <EmptyState
- title="No alerts have been created for any certificate collections"
- icon={faExclamationCircle}
- />
- )}
- </TableContainer>
+ <Table>
+ <TableHeader>
+ <TableRow>
+ <TableHead>Alert Name</TableHead>
+ <TableHead>Alert Before Days</TableHead>
+ <TableHead>Certificate Collection</TableHead>
+ <TableHead className="w-5" />
+ </TableRow>
+ </TableHeader>
+ <TableBody>
+ {isPending && <TableSkeletonRows columns={4} />}
+ {!isPending &&
+ data?.alerts.map((alert) => {
+ return (
+ <PkiAlertRow
+ key={`alert-${alert.id}`}
+ alert={alert}
+ handlePopUpOpen={handlePopUpOpen}
+ />
+ );
+ })}
+ </TableBody>
+ </Table>
);
};
diff --git a/frontend/src/pages/cert-manager/ApplicationDetailsByIDPage/components/AddApplicationMemberModal.tsx b/frontend/src/pages/cert-manager/ApplicationDetailsByIDPage/components/AddApplicationMemberModal.tsx
index 438df2e4f8..119ba4b655 100644
--- a/frontend/src/pages/cert-manager/ApplicationDetailsByIDPage/components/AddApplicationMemberModal.tsx
+++ b/frontend/src/pages/cert-manager/ApplicationDetailsByIDPage/components/AddApplicationMemberModal.tsx
@@ -1,10 +1,9 @@
-import { useMemo, useState } from "react";
+import { useId, useMemo, useState } from "react";
import { useQueries } from "@tanstack/react-query";
import { HardDriveIcon, UserIcon, UsersIcon } from "lucide-react";
import { createNotification } from "@app/components/notifications";
import { RoleOption } from "@app/components/roles";
-import { FormControl } from "@app/components/v2";
import {
Button,
ButtonGroup,
@@ -13,7 +12,9 @@ import {
DialogDescription,
DialogFooter,
DialogHeader,
- DialogTitle
+ DialogTitle,
+ Field,
+ FieldLabel
} from "@app/components/v3";
import { FilterableSelect } from "@app/components/v3/generic/ReactSelect";
import { apiRequest } from "@app/config/request";
@@ -98,6 +99,8 @@ export const AddApplicationMemberModal = ({
onOpenChange,
existingMembers
}: Props) => {
+ const memberSelectId = useId();
+ const roleSelectId = useId();
const { currentProject } = useProject();
const projectId = currentProject?.id ?? "";
@@ -304,8 +307,10 @@ export const AddApplicationMemberModal = ({
</ButtonGroup>
{type === "user" && (
- <FormControl label="Users">
+ <Field>
+ <FieldLabel htmlFor={memberSelectId}>Users</FieldLabel>
<FilterableSelect
+ inputId={memberSelectId}
isMulti
isLoading={usersQuery.isPending}
options={userOptions}
@@ -315,12 +320,14 @@ export const AddApplicationMemberModal = ({
formatOptionLabel={formatMemberOptionLabel}
noOptionsMessage={NoUserOptions}
/>
- </FormControl>
+ </Field>
)}
{type === "identity" && (
- <FormControl label="Machine Identities">
+ <Field>
+ <FieldLabel htmlFor={memberSelectId}>Machine Identities</FieldLabel>
<FilterableSelect
+ inputId={memberSelectId}
isMulti
isLoading={identitiesQuery.isPending}
options={identityOptions}
@@ -330,12 +337,14 @@ export const AddApplicationMemberModal = ({
formatOptionLabel={formatMemberOptionLabel}
noOptionsMessage={NoIdentityOptions}
/>
- </FormControl>
+ </Field>
)}
{type === "group" && (
- <FormControl label="Groups">
+ <Field>
+ <FieldLabel htmlFor={memberSelectId}>Groups</FieldLabel>
<FilterableSelect
+ inputId={memberSelectId}
isMulti
isLoading={groupsQuery.isPending}
options={groupOptions}
@@ -345,11 +354,13 @@ export const AddApplicationMemberModal = ({
formatOptionLabel={formatMemberOptionLabel}
noOptionsMessage={NoGroupOptions}
/>
- </FormControl>
+ </Field>
)}
- <FormControl label="Role">
+ <Field>
+ <FieldLabel htmlFor={roleSelectId}>Role</FieldLabel>
<FilterableSelect
+ inputId={roleSelectId}
options={APP_ROLES}
value={APP_ROLES.find((r) => r.slug === role) ?? null}
onChange={(v) => {
@@ -361,7 +372,7 @@ export const AddApplicationMemberModal = ({
components={{ Option: RoleOption }}
isClearable={false}
/>
- </FormControl>
+ </Field>
</div>
<DialogFooter>
diff --git a/frontend/src/pages/cert-manager/ApplicationDetailsByIDPage/components/ConfigureEnrollmentModal.tsx b/frontend/src/pages/cert-manager/ApplicationDetailsByIDPage/components/ConfigureEnrollmentModal.tsx
index b49adc6b5d..d15afc2d28 100644
--- a/frontend/src/pages/cert-manager/ApplicationDetailsByIDPage/components/ConfigureEnrollmentModal.tsx
+++ b/frontend/src/pages/cert-manager/ApplicationDetailsByIDPage/components/ConfigureEnrollmentModal.tsx
@@ -18,7 +18,6 @@ import {
useUpgradeGate
} from "@app/components/license/UpgradeGate";
import { createNotification } from "@app/components/notifications";
-import { Spinner, Tab, TabList, TabPanel, Tabs } from "@app/components/v2";
import {
AlertDialog,
AlertDialogAction,
@@ -61,6 +60,11 @@ import {
SelectItem,
SelectTrigger,
SelectValue,
+ Spinner,
+ Tabs,
+ TabsContent,
+ TabsList,
+ TabsTrigger,
TextArea,
Toggle,
Tooltip,
@@ -1518,16 +1522,16 @@ export const ConfigureEnrollmentModal = ({
<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">
+ <TabsList variant="project" className="border-b-0">
{visibleMethods.map((m) => (
- <Tab key={m} value={m}>
+ <TabsTrigger key={m} value={m}>
{METHOD_LABELS[m]}
{isUnsaved(m) && (
<span className="ml-1.5 text-xs text-muted">(unsaved)</span>
)}
- </Tab>
+ </TabsTrigger>
))}
- </TabList>
+ </TabsList>
</Tabs>
) : (
<div />
@@ -1581,7 +1585,7 @@ export const ConfigureEnrollmentModal = ({
)}
<Tabs value={activeTab} onValueChange={(v) => setActiveTab(v as EnrollmentMethod)}>
{visibleMethods.includes("api") ? (
- <TabPanel value="api" className="pb-0 data-[state=inactive]:hidden" forceMount>
+ <TabsContent value="api" className="data-[state=inactive]:hidden" forceMount>
<ApiPanel
applicationId={applicationId}
profileId={profileId}
@@ -1590,10 +1594,10 @@ export const ConfigureEnrollmentModal = ({
onCancelPending={() => handleCancelPending("api")}
onDirtyChange={(d) => handleDirtyChange("api", d)}
/>
- </TabPanel>
+ </TabsContent>
) : null}
{visibleMethods.includes("est") ? (
- <TabPanel value="est" className="pb-0 data-[state=inactive]:hidden" forceMount>
+ <TabsContent value="est" className="data-[state=inactive]:hidden" forceMount>
<EstPanel
applicationId={applicationId}
profileId={profileId}
@@ -1602,10 +1606,10 @@ export const ConfigureEnrollmentModal = ({
onCancelPending={() => handleCancelPending("est")}
onDirtyChange={(d) => handleDirtyChange("est", d)}
/>
- </TabPanel>
+ </TabsContent>
) : null}
{visibleMethods.includes("acme") ? (
- <TabPanel value="acme" className="pb-0 data-[state=inactive]:hidden" forceMount>
+ <TabsContent value="acme" className="data-[state=inactive]:hidden" forceMount>
<AcmePanel
applicationId={applicationId}
profileId={profileId}
@@ -1614,10 +1618,10 @@ export const ConfigureEnrollmentModal = ({
onCancelPending={() => handleCancelPending("acme")}
onDirtyChange={(d) => handleDirtyChange("acme", d)}
/>
- </TabPanel>
+ </TabsContent>
) : null}
{visibleMethods.includes("scep") ? (
- <TabPanel value="scep" className="pb-0 data-[state=inactive]:hidden" forceMount>
+ <TabsContent value="scep" className="data-[state=inactive]:hidden" forceMount>
<ScepPanel
applicationId={applicationId}
profileId={profileId}
@@ -1628,7 +1632,7 @@ export const ConfigureEnrollmentModal = ({
onCancelPending={() => handleCancelPending("scep")}
onDirtyChange={(d) => handleDirtyChange("scep", d)}
/>
- </TabPanel>
+ </TabsContent>
) : null}
</Tabs>
</>
diff --git a/frontend/src/pages/cert-manager/ApprovalsPage/components/PolicyTab/components/PoliciesTable.tsx b/frontend/src/pages/cert-manager/ApprovalsPage/components/PolicyTab/components/PoliciesTable.tsx
index 573c8f52b0..75056d3be5 100644
--- a/frontend/src/pages/cert-manager/ApprovalsPage/components/PolicyTab/components/PoliciesTable.tsx
+++ b/frontend/src/pages/cert-manager/ApprovalsPage/components/PolicyTab/components/PoliciesTable.tsx
@@ -1,31 +1,29 @@
import { useMemo } from "react";
-import {
- faEdit,
- faEllipsisV,
- faFileCircleQuestion,
- faTrash
-} from "@fortawesome/free-solid-svg-icons";
-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { useQuery } from "@tanstack/react-query";
import { formatDistance } from "date-fns";
+import { EllipsisVerticalIcon, FileQuestionIcon, PencilIcon, Trash2Icon } from "lucide-react";
import {
DropdownMenu,
DropdownMenuContent,
DropdownMenuItem,
DropdownMenuTrigger,
- EmptyState,
+ Empty,
+ EmptyHeader,
+ EmptyMedia,
+ EmptyTitle,
IconButton,
Table,
- TableContainer,
- TableSkeleton,
- TBody,
- Td,
- Th,
- THead,
+ TableBody,
+ TableCell,
+ TableHead,
+ TableHeader,
+ TableRow,
+ TableSkeletonRows,
Tooltip,
- Tr
-} from "@app/components/v2";
+ TooltipContent,
+ TooltipTrigger
+} from "@app/components/v3";
import { useProject } from "@app/context";
import {
approvalPolicyQuery,
@@ -67,100 +65,104 @@ export const PoliciesTable = ({ handlePopUpOpen, applicationId }: Props) => {
return conditions.flatMap((c: { profileNames: string[] }) => c.profileNames);
};
+ if (!isPoliciesLoading && !sortedPolicies.length) {
+ return (
+ <Empty className="border">
+ <EmptyHeader>
+ <EmptyMedia variant="icon">
+ <FileQuestionIcon />
+ </EmptyMedia>
+ <EmptyTitle>No certificate approval policies found</EmptyTitle>
+ </EmptyHeader>
+ </Empty>
+ );
+ }
+
return (
- <TableContainer>
- <Table>
- <THead>
- <Tr>
- <Th>Policy Name</Th>
- <Th>Profile Name</Th>
- <Th>Approval Steps</Th>
- <Th>Created</Th>
- <Th className="w-5" />
- </Tr>
- </THead>
- <TBody>
- {isPoliciesLoading && <TableSkeleton columns={5} innerKey="cert-approval-policies" />}
- {!isPoliciesLoading &&
- sortedPolicies.map((policy) => {
- const profileNames = getProfileNames(policy);
- return (
- <Tr key={policy.id} className="group">
- <Td>
- <div className="flex items-center gap-x-2">
- <span className="text-sm font-medium text-foreground">{policy.name}</span>
- {policy.scopeType !== ApprovalPolicyScope.PkiApplication && (
- <span className="rounded bg-surface-active px-2 py-0.5 text-[10px] tracking-wide text-foreground-secondary uppercase">
- Legacy
- </span>
- )}
- </div>
- </Td>
- <Td>
- <div className="flex flex-wrap items-center gap-1">
- {profileNames.slice(0, 3).map((name) => (
- <span
- key={name}
- className="rounded bg-surface-active px-2 py-0.5 text-xs text-foreground-secondary"
- >
- {name}
- </span>
- ))}
- {profileNames.length > 3 && (
- <span className="text-xs text-muted">+{profileNames.length - 3} more</span>
- )}
- </div>
- </Td>
- <Td>
- <span className="text-sm text-foreground-secondary">
- {policy.steps.length} step{policy.steps.length !== 1 ? "s" : ""}
- </span>
- </Td>
- <Td>
- <span className="text-sm text-muted">
- {formatDistance(new Date(policy.createdAt), new Date(), { addSuffix: true })}
- </span>
- </Td>
- <Td>
- <DropdownMenu>
- <DropdownMenuTrigger asChild className="rounded-lg">
- <div className="hover:text-project data-[state=open]:text-project">
- <Tooltip content="More options">
- <IconButton
- ariaLabel="More options"
- variant="plain"
- className="w-4 p-0"
- size="md"
- >
- <FontAwesomeIcon icon={faEllipsisV} />
- </IconButton>
- </Tooltip>
- </div>
- </DropdownMenuTrigger>
- <DropdownMenuContent align="end" className="p-1" sideOffset={5}>
- <DropdownMenuItem
- onClick={() => handlePopUpOpen("policy", { policyId: policy.id, policy })}
- icon={<FontAwesomeIcon icon={faEdit} />}
- >
- Edit Policy
- </DropdownMenuItem>
- <DropdownMenuItem
- onClick={() => handlePopUpOpen("deletePolicy", { policyId: policy.id })}
- icon={<FontAwesomeIcon icon={faTrash} />}
- >
- Delete Policy
- </DropdownMenuItem>
- </DropdownMenuContent>
- </DropdownMenu>
- </Td>
- </Tr>
- );
- })}
- </TBody>
- </Table>
- {!isPoliciesLoading && !sortedPolicies.length && (
- <EmptyState title="No certificate approval policies found" icon={faFileCircleQuestion} />
- )}
- </TableContainer>
+ <Table>
+ <TableHeader>
+ <TableRow>
+ <TableHead>Policy Name</TableHead>
+ <TableHead>Profile Name</TableHead>
+ <TableHead>Approval Steps</TableHead>
+ <TableHead>Created</TableHead>
+ <TableHead className="w-5" />
+ </TableRow>
+ </TableHeader>
+ <TableBody>
+ {isPoliciesLoading && <TableSkeletonRows columns={5} />}
+ {!isPoliciesLoading &&
+ sortedPolicies.map((policy) => {
+ const profileNames = getProfileNames(policy);
+ return (
+ <TableRow key={policy.id} className="group">
+ <TableCell>
+ <div className="flex items-center gap-x-2">
+ <span className="text-sm font-medium text-foreground">{policy.name}</span>
+ {policy.scopeType !== ApprovalPolicyScope.PkiApplication && (
+ <span className="rounded bg-surface-active px-2 py-0.5 text-[10px] tracking-wide text-foreground-secondary">
+ Legacy
+ </span>
+ )}
+ </div>
+ </TableCell>
+ <TableCell>
+ <div className="flex flex-wrap items-center gap-1">
+ {profileNames.slice(0, 3).map((name) => (
+ <span
+ key={name}
+ className="rounded bg-surface-active px-2 py-0.5 text-xs text-foreground-secondary"
+ >
+ {name}
+ </span>
+ ))}
+ {profileNames.length > 3 && (
+ <span className="text-xs text-muted">+{profileNames.length - 3} more</span>
+ )}
+ </div>
+ </TableCell>
+ <TableCell>
+ <span className="text-sm text-foreground-secondary">
+ {policy.steps.length} step{policy.steps.length !== 1 ? "s" : ""}
+ </span>
+ </TableCell>
+ <TableCell>
+ <span className="text-sm text-muted">
+ {formatDistance(new Date(policy.createdAt), new Date(), { addSuffix: true })}
+ </span>
+ </TableCell>
+ <TableCell>
+ <DropdownMenu>
+ <Tooltip hoverable delayDuration={50}>
+ <TooltipTrigger asChild>
+ <DropdownMenuTrigger asChild>
+ <IconButton aria-label="More options" variant="ghost" size="xs">
+ <EllipsisVerticalIcon />
+ </IconButton>
+ </DropdownMenuTrigger>
+ </TooltipTrigger>
+ <TooltipContent>More options</TooltipContent>
+ </Tooltip>
+ <DropdownMenuContent align="end" sideOffset={5}>
+ <DropdownMenuItem
+ onClick={() => handlePopUpOpen("policy", { policyId: policy.id, policy })}
+ >
+ <PencilIcon />
+ Edit Policy
+ </DropdownMenuItem>
+ <DropdownMenuItem
+ onClick={() => handlePopUpOpen("deletePolicy", { policyId: policy.id })}
+ >
+ <Trash2Icon />
+ Delete Policy
+ </DropdownMenuItem>
+ </DropdownMenuContent>
+ </DropdownMenu>
+ </TableCell>
+ </TableRow>
+ );
+ })}
+ </TableBody>
+ </Table>
);
};
diff --git a/frontend/src/pages/cert-manager/ApprovalsPage/components/PolicyTab/components/PolicySteps/PolicyDetailsStep.tsx b/frontend/src/pages/cert-manager/ApprovalsPage/components/PolicyTab/components/PolicySteps/PolicyDetailsStep.tsx
index 39304507a7..56917554a9 100644
--- a/frontend/src/pages/cert-manager/ApprovalsPage/components/PolicyTab/components/PolicySteps/PolicyDetailsStep.tsx
+++ b/frontend/src/pages/cert-manager/ApprovalsPage/components/PolicyTab/components/PolicySteps/PolicyDetailsStep.tsx
@@ -2,7 +2,16 @@ import { useMemo } from "react";
import { Controller, useFormContext } from "react-hook-form";
import { TtlFormLabel } from "@app/components/features";
-import { Checkbox, FilterableSelect, FormControl, Input } from "@app/components/v2";
+import { FilterableSelect } from "@app/components/v2";
+import {
+ Checkbox,
+ Field,
+ FieldContent,
+ FieldDescription,
+ FieldError,
+ FieldLabel,
+ Input
+} from "@app/components/v3";
import { useListCertificateProfiles } from "@app/hooks/api/certificateProfiles";
import { useListPkiApplicationProfiles } from "@app/hooks/api/pkiApplications";
@@ -44,20 +53,22 @@ export const PolicyDetailsStep = ({ applicationId }: Props) => {
control={control}
name="name"
render={({ field, fieldState: { error } }) => (
- <FormControl
- label="Policy Name"
- className="mb-0 flex-1"
- isRequired
- isError={Boolean(error)}
- errorText={error?.message}
- >
- <Input
- {...field}
- placeholder="Enter policy name"
- autoComplete="off"
- name="policy-name"
- />
- </FormControl>
+ <Field className="flex-1">
+ <FieldLabel htmlFor="policy-name">
+ Policy Name <span className="text-danger">*</span>
+ </FieldLabel>
+ <FieldContent>
+ <Input
+ {...field}
+ id="policy-name"
+ placeholder="Enter policy name"
+ autoComplete="off"
+ name="policy-name"
+ isError={Boolean(error)}
+ />
+ <FieldError errors={[error]} />
+ </FieldContent>
+ </Field>
)}
/>
@@ -65,26 +76,28 @@ export const PolicyDetailsStep = ({ applicationId }: Props) => {
control={control}
name="maxRequestTtl"
render={({ field, fieldState: { error } }) => (
- <FormControl
- label={<TtlFormLabel label="Max. Request TTL" />}
- className="mb-0"
- isError={Boolean(error)}
- errorText={error?.message}
- helperText="Maximum time a request can be pending (optional)"
- >
- <Input
- {...field}
- value={field.value || ""}
- placeholder="e.g., 7d"
- onChange={(e) => {
- if (!e.target.value || e.target.value === "") {
- field.onChange(null);
- return;
- }
- field.onChange(e.target.value);
- }}
- />
- </FormControl>
+ <Field className="w-auto">
+ <TtlFormLabel label="Max. Request TTL" />
+ <FieldContent>
+ <Input
+ {...field}
+ value={field.value || ""}
+ placeholder="e.g., 7d"
+ isError={Boolean(error)}
+ onChange={(e) => {
+ if (!e.target.value || e.target.value === "") {
+ field.onChange(null);
+ return;
+ }
+ field.onChange(e.target.value);
+ }}
+ />
+ <FieldDescription isOpen={!error}>
+ Maximum time a request can be pending (optional)
+ </FieldDescription>
+ <FieldError errors={[error]} />
+ </FieldContent>
+ </Field>
)}
/>
</div>
@@ -93,27 +106,31 @@ export const PolicyDetailsStep = ({ applicationId }: Props) => {
control={control}
name="conditions.0.profileNames"
render={({ field: profileField, fieldState: { error } }) => (
- <FormControl
- isRequired
- label="Certificate Profiles"
- isError={Boolean(error)}
- errorText={error?.message}
- helperText="Policy applies to certificates issued from these selected profiles"
- >
- <FilterableSelect
- isMulti
- isLoading={applicationId ? isAppProfilesLoading : isProfilesLoading}
- options={profileOptions}
- value={profileField.value.map((slug) => ({ label: slug, value: slug }))}
- onChange={(selected) => {
- const selectedOptions = selected as ProfileOption[];
- profileField.onChange(selectedOptions.map((opt) => opt.value));
- }}
- placeholder="Select certificate profiles..."
- noOptionsMessage={() => "No profiles found"}
- maxMenuHeight={150}
- />
- </FormControl>
+ <Field>
+ <FieldLabel htmlFor="policy-profile-names">
+ Certificate Profiles <span className="text-danger">*</span>
+ </FieldLabel>
+ <FieldContent>
+ <FilterableSelect
+ inputId="policy-profile-names"
+ isMulti
+ isLoading={applicationId ? isAppProfilesLoading : isProfilesLoading}
+ options={profileOptions}
+ value={profileField.value.map((slug) => ({ label: slug, value: slug }))}
+ onChange={(selected) => {
+ const selectedOptions = selected as ProfileOption[];
+ profileField.onChange(selectedOptions.map((opt) => opt.value));
+ }}
+ placeholder="Select certificate profiles..."
+ noOptionsMessage={() => "No profiles found"}
+ maxMenuHeight={150}
+ />
+ <FieldDescription isOpen={!error}>
+ Policy applies to certificates issued from these selected profiles
+ </FieldDescription>
+ <FieldError errors={[error]} />
+ </FieldContent>
+ </Field>
)}
/>
@@ -121,21 +138,22 @@ export const PolicyDetailsStep = ({ applicationId }: Props) => {
control={control}
name="bypassForMachineIdentities"
render={({ field: { value, onChange } }) => (
- <div className="mt-2 items-center">
+ <Field orientation="horizontal" className="mt-2">
<Checkbox
id="bypassForMachineIdentities"
+ variant="project"
isChecked={value}
onCheckedChange={onChange}
- checkIndicatorBg="text-project"
- >
- <span className="text-sm text-foreground-secondary">
+ />
+ <FieldContent>
+ <FieldLabel htmlFor="bypassForMachineIdentities" className="cursor-pointer">
Bypass approval for machine identities
- </span>
- <p className="text-xs text-muted">
+ </FieldLabel>
+ <FieldDescription>
When enabled, machine identities can issue certificates without requiring approval
- </p>
- </Checkbox>
- </div>
+ </FieldDescription>
+ </FieldContent>
+ </Field>
)}
/>
</div>
diff --git a/frontend/src/pages/cert-manager/CertificateDetailsByIDPage/components/CertificateDetailsSection.tsx b/frontend/src/pages/cert-manager/CertificateDetailsByIDPage/components/CertificateDetailsSection.tsx
index f955f03f22..ecbe32b8f9 100644
--- a/frontend/src/pages/cert-manager/CertificateDetailsByIDPage/components/CertificateDetailsSection.tsx
+++ b/frontend/src/pages/cert-manager/CertificateDetailsByIDPage/components/CertificateDetailsSection.tsx
@@ -1,4 +1,3 @@
-import { CopyButton } from "@app/components/v2/CopyButton";
import {
Badge,
Card,
@@ -6,6 +5,7 @@ import {
CardDescription,
CardHeader,
CardTitle,
+ CopyButton,
Detail,
DetailGroup,
DetailLabel,
@@ -274,8 +274,7 @@ export const CertificateDetailsSection = ({ certificateId }: Props) => {
{certificate.fingerprints.sha256 && (
<CopyButton
value={certificate.fingerprints.sha256}
- size="xs"
- variant="plain"
+ ariaLabel="Copy SHA-256 fingerprint"
/>
)}
</DetailValue>
@@ -285,7 +284,10 @@ export const CertificateDetailsSection = ({ certificateId }: Props) => {
<DetailValue className="flex items-center gap-2 font-mono">
{certificate.fingerprints.sha1 || <span className="text-muted">—</span>}
{certificate.fingerprints.sha1 && (
- <CopyButton value={certificate.fingerprints.sha1} size="xs" variant="plain" />
+ <CopyButton
+ value={certificate.fingerprints.sha1}
+ ariaLabel="Copy SHA-1 fingerprint"
+ />
)}
</DetailValue>
</Detail>
diff --git a/frontend/src/pages/cert-manager/CertificateRequestsPage/components/CertificateRequestsSection.tsx b/frontend/src/pages/cert-manager/CertificateRequestsPage/components/CertificateRequestsSection.tsx
index efd60a53ae..34152153a1 100644
--- a/frontend/src/pages/cert-manager/CertificateRequestsPage/components/CertificateRequestsSection.tsx
+++ b/frontend/src/pages/cert-manager/CertificateRequestsPage/components/CertificateRequestsSection.tsx
@@ -5,7 +5,7 @@ import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { SearchIcon } from "lucide-react";
import { twMerge } from "tailwind-merge";
-import { FilterableSelect, Select, SelectItem } from "@app/components/v2";
+import { FilterableSelect } from "@app/components/v2";
import {
Button,
Card,
@@ -26,6 +26,11 @@ import {
InputGroupAddon,
InputGroupInput,
Pagination,
+ Select,
+ SelectContent,
+ SelectItem,
+ SelectTrigger,
+ SelectValue,
Skeleton,
Table,
TableBody,
@@ -359,15 +364,16 @@ export const CertificateRequestsSection = ({
status: value === "all" ? undefined : (value as CertificateRequestStatus)
}));
}}
- placeholder="All events"
- className="w-full border-border-control bg-surface-hover text-foreground-soft"
- position="popper"
- dropdownContainerClassName="max-w-none"
>
- <SelectItem value="all">All events</SelectItem>
- <SelectItem value="pending">Pending</SelectItem>
- <SelectItem value="issued">Issued</SelectItem>
- <SelectItem value="failed">Failed</SelectItem>
+ <SelectTrigger className="w-full">
+ <SelectValue placeholder="All events" />
+ </SelectTrigger>
+ <SelectContent position="popper">
+ <SelectItem value="all">All events</SelectItem>
+ <SelectItem value="pending">Pending</SelectItem>
+ <SelectItem value="issued">Issued</SelectItem>
+ <SelectItem value="failed">Failed</SelectItem>
+ </SelectContent>
</Select>
</div>
diff --git a/frontend/src/pages/cert-manager/DiscoveryDetailsByIDPage/components/DiscoveryScanLogsSection.tsx b/frontend/src/pages/cert-manager/DiscoveryDetailsByIDPage/components/DiscoveryScanLogsSection.tsx
index aacfe9cf09..ad50e12280 100644
--- a/frontend/src/pages/cert-manager/DiscoveryDetailsByIDPage/components/DiscoveryScanLogsSection.tsx
+++ b/frontend/src/pages/cert-manager/DiscoveryDetailsByIDPage/components/DiscoveryScanLogsSection.tsx
@@ -3,7 +3,6 @@ import { faSyncAlt } from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { format } from "date-fns";
-import { Tooltip } from "@app/components/v2";
import {
Button,
Card,
@@ -22,7 +21,10 @@ import {
TableCell,
TableHead,
TableHeader,
- TableRow
+ TableRow,
+ Tooltip,
+ TooltipContent,
+ TooltipTrigger
} from "@app/components/v3";
import { useGetScanHistory } from "@app/hooks/api";
import { getScanStatusBadge } from "@app/pages/cert-manager/pki-discovery-utils";
@@ -131,19 +133,19 @@ export const DiscoveryScanLogsSection = ({
<TableCell>{duration !== null ? `${duration}s` : "-"}</TableCell>
<TableCell>
{scan.errorMessage ? (
- <Tooltip
- className="max-w-sm"
- content={
+ <Tooltip hoverable delayDuration={50}>
+ <TooltipTrigger asChild>
+ <span className="cursor-help truncate text-warning">
+ {scan.errorMessage.length > 20
+ ? `${scan.errorMessage.substring(0, 20)}...`
+ : scan.errorMessage}
+ </span>
+ </TooltipTrigger>
+ <TooltipContent className="max-w-sm">
<div className="max-h-40 overflow-y-auto py-1 text-xs break-words whitespace-normal">
{scan.errorMessage}
</div>
- }
- >
- <span className="cursor-help truncate text-warning">
- {scan.errorMessage.length > 20
- ? `${scan.errorMessage.substring(0, 20)}...`
- : scan.errorMessage}
- </span>
+ </TooltipContent>
</Tooltip>
) : (
"-"
diff --git a/frontend/src/pages/cert-manager/PkiCollectionDetailsByIDPage/components/PkiCollectionDetailsSection.tsx b/frontend/src/pages/cert-manager/PkiCollectionDetailsByIDPage/components/PkiCollectionDetailsSection.tsx
index 1cd8761913..016ebe1eed 100644
--- a/frontend/src/pages/cert-manager/PkiCollectionDetailsByIDPage/components/PkiCollectionDetailsSection.tsx
+++ b/frontend/src/pages/cert-manager/PkiCollectionDetailsByIDPage/components/PkiCollectionDetailsSection.tsx
@@ -1,8 +1,7 @@
-import { faCheck, faCopy, faPencil } from "@fortawesome/free-solid-svg-icons";
-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
+import { CheckIcon, CopyIcon, PencilIcon } from "lucide-react";
import { ProjectPermissionCan } from "@app/components/permissions";
-import { IconButton, Tooltip } from "@app/components/v2";
+import { IconButton, Tooltip, TooltipContent, TooltipTrigger } from "@app/components/v3";
import { ProjectPermissionActions, ProjectPermissionSub } from "@app/context";
import { useTimedReset } from "@app/hooks";
import { useGetPkiCollectionById } from "@app/hooks/api";
@@ -30,20 +29,25 @@ export const PkiCollectionDetailsSection = ({ collectionId, handlePopUpOpen }: P
>
{(isAllowed) => {
return (
- <Tooltip content="Edit Identity">
- <IconButton
- isDisabled={!isAllowed}
- ariaLabel="copy icon"
- variant="plain"
- className="group relative"
- onClick={() =>
- handlePopUpOpen("pkiCollection", {
- collectionId
- })
- }
- >
- <FontAwesomeIcon icon={faPencil} />
- </IconButton>
+ <Tooltip hoverable delayDuration={50}>
+ <TooltipTrigger asChild>
+ <span className="inline-flex">
+ <IconButton
+ isDisabled={!isAllowed}
+ aria-label="Edit collection"
+ variant="ghost"
+ size="xs"
+ onClick={() =>
+ handlePopUpOpen("pkiCollection", {
+ collectionId
+ })
+ }
+ >
+ <PencilIcon />
+ </IconButton>
+ </span>
+ </TooltipTrigger>
+ <TooltipContent>Edit Collection</TooltipContent>
</Tooltip>
);
}}
@@ -55,18 +59,22 @@ export const PkiCollectionDetailsSection = ({ collectionId, handlePopUpOpen }: P
<div className="group flex align-top">
<p className="text-sm text-label">{pkiCollection.id}</p>
<div className="opacity-0 transition-opacity duration-300 group-hover:opacity-100">
- <Tooltip content={copyTextId}>
- <IconButton
- ariaLabel="copy icon"
- variant="plain"
- className="group relative ml-2"
- onClick={() => {
- navigator.clipboard.writeText(pkiCollection.id);
- setCopyTextId("Copied");
- }}
- >
- <FontAwesomeIcon icon={isCopyingId ? faCheck : faCopy} />
- </IconButton>
+ <Tooltip hoverable delayDuration={50}>
+ <TooltipTrigger asChild>
+ <IconButton
+ aria-label="Copy ID to clipboard"
+ variant="ghost"
+ size="xs"
+ className="ml-2"
+ onClick={() => {
+ navigator.clipboard.writeText(pkiCollection.id);
+ setCopyTextId("Copied");
+ }}
+ >
+ {isCopyingId ? <CheckIcon /> : <CopyIcon />}
+ </IconButton>
+ </TooltipTrigger>
+ <TooltipContent>{copyTextId}</TooltipContent>
</Tooltip>
</div>
</div>
diff --git a/frontend/src/pages/cert-manager/PkiCollectionDetailsByIDPage/components/PkiCollectionItemsTable.tsx b/frontend/src/pages/cert-manager/PkiCollectionDetailsByIDPage/components/PkiCollectionItemsTable.tsx
index 404b1d22f0..c0cf21e3ac 100644
--- a/frontend/src/pages/cert-manager/PkiCollectionDetailsByIDPage/components/PkiCollectionItemsTable.tsx
+++ b/frontend/src/pages/cert-manager/PkiCollectionDetailsByIDPage/components/PkiCollectionItemsTable.tsx
@@ -1,23 +1,26 @@
import { useState } from "react";
-import { faBoxesStacked, faXmark } from "@fortawesome/free-solid-svg-icons";
-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { format } from "date-fns";
+import { BoxesIcon, XIcon } from "lucide-react";
import { ProjectPermissionCan } from "@app/components/permissions";
import {
- EmptyState,
+ Empty,
+ EmptyHeader,
+ EmptyMedia,
+ EmptyTitle,
IconButton,
Pagination,
Table,
- TableContainer,
- TableSkeleton,
- TBody,
- Td,
- Th,
- THead,
+ TableBody,
+ TableCell,
+ TableHead,
+ TableHeader,
+ TableRow,
+ TableSkeletonRows,
Tooltip,
- Tr
-} from "@app/components/v2";
+ TooltipContent,
+ TooltipTrigger
+} from "@app/components/v3";
import { ProjectPermissionActions, ProjectPermissionSub } from "@app/context";
import { useListPkiCollectionItems } from "@app/hooks/api";
import { PkiItemType, pkiItemTypeToNameMap } from "@app/hooks/api/pkiCollections/constants";
@@ -47,75 +50,84 @@ export const PkiCollectionItemsTable = ({ collectionId, type, handlePopUpOpen }:
return (
<div>
- <TableContainer>
+ {!isPending && !data?.collectionItems?.length ? (
+ <Empty className="border">
+ <EmptyHeader>
+ <EmptyMedia variant="icon">
+ <BoxesIcon />
+ </EmptyMedia>
+ <EmptyTitle>{`No ${pkiItemTypeToNameMap[type]}s have been added to this collection`}</EmptyTitle>
+ </EmptyHeader>
+ </Empty>
+ ) : (
<Table>
- <THead>
- <Tr>
- <Th>Friendly Name</Th>
- <Th>Not Before</Th>
- <Th>Not After</Th>
- <Th className="w-5" />
- </Tr>
- </THead>
- <TBody>
- {isPending && <TableSkeleton columns={2} innerKey="pki-collections" />}
+ <TableHeader>
+ <TableRow>
+ <TableHead>Friendly Name</TableHead>
+ <TableHead>Not Before</TableHead>
+ <TableHead>Not After</TableHead>
+ <TableHead className="w-5" />
+ </TableRow>
+ </TableHeader>
+ <TableBody>
+ {isPending && <TableSkeletonRows columns={4} />}
{!isPending &&
data?.collectionItems.map((collectionItem) => {
return (
- <Tr className="group" key={`pki-collection-item-${collectionItem.id}`}>
- <Td className="w-1/3">{collectionItem.friendlyName}</Td>
- <Td>{format(new Date(collectionItem.notBefore), "yyyy-MM-dd")}</Td>
- <Td>{format(new Date(collectionItem.notAfter), "yyyy-MM-dd")}</Td>
- <Td>
+ <TableRow className="group" key={`pki-collection-item-${collectionItem.id}`}>
+ <TableCell className="w-1/3">{collectionItem.friendlyName}</TableCell>
+ <TableCell>
+ {format(new Date(collectionItem.notBefore), "yyyy-MM-dd")}
+ </TableCell>
+ <TableCell>{format(new Date(collectionItem.notAfter), "yyyy-MM-dd")}</TableCell>
+ <TableCell>
<div className="opacity-0 transition-opacity duration-300 group-hover:opacity-100">
<ProjectPermissionCan
I={ProjectPermissionActions.Delete}
a={ProjectPermissionSub.PkiCollections}
>
{(isAllowed) => (
- <Tooltip content="Remove">
- <IconButton
- colorSchema="danger"
- ariaLabel="copy icon"
- variant="plain"
- className="group relative"
- isDisabled={!isAllowed}
- onClick={(e) => {
- e.stopPropagation();
- handlePopUpOpen("deletePkiCollectionItem", {
- collectionId,
- itemId: collectionItem.id
- });
- }}
- >
- <FontAwesomeIcon icon={faXmark} />
- </IconButton>
+ <Tooltip hoverable delayDuration={50}>
+ <TooltipTrigger asChild>
+ <span className="inline-flex">
+ <IconButton
+ aria-label="Remove"
+ variant="ghost"
+ size="xs"
+ isDisabled={!isAllowed}
+ onClick={(e) => {
+ e.stopPropagation();
+ handlePopUpOpen("deletePkiCollectionItem", {
+ collectionId,
+ itemId: collectionItem.id
+ });
+ }}
+ >
+ <XIcon />
+ </IconButton>
+ </span>
+ </TooltipTrigger>
+ <TooltipContent>Remove</TooltipContent>
</Tooltip>
)}
</ProjectPermissionCan>
</div>
- </Td>
- </Tr>
+ </TableCell>
+ </TableRow>
);
})}
- </TBody>
+ </TableBody>
</Table>
- {!isPending && data?.totalCount !== undefined && data.totalCount >= PER_PAGE_INIT && (
- <Pagination
- count={data.totalCount}
- page={page}
- perPage={perPage}
- onChangePage={(newPage) => setPage(newPage)}
- onChangePerPage={(newPerPage) => setPerPage(newPerPage)}
- />
- )}
- {!isPending && !data?.collectionItems?.length && (
- <EmptyState
- title={`No ${pkiItemTypeToNameMap[type]}s have been added to this collection`}
- icon={faBoxesStacked}
- />
- )}
- </TableContainer>
+ )}
+ {!isPending && data?.totalCount !== undefined && data.totalCount >= PER_PAGE_INIT && (
+ <Pagination
+ count={data.totalCount}
+ page={page}
+ perPage={perPage}
+ onChangePage={(newPage) => setPage(newPage)}
+ onChangePerPage={(newPerPage) => setPerPage(newPerPage)}
+ />
+ )}
</div>
);
};
diff --git a/frontend/src/pages/cert-manager/PkiSubscriberDetailsByIDPage/components/PkiSubscriberCertificatesTable.tsx b/frontend/src/pages/cert-manager/PkiSubscriberDetailsByIDPage/components/PkiSubscriberCertificatesTable.tsx
index 56a63de1c5..33bdcb37fc 100644
--- a/frontend/src/pages/cert-manager/PkiSubscriberDetailsByIDPage/components/PkiSubscriberCertificatesTable.tsx
+++ b/frontend/src/pages/cert-manager/PkiSubscriberDetailsByIDPage/components/PkiSubscriberCertificatesTable.tsx
@@ -1,29 +1,32 @@
import { useMemo, useState } from "react";
import { subject } from "@casl/ability";
-import { faCertificate, faEllipsis, faTrash } from "@fortawesome/free-solid-svg-icons";
-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { format } from "date-fns";
-import { twMerge } from "tailwind-merge";
+import { MoreHorizontalIcon, ScrollTextIcon, Trash2Icon } from "lucide-react";
import { ProjectPermissionCan } from "@app/components/permissions";
import {
+ Badge,
DropdownMenu,
DropdownMenuContent,
DropdownMenuItem,
DropdownMenuTrigger,
- EmptyState,
+ Empty,
+ EmptyHeader,
+ EmptyMedia,
+ EmptyTitle,
+ IconButton,
Pagination,
Table,
- TableContainer,
- TableSkeleton,
- TBody,
- Td,
- Th,
- THead,
+ TableBody,
+ TableCell,
+ TableHead,
+ TableHeader,
+ TableRow,
+ TableSkeletonRows,
Tooltip,
- Tr
-} from "@app/components/v2";
-import { Badge } from "@app/components/v3";
+ TooltipContent,
+ TooltipTrigger
+} from "@app/components/v3";
import {
ProjectPermissionPkiSubscriberActions,
ProjectPermissionSub,
@@ -107,36 +110,51 @@ export const PkiSubscriberCertificatesTable = ({ subscriberName, handlePopUpOpen
return (
<div>
- <TableContainer>
+ {!isPending && !data?.certificates?.length ? (
+ <Empty className="border">
+ <EmptyHeader>
+ <EmptyMedia variant="icon">
+ <ScrollTextIcon />
+ </EmptyMedia>
+ <EmptyTitle>
+ {canListPkiSubscriberCerts
+ ? "No certificates have been issued for this subscriber"
+ : "You do not have permission to view this subscriber's certificates"}
+ </EmptyTitle>
+ </EmptyHeader>
+ </Empty>
+ ) : (
<Table>
- <THead>
- <Tr>
- <Th>Common Name</Th>
- <Th>Status</Th>
- <Th>Not Before</Th>
- <Th>Not After</Th>
- <Th />
- </Tr>
- </THead>
- <TBody>
- {isPending && <TableSkeleton columns={5} innerKey="pki-subscriber-certificates" />}
+ <TableHeader>
+ <TableRow>
+ <TableHead>Common Name</TableHead>
+ <TableHead>Status</TableHead>
+ <TableHead>Not Before</TableHead>
+ <TableHead>Not After</TableHead>
+ <TableHead />
+ </TableRow>
+ </TableHeader>
+ <TableBody>
+ {isPending && <TableSkeletonRows columns={5} />}
{!isPending &&
data?.certificates?.map((certificate) => {
return (
- <Tr className="h-10" key={`certificate-${certificate.id}`}>
- <Td>{certificate.commonName}</Td>
- <Td>{getCertStatusBadge(certificate.status, certificate.notAfter)}</Td>
- <Td>
+ <TableRow key={`certificate-${certificate.id}`}>
+ <TableCell>{certificate.commonName}</TableCell>
+ <TableCell>
+ {getCertStatusBadge(certificate.status, certificate.notAfter)}
+ </TableCell>
+ <TableCell>
{certificate.notBefore
? format(new Date(certificate.notBefore), "yyyy-MM-dd")
: "-"}
- </Td>
- <Td>
+ </TableCell>
+ <TableCell>
{certificate.notAfter
? format(new Date(certificate.notAfter), "yyyy-MM-dd")
: "-"}
- </Td>
- <Td className="flex justify-end">
+ </TableCell>
+ <TableCell variant="action">
{(() => {
const caType = caCapabilityMap[certificate.caId];
const supportsRevocation =
@@ -149,33 +167,32 @@ export const PkiSubscriberCertificatesTable = ({ subscriberName, handlePopUpOpen
return (
<DropdownMenu>
- <DropdownMenuTrigger asChild className="rounded-lg">
- <div className="hover:text-project data-[state=open]:text-project">
- <Tooltip content="More options">
- <FontAwesomeIcon size="lg" icon={faEllipsis} />
- </Tooltip>
- </div>
- </DropdownMenuTrigger>
- <DropdownMenuContent align="start" className="p-1">
+ <Tooltip hoverable delayDuration={50}>
+ <TooltipTrigger asChild>
+ <DropdownMenuTrigger asChild>
+ <IconButton aria-label="More options" variant="ghost" size="xs">
+ <MoreHorizontalIcon />
+ </IconButton>
+ </DropdownMenuTrigger>
+ </TooltipTrigger>
+ <TooltipContent>More options</TooltipContent>
+ </Tooltip>
+ <DropdownMenuContent align="start">
<ProjectPermissionCan
I={ProjectPermissionPkiSubscriberActions.Delete}
a={ProjectPermissionSub.PkiSubscribers}
>
{(isAllowed) => (
<DropdownMenuItem
- className={twMerge(
- !isAllowed &&
- "pointer-events-none cursor-not-allowed opacity-50"
- )}
onClick={() =>
handlePopUpOpen &&
handlePopUpOpen("revokeCertificate", {
certificateId: certificate.id
})
}
- disabled={!isAllowed}
- icon={<FontAwesomeIcon icon={faTrash} />}
+ isDisabled={!isAllowed}
>
+ <Trash2Icon />
Revoke Certificate
</DropdownMenuItem>
)}
@@ -184,28 +201,22 @@ export const PkiSubscriberCertificatesTable = ({ subscriberName, handlePopUpOpen
</DropdownMenu>
);
})()}
- </Td>
- </Tr>
+ </TableCell>
+ </TableRow>
);
})}
- </TBody>
+ </TableBody>
</Table>
- {!isPending && data?.totalCount !== undefined && data.totalCount >= PER_PAGE_INIT && (
- <Pagination
- count={data.totalCount}
- page={page}
- perPage={perPage}
- onChangePage={(newPage) => setPage(newPage)}
- onChangePerPage={(newPerPage) => setPerPage(newPerPage)}
- />
- )}
- {!isPending && !data?.certificates?.length && (
- <EmptyState
- title={`${canListPkiSubscriberCerts ? "No certificates have been issued for this subscriber" : "You do not have permission to view this subscriber's certificates"}`}
- icon={faCertificate}
- />
- )}
- </TableContainer>
+ )}
+ {!isPending && data?.totalCount !== undefined && data.totalCount >= PER_PAGE_INIT && (
+ <Pagination
+ count={data.totalCount}
+ page={page}
+ perPage={perPage}
+ onChangePage={(newPage) => setPage(newPage)}
+ onChangePerPage={(newPerPage) => setPerPage(newPerPage)}
+ />
+ )}
</div>
);
};
diff --git a/frontend/src/pages/cert-manager/PkiTemplateListPage/components/PkiTemplateForm.tsx b/frontend/src/pages/cert-manager/PkiTemplateListPage/components/PkiTemplateForm.tsx
index f4c47a938b..e99882c810 100644
--- a/frontend/src/pages/cert-manager/PkiTemplateListPage/components/PkiTemplateForm.tsx
+++ b/frontend/src/pages/cert-manager/PkiTemplateListPage/components/PkiTemplateForm.tsx
@@ -1,10 +1,10 @@
import { Controller, useForm } from "react-hook-form";
-import { faQuestionCircle } from "@fortawesome/free-regular-svg-icons";
-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { zodResolver } from "@hookform/resolvers/zod";
+import { CircleHelpIcon } from "lucide-react";
import { z } from "zod";
import { createNotification } from "@app/components/notifications";
+import { FilterableSelect } from "@app/components/v2";
import {
Accordion,
AccordionContent,
@@ -12,12 +12,15 @@ import {
AccordionTrigger,
Button,
Checkbox,
- FilterableSelect,
- FormControl,
- FormLabel,
+ Field,
+ FieldContent,
+ FieldError,
+ FieldLabel,
Input,
- Tooltip
-} from "@app/components/v2";
+ Tooltip,
+ TooltipContent,
+ TooltipTrigger
+} from "@app/components/v3";
import { useProject } from "@app/context";
import {
useCreateCertTemplateV2,
@@ -178,50 +181,56 @@ export const PkiTemplateForm = ({ certTemplate, handlePopUpToggle }: Props) => {
};
return (
- <form onSubmit={handleSubmit(onFormSubmit)}>
+ <form className="flex flex-col gap-4" onSubmit={handleSubmit(onFormSubmit)}>
{certTemplate && (
- <FormControl label="Certificate Template ID">
- <Input value={certTemplate.id} isDisabled className="bg-foreground-inverse/[0.07]" />
- </FormControl>
+ <Field>
+ <FieldLabel htmlFor="pki-template-id">Certificate Template ID</FieldLabel>
+ <Input id="pki-template-id" value={certTemplate.id} disabled />
+ </Field>
)}
<Controller
control={control}
defaultValue=""
name="name"
render={({ field, fieldState: { error } }) => (
- <FormControl
- label="Template Name"
- isError={Boolean(error)}
- errorText={error?.message}
- isRequired
- >
- <Input
- {...field}
- placeholder="my-template"
- autoComplete="off"
- name="pki-template-name"
- />
- </FormControl>
+ <Field>
+ <FieldLabel htmlFor="pki-template-name">
+ Template Name <span className="text-danger">*</span>
+ </FieldLabel>
+ <FieldContent>
+ <Input
+ {...field}
+ id="pki-template-name"
+ placeholder="my-template"
+ autoComplete="off"
+ name="pki-template-name"
+ isError={Boolean(error)}
+ />
+ <FieldError errors={[error]} />
+ </FieldContent>
+ </Field>
)}
/>
<Controller
render={({ field: { value, onChange }, fieldState: { error } }) => (
- <FormControl
- label="Issuing CA"
- errorText={error?.message}
- isError={Boolean(error)}
- isRequired
- >
- <FilterableSelect
- options={cas || []}
- isLoading={isCaLoading}
- placeholder="Select CA..."
- onChange={onChange}
- value={value}
- getOptionValue={(option) => option.id}
- getOptionLabel={(option) => option.name}
- />
- </FormControl>
+ <Field>
+ <FieldLabel htmlFor="pki-template-ca">
+ Issuing CA <span className="text-danger">*</span>
+ </FieldLabel>
+ <FieldContent>
+ <FilterableSelect
+ inputId="pki-template-ca"
+ options={cas || []}
+ isLoading={isCaLoading}
+ placeholder="Select CA..."
+ onChange={onChange}
+ value={value}
+ getOptionValue={(option) => option.id}
+ getOptionLabel={(option) => option.name}
+ />
+ <FieldError errors={[error]} />
+ </FieldContent>
+ </Field>
)}
control={control}
name="ca"
@@ -231,34 +240,29 @@ export const PkiTemplateForm = ({ certTemplate, handlePopUpToggle }: Props) => {
defaultValue=""
name="commonName"
render={({ field, fieldState: { error } }) => (
- <FormControl
- label={
- <div>
- <FormLabel
- isRequired
- label="Common Name (CN)"
- icon={
- <Tooltip
- className="text-center"
- content={
- <span>
- This field accepts limited regular expressions: spaces, *, ., @, -, \ (for
- escaping), and alphanumeric characters only
- </span>
- }
- >
- <FontAwesomeIcon icon={faQuestionCircle} size="sm" />
- </Tooltip>
- }
- />
- </div>
- }
- isError={Boolean(error)}
- errorText={error?.message}
- isRequired
- >
- <Input {...field} placeholder=".*\.acme.com" />
- </FormControl>
+ <Field>
+ <FieldLabel htmlFor="pki-template-common-name">
+ Common Name (CN) <span className="text-danger">*</span>
+ <Tooltip hoverable delayDuration={50}>
+ <TooltipTrigger asChild>
+ <CircleHelpIcon className="size-3.5 text-muted" />
+ </TooltipTrigger>
+ <TooltipContent className="max-w-xs text-center">
+ This field accepts limited regular expressions: spaces, *, ., @, -, \ (for
+ escaping), and alphanumeric characters only
+ </TooltipContent>
+ </Tooltip>
+ </FieldLabel>
+ <FieldContent>
+ <Input
+ {...field}
+ id="pki-template-common-name"
+ placeholder=".*\.acme.com"
+ isError={Boolean(error)}
+ />
+ <FieldError errors={[error]} />
+ </FieldContent>
+ </Field>
)}
/>
<Controller
@@ -266,86 +270,91 @@ export const PkiTemplateForm = ({ certTemplate, handlePopUpToggle }: Props) => {
defaultValue=""
name="subjectAlternativeName"
render={({ field, fieldState: { error } }) => (
- <FormControl
- label={
- <div>
- <FormLabel
- isRequired
- label="Alternative Names (SAN)"
- icon={
- <Tooltip
- className="text-center"
- content={
- <span>
- This field accepts limited regular expressions: spaces, *, ., @, -, \ (for
- escaping), and alphanumeric characters only
- </span>
- }
- >
- <FontAwesomeIcon icon={faQuestionCircle} size="sm" />
- </Tooltip>
- }
- />
- </div>
- }
- isError={Boolean(error)}
- errorText={error?.message}
- isRequired
- >
- <Input {...field} placeholder="service\.acme.\..*" />
- </FormControl>
+ <Field>
+ <FieldLabel htmlFor="pki-template-san">
+ Alternative Names (SAN) <span className="text-danger">*</span>
+ <Tooltip hoverable delayDuration={50}>
+ <TooltipTrigger asChild>
+ <CircleHelpIcon className="size-3.5 text-muted" />
+ </TooltipTrigger>
+ <TooltipContent className="max-w-xs text-center">
+ This field accepts limited regular expressions: spaces, *, ., @, -, \ (for
+ escaping), and alphanumeric characters only
+ </TooltipContent>
+ </Tooltip>
+ </FieldLabel>
+ <FieldContent>
+ <Input
+ {...field}
+ id="pki-template-san"
+ placeholder="service\.acme.\..*"
+ isError={Boolean(error)}
+ />
+ <FieldError errors={[error]} />
+ </FieldContent>
+ </Field>
)}
/>
<Controller
control={control}
name="ttl"
render={({ field, fieldState: { error } }) => (
- <FormControl
- label="Max TTL"
- isError={Boolean(error)}
- errorText={error?.message}
- isRequired
- >
- <Input {...field} placeholder="2 days, 1d, 2h, 1y, ..." />
- </FormControl>
+ <Field>
+ <FieldLabel htmlFor="pki-template-ttl">
+ Max TTL <span className="text-danger">*</span>
+ </FieldLabel>
+ <FieldContent>
+ <Input
+ {...field}
+ id="pki-template-ttl"
+ placeholder="2 days, 1d, 2h, 1y, ..."
+ isError={Boolean(error)}
+ />
+ <FieldError errors={[error]} />
+ </FieldContent>
+ </Field>
)}
/>
- <Accordion type="single" collapsible className="w-full">
- <AccordionItem value="key-usages" className="data-[state=open]:border-none">
- <AccordionTrigger className="h-fit flex-none pl-1 text-sm">
- <div className="order-1 ml-3">Key Usage</div>
- </AccordionTrigger>
+ <Accordion type="single" collapsible variant="ghost" className="w-full">
+ <AccordionItem value="key-usages" className="border-b-0">
+ <AccordionTrigger>Key Usage</AccordionTrigger>
<AccordionContent>
<Controller
control={control}
name="keyUsages"
render={({ field: { onChange, value }, fieldState: { error } }) => {
return (
- <FormControl
- label="Key Usage"
- errorText={error?.message}
- isError={Boolean(error)}
- >
- <div className="mt-2 mb-7 grid grid-cols-2 gap-2">
- {KEY_USAGES_OPTIONS.map(({ label, value: optionValue }) => {
- return (
- <Checkbox
- id={optionValue}
- key={optionValue}
- isChecked={value[optionValue]}
- onCheckedChange={(state) => {
- onChange({
- ...value,
- [optionValue]: state
- });
- }}
- >
- {label}
- </Checkbox>
- );
- })}
- </div>
- </FormControl>
+ <Field className="mb-7">
+ <FieldLabel>Key Usage</FieldLabel>
+ <FieldContent>
+ <div className="mt-2 grid grid-cols-2 gap-2">
+ {KEY_USAGES_OPTIONS.map(({ label, value: optionValue }) => {
+ return (
+ <div key={optionValue} className="flex items-center gap-3">
+ <Checkbox
+ id={`key-usage-${optionValue}`}
+ variant="project"
+ isChecked={value[optionValue]}
+ onCheckedChange={(state) => {
+ onChange({
+ ...value,
+ [optionValue]: state
+ });
+ }}
+ />
+ <label
+ htmlFor={`key-usage-${optionValue}`}
+ className="cursor-pointer text-sm text-foreground"
+ >
+ {label}
+ </label>
+ </div>
+ );
+ })}
+ </div>
+ <FieldError errors={[error]} />
+ </FieldContent>
+ </Field>
);
}}
/>
@@ -354,48 +363,48 @@ export const PkiTemplateForm = ({ certTemplate, handlePopUpToggle }: Props) => {
name="extendedKeyUsages"
render={({ field: { onChange, value }, fieldState: { error } }) => {
return (
- <FormControl
- label="Extended Key Usage"
- errorText={error?.message}
- isError={Boolean(error)}
- >
- <div className="mt-2 mb-7 grid grid-cols-2 gap-2">
- {EXTENDED_KEY_USAGES_OPTIONS.map(({ label, value: optionValue }) => {
- return (
- <Checkbox
- id={optionValue}
- key={optionValue}
- isChecked={value[optionValue]}
- onCheckedChange={(state) => {
- onChange({
- ...value,
- [optionValue]: state
- });
- }}
- >
- {label}
- </Checkbox>
- );
- })}
- </div>
- </FormControl>
+ <Field className="mb-7">
+ <FieldLabel>Extended Key Usage</FieldLabel>
+ <FieldContent>
+ <div className="mt-2 grid grid-cols-2 gap-2">
+ {EXTENDED_KEY_USAGES_OPTIONS.map(({ label, value: optionValue }) => {
+ return (
+ <div key={optionValue} className="flex items-center gap-3">
+ <Checkbox
+ id={`extended-key-usage-${optionValue}`}
+ variant="project"
+ isChecked={value[optionValue]}
+ onCheckedChange={(state) => {
+ onChange({
+ ...value,
+ [optionValue]: state
+ });
+ }}
+ />
+ <label
+ htmlFor={`extended-key-usage-${optionValue}`}
+ className="cursor-pointer text-sm text-foreground"
+ >
+ {label}
+ </label>
+ </div>
+ );
+ })}
+ </div>
+ <FieldError errors={[error]} />
+ </FieldContent>
+ </Field>
);
}}
/>
</AccordionContent>
</AccordionItem>
</Accordion>
- <div className="mt-4 flex items-center">
- <Button
- className="mr-4"
- size="sm"
- type="submit"
- isLoading={isSubmitting}
- isDisabled={isSubmitting}
- >
+ <div className="flex items-center gap-4">
+ <Button variant="project" type="submit" isPending={isSubmitting} isDisabled={isSubmitting}>
Save
</Button>
- <Button colorSchema="secondary" variant="plain" onClick={() => handlePopUpToggle(false)}>
+ <Button variant="ghost" onClick={() => handlePopUpToggle(false)}>
Cancel
</Button>
</div>
diff --git a/frontend/src/views/PkiAlertsV2Page/components/PkiAlertV2Row.tsx b/frontend/src/views/PkiAlertsV2Page/components/PkiAlertV2Row.tsx
index 77c7e0a6e3..9b151d7027 100644
--- a/frontend/src/views/PkiAlertsV2Page/components/PkiAlertV2Row.tsx
+++ b/frontend/src/views/PkiAlertsV2Page/components/PkiAlertV2Row.tsx
@@ -1,17 +1,19 @@
-import { faCircleInfo, faEllipsisH, faEye, faTrash } from "@fortawesome/free-solid-svg-icons";
+import { faCircleInfo } from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
+import { EyeIcon, MoreHorizontalIcon, Trash2Icon } from "lucide-react";
+import { Td, Tr } from "@app/components/v2";
import {
+ Badge,
DropdownMenu,
DropdownMenuContent,
DropdownMenuItem,
DropdownMenuTrigger,
IconButton,
- Td,
Tooltip,
- Tr
-} from "@app/components/v2";
-import { Badge } from "@app/components/v3";
+ TooltipContent,
+ TooltipTrigger
+} from "@app/components/v3";
import { PkiAlertEventTypeV2, TPkiAlertV2 } from "@app/hooks/api/pkiAlertsV2";
import { formatAlertBefore, formatEventType } from "../utils/pki-alert-formatters";
@@ -29,8 +31,11 @@ export const PkiAlertV2Row = ({ alert, onView, onDelete }: Props) => {
<div className="flex items-center gap-2">
<div className="font-medium text-foreground-cool">{alert.name}</div>
{alert.description && (
- <Tooltip content={alert.description}>
- <FontAwesomeIcon icon={faCircleInfo} className="text-muted" />
+ <Tooltip hoverable delayDuration={50}>
+ <TooltipTrigger asChild>
+ <FontAwesomeIcon icon={faCircleInfo} className="text-muted" />
+ </TooltipTrigger>
+ <TooltipContent className="max-w-sm">{alert.description}</TooltipContent>
</Tooltip>
)}
</div>
@@ -52,8 +57,13 @@ export const PkiAlertV2Row = ({ alert, onView, onDelete }: Props) => {
</Td>
<Td>
{alert.lastRun ? (
- <Tooltip
- content={
+ <Tooltip hoverable delayDuration={50}>
+ <TooltipTrigger asChild>
+ <Badge variant={alert.lastRun.status === "success" ? "success" : "danger"}>
+ {alert.lastRun.status === "success" ? "Success" : "Failed"}
+ </Badge>
+ </TooltipTrigger>
+ <TooltipContent>
<div className="max-w-sm">
<div className="text-xs text-label">
{new Date(alert.lastRun.timestamp)
@@ -67,11 +77,7 @@ export const PkiAlertV2Row = ({ alert, onView, onDelete }: Props) => {
</div>
)}
</div>
- }
- >
- <Badge variant={alert.lastRun.status === "success" ? "success" : "danger"}>
- {alert.lastRun.status === "success" ? "Success" : "Failed"}
- </Badge>
+ </TooltipContent>
</Tooltip>
) : (
<span className="text-surface-selected">—</span>
@@ -80,17 +86,17 @@ export const PkiAlertV2Row = ({ alert, onView, onDelete }: Props) => {
<Td className="text-right">
<DropdownMenu>
<DropdownMenuTrigger asChild>
- <IconButton size="sm" variant="plain" ariaLabel="Alert actions">
- <FontAwesomeIcon icon={faEllipsisH} />
+ <IconButton size="xs" variant="ghost" aria-label="Alert actions">
+ <MoreHorizontalIcon />
</IconButton>
</DropdownMenuTrigger>
<DropdownMenuContent align="end">
<DropdownMenuItem onClick={onView}>
- <FontAwesomeIcon icon={faEye} className="mr-2 h-4 w-4" />
+ <EyeIcon />
View details
</DropdownMenuItem>
- <DropdownMenuItem onClick={onDelete} className="text-danger">
- <FontAwesomeIcon icon={faTrash} className="mr-2 h-4 w-4" />
+ <DropdownMenuItem onClick={onDelete} variant="danger">
+ <Trash2Icon />
Delete alert
</DropdownMenuItem>
</DropdownMenuContent>