feat: renamed old frontend and fixed some minor bugs

This commit is contained in:
=
2025-01-06 14:56:49 +05:30
parent 8c902d7699
commit 54377a44d3
2577 changed files with 35240 additions and 35116 deletions
@@ -0,0 +1,17 @@
import { motion } from "framer-motion";
import { PkiAlertsSection } from "./components";
export const PkiAlertsTab = () => {
return (
<motion.div
key="panel-alerts"
transition={{ duration: 0.15 }}
initial={{ opacity: 0, translateX: 30 }}
animate={{ opacity: 1, translateX: 0 }}
exit={{ opacity: 0, translateX: 30 }}
>
<PkiAlertsSection />
</motion.div>
);
};
@@ -0,0 +1,295 @@
import { useEffect } from "react";
import { Controller, useForm } from "react-hook-form";
import { zodResolver } from "@hookform/resolvers/zod";
import { z } from "zod";
import { createNotification } from "@app/components/notifications";
import {
Button,
FormControl,
Input,
Modal,
ModalContent,
Select,
SelectItem
} from "@app/components/v2";
import { useWorkspace } from "@app/context";
import {
useCreatePkiAlert,
useGetPkiAlertById,
useListWorkspacePkiCollections,
useUpdatePkiAlert
} from "@app/hooks/api";
import { UsePopUpState } from "@app/hooks/usePopUp";
enum TimeUnit {
DAY = "days",
WEEK = "weeks",
MONTH = "months",
YEAR = "years"
}
const schema = z.object({
name: z.string().trim().min(1),
pkiCollectionId: z.string(),
alertBefore: z.string(),
alertUnit: z.nativeEnum(TimeUnit),
emails: z.string().trim()
});
const convertToDays = (unit: TimeUnit, value: number) => {
switch (unit) {
case TimeUnit.DAY:
return value;
case TimeUnit.WEEK:
return value * 7;
case TimeUnit.MONTH:
return value * 30;
case TimeUnit.YEAR:
return value * 365;
default:
throw new Error(`Unknown time unit: ${unit}`);
}
};
export type FormData = z.infer<typeof schema>;
type Props = {
popUp: UsePopUpState<["pkiAlert"]>;
handlePopUpToggle: (popUpName: keyof UsePopUpState<["pkiAlert"]>, state?: boolean) => void;
};
export const PkiAlertModal = ({ popUp, handlePopUpToggle }: Props) => {
const { currentWorkspace } = useWorkspace();
const projectId = currentWorkspace?.id || "";
const { data: alert } = useGetPkiAlertById(
(popUp?.pkiAlert?.data as { alertId: string })?.alertId || ""
);
const { data: pkiCollections } = useListWorkspacePkiCollections({
workspaceId: projectId
});
const { mutateAsync: createPkiAlert } = useCreatePkiAlert();
const { mutateAsync: updatePkiAlert } = useUpdatePkiAlert();
const {
control,
handleSubmit,
reset,
formState: { isSubmitting }
} = useForm<FormData>({
resolver: zodResolver(schema),
defaultValues: {
alertUnit: TimeUnit.DAY
}
});
useEffect(() => {
if (alert) {
reset({
name: alert.name,
pkiCollectionId: alert.pkiCollectionId,
alertBefore: alert.alertBeforeDays.toString(),
alertUnit: TimeUnit.DAY,
emails: alert.recipientEmails
});
} else {
// TODO: add default collection?
reset({
name: "",
...(pkiCollections?.collections?.[0] && {
pkiCollectionId: pkiCollections.collections[0].id
})
});
}
}, [alert, pkiCollections]);
const onFormSubmit = async ({
name,
pkiCollectionId,
alertBefore,
alertUnit,
emails
}: FormData) => {
try {
if (!projectId) return;
const emailArray = emails
.split(",")
.map((email) => email.trim())
.filter((email) => email.length > 0);
const alertBeforeDays = convertToDays(alertUnit, Number(alertBefore));
if (alert) {
// update
await updatePkiAlert({
alertId: alert.id,
pkiCollectionId,
name,
projectId,
alertBeforeDays,
emails: emailArray
});
} else {
// create
await createPkiAlert({
name,
projectId,
pkiCollectionId,
alertBeforeDays,
emails: emailArray
});
}
handlePopUpToggle("pkiAlert", false);
reset();
createNotification({
text: `Successfully ${alert ? "updated" : "created"} alert`,
type: "success"
});
} catch (err) {
console.error(err);
createNotification({
text: `Failed to ${alert ? "updated" : "created"} alert`,
type: "error"
});
}
};
return (
<Modal
isOpen={popUp?.pkiAlert?.isOpen}
onOpenChange={(isOpen) => {
handlePopUpToggle("pkiAlert", isOpen);
reset();
}}
>
<ModalContent title={`${alert ? "Edit" : "Create"} Alert`}>
<form onSubmit={handleSubmit(onFormSubmit)}>
<Controller
control={control}
defaultValue=""
name="name"
render={({ field, fieldState: { error } }) => (
<FormControl
label="Name"
isError={Boolean(error)}
errorText={error?.message}
isRequired
>
<Input {...field} placeholder="My Alert" />
</FormControl>
)}
/>
<Controller
control={control}
name="pkiCollectionId"
defaultValue=""
render={({ field: { onChange, ...field }, fieldState: { error } }) => (
<FormControl
label="Certificate Collection"
errorText={error?.message}
isError={Boolean(error)}
isRequired
>
<Select
defaultValue={field.value}
{...field}
onValueChange={(e) => onChange(e)}
className="w-full"
>
{(pkiCollections?.collections || []).map(({ id, name }) => (
<SelectItem value={id} key={`project-${id}`}>
{name}
</SelectItem>
))}
</Select>
</FormControl>
)}
/>
<div className="flex items-center">
<Controller
control={control}
defaultValue=""
name="alertBefore"
render={({ field, fieldState: { error } }) => (
<FormControl
label="Alert Before"
isError={Boolean(error)}
errorText={error?.message}
className="w-full"
isRequired
>
<Input {...field} placeholder="5" type="number" min={1} />
</FormControl>
)}
/>
<Controller
control={control}
name="alertUnit"
defaultValue={TimeUnit.YEAR}
render={({ field: { onChange, ...field }, fieldState: { error } }) => (
<FormControl
className="ml-4"
label="Alert Unit"
errorText={error?.message}
isError={Boolean(error)}
>
<Select
defaultValue={field.value}
{...field}
onValueChange={(e) => onChange(e)}
className="w-48"
>
<SelectItem value={TimeUnit.DAY}>Days</SelectItem>
<SelectItem value={TimeUnit.WEEK}>Weeks</SelectItem>
<SelectItem value={TimeUnit.MONTH}>Months</SelectItem>
<SelectItem value={TimeUnit.YEAR}>Years</SelectItem>
</Select>
</FormControl>
)}
/>
</div>
<Controller
control={control}
defaultValue=""
name="emails"
render={({ field, fieldState: { error } }) => (
<FormControl
label="Emails to Alert"
isError={Boolean(error)}
errorText={error?.message}
isRequired
>
<Input {...field} placeholder="[email protected], [email protected], ..." />
</FormControl>
)}
/>
<div className="flex items-center">
<Button
className="mr-4"
size="sm"
type="submit"
isLoading={isSubmitting}
isDisabled={isSubmitting}
>
{alert ? "Update" : "Create"}
</Button>
<Button
colorSchema="secondary"
variant="plain"
onClick={() => handlePopUpToggle("pkiAlert", false)}
>
Cancel
</Button>
</div>
</form>
</ModalContent>
</Modal>
);
};
@@ -0,0 +1,92 @@
import { faEllipsis } from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { twMerge } from "tailwind-merge";
import { ProjectPermissionCan } from "@app/components/permissions";
import {
DropdownMenu,
DropdownMenuContent,
DropdownMenuItem,
DropdownMenuTrigger,
Td,
Tr
} from "@app/components/v2";
import { ProjectPermissionActions, ProjectPermissionSub } from "@app/context";
import { useGetPkiCollectionById } from "@app/hooks/api";
import { TPkiAlert } from "@app/hooks/api/pkiAlerts/types";
import { UsePopUpState } from "@app/hooks/usePopUp";
type Props = {
alert: TPkiAlert;
handlePopUpOpen: (
popUpName: keyof UsePopUpState<["pkiAlert", "deletePkiAlert"]>,
data?: object
) => void;
};
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>
<DropdownMenu>
<DropdownMenuTrigger asChild className="rounded-lg">
<div className="hover:text-primary-400 data-[state=open]:text-primary-400">
<FontAwesomeIcon size="sm" icon={faEllipsis} />
</div>
</DropdownMenuTrigger>
<DropdownMenuContent align="start" className="p-1">
<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}
>
Edit Alert
</DropdownMenuItem>
)}
</ProjectPermissionCan>
<ProjectPermissionCan
I={ProjectPermissionActions.Delete}
a={ProjectPermissionSub.PkiAlerts}
>
{(isAllowed) => (
<DropdownMenuItem
className={twMerge(
isAllowed
? "hover:!bg-red-500 hover:!text-white"
: "pointer-events-none cursor-not-allowed opacity-50"
)}
onClick={(e) => {
e.stopPropagation();
handlePopUpOpen("deletePkiAlert", {
alertId: alert.id,
name: alert.name
});
}}
disabled={!isAllowed}
>
Delete Alert
</DropdownMenuItem>
)}
</ProjectPermissionCan>
</DropdownMenuContent>
</DropdownMenu>
</Td>
</Tr>
);
};
@@ -0,0 +1,84 @@
import { faPlus } from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { createNotification } from "@app/components/notifications";
import { ProjectPermissionCan } from "@app/components/permissions";
import { Button, DeleteActionModal } from "@app/components/v2";
import { ProjectPermissionActions, ProjectPermissionSub, useWorkspace } from "@app/context";
import { useDeletePkiAlert } from "@app/hooks/api";
import { usePopUp } from "@app/hooks/usePopUp";
import { PkiAlertModal } from "./PkiAlertModal";
import { PkiAlertsTable } from "./PkiAlertsTable";
export const PkiAlertsSection = () => {
const { currentWorkspace } = useWorkspace();
const projectId = currentWorkspace?.id || "";
const { mutateAsync: deletePkiAlert } = useDeletePkiAlert();
const { popUp, handlePopUpOpen, handlePopUpClose, handlePopUpToggle } = usePopUp([
"pkiAlert",
"deletePkiAlert"
] as const);
const onRemoveAlertSubmit = async (alertId: string) => {
try {
if (!projectId) return;
await deletePkiAlert({
alertId,
projectId
});
createNotification({
text: "Successfully deleted alert",
type: "success"
});
handlePopUpClose("deletePkiAlert");
} catch (err) {
console.error(err);
createNotification({
text: "Failed to delete alert",
type: "error"
});
}
};
return (
<div className="mb-6 rounded-lg border border-mineshaft-600 bg-mineshaft-900 p-4">
<div className="mb-4 flex justify-between">
<p className="text-xl font-semibold text-mineshaft-100">Alerts</p>
<ProjectPermissionCan
I={ProjectPermissionActions.Create}
a={ProjectPermissionSub.PkiAlerts}
>
{(isAllowed) => (
<Button
colorSchema="primary"
type="submit"
leftIcon={<FontAwesomeIcon icon={faPlus} />}
onClick={() => handlePopUpOpen("pkiAlert")}
isDisabled={!isAllowed}
>
Create
</Button>
)}
</ProjectPermissionCan>
</div>
<PkiAlertsTable handlePopUpOpen={handlePopUpOpen} />
<PkiAlertModal popUp={popUp} handlePopUpToggle={handlePopUpToggle} />
<DeleteActionModal
isOpen={popUp.deletePkiAlert.isOpen}
title={`Are you sure want to remove the alert ${
(popUp?.deletePkiAlert?.data as { name: string })?.name || ""
} from the project?`}
onChange={(isOpen) => handlePopUpToggle("deletePkiAlert", isOpen)}
deleteKey="confirm"
onDeleteApproved={() =>
onRemoveAlertSubmit((popUp?.deletePkiAlert?.data as { alertId: string })?.alertId)
}
/>
</div>
);
};
@@ -0,0 +1,67 @@
import { faExclamationCircle } from "@fortawesome/free-solid-svg-icons";
import {
EmptyState,
Table,
TableContainer,
TableSkeleton,
TBody,
Th,
THead,
Tr
} from "@app/components/v2";
import { useWorkspace } from "@app/context";
import { useListWorkspacePkiAlerts } from "@app/hooks/api";
import { UsePopUpState } from "@app/hooks/usePopUp";
import { PkiAlertRow } from "./PkiAlertRow";
type Props = {
handlePopUpOpen: (
popUpName: keyof UsePopUpState<["pkiAlert", "deletePkiAlert"]>,
data?: object
) => void;
};
export const PkiAlertsTable = ({ handlePopUpOpen }: Props) => {
const { currentWorkspace } = useWorkspace();
const projectId = currentWorkspace?.id || "";
const { data, isPending } = useListWorkspacePkiAlerts({
workspaceId: projectId
});
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>
);
};
@@ -0,0 +1,171 @@
import { useEffect } from "react";
import { Controller, useForm } from "react-hook-form";
import { zodResolver } from "@hookform/resolvers/zod";
import { useNavigate } from "@tanstack/react-router";
import { z } from "zod";
import { createNotification } from "@app/components/notifications";
import { Button, FormControl, Input, Modal, ModalContent } from "@app/components/v2";
import { useWorkspace } from "@app/context";
import {
useCreatePkiCollection,
useGetPkiCollectionById,
useUpdatePkiCollection
} from "@app/hooks/api";
import { ProjectType } from "@app/hooks/api/workspace/types";
import { UsePopUpState } from "@app/hooks/usePopUp";
const schema = z.object({
name: z.string().trim().min(1),
description: z.string()
});
export type FormData = z.infer<typeof schema>;
type Props = {
popUp: UsePopUpState<["pkiCollection"]>;
handlePopUpToggle: (popUpName: keyof UsePopUpState<["pkiCollection"]>, state?: boolean) => void;
};
export const PkiCollectionModal = ({ popUp, handlePopUpToggle }: Props) => {
const navigate = useNavigate();
const { currentWorkspace } = useWorkspace();
const projectId = currentWorkspace?.id || "";
const { data: pkiCollection } = useGetPkiCollectionById(
(popUp?.pkiCollection?.data as { collectionId: string })?.collectionId || ""
);
const { mutateAsync: createPkiCollection } = useCreatePkiCollection();
const { mutateAsync: updatePkiCollection } = useUpdatePkiCollection();
const {
control,
handleSubmit,
reset,
formState: { isSubmitting }
} = useForm<FormData>({
resolver: zodResolver(schema)
});
useEffect(() => {
if (pkiCollection) {
reset({
name: pkiCollection.name,
description: pkiCollection.description
});
} else {
reset({
name: "",
description: ""
});
}
}, [pkiCollection]);
const onFormSubmit = async ({ name, description }: FormData) => {
try {
if (!projectId) return;
if (pkiCollection) {
// update
await updatePkiCollection({
collectionId: pkiCollection.id,
name,
description,
projectId
});
} else {
// create
const { id: collectionId } = await createPkiCollection({
name,
description,
projectId
});
navigate({
to: `/${ProjectType.CertificateManager}/$projectId/pki-collections/$collectionId` as const,
params: {
projectId,
collectionId
}
});
}
handlePopUpToggle("pkiCollection", false);
reset();
createNotification({
text: `Successfully ${pkiCollection ? "updated" : "created"} PKI collection`,
type: "success"
});
} catch (err) {
console.error(err);
createNotification({
text: `Failed to ${pkiCollection ? "updated" : "created"} PKI collection`,
type: "error"
});
}
};
return (
<Modal
isOpen={popUp?.pkiCollection?.isOpen}
onOpenChange={(isOpen) => {
handlePopUpToggle("pkiCollection", isOpen);
reset();
}}
>
<ModalContent title={`${pkiCollection ? "Edit" : "Create"} Certificate Collection`}>
<form onSubmit={handleSubmit(onFormSubmit)}>
<Controller
control={control}
defaultValue=""
name="name"
render={({ field, fieldState: { error } }) => (
<FormControl
label="Name"
isError={Boolean(error)}
errorText={error?.message}
isRequired
>
<Input {...field} placeholder="My Certificate Collection" />
</FormControl>
)}
/>
<Controller
control={control}
defaultValue=""
name="description"
render={({ field, fieldState: { error } }) => (
<FormControl label="Description" isError={Boolean(error)} errorText={error?.message}>
<Input
{...field}
placeholder="A collection to house certificates for ACME device"
/>
</FormControl>
)}
/>
<div className="flex items-center">
<Button
className="mr-4"
size="sm"
type="submit"
isLoading={isSubmitting}
isDisabled={isSubmitting}
>
{pkiCollection ? "Update" : "Create"}
</Button>
<Button
colorSchema="secondary"
variant="plain"
onClick={() => handlePopUpToggle("pkiCollection", false)}
>
Cancel
</Button>
</div>
</form>
</ModalContent>
</Modal>
);
};
@@ -0,0 +1,86 @@
import { faPlus } from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { createNotification } from "@app/components/notifications";
import { ProjectPermissionCan } from "@app/components/permissions";
import { Button, DeleteActionModal } from "@app/components/v2";
import { ProjectPermissionActions, ProjectPermissionSub, useWorkspace } from "@app/context";
import { useDeletePkiCollection } from "@app/hooks/api";
import { usePopUp } from "@app/hooks/usePopUp";
import { PkiCollectionModal } from "./PkiCollectionModal";
import { PkiCollectionTable } from "./PkiCollectionTable";
export const PkiCollectionSection = () => {
const { currentWorkspace } = useWorkspace();
const projectId = currentWorkspace?.id || "";
const { mutateAsync: deletePkiCollection } = useDeletePkiCollection();
const { popUp, handlePopUpOpen, handlePopUpClose, handlePopUpToggle } = usePopUp([
"pkiCollection",
"deletePkiCollection"
] as const);
const onRemovePkiCollectionSubmit = async (collectionId: string) => {
try {
if (!projectId) return;
await deletePkiCollection({
collectionId,
projectId
});
createNotification({
text: "Successfully deleted PKI collection",
type: "success"
});
handlePopUpClose("deletePkiCollection");
} catch (err) {
console.error(err);
createNotification({
text: "Failed to delete PKI collection",
type: "error"
});
}
};
return (
<div className="mb-6 rounded-lg border border-mineshaft-600 bg-mineshaft-900 p-4">
<div className="mb-4 flex justify-between">
<p className="text-xl font-semibold text-mineshaft-100">Certificate Collections</p>
<ProjectPermissionCan
I={ProjectPermissionActions.Create}
a={ProjectPermissionSub.PkiCollections}
>
{(isAllowed) => (
<Button
colorSchema="primary"
type="submit"
leftIcon={<FontAwesomeIcon icon={faPlus} />}
onClick={() => handlePopUpOpen("pkiCollection")}
isDisabled={!isAllowed}
>
Create
</Button>
)}
</ProjectPermissionCan>
</div>
<PkiCollectionTable handlePopUpOpen={handlePopUpOpen} />
<PkiCollectionModal popUp={popUp} handlePopUpToggle={handlePopUpToggle} />
<DeleteActionModal
isOpen={popUp.deletePkiCollection.isOpen}
title={`Are you sure want to remove the alert ${
(popUp?.deletePkiCollection?.data as { name: string })?.name || ""
} from the project?`}
onChange={(isOpen) => handlePopUpToggle("deletePkiCollection", isOpen)}
deleteKey="confirm"
onDeleteApproved={() =>
onRemovePkiCollectionSubmit(
(popUp?.deletePkiCollection?.data as { collectionId: string })?.collectionId
)
}
/>
</div>
);
};
@@ -0,0 +1,141 @@
import { faBoxesStacked, faEllipsis } from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { useNavigate } from "@tanstack/react-router";
import { twMerge } from "tailwind-merge";
import { ProjectPermissionCan } from "@app/components/permissions";
import {
DropdownMenu,
DropdownMenuContent,
DropdownMenuItem,
DropdownMenuTrigger,
EmptyState,
Table,
TableContainer,
TableSkeleton,
TBody,
Td,
Th,
THead,
Tr
} from "@app/components/v2";
import { ProjectPermissionActions, ProjectPermissionSub, useWorkspace } from "@app/context";
import { useListWorkspacePkiCollections } from "@app/hooks/api";
import { ProjectType } from "@app/hooks/api/workspace/types";
import { UsePopUpState } from "@app/hooks/usePopUp";
type Props = {
handlePopUpOpen: (
popUpName: keyof UsePopUpState<["pkiCollection", "deletePkiCollection"]>,
data?: object
) => void;
};
export const PkiCollectionTable = ({ handlePopUpOpen }: Props) => {
const navigate = useNavigate();
const { currentWorkspace } = useWorkspace();
const projectId = currentWorkspace?.id || "";
const { data, isPending } = useListWorkspacePkiCollections({
workspaceId: projectId
});
return (
<div>
<TableContainer>
<Table>
<THead>
<Tr>
<Th>Name</Th>
<Th>Description</Th>
<Th className="w-5" />
</Tr>
</THead>
<TBody>
{isPending && <TableSkeleton columns={3} innerKey="pki-collections" />}
{!isPending &&
data?.collections.map((pkiCollection) => {
return (
<Tr
className="h-10 cursor-pointer transition-colors duration-100 hover:bg-mineshaft-700"
key={`pki-collection-${pkiCollection.id}`}
onClick={() =>
navigate({
to: `/${ProjectType.CertificateManager}/$projectId/pki-collections/$collectionId` as const,
params: {
projectId,
collectionId: pkiCollection.id
}
})
}
>
<Td>{pkiCollection.name}</Td>
<Td>{pkiCollection.description ? pkiCollection.description : "-"}</Td>
<Td>
<DropdownMenu>
<DropdownMenuTrigger asChild className="rounded-lg">
<div className="hover:text-primary-400 data-[state=open]:text-primary-400">
<FontAwesomeIcon size="sm" icon={faEllipsis} />
</div>
</DropdownMenuTrigger>
<DropdownMenuContent align="start" className="p-1">
<ProjectPermissionCan
I={ProjectPermissionActions.Edit}
a={ProjectPermissionSub.PkiCollections}
>
{(isAllowed) => (
<DropdownMenuItem
className={twMerge(
!isAllowed && "pointer-events-none cursor-not-allowed opacity-50"
)}
onClick={(e) => {
e.stopPropagation();
handlePopUpOpen("pkiCollection", {
collectionId: pkiCollection.id
});
}}
disabled={!isAllowed}
>
Edit Collection
</DropdownMenuItem>
)}
</ProjectPermissionCan>
<ProjectPermissionCan
I={ProjectPermissionActions.Delete}
a={ProjectPermissionSub.PkiCollections}
>
{(isAllowed) => (
<DropdownMenuItem
className={twMerge(
isAllowed
? "hover:!bg-red-500 hover:!text-white"
: "pointer-events-none cursor-not-allowed opacity-50"
)}
onClick={(e) => {
e.stopPropagation();
handlePopUpOpen("deletePkiCollection", {
collectionId: pkiCollection.id,
name: pkiCollection.name
});
}}
disabled={!isAllowed}
>
Delete Collection
</DropdownMenuItem>
)}
</ProjectPermissionCan>
</DropdownMenuContent>
</DropdownMenu>
</Td>
</Tr>
);
})}
</TBody>
</Table>
{!isPending && !data?.collections?.length && (
<EmptyState title="No certificate collections have been created" icon={faBoxesStacked} />
)}
</TableContainer>
</div>
);
};
@@ -0,0 +1,2 @@
export { PkiAlertsSection } from "./PkiAlertsSection";
export { PkiCollectionSection } from "./PkiCollectionSection";
@@ -0,0 +1 @@
export { PkiAlertsTab } from "./PkiAlertsTab";