From 9ce6fd3f8ec22ce700fc44ecefad2d62b920b912 Mon Sep 17 00:00:00 2001 From: Tuan Dang Date: Tue, 10 Sep 2024 08:18:31 -0700 Subject: [PATCH] Made required adjustments based on review --- .../routes/v1/certificate-authority-router.ts | 2 +- .../server/routes/v1/certificate-router.ts | 4 +- .../CaPage/components/CaDetailsSection.tsx | 2 +- .../components/CaTab/components/CaModal.tsx | 38 +++++++++---------- .../CertificateTemplatesSection.tsx | 19 ---------- .../components/CertificateTemplatesTable.tsx | 6 --- 6 files changed, 22 insertions(+), 49 deletions(-) diff --git a/backend/src/server/routes/v1/certificate-authority-router.ts b/backend/src/server/routes/v1/certificate-authority-router.ts index 3c14b851e..77ee70e57 100644 --- a/backend/src/server/routes/v1/certificate-authority-router.ts +++ b/backend/src/server/routes/v1/certificate-authority-router.ts @@ -45,7 +45,7 @@ export const registerCaRouter = async (server: FastifyZodProvider) => { .describe(CERTIFICATE_AUTHORITIES.CREATE.keyAlgorithm), requireTemplateForIssuance: z .boolean() - .default(true) + .default(false) .describe(CERTIFICATE_AUTHORITIES.CREATE.requireTemplateForIssuance) }) .refine( diff --git a/backend/src/server/routes/v1/certificate-router.ts b/backend/src/server/routes/v1/certificate-router.ts index 2558b4970..91ae85982 100644 --- a/backend/src/server/routes/v1/certificate-router.ts +++ b/backend/src/server/routes/v1/certificate-router.ts @@ -101,7 +101,7 @@ export const registerCertRouter = async (server: FastifyZodProvider) => { .refine( (data) => (data.caId !== undefined && data.certificateTemplateId === undefined) || - (data.caId === undefined && data.pkiCollectionId === undefined && data.certificateTemplateId !== undefined), + (data.caId === undefined && data.certificateTemplateId !== undefined), { message: "Either CA ID or Certificate Template ID must be present, but not both", path: ["caId", "certificateTemplateId"] @@ -192,7 +192,7 @@ export const registerCertRouter = async (server: FastifyZodProvider) => { .refine( (data) => (data.caId !== undefined && data.certificateTemplateId === undefined) || - (data.caId === undefined && data.pkiCollectionId === undefined && data.certificateTemplateId !== undefined), + (data.caId === undefined && data.certificateTemplateId !== undefined), { message: "Either CA ID or Certificate Template ID must be present, but not both", path: ["caId", "certificateTemplateId"] diff --git a/frontend/src/views/Project/CaPage/components/CaDetailsSection.tsx b/frontend/src/views/Project/CaPage/components/CaDetailsSection.tsx index 4bff13225..9d5d20337 100644 --- a/frontend/src/views/Project/CaPage/components/CaDetailsSection.tsx +++ b/frontend/src/views/Project/CaPage/components/CaDetailsSection.tsx @@ -36,7 +36,7 @@ export const CaDetailsSection = ({ caId, handlePopUpOpen }: Props) => { {(isAllowed) => { return ( - + { ); }} /> - {/* {!ca && ( */} -
- - -
- {/* )} */} +
+ + +
diff --git a/frontend/src/views/Project/CertificatesPage/components/CertificatesTab/components/CertificateTemplatesSection.tsx b/frontend/src/views/Project/CertificatesPage/components/CertificatesTab/components/CertificateTemplatesSection.tsx index e76d2ce33..b1cce918f 100644 --- a/frontend/src/views/Project/CertificatesPage/components/CertificatesTab/components/CertificateTemplatesSection.tsx +++ b/frontend/src/views/Project/CertificatesPage/components/CertificatesTab/components/CertificateTemplatesSection.tsx @@ -59,25 +59,6 @@ export const CertificateTemplatesSection = ({ caId }: Props) => { return (
- {/*
-

Certificate Templates

- - {(isAllowed) => ( - - )} - -
*/}

Certificate Templates

{ const { subscription } = useSubscription(); const { data, isLoading } = useGetCaCertTemplates(caId); - - // const { data, isLoading } = useListWorkspaceCertificateTemplates({ - // workspaceId: currentWorkspace?.id ?? "" - // }); return (
@@ -59,7 +55,6 @@ export const CertificateTemplatesTable = ({ handlePopUpOpen, caId }: Props) => { Name - {/* Certificate Authority */} @@ -70,7 +65,6 @@ export const CertificateTemplatesTable = ({ handlePopUpOpen, caId }: Props) => { return ( {certificateTemplate.name} - {/* {certificateTemplate.caName} */}