From df75b3b8d38923dbbe2410a3ef073b7a7150349a Mon Sep 17 00:00:00 2001 From: Sheen Capadngan Date: Thu, 22 May 2025 04:21:54 +0800 Subject: [PATCH] misc: migrated internal CA to use new CA endpoint --- .../routes/v1/certificate-authority-router.ts | 2 + .../certificate-authority-service.ts | 6 +- .../internal-certificate-authority-schemas.ts | 10 +- .../internal-certificate-authority-service.ts | 17 +- .../internal-certificate-authority-types.ts | 14 +- .../src/services/project/project-service.ts | 2 +- frontend/src/const/routes.ts | 4 +- frontend/src/hooks/api/ca/index.tsx | 5 +- frontend/src/hooks/api/ca/mutations.tsx | 80 ++---- frontend/src/hooks/api/ca/types.ts | 28 +-- .../CertAuthDetailsByIDPage.tsx | 42 ++-- .../components/CaDetailsSection.tsx | 112 +++++---- .../CertAuthDetailsByIDPage/route.tsx | 2 +- .../ExternalCaInstallForm.tsx | 2 +- .../InternalCaInstallForm.tsx | 2 +- .../components/CaModal.tsx | 232 ++++++++++-------- .../components/CaSection.tsx | 16 +- .../components/CaTable.tsx | 36 +-- .../components/ExternalCaModal.tsx | 8 +- .../components/ExternalCaSection.tsx | 6 +- frontend/src/routeTree.gen.ts | 28 +-- frontend/src/routes.ts | 2 +- 22 files changed, 325 insertions(+), 331 deletions(-) diff --git a/backend/src/server/routes/v1/certificate-authority-router.ts b/backend/src/server/routes/v1/certificate-authority-router.ts index 77f01efae..2041abd3f 100644 --- a/backend/src/server/routes/v1/certificate-authority-router.ts +++ b/backend/src/server/routes/v1/certificate-authority-router.ts @@ -85,6 +85,7 @@ export const registerCaRouter = async (server: FastifyZodProvider) => { actorAuthMethod: req.permission.authMethod, isInternal: false, actorOrgId: req.permission.orgId, + enableDirectIssuance: !req.body.requireTemplateForIssuance, ...req.body }); @@ -217,6 +218,7 @@ export const registerCaRouter = async (server: FastifyZodProvider) => { isInternal: false, actorAuthMethod: req.permission.authMethod, actorOrgId: req.permission.orgId, + enableDirectIssuance: !req.body.requireTemplateForIssuance, ...req.body }); diff --git a/backend/src/services/certificate-authority/certificate-authority-service.ts b/backend/src/services/certificate-authority/certificate-authority-service.ts index d94abf165..fa66758c3 100644 --- a/backend/src/services/certificate-authority/certificate-authority-service.ts +++ b/backend/src/services/certificate-authority/certificate-authority-service.ts @@ -127,7 +127,8 @@ export const certificateAuthorityServiceFactory = ({ ...(configuration as TCreateInternalCertificateAuthorityDTO["configuration"]), isInternal: true, projectId: finalProjectId, - requireTemplateForIssuance: !enableDirectIssuance + enableDirectIssuance, + name }); if (!ca.internalCa) { @@ -312,8 +313,9 @@ export const certificateAuthorityServiceFactory = ({ const updatedCa = await internalCertificateAuthorityService.updateCaById({ ...configuration, isInternal: true, - requireTemplateForIssuance: !enableDirectIssuance, + enableDirectIssuance, caId: certificateAuthority.id, + status, name }); diff --git a/backend/src/services/certificate-authority/internal/internal-certificate-authority-schemas.ts b/backend/src/services/certificate-authority/internal/internal-certificate-authority-schemas.ts index 0979b968f..ffec0d762 100644 --- a/backend/src/services/certificate-authority/internal/internal-certificate-authority-schemas.ts +++ b/backend/src/services/certificate-authority/internal/internal-certificate-authority-schemas.ts @@ -23,14 +23,12 @@ const InternalCertificateAuthorityConfigurationSchema = z locality: z.string().trim().describe(CertificateAuthorities.CONFIGURATIONS.INTERNAL.locality), notBefore: validateCaDateField.optional().describe(CertificateAuthorities.CONFIGURATIONS.INTERNAL.notBefore), notAfter: validateCaDateField.optional().describe(CertificateAuthorities.CONFIGURATIONS.INTERNAL.notAfter), - maxPathLength: z.number().min(-1).describe(CertificateAuthorities.CONFIGURATIONS.INTERNAL.maxPathLength), + maxPathLength: z.number().min(-1).nullish().describe(CertificateAuthorities.CONFIGURATIONS.INTERNAL.maxPathLength), keyAlgorithm: z.nativeEnum(CertKeyAlgorithm).describe(CertificateAuthorities.CONFIGURATIONS.INTERNAL.keyAlgorithm), - - // no need for descriptions of the following fields because they are not exposed to the API user - dn: z.string().trim(), + dn: z.string().trim().nullish(), parentCaId: z.string().uuid().nullish(), - serialNumber: z.string().trim().optional(), - activeCaCertId: z.string().uuid().optional() + serialNumber: z.string().trim().nullish(), + activeCaCertId: z.string().uuid().nullish() }) .refine( (data) => { diff --git a/backend/src/services/certificate-authority/internal/internal-certificate-authority-service.ts b/backend/src/services/certificate-authority/internal/internal-certificate-authority-service.ts index 7a0ccfeed..d42edecb1 100644 --- a/backend/src/services/certificate-authority/internal/internal-certificate-authority-service.ts +++ b/backend/src/services/certificate-authority/internal/internal-certificate-authority-service.ts @@ -143,7 +143,8 @@ export const internalCertificateAuthorityServiceFactory = ({ notAfter, maxPathLength, keyAlgorithm, - requireTemplateForIssuance, + enableDirectIssuance, + name, ...dto }: TCreateCaDTO) => { let projectId: string; @@ -202,8 +203,8 @@ export const internalCertificateAuthorityServiceFactory = ({ const ca = await certificateAuthorityDAL.create( { projectId, - enableDirectIssuance: !requireTemplateForIssuance, - name: slugify(`${friendlyName || dn}-${alphaNumericNanoId(8)}`), + enableDirectIssuance, + name: name || slugify(`${(friendlyName || dn).slice(0, 16)}-${alphaNumericNanoId(8)}`), status: type === InternalCaType.ROOT ? CaStatus.ACTIVE : CaStatus.PENDING_CERTIFICATE }, tx @@ -360,7 +361,7 @@ export const internalCertificateAuthorityServiceFactory = ({ * Update CA with id [caId]. * Note: Used to enable/disable CA */ - const updateCaById = async ({ caId, status, requireTemplateForIssuance, name, ...dto }: TUpdateCaDTO) => { + const updateCaById = async ({ caId, status, enableDirectIssuance, name, ...dto }: TUpdateCaDTO) => { const ca = await certificateAuthorityDAL.findByIdWithAssociatedCa(caId); if (!ca.internalCa) throw new NotFoundError({ message: `CA with ID '${caId}' not found` }); @@ -381,12 +382,8 @@ export const internalCertificateAuthorityServiceFactory = ({ } const updatedCa = await certificateAuthorityDAL.transaction(async (tx) => { - if (requireTemplateForIssuance !== undefined || status !== undefined || name !== undefined) { - await certificateAuthorityDAL.updateById( - ca.id, - { enableDirectIssuance: !requireTemplateForIssuance, status, name }, - tx - ); + if (enableDirectIssuance !== undefined || status !== undefined || name !== undefined) { + await certificateAuthorityDAL.updateById(ca.id, { enableDirectIssuance, status, name }, tx); } return certificateAuthorityDAL.findByIdWithAssociatedCa(caId, tx); diff --git a/backend/src/services/certificate-authority/internal/internal-certificate-authority-types.ts b/backend/src/services/certificate-authority/internal/internal-certificate-authority-types.ts index 54daa78d7..f8ea82a59 100644 --- a/backend/src/services/certificate-authority/internal/internal-certificate-authority-types.ts +++ b/backend/src/services/certificate-authority/internal/internal-certificate-authority-types.ts @@ -31,6 +31,7 @@ export type TCreateCaDTO = projectId: string; type: InternalCaType; friendlyName?: string; + name?: string; commonName: string; organization: string; ou: string; @@ -39,15 +40,16 @@ export type TCreateCaDTO = locality: string; notBefore?: string; notAfter?: string; - maxPathLength: number; + maxPathLength?: number | null; keyAlgorithm: CertKeyAlgorithm; - requireTemplateForIssuance: boolean; + enableDirectIssuance: boolean; } | ({ isInternal: false; projectSlug: string; type: InternalCaType; friendlyName?: string; + name?: string; commonName: string; organization: string; ou: string; @@ -56,9 +58,9 @@ export type TCreateCaDTO = locality: string; notBefore?: string; notAfter?: string; - maxPathLength: number; + maxPathLength?: number | null; keyAlgorithm: CertKeyAlgorithm; - requireTemplateForIssuance: boolean; + enableDirectIssuance: boolean; } & Omit); export type TGetCaDTO = { @@ -71,14 +73,14 @@ export type TUpdateCaDTO = caId: string; name?: string; status?: CaStatus; - requireTemplateForIssuance?: boolean; + enableDirectIssuance?: boolean; } | ({ isInternal: false; caId: string; name?: string; status?: CaStatus; - requireTemplateForIssuance?: boolean; + enableDirectIssuance?: boolean; } & Omit); export type TDeleteCaDTO = { diff --git a/backend/src/services/project/project-service.ts b/backend/src/services/project/project-service.ts index 4770b4c9f..d042ee32a 100644 --- a/backend/src/services/project/project-service.ts +++ b/backend/src/services/project/project-service.ts @@ -920,7 +920,7 @@ export const projectServiceFactory = ({ { [`${TableName.CertificateAuthority}.projectId` as "projectId"]: projectId, $notNull: [`${TableName.InternalCertificateAuthority}.id` as "id"], - ...(status && { [`${TableName.InternalCertificateAuthority}.status` as "status"]: status }), + ...(status && { [`${TableName.CertificateAuthority}.status` as "status"]: status }), ...(friendlyName && { [`${TableName.InternalCertificateAuthority}.friendlyName` as "friendlyName"]: friendlyName }), diff --git a/frontend/src/const/routes.ts b/frontend/src/const/routes.ts index e390fbcc6..6ba6c4a69 100644 --- a/frontend/src/const/routes.ts +++ b/frontend/src/const/routes.ts @@ -284,8 +284,8 @@ export const ROUTE_PATHS = Object.freeze({ }, CertManager: { CertAuthDetailsByIDPage: setRoute( - "/cert-manager/$projectId/ca/$caId", - "/_authenticate/_inject-org-details/_org-layout/cert-manager/$projectId/_cert-manager-layout/ca/$caId" + "/cert-manager/$projectId/ca/$caName", + "/_authenticate/_inject-org-details/_org-layout/cert-manager/$projectId/_cert-manager-layout/ca/$caName" ), SubscribersPage: setRoute( "/cert-manager/$projectId/subscribers", diff --git a/frontend/src/hooks/api/ca/index.tsx b/frontend/src/hooks/api/ca/index.tsx index ca96c676e..82e9ea3be 100644 --- a/frontend/src/hooks/api/ca/index.tsx +++ b/frontend/src/hooks/api/ca/index.tsx @@ -2,14 +2,11 @@ export { AcmeDnsProvider, CaRenewalType, CaStatus, CaType, InternalCaType } from export { useCreateCa, useCreateCertificate, - useCreateUnifiedCa, useDeleteCa, - useDeleteUnifiedCa, useImportCaCertificate, useRenewCa, useSignIntermediate, - useUpdateCa, - useUpdateUnifiedCa + useUpdateCa } from "./mutations"; export { useGetCa, diff --git a/frontend/src/hooks/api/ca/mutations.tsx b/frontend/src/hooks/api/ca/mutations.tsx index 165fbe121..9c865d451 100644 --- a/frontend/src/hooks/api/ca/mutations.tsx +++ b/frontend/src/hooks/api/ca/mutations.tsx @@ -3,15 +3,13 @@ import { useMutation, useQueryClient } from "@tanstack/react-query"; import { apiRequest } from "@app/config/request"; import { workspaceKeys } from "../workspace"; +import { CaType } from "./enums"; import { caKeys } from "./queries"; import { - TCertificateAuthority, - TCreateCaDTO, + TCreateCertificateAuthorityDTO, TCreateCertificateDTO, TCreateCertificateResponse, - TCreateUnifiedCertificateAuthorityDTO, - TDeleteCaDTO, - TDeleteUnifiedCertificateAuthorityDTO, + TDeleteCertificateAuthorityDTO, TImportCaCertificateDTO, TImportCaCertificateResponse, TRenewCaDTO, @@ -19,13 +17,12 @@ import { TSignIntermediateDTO, TSignIntermediateResponse, TUnifiedCertificateAuthority, - TUpdateCaDTO, - TUpdateUnifiedCertificateAuthorityDTO + TUpdateCertificateAuthorityDTO } from "./types"; -export const useUpdateUnifiedCa = () => { +export const useUpdateCa = () => { const queryClient = useQueryClient(); - return useMutation({ + return useMutation({ mutationFn: async ({ caName, ...body }) => { const { data } = await apiRequest.patch( `/api/v1/pki/ca/${body.type}/${caName}`, @@ -42,9 +39,9 @@ export const useUpdateUnifiedCa = () => { }); }; -export const useCreateUnifiedCa = () => { +export const useCreateCa = () => { const queryClient = useQueryClient(); - return useMutation({ + return useMutation({ mutationFn: async (body) => { const { data } = await apiRequest.post( `/api/v1/pki/ca/${body.type}`, @@ -60,13 +57,11 @@ export const useCreateUnifiedCa = () => { }); }; -export const useDeleteUnifiedCa = () => { +export const useDeleteCa = () => { const queryClient = useQueryClient(); - return useMutation({ + return useMutation({ mutationFn: async ({ caName, type, projectId }) => { - const { - data: { certificateAuthority } - } = await apiRequest.delete<{ certificateAuthority: TUnifiedCertificateAuthority }>( + const { data } = await apiRequest.delete( `/api/v1/pki/ca/${type}/${caName}`, { data: { @@ -74,7 +69,7 @@ export const useDeleteUnifiedCa = () => { } } ); - return certificateAuthority; + return data; }, onSuccess: (_, { type, projectId }) => { queryClient.invalidateQueries({ @@ -84,52 +79,6 @@ export const useDeleteUnifiedCa = () => { }); }; -export const useCreateCa = () => { - const queryClient = useQueryClient(); - return useMutation({ - mutationFn: async (body) => { - const { - data: { ca } - } = await apiRequest.post<{ ca: TCertificateAuthority }>("/api/v1/pki/ca/", body); - return ca; - }, - onSuccess: (_, { projectSlug }) => { - queryClient.invalidateQueries({ queryKey: workspaceKeys.getWorkspaceCas({ projectSlug }) }); - } - }); -}; - -export const useUpdateCa = () => { - const queryClient = useQueryClient(); - return useMutation({ - mutationFn: async ({ caId, projectSlug, ...body }) => { - const { - data: { ca } - } = await apiRequest.patch<{ ca: TCertificateAuthority }>(`/api/v1/pki/ca/${caId}`, body); - return ca; - }, - onSuccess: ({ id }, { projectSlug }) => { - queryClient.invalidateQueries({ queryKey: workspaceKeys.getWorkspaceCas({ projectSlug }) }); - queryClient.invalidateQueries({ queryKey: caKeys.getCaById(id) }); - } - }); -}; - -export const useDeleteCa = () => { - const queryClient = useQueryClient(); - return useMutation({ - mutationFn: async ({ caId }) => { - const { - data: { ca } - } = await apiRequest.delete<{ ca: TCertificateAuthority }>(`/api/v1/pki/ca/${caId}`); - return ca; - }, - onSuccess: (_, { projectSlug }) => { - queryClient.invalidateQueries({ queryKey: workspaceKeys.getWorkspaceCas({ projectSlug }) }); - } - }); -}; - export const useSignIntermediate = () => { // TODO: consider renaming return useMutation({ @@ -143,7 +92,7 @@ export const useSignIntermediate = () => { }); }; -export const useImportCaCertificate = () => { +export const useImportCaCertificate = (projectId: string) => { const queryClient = useQueryClient(); return useMutation({ mutationFn: async ({ caId, ...body }) => { @@ -157,6 +106,9 @@ export const useImportCaCertificate = () => { queryClient.invalidateQueries({ queryKey: workspaceKeys.getWorkspaceCas({ projectSlug }) }); queryClient.invalidateQueries({ queryKey: caKeys.getCaCerts(caId) }); queryClient.invalidateQueries({ queryKey: caKeys.getCaCert(caId) }); + queryClient.invalidateQueries({ + queryKey: caKeys.listCasByTypeAndProjectId(CaType.INTERNAL, projectId) + }); } }); }; diff --git a/frontend/src/hooks/api/ca/types.ts b/frontend/src/hooks/api/ca/types.ts index 171143c12..f3703fe52 100644 --- a/frontend/src/hooks/api/ca/types.ts +++ b/frontend/src/hooks/api/ca/types.ts @@ -39,10 +39,10 @@ export type TInternalCertificateAuthority = { keyAlgorithm: CertKeyAlgorithm; notAfter?: string; notBefore?: string; - dn: string; + dn?: string; parentCaId?: string; - serialNumber: string; - activeCaCertId: string; + serialNumber?: string; + activeCaCertId?: string; }; }; @@ -50,14 +50,14 @@ export type TUnifiedCertificateAuthority = | TAcmeCertificateAuthority | TInternalCertificateAuthority; -export type TCreateUnifiedCertificateAuthorityDTO = Omit; -export type TUpdateUnifiedCertificateAuthorityDTO = Partial & { +export type TCreateCertificateAuthorityDTO = Omit; +export type TUpdateCertificateAuthorityDTO = Partial & { caName: string; projectId: string; type: CaType; }; -export type TDeleteUnifiedCertificateAuthorityDTO = { +export type TDeleteCertificateAuthorityDTO = { caName: string; type: CaType; projectId: string; @@ -87,22 +87,6 @@ export type TCertificateAuthority = { updatedAt: string; }; -export type TCreateCaDTO = { - projectSlug: string; - type: string; - friendlyName?: string; - organization: string; - ou: string; - country: string; - province: string; - locality: string; - commonName: string; - notAfter?: string; - maxPathLength: number; - keyAlgorithm: CertKeyAlgorithm; - requireTemplateForIssuance: boolean; -}; - export type TUpdateCaDTO = { projectSlug: string; caId: string; diff --git a/frontend/src/pages/cert-manager/CertAuthDetailsByIDPage/CertAuthDetailsByIDPage.tsx b/frontend/src/pages/cert-manager/CertAuthDetailsByIDPage/CertAuthDetailsByIDPage.tsx index df5680668..e76720275 100644 --- a/frontend/src/pages/cert-manager/CertAuthDetailsByIDPage/CertAuthDetailsByIDPage.tsx +++ b/frontend/src/pages/cert-manager/CertAuthDetailsByIDPage/CertAuthDetailsByIDPage.tsx @@ -16,7 +16,8 @@ import { } from "@app/components/v2"; import { ROUTE_PATHS } from "@app/const/routes"; import { ProjectPermissionActions, ProjectPermissionSub, useWorkspace } from "@app/context"; -import { useDeleteCa, useGetCaById } from "@app/hooks/api"; +import { CaType, useDeleteCa, useGetCa } from "@app/hooks/api"; +import { TInternalCertificateAuthority } from "@app/hooks/api/ca/types"; import { ProjectType } from "@app/hooks/api/workspace/types"; import { usePopUp } from "@app/hooks/usePopUp"; @@ -31,14 +32,18 @@ import { } from "./components"; const Page = () => { + const { currentWorkspace } = useWorkspace(); const navigate = useNavigate(); const params = useParams({ from: ROUTE_PATHS.CertManager.CertAuthDetailsByIDPage.id }); - const caId = params.caId as string; - const { data } = useGetCaById(caId); + const { caName } = params as { caName: string }; + const { data } = useGetCa({ + caName, + projectId: currentWorkspace?.id || "", + type: CaType.INTERNAL + }) as { data: TInternalCertificateAuthority }; - const { currentWorkspace } = useWorkspace(); const projectId = currentWorkspace?.id || ""; const { mutateAsync: deleteCa } = useDeleteCa(); @@ -50,11 +55,15 @@ const Page = () => { "renewCa" ] as const); - const onRemoveCaSubmit = async (caIdToDelete: string) => { + const onRemoveCaSubmit = async () => { try { if (!currentWorkspace?.slug) return; - await deleteCa({ caId: caIdToDelete, projectSlug: currentWorkspace.slug }); + await deleteCa({ + caName, + projectId: currentWorkspace.id, + type: CaType.INTERNAL + }); createNotification({ text: "Successfully deleted CA", @@ -63,7 +72,7 @@ const Page = () => { handlePopUpClose("deleteCa"); navigate({ - to: `/${ProjectType.CertificateManager}/$projectId/certificates` as const, + to: `/${ProjectType.CertificateManager}/$projectId/certificate-authorities` as const, params: { projectId } @@ -80,7 +89,7 @@ const Page = () => {
{data && (
- +
@@ -101,12 +110,7 @@ const Page = () => { ? "hover:!bg-red-500 hover:!text-white" : "pointer-events-none cursor-not-allowed opacity-50" )} - onClick={() => - handlePopUpOpen("deleteCa", { - caId: data.id, - dn: data.dn - }) - } + onClick={() => handlePopUpOpen("deleteCa")} disabled={!isAllowed} > Delete CA @@ -118,12 +122,12 @@ const Page = () => {
- +
- - - + + +
@@ -139,7 +143,7 @@ const Page = () => { subTitle="This action will delete other CAs and certificates below it in your CA hierarchy." onChange={(isOpen) => handlePopUpToggle("deleteCa", isOpen)} deleteKey="confirm" - onDeleteApproved={() => onRemoveCaSubmit((popUp?.deleteCa?.data as { caId: string })?.caId)} + onDeleteApproved={onRemoveCaSubmit} />
); diff --git a/frontend/src/pages/cert-manager/CertAuthDetailsByIDPage/components/CaDetailsSection.tsx b/frontend/src/pages/cert-manager/CertAuthDetailsByIDPage/components/CaDetailsSection.tsx index b5266fea9..f12fcfd28 100644 --- a/frontend/src/pages/cert-manager/CertAuthDetailsByIDPage/components/CaDetailsSection.tsx +++ b/frontend/src/pages/cert-manager/CertAuthDetailsByIDPage/components/CaDetailsSection.tsx @@ -4,22 +4,24 @@ import { format } from "date-fns"; import { ProjectPermissionCan } from "@app/components/permissions"; import { Button, IconButton, Tooltip } from "@app/components/v2"; -import { ProjectPermissionActions, ProjectPermissionSub } from "@app/context"; +import { ProjectPermissionActions, ProjectPermissionSub, useWorkspace } from "@app/context"; import { useTimedReset } from "@app/hooks"; -import { CaStatus, InternalCaType, useGetCaById } from "@app/hooks/api"; +import { CaStatus, CaType, InternalCaType, useGetCa } from "@app/hooks/api"; import { caStatusToNameMap, caTypeToNameMap } from "@app/hooks/api/ca/constants"; +import { TInternalCertificateAuthority } from "@app/hooks/api/ca/types"; import { certKeyAlgorithmToNameMap } from "@app/hooks/api/certificates/constants"; import { UsePopUpState } from "@app/hooks/usePopUp"; type Props = { - caId: string; + caName: string; handlePopUpOpen: ( popUpName: keyof UsePopUpState<["ca", "renewCa", "installCaCert"]>, data?: object ) => void; }; -export const CaDetailsSection = ({ caId, handlePopUpOpen }: Props) => { +export const CaDetailsSection = ({ caName, handlePopUpOpen }: Props) => { + const { currentWorkspace } = useWorkspace(); const [copyTextId, isCopyingId, setCopyTextId] = useTimedReset({ initialState: "Copy ID to clipboard" }); @@ -27,7 +29,13 @@ export const CaDetailsSection = ({ caId, handlePopUpOpen }: Props) => { initialState: "Copy ID to clipboard" }); - const { data: ca } = useGetCaById(caId); + const { data } = useGetCa({ + caName, + projectId: currentWorkspace.id, + type: CaType.INTERNAL + }); + + const ca = data as TInternalCertificateAuthority; return ca ? (
@@ -45,7 +53,7 @@ export const CaDetailsSection = ({ caId, handlePopUpOpen }: Props) => { onClick={(e) => { e.stopPropagation(); handlePopUpOpen("ca", { - caId: ca.id + name: ca.name }); }} > @@ -59,7 +67,7 @@ export const CaDetailsSection = ({ caId, handlePopUpOpen }: Props) => {

CA Type

-

{caTypeToNameMap[ca.type]}

+

{caTypeToNameMap[ca.configuration.type]}

CA ID

@@ -82,36 +90,39 @@ export const CaDetailsSection = ({ caId, handlePopUpOpen }: Props) => {
- {ca.type === InternalCaType.INTERMEDIATE && ca.status !== CaStatus.PENDING_CERTIFICATE && ( -
-

Parent CA ID

-
-

- {ca.parentCaId ? ca.parentCaId : "N/A - External Parent CA"} -

- {ca.parentCaId && ( -
- - { - navigator.clipboard.writeText(ca.parentCaId as string); - setCopyTextParentId("Copied"); - }} - > - - - -
- )} + {ca.configuration.type === InternalCaType.INTERMEDIATE && + ca.status !== CaStatus.PENDING_CERTIFICATE && ( +
+

Parent CA ID

+
+

+ {ca.configuration.parentCaId + ? ca.configuration.parentCaId + : "N/A - External Parent CA"} +

+ {ca.configuration.parentCaId && ( +
+ + { + navigator.clipboard.writeText(ca.configuration.parentCaId as string); + setCopyTextParentId("Copied"); + }} + > + + + +
+ )} +
-
- )} + )}
-

Friendly Name

-

{ca.friendlyName}

+

Name

+

{ca.name}

Status

@@ -119,29 +130,33 @@ export const CaDetailsSection = ({ caId, handlePopUpOpen }: Props) => {

Key Algorithm

-

{certKeyAlgorithmToNameMap[ca.keyAlgorithm]}

+

+ {certKeyAlgorithmToNameMap[ca.configuration.keyAlgorithm]} +

Max Path Length

-

{ca.maxPathLength ?? "-"}

+

{ca.configuration.maxPathLength ?? "-"}

Not Before

- {ca.notBefore ? format(new Date(ca.notBefore), "yyyy-MM-dd") : "-"} + {ca.configuration.notBefore + ? format(new Date(ca.configuration.notBefore), "yyyy-MM-dd") + : "-"}

Not After

- {ca.notAfter ? format(new Date(ca.notAfter), "yyyy-MM-dd") : "-"} + {ca.configuration.notAfter + ? format(new Date(ca.configuration.notAfter), "yyyy-MM-dd") + : "-"}

-

Template Issuance Required

-

- {ca.requireTemplateForIssuance ? "True" : "False"} -

+

Enable Direct Issuance

+

{ca.enableDirectIssuance ? "True" : "False"}

{ca.status === CaStatus.ACTIVE && ( { colorSchema="primary" type="submit" onClick={() => { - if (ca.type === InternalCaType.INTERMEDIATE && !ca.parentCaId) { + if ( + ca.configuration.type === InternalCaType.INTERMEDIATE && + !ca.configuration.parentCaId + ) { // intermediate CA with external parent CA handlePopUpOpen("installCaCert", { - caId, + caId: ca.id, isParentCaExternal: true }); return; } handlePopUpOpen("renewCa", { - caId + caId: ca.id }); }} > @@ -190,7 +208,7 @@ export const CaDetailsSection = ({ caId, handlePopUpOpen }: Props) => { type="submit" onClick={() => { handlePopUpOpen("installCaCert", { - caId + caId: ca.id }); }} > diff --git a/frontend/src/pages/cert-manager/CertAuthDetailsByIDPage/route.tsx b/frontend/src/pages/cert-manager/CertAuthDetailsByIDPage/route.tsx index aa7540a7f..ab04ecba4 100644 --- a/frontend/src/pages/cert-manager/CertAuthDetailsByIDPage/route.tsx +++ b/frontend/src/pages/cert-manager/CertAuthDetailsByIDPage/route.tsx @@ -3,7 +3,7 @@ import { createFileRoute, linkOptions } from "@tanstack/react-router"; import { CertAuthDetailsByIDPage } from "./CertAuthDetailsByIDPage"; export const Route = createFileRoute( - "/_authenticate/_inject-org-details/_org-layout/cert-manager/$projectId/_cert-manager-layout/ca/$caId" + "/_authenticate/_inject-org-details/_org-layout/cert-manager/$projectId/_cert-manager-layout/ca/$caName" )({ component: CertAuthDetailsByIDPage, beforeLoad: ({ context, params }) => { diff --git a/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/CaInstallCertModal/ExternalCaInstallForm.tsx b/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/CaInstallCertModal/ExternalCaInstallForm.tsx index 9ff62ff2e..6f79cbb24 100644 --- a/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/CaInstallCertModal/ExternalCaInstallForm.tsx +++ b/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/CaInstallCertModal/ExternalCaInstallForm.tsx @@ -41,7 +41,7 @@ export const ExternalCaInstallForm = ({ caId, handlePopUpToggle }: Props) => { }); const { data: csr } = useGetCaCsr(caId); - const { mutateAsync: importCaCertificate } = useImportCaCertificate(); + const { mutateAsync: importCaCertificate } = useImportCaCertificate(currentWorkspace.id); useEffect(() => { reset(); diff --git a/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/CaInstallCertModal/InternalCaInstallForm.tsx b/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/CaInstallCertModal/InternalCaInstallForm.tsx index 4d0aa4a8e..677407dc8 100644 --- a/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/CaInstallCertModal/InternalCaInstallForm.tsx +++ b/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/CaInstallCertModal/InternalCaInstallForm.tsx @@ -55,7 +55,7 @@ export const InternalCaInstallForm = ({ caId, handlePopUpToggle }: Props) => { const { data: csr } = useGetCaCsr(caId); const { mutateAsync: signIntermediate } = useSignIntermediate(); - const { mutateAsync: importCaCertificate } = useImportCaCertificate(); + const { mutateAsync: importCaCertificate } = useImportCaCertificate(currentWorkspace.id); const { control, diff --git a/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/CaModal.tsx b/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/CaModal.tsx index 5e18abf7b..07bf1493a 100644 --- a/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/CaModal.tsx +++ b/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/CaModal.tsx @@ -17,10 +17,18 @@ import { // DatePicker } from "@app/components/v2"; import { useWorkspace } from "@app/context"; -import { InternalCaType, useCreateCa, useGetCaById, useUpdateCa } from "@app/hooks/api/ca"; +import { + CaStatus, + CaType, + InternalCaType, + useCreateCa, + useGetCa, + useUpdateCa +} from "@app/hooks/api/ca"; import { certKeyAlgorithms } from "@app/hooks/api/certificates/constants"; import { CertKeyAlgorithm } from "@app/hooks/api/certificates/enums"; import { UsePopUpState } from "@app/hooks/usePopUp"; +import { slugSchema } from "@app/lib/schemas"; const isValidDate = (dateString: string) => { const date = new Date(dateString); @@ -35,23 +43,31 @@ const getDateTenYearsFromToday = () => { const schema = z .object({ - type: z.enum([InternalCaType.ROOT, InternalCaType.INTERMEDIATE]), - friendlyName: z.string(), - organization: z.string(), - ou: z.string(), - country: z.string(), - province: z.string(), - locality: z.string(), - commonName: z.string(), - notAfter: z.string().trim().refine(isValidDate, { message: "Invalid date format" }), - maxPathLength: z.string(), - keyAlgorithm: z.enum([ - CertKeyAlgorithm.RSA_2048, - CertKeyAlgorithm.RSA_4096, - CertKeyAlgorithm.ECDSA_P256, - CertKeyAlgorithm.ECDSA_P384 - ]), - requireTemplateForIssuance: z.boolean() + type: z.nativeEnum(CaType), + name: slugSchema({ + field: "Name" + }), + enableDirectIssuance: z.boolean(), + status: z.nativeEnum(CaStatus), + configuration: z + .object({ + type: z.enum([InternalCaType.ROOT, InternalCaType.INTERMEDIATE]), + organization: z.string(), + ou: z.string(), + country: z.string(), + province: z.string(), + locality: z.string(), + commonName: z.string(), + notAfter: z.string().trim().refine(isValidDate, { message: "Invalid date format" }), + maxPathLength: z.string(), + keyAlgorithm: z.enum([ + CertKeyAlgorithm.RSA_2048, + CertKeyAlgorithm.RSA_4096, + CertKeyAlgorithm.ECDSA_P256, + CertKeyAlgorithm.ECDSA_P384 + ]) + }) + .required() }) .required(); @@ -69,9 +85,11 @@ const caTypes = [ export const CaModal = ({ popUp, handlePopUpToggle }: Props) => { const { currentWorkspace } = useWorkspace(); - // const [isStartDatePickerOpen, setIsStartDatePickerOpen] = useState(false); - - const { data: ca } = useGetCaById((popUp?.ca?.data as { caId: string })?.caId || ""); + const { data: ca } = useGetCa({ + caName: (popUp?.ca?.data as { name: string })?.name || "", + projectId: currentWorkspace?.id || "", + type: CaType.INTERNAL + }); const { mutateAsync: createMutateAsync } = useCreateCa(); const { mutateAsync: updateMutateAsync } = useUpdateCa(); @@ -85,42 +103,12 @@ export const CaModal = ({ popUp, handlePopUpToggle }: Props) => { } = useForm({ resolver: zodResolver(schema), defaultValues: { - type: InternalCaType.ROOT, - friendlyName: "", - organization: "", - ou: "", - country: "", - province: "", - locality: "", - commonName: "", - notAfter: getDateTenYearsFromToday(), - maxPathLength: "-1", - keyAlgorithm: CertKeyAlgorithm.RSA_2048 - } - }); - - const caType = watch("type"); - - useEffect(() => { - if (ca) { - reset({ - type: ca.type, - friendlyName: ca.friendlyName, - organization: ca.organization, - ou: ca.ou, - country: ca.country, - province: ca.province, - locality: ca.locality, - commonName: ca.commonName, - notAfter: ca.notAfter ? format(new Date(ca.notAfter), "yyyy-MM-dd") : "", - maxPathLength: ca.maxPathLength ? String(ca.maxPathLength) : "", - keyAlgorithm: ca.keyAlgorithm, - requireTemplateForIssuance: ca.requireTemplateForIssuance - }); - } else { - reset({ + type: CaType.INTERNAL, + name: "", + status: CaStatus.ACTIVE, + enableDirectIssuance: true, + configuration: { type: InternalCaType.ROOT, - friendlyName: "", organization: "", ou: "", country: "", @@ -129,25 +117,65 @@ export const CaModal = ({ popUp, handlePopUpToggle }: Props) => { commonName: "", notAfter: getDateTenYearsFromToday(), maxPathLength: "-1", - keyAlgorithm: CertKeyAlgorithm.RSA_2048, - requireTemplateForIssuance: true + keyAlgorithm: CertKeyAlgorithm.RSA_2048 + } + } + }); + + const caType = watch("configuration.type"); + + useEffect(() => { + if (ca && ca.type === CaType.INTERNAL) { + reset({ + type: ca.type, + name: ca.name, + status: ca.status, + enableDirectIssuance: ca.enableDirectIssuance, + configuration: { + type: ca.configuration.type, + organization: ca.configuration.organization, + ou: ca.configuration.ou, + country: ca.configuration.country, + province: ca.configuration.province, + locality: ca.configuration.locality, + commonName: ca.configuration.commonName, + notAfter: ca.configuration.notAfter + ? format(new Date(ca.configuration.notAfter), "yyyy-MM-dd") + : "", + maxPathLength: ca.configuration.maxPathLength + ? String(ca.configuration.maxPathLength) + : "", + keyAlgorithm: ca.configuration.keyAlgorithm + } + }); + } else { + reset({ + type: CaType.INTERNAL, + name: "", + status: CaStatus.ACTIVE, + enableDirectIssuance: true, + configuration: { + type: InternalCaType.ROOT, + organization: "", + ou: "", + country: "", + province: "", + locality: "", + commonName: "", + notAfter: getDateTenYearsFromToday(), + maxPathLength: "-1", + keyAlgorithm: CertKeyAlgorithm.RSA_2048 + } }); } }, [ca]); const onFormSubmit = async ({ type, - friendlyName, - commonName, - organization, - ou, - country, - locality, - province, - notAfter, - maxPathLength, - keyAlgorithm, - requireTemplateForIssuance + name, + enableDirectIssuance, + status, + configuration }: FormData) => { try { if (!currentWorkspace?.slug) return; @@ -155,26 +183,29 @@ export const CaModal = ({ popUp, handlePopUpToggle }: Props) => { if (ca) { // update await updateMutateAsync({ - projectSlug: currentWorkspace.slug, - caId: ca.id, - requireTemplateForIssuance + caName: ca.name, + projectId: currentWorkspace.id, + name, + type: CaType.INTERNAL, + status, + enableDirectIssuance, + configuration: { + ...configuration, + maxPathLength: Number(configuration.maxPathLength) + } }); } else { // create await createMutateAsync({ - projectSlug: currentWorkspace.slug, + projectId: currentWorkspace.id, + name, type, - friendlyName, - commonName, - organization, - ou, - country, - province, - locality, - notAfter, - maxPathLength: Number(maxPathLength), - keyAlgorithm, - requireTemplateForIssuance + status, + enableDirectIssuance, + configuration: { + ...configuration, + maxPathLength: Number(configuration.maxPathLength) + } }); } @@ -211,7 +242,7 @@ export const CaModal = ({ popUp, handlePopUpToggle }: Props) => { )} ( @@ -264,7 +295,7 @@ export const CaModal = ({ popUp, handlePopUpToggle }: Props) => { ( { /> ( { )} ( { ( - + )} /> ( { ( { ( { ( { ( { ( { /> { return ( field.onChange(value)} isChecked={field.value} > -

Require Template for Certificate Issuance

+

Enable Direct Issuance

); diff --git a/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/CaSection.tsx b/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/CaSection.tsx index da340c9dd..f928f25d8 100644 --- a/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/CaSection.tsx +++ b/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/CaSection.tsx @@ -6,7 +6,7 @@ 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 { CaStatus, useDeleteCa, useUpdateCa } from "@app/hooks/api"; +import { CaStatus, CaType, useDeleteCa, useUpdateCa } from "@app/hooks/api"; import { usePopUp } from "@app/hooks/usePopUp"; import { CaCertModal } from "./CaCertModal"; @@ -28,11 +28,11 @@ export const CaSection = () => { "upgradePlan" ] as const); - const onRemoveCaSubmit = async (caId: string) => { + const onRemoveCaSubmit = async (caName: string) => { try { if (!currentWorkspace?.slug) return; - await deleteCa({ caId, projectSlug: currentWorkspace.slug }); + await deleteCa({ caName, projectId: currentWorkspace.id, type: CaType.INTERNAL }); createNotification({ text: "Successfully deleted CA", @@ -48,11 +48,11 @@ export const CaSection = () => { } }; - const onUpdateCaStatus = async ({ caId, status }: { caId: string; status: CaStatus }) => { + const onUpdateCaStatus = async ({ caName, status }: { caName: string; status: CaStatus }) => { try { if (!currentWorkspace?.slug) return; - await updateCa({ caId, projectSlug: currentWorkspace.slug, status }); + await updateCa({ caName, projectId: currentWorkspace.id, type: CaType.INTERNAL, status }); createNotification({ text: `Successfully ${status === CaStatus.ACTIVE ? "enabled" : "disabled"} CA`, @@ -102,7 +102,9 @@ export const CaSection = () => { subTitle="This action will delete other CAs and certificates below it in your CA hierarchy." onChange={(isOpen) => handlePopUpToggle("deleteCa", isOpen)} deleteKey="confirm" - onDeleteApproved={() => onRemoveCaSubmit((popUp?.deleteCa?.data as { caId: string })?.caId)} + onDeleteApproved={() => + onRemoveCaSubmit((popUp?.deleteCa?.data as { caName: string })?.caName) + } /> { onChange={(isOpen) => handlePopUpToggle("caStatus", isOpen)} deleteKey="confirm" onDeleteApproved={() => - onUpdateCaStatus(popUp?.caStatus?.data as { caId: string; status: CaStatus }) + onUpdateCaStatus(popUp?.caStatus?.data as { caName: string; status: CaStatus }) } /> , data?: { caId?: string; + caName?: string; dn?: string; status?: CaStatus; description?: string; @@ -49,9 +51,8 @@ type Props = { export const CaTable = ({ handlePopUpOpen }: Props) => { const navigate = useNavigate(); const { currentWorkspace } = useWorkspace(); - const { data, isPending } = useListWorkspaceCas({ - projectSlug: currentWorkspace?.slug ?? "" - }); + const { data, isPending } = useListCasByTypeAndProjectId(CaType.INTERNAL, currentWorkspace.id); + const cas = data as TInternalCertificateAuthority[]; return (
@@ -59,7 +60,7 @@ export const CaTable = ({ handlePopUpOpen }: Props) => { - + @@ -69,33 +70,37 @@ export const CaTable = ({ handlePopUpOpen }: Props) => { {isPending && } {!isPending && - data && - data.length > 0 && - data.map((ca) => { + cas && + cas.length > 0 && + cas.map((ca) => { return ( navigate({ - to: `/${ProjectType.CertificateManager}/$projectId/ca/$caId` as const, + to: `/${ProjectType.CertificateManager}/$projectId/ca/$caName` as const, params: { projectId: currentWorkspace.id, - caId: ca.id + caName: ca.name } }) } > - + - +
Friendly NameName Status Type Valid Until
{ca.friendlyName}{ca.name} {caStatusToNameMap[ca.status]} {caTypeToNameMap[ca.type]}{caTypeToNameMap[ca.configuration.type]}
-

{ca.notAfter ? format(new Date(ca.notAfter), "yyyy-MM-dd") : "-"}

+

+ {ca.configuration.notAfter + ? format(new Date(ca.configuration.notAfter), "yyyy-MM-dd") + : "-"} +

@@ -172,7 +177,7 @@ export const CaTable = ({ handlePopUpOpen }: Props) => { onClick={(e) => { e.stopPropagation(); handlePopUpOpen("caStatus", { - caId: ca.id, + caName: ca.name, status: ca.status === CaStatus.ACTIVE ? CaStatus.DISABLED @@ -199,8 +204,7 @@ export const CaTable = ({ handlePopUpOpen }: Props) => { onClick={(e) => { e.stopPropagation(); handlePopUpOpen("deleteCa", { - caId: ca.id, - dn: ca.dn + caName: ca.name }); }} disabled={!isAllowed} diff --git a/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/ExternalCaModal.tsx b/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/ExternalCaModal.tsx index d0ce4eada..b7d91a851 100644 --- a/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/ExternalCaModal.tsx +++ b/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/ExternalCaModal.tsx @@ -22,9 +22,9 @@ import { AcmeDnsProvider, CaStatus, CaType, - useCreateUnifiedCa, + useCreateCa, useGetCa, - useUpdateUnifiedCa + useUpdateCa } from "@app/hooks/api/ca"; import { UsePopUpState } from "@app/hooks/usePopUp"; import { slugSchema } from "@app/lib/schemas"; @@ -71,8 +71,8 @@ export const ExternalCaModal = ({ popUp, handlePopUpToggle }: Props) => { type: (popUp?.ca?.data as { type: CaType })?.type || "" }); - const { mutateAsync: createMutateAsync } = useCreateUnifiedCa(); - const { mutateAsync: updateMutateAsync } = useUpdateUnifiedCa(); + const { mutateAsync: createMutateAsync } = useCreateCa(); + const { mutateAsync: updateMutateAsync } = useUpdateCa(); const { control, diff --git a/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/ExternalCaSection.tsx b/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/ExternalCaSection.tsx index 597e860d7..ca4b7f0f8 100644 --- a/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/ExternalCaSection.tsx +++ b/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/ExternalCaSection.tsx @@ -6,7 +6,7 @@ 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 { CaStatus, CaType, useDeleteUnifiedCa, useUpdateUnifiedCa } from "@app/hooks/api"; +import { CaStatus, CaType, useDeleteCa, useUpdateCa } from "@app/hooks/api"; import { usePopUp } from "@app/hooks/usePopUp"; import { ExternalCaModal } from "./ExternalCaModal"; @@ -14,8 +14,8 @@ import { ExternalCaTable } from "./ExternalCaTable"; export const ExternalCaSection = () => { const { currentWorkspace } = useWorkspace(); - const { mutateAsync: deleteCa } = useDeleteUnifiedCa(); - const { mutateAsync: updateCa } = useUpdateUnifiedCa(); + const { mutateAsync: deleteCa } = useDeleteCa(); + const { mutateAsync: updateCa } = useUpdateCa(); const { popUp, handlePopUpOpen, handlePopUpClose, handlePopUpToggle } = usePopUp([ "ca", diff --git a/frontend/src/routeTree.gen.ts b/frontend/src/routeTree.gen.ts index f457cf209..bc19deb6c 100644 --- a/frontend/src/routeTree.gen.ts +++ b/frontend/src/routeTree.gen.ts @@ -1135,8 +1135,8 @@ const certManagerPkiSubscriberDetailsByIDPageRouteRoute = const certManagerCertAuthDetailsByIDPageRouteRoute = certManagerCertAuthDetailsByIDPageRouteImport.update({ - id: '/ca/$caId', - path: '/ca/$caId', + id: '/ca/$caName', + path: '/ca/$caName', getParentRoute: () => certManagerLayoutRoute, } as any) @@ -2503,10 +2503,10 @@ declare module '@tanstack/react-router' { preLoaderRoute: typeof secretManagerIntegrationsListPageRouteImport parentRoute: typeof AuthenticateInjectOrgDetailsOrgLayoutSecretManagerProjectIdSecretManagerLayoutIntegrationsImport } - '/_authenticate/_inject-org-details/_org-layout/cert-manager/$projectId/_cert-manager-layout/ca/$caId': { - id: '/_authenticate/_inject-org-details/_org-layout/cert-manager/$projectId/_cert-manager-layout/ca/$caId' - path: '/ca/$caId' - fullPath: '/cert-manager/$projectId/ca/$caId' + '/_authenticate/_inject-org-details/_org-layout/cert-manager/$projectId/_cert-manager-layout/ca/$caName': { + id: '/_authenticate/_inject-org-details/_org-layout/cert-manager/$projectId/_cert-manager-layout/ca/$caName' + path: '/ca/$caName' + fullPath: '/cert-manager/$projectId/ca/$caName' preLoaderRoute: typeof certManagerCertAuthDetailsByIDPageRouteImport parentRoute: typeof certManagerLayoutImport } @@ -4105,7 +4105,7 @@ export interface FileRoutesByFullPath { '/ssh/$projectId/access-management': typeof projectAccessControlPageRouteSshRoute '/cert-manager/$projectId/subscribers/': typeof certManagerPkiSubscribersPageRouteRoute '/secret-manager/$projectId/integrations/': typeof secretManagerIntegrationsListPageRouteRoute - '/cert-manager/$projectId/ca/$caId': typeof certManagerCertAuthDetailsByIDPageRouteRoute + '/cert-manager/$projectId/ca/$caName': typeof certManagerCertAuthDetailsByIDPageRouteRoute '/cert-manager/$projectId/subscribers/$subscriberName': typeof certManagerPkiSubscriberDetailsByIDPageRouteRoute '/organization/app-connections/$appConnection/oauth/callback': typeof organizationAppConnectionsOauthCallbackPageRouteRoute '/secret-manager/$projectId/integrations/$integrationId': typeof secretManagerIntegrationsDetailsByIDPageRouteRoute @@ -4290,7 +4290,7 @@ export interface FileRoutesByTo { '/ssh/$projectId/access-management': typeof projectAccessControlPageRouteSshRoute '/cert-manager/$projectId/subscribers': typeof certManagerPkiSubscribersPageRouteRoute '/secret-manager/$projectId/integrations': typeof secretManagerIntegrationsListPageRouteRoute - '/cert-manager/$projectId/ca/$caId': typeof certManagerCertAuthDetailsByIDPageRouteRoute + '/cert-manager/$projectId/ca/$caName': typeof certManagerCertAuthDetailsByIDPageRouteRoute '/cert-manager/$projectId/subscribers/$subscriberName': typeof certManagerPkiSubscriberDetailsByIDPageRouteRoute '/organization/app-connections/$appConnection/oauth/callback': typeof organizationAppConnectionsOauthCallbackPageRouteRoute '/secret-manager/$projectId/integrations/$integrationId': typeof secretManagerIntegrationsDetailsByIDPageRouteRoute @@ -4495,7 +4495,7 @@ export interface FileRoutesById { '/_authenticate/_inject-org-details/_org-layout/ssh/$projectId/_ssh-layout/access-management': typeof projectAccessControlPageRouteSshRoute '/_authenticate/_inject-org-details/_org-layout/cert-manager/$projectId/_cert-manager-layout/subscribers/': typeof certManagerPkiSubscribersPageRouteRoute '/_authenticate/_inject-org-details/_org-layout/secret-manager/$projectId/_secret-manager-layout/integrations/': typeof secretManagerIntegrationsListPageRouteRoute - '/_authenticate/_inject-org-details/_org-layout/cert-manager/$projectId/_cert-manager-layout/ca/$caId': typeof certManagerCertAuthDetailsByIDPageRouteRoute + '/_authenticate/_inject-org-details/_org-layout/cert-manager/$projectId/_cert-manager-layout/ca/$caName': typeof certManagerCertAuthDetailsByIDPageRouteRoute '/_authenticate/_inject-org-details/_org-layout/cert-manager/$projectId/_cert-manager-layout/subscribers/$subscriberName': typeof certManagerPkiSubscriberDetailsByIDPageRouteRoute '/_authenticate/_inject-org-details/_org-layout/organization/app-connections/$appConnection/oauth/callback': typeof organizationAppConnectionsOauthCallbackPageRouteRoute '/_authenticate/_inject-org-details/_org-layout/secret-manager/$projectId/_secret-manager-layout/integrations/$integrationId': typeof secretManagerIntegrationsDetailsByIDPageRouteRoute @@ -4692,7 +4692,7 @@ export interface FileRouteTypes { | '/ssh/$projectId/access-management' | '/cert-manager/$projectId/subscribers/' | '/secret-manager/$projectId/integrations/' - | '/cert-manager/$projectId/ca/$caId' + | '/cert-manager/$projectId/ca/$caName' | '/cert-manager/$projectId/subscribers/$subscriberName' | '/organization/app-connections/$appConnection/oauth/callback' | '/secret-manager/$projectId/integrations/$integrationId' @@ -4876,7 +4876,7 @@ export interface FileRouteTypes { | '/ssh/$projectId/access-management' | '/cert-manager/$projectId/subscribers' | '/secret-manager/$projectId/integrations' - | '/cert-manager/$projectId/ca/$caId' + | '/cert-manager/$projectId/ca/$caName' | '/cert-manager/$projectId/subscribers/$subscriberName' | '/organization/app-connections/$appConnection/oauth/callback' | '/secret-manager/$projectId/integrations/$integrationId' @@ -5079,7 +5079,7 @@ export interface FileRouteTypes { | '/_authenticate/_inject-org-details/_org-layout/ssh/$projectId/_ssh-layout/access-management' | '/_authenticate/_inject-org-details/_org-layout/cert-manager/$projectId/_cert-manager-layout/subscribers/' | '/_authenticate/_inject-org-details/_org-layout/secret-manager/$projectId/_secret-manager-layout/integrations/' - | '/_authenticate/_inject-org-details/_org-layout/cert-manager/$projectId/_cert-manager-layout/ca/$caId' + | '/_authenticate/_inject-org-details/_org-layout/cert-manager/$projectId/_cert-manager-layout/ca/$caName' | '/_authenticate/_inject-org-details/_org-layout/cert-manager/$projectId/_cert-manager-layout/subscribers/$subscriberName' | '/_authenticate/_inject-org-details/_org-layout/organization/app-connections/$appConnection/oauth/callback' | '/_authenticate/_inject-org-details/_org-layout/secret-manager/$projectId/_secret-manager-layout/integrations/$integrationId' @@ -5606,7 +5606,7 @@ export const routeTree = rootRoute "/_authenticate/_inject-org-details/_org-layout/cert-manager/$projectId/_cert-manager-layout/settings", "/_authenticate/_inject-org-details/_org-layout/cert-manager/$projectId/_cert-manager-layout/access-management", "/_authenticate/_inject-org-details/_org-layout/cert-manager/$projectId/_cert-manager-layout/subscribers", - "/_authenticate/_inject-org-details/_org-layout/cert-manager/$projectId/_cert-manager-layout/ca/$caId", + "/_authenticate/_inject-org-details/_org-layout/cert-manager/$projectId/_cert-manager-layout/ca/$caName", "/_authenticate/_inject-org-details/_org-layout/cert-manager/$projectId/_cert-manager-layout/identities/$identityId", "/_authenticate/_inject-org-details/_org-layout/cert-manager/$projectId/_cert-manager-layout/members/$membershipId", "/_authenticate/_inject-org-details/_org-layout/cert-manager/$projectId/_cert-manager-layout/pki-collections/$collectionId", @@ -5879,7 +5879,7 @@ export const routeTree = rootRoute "filePath": "secret-manager/IntegrationsListPage/route.tsx", "parent": "/_authenticate/_inject-org-details/_org-layout/secret-manager/$projectId/_secret-manager-layout/integrations" }, - "/_authenticate/_inject-org-details/_org-layout/cert-manager/$projectId/_cert-manager-layout/ca/$caId": { + "/_authenticate/_inject-org-details/_org-layout/cert-manager/$projectId/_cert-manager-layout/ca/$caName": { "filePath": "cert-manager/CertAuthDetailsByIDPage/route.tsx", "parent": "/_authenticate/_inject-org-details/_org-layout/cert-manager/$projectId/_cert-manager-layout" }, diff --git a/frontend/src/routes.ts b/frontend/src/routes.ts index d6553e663..7f2a250e7 100644 --- a/frontend/src/routes.ts +++ b/frontend/src/routes.ts @@ -296,7 +296,7 @@ const certManagerRoutes = route("/cert-manager/$projectId", [ route("/certificates", "cert-manager/CertificatesPage/route.tsx"), route("/certificate-authorities", "cert-manager/CertificateAuthoritiesPage/route.tsx"), route("/alerting", "cert-manager/AlertingPage/route.tsx"), - route("/ca/$caId", "cert-manager/CertAuthDetailsByIDPage/route.tsx"), + route("/ca/$caName", "cert-manager/CertAuthDetailsByIDPage/route.tsx"), route("/pki-collections/$collectionId", "cert-manager/PkiCollectionDetailsByIDPage/routes.tsx"), route("/settings", "cert-manager/SettingsPage/route.tsx"), route("/access-management", "project/AccessControlPage/route-cert-manager.tsx"),