From 9263c1a23d6a2f81934c485e97726d713ce5ac88 Mon Sep 17 00:00:00 2001 From: Carlos Monastyrski Date: Mon, 17 Nov 2025 10:47:38 -0300 Subject: [PATCH 1/4] Fix refresh issues on PKI Inventory table --- .../src/hooks/api/certificates/mutations.tsx | 23 ++++++++++++++----- frontend/src/hooks/api/certificates/types.ts | 2 ++ .../components/CertificateRevocationModal.tsx | 1 + .../components/CertificatesSection.tsx | 6 ++++- 4 files changed, 25 insertions(+), 7 deletions(-) diff --git a/frontend/src/hooks/api/certificates/mutations.tsx b/frontend/src/hooks/api/certificates/mutations.tsx index a6daf0491..f65d6adc6 100644 --- a/frontend/src/hooks/api/certificates/mutations.tsx +++ b/frontend/src/hooks/api/certificates/mutations.tsx @@ -27,9 +27,18 @@ export const useDeleteCert = () => { ); return certificate; }, - onSuccess: (_, { projectSlug }) => { + onSuccess: (_, { projectId }) => { queryClient.invalidateQueries({ - queryKey: projectKeys.forProjectCertificates(projectSlug) + queryKey: ["certificate-profiles", "list"] + }); + queryClient.invalidateQueries({ + queryKey: pkiSubscriberKeys.allPkiSubscriberCertificates() + }); + queryClient.invalidateQueries({ + queryKey: projectKeys.allProjectCertificates() + }); + queryClient.invalidateQueries({ + queryKey: projectKeys.forProjectCertificates(projectId) }); } }); @@ -49,16 +58,18 @@ export const useRevokeCert = () => { ); return certificate; }, - onSuccess: (_, { projectSlug }) => { + onSuccess: (_, { projectId }) => { queryClient.invalidateQueries({ - queryKey: projectKeys.forProjectCertificates(projectSlug) + queryKey: ["certificate-profiles", "list"] }); queryClient.invalidateQueries({ queryKey: pkiSubscriberKeys.allPkiSubscriberCertificates() }); - queryClient.invalidateQueries({ - queryKey: ["certificate-profiles", "list"] + queryKey: projectKeys.allProjectCertificates() + }); + queryClient.invalidateQueries({ + queryKey: projectKeys.forProjectCertificates(projectId) }); } }); diff --git a/frontend/src/hooks/api/certificates/types.ts b/frontend/src/hooks/api/certificates/types.ts index 5e950b9c9..52ac0d9d4 100644 --- a/frontend/src/hooks/api/certificates/types.ts +++ b/frontend/src/hooks/api/certificates/types.ts @@ -25,11 +25,13 @@ export type TCertificate = { export type TDeleteCertDTO = { projectSlug: string; + projectId: string; serialNumber: string; }; export type TRevokeCertDTO = { projectSlug: string; + projectId: string; serialNumber: string; revocationReason: string; }; diff --git a/frontend/src/pages/cert-manager/CertificatesPage/components/CertificateRevocationModal.tsx b/frontend/src/pages/cert-manager/CertificatesPage/components/CertificateRevocationModal.tsx index d9a564fb1..39198beb8 100644 --- a/frontend/src/pages/cert-manager/CertificatesPage/components/CertificateRevocationModal.tsx +++ b/frontend/src/pages/cert-manager/CertificatesPage/components/CertificateRevocationModal.tsx @@ -54,6 +54,7 @@ export const CertificateRevocationModal = ({ popUp, handlePopUpToggle }: Props) await revokeCertificate({ projectSlug: currentProject.slug, + projectId: currentProject.id, serialNumber, revocationReason }); diff --git a/frontend/src/pages/cert-manager/CertificatesPage/components/CertificatesSection.tsx b/frontend/src/pages/cert-manager/CertificatesPage/components/CertificatesSection.tsx index 7ca9b81d0..1330c5c4a 100644 --- a/frontend/src/pages/cert-manager/CertificatesPage/components/CertificatesSection.tsx +++ b/frontend/src/pages/cert-manager/CertificatesPage/components/CertificatesSection.tsx @@ -42,7 +42,11 @@ export const CertificatesSection = () => { const onRemoveCertificateSubmit = async (serialNumber: string) => { if (!currentProject?.slug) return; - await deleteCert({ serialNumber, projectSlug: currentProject.slug }); + await deleteCert({ + serialNumber, + projectSlug: currentProject.slug, + projectId: currentProject.id + }); createNotification({ text: "Successfully deleted certificate", From 89c1ef2f470c52eebe6c6b676005022cef8dbe5c Mon Sep 17 00:00:00 2001 From: Carlos Monastyrski Date: Mon, 17 Nov 2025 10:56:35 -0300 Subject: [PATCH 2/4] Address greptile comments --- frontend/src/hooks/api/certificates/types.ts | 2 -- .../CertificatesPage/components/CertificateRevocationModal.tsx | 1 - .../CertificatesPage/components/CertificatesSection.tsx | 1 - 3 files changed, 4 deletions(-) diff --git a/frontend/src/hooks/api/certificates/types.ts b/frontend/src/hooks/api/certificates/types.ts index 52ac0d9d4..ee543aac7 100644 --- a/frontend/src/hooks/api/certificates/types.ts +++ b/frontend/src/hooks/api/certificates/types.ts @@ -24,13 +24,11 @@ export type TCertificate = { }; export type TDeleteCertDTO = { - projectSlug: string; projectId: string; serialNumber: string; }; export type TRevokeCertDTO = { - projectSlug: string; projectId: string; serialNumber: string; revocationReason: string; diff --git a/frontend/src/pages/cert-manager/CertificatesPage/components/CertificateRevocationModal.tsx b/frontend/src/pages/cert-manager/CertificatesPage/components/CertificateRevocationModal.tsx index 39198beb8..14e8d100a 100644 --- a/frontend/src/pages/cert-manager/CertificatesPage/components/CertificateRevocationModal.tsx +++ b/frontend/src/pages/cert-manager/CertificatesPage/components/CertificateRevocationModal.tsx @@ -53,7 +53,6 @@ export const CertificateRevocationModal = ({ popUp, handlePopUpToggle }: Props) const { serialNumber } = popUp.revokeCertificate.data as { serialNumber: string }; await revokeCertificate({ - projectSlug: currentProject.slug, projectId: currentProject.id, serialNumber, revocationReason diff --git a/frontend/src/pages/cert-manager/CertificatesPage/components/CertificatesSection.tsx b/frontend/src/pages/cert-manager/CertificatesPage/components/CertificatesSection.tsx index 1330c5c4a..e151df542 100644 --- a/frontend/src/pages/cert-manager/CertificatesPage/components/CertificatesSection.tsx +++ b/frontend/src/pages/cert-manager/CertificatesPage/components/CertificatesSection.tsx @@ -44,7 +44,6 @@ export const CertificatesSection = () => { await deleteCert({ serialNumber, - projectSlug: currentProject.slug, projectId: currentProject.id }); From c2f05a6d57f24a5d183f695a4c4b5aac6e541681 Mon Sep 17 00:00:00 2001 From: Carlos Monastyrski Date: Wed, 19 Nov 2025 01:56:02 -0300 Subject: [PATCH 3/4] Fix plan pkiAcme check --- .../services/certificate-profile/certificate-profile-service.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/src/services/certificate-profile/certificate-profile-service.ts b/backend/src/services/certificate-profile/certificate-profile-service.ts index 87063c6da..a5bd09b18 100644 --- a/backend/src/services/certificate-profile/certificate-profile-service.ts +++ b/backend/src/services/certificate-profile/certificate-profile-service.ts @@ -213,7 +213,7 @@ export const certificateProfileServiceFactory = ({ throw new NotFoundError({ message: "Project not found" }); } const plan = await licenseService.getPlan(project.orgId); - if (!plan.pkiAcme) { + if (!plan.pkiAcme && data.enrollmentType === EnrollmentType.EST) { throw new BadRequestError({ message: "Failed to create certificate profile: Plan restriction. Upgrade plan to continue" }); From 3bf0656d87c73013338220f7361136d0bf7f060a Mon Sep 17 00:00:00 2001 From: Carlos Monastyrski Date: Wed, 19 Nov 2025 02:03:12 -0300 Subject: [PATCH 4/4] Fix wrong enrollmentType on condition --- .../services/certificate-profile/certificate-profile-service.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/src/services/certificate-profile/certificate-profile-service.ts b/backend/src/services/certificate-profile/certificate-profile-service.ts index a5bd09b18..12e272ad6 100644 --- a/backend/src/services/certificate-profile/certificate-profile-service.ts +++ b/backend/src/services/certificate-profile/certificate-profile-service.ts @@ -213,7 +213,7 @@ export const certificateProfileServiceFactory = ({ throw new NotFoundError({ message: "Project not found" }); } const plan = await licenseService.getPlan(project.orgId); - if (!plan.pkiAcme && data.enrollmentType === EnrollmentType.EST) { + if (!plan.pkiAcme && data.enrollmentType === EnrollmentType.ACME) { throw new BadRequestError({ message: "Failed to create certificate profile: Plan restriction. Upgrade plan to continue" });