Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.
TypeScript acmeagentsai-agentscertificate-managementdevsecopsenvironment-variableskubernetesopen-sourcepampkipostgresprivate-caprivileged-access-managementsecret-managementsecret-managersecretssecrets-managementsecuritysecurity-toolsvault
PKI inventory+dashboard
Carlos Monastyrski8e4ba29729d8
diff --git a/backend/src/@types/fastify.d.ts b/backend/src/@types/fastify.d.tsindex 2a7dc22076..55c756af20 100644--- a/backend/src/@types/fastify.d.ts+++ b/backend/src/@types/fastify.d.ts@@ -80,6 +80,7 @@ import { TCertificateAuthorityServiceFactory } from "@app/services/certificate-aimport { TInternalCertificateAuthorityServiceFactory } from "@app/services/certificate-authority/internal/internal-certificate-authority-service";import { TCertificateCleanupServiceFactory } from "@app/services/certificate-cleanup/certificate-cleanup-service";import { TCertificateEstV3ServiceFactory } from "@app/services/certificate-est-v3/certificate-est-v3-service";+import { TCertificateInventoryViewServiceFactory } from "@app/services/certificate-inventory-view/certificate-inventory-view-service";import { TCertificatePolicyServiceFactory } from "@app/services/certificate-policy/certificate-policy-service";import { TCertificateProfileServiceFactory } from "@app/services/certificate-profile/certificate-profile-service";import { TCertificateRequestServiceFactory } from "@app/services/certificate-request/certificate-request-service";@@ -313,6 +314,7 @@ declare module "fastify" {auditLogStream: TAuditLogStreamServiceFactory;certificate: TCertificateServiceFactory;certificateCleanup: TCertificateCleanupServiceFactory;+ certificateInventoryView: TCertificateInventoryViewServiceFactory;certificateV3: TCertificateV3ServiceFactory;certificateRequest: TCertificateRequestServiceFactory;certificateTemplate: TCertificateTemplateServiceFactory;diff --git a/backend/src/@types/knex.d.ts b/backend/src/@types/knex.d.tsindex 354b77ea1a..a6b6572b77 100644--- a/backend/src/@types/knex.d.ts+++ b/backend/src/@types/knex.d.ts@@ -110,6 +110,9 @@ import {TCertificateCleanupConfigs,TCertificateCleanupConfigsInsert,TCertificateCleanupConfigsUpdate,+ TCertificateInventoryViews,+ TCertificateInventoryViewsInsert,+ TCertificateInventoryViewsUpdate,TCertificates,TCertificateSecrets,TCertificateSecretsInsert,@@ -1747,6 +1750,11 @@ declare module "knex/types/tables" {TCertificateCleanupConfigsInsert,TCertificateCleanupConfigsUpdate>;+ [TableName.CertificateInventoryView]: KnexOriginal.CompositeTableType<+ TCertificateInventoryViews,+ TCertificateInventoryViewsInsert,+ TCertificateInventoryViewsUpdate+ >;[TableName.SecretValidationRule]: KnexOriginal.CompositeTableType<TSecretValidationRules,TSecretValidationRulesInsert,diff --git a/backend/src/db/migrations/20260401124650_certificate-inventory-views.ts b/backend/src/db/migrations/20260401124650_certificate-inventory-views.tsnew file mode 100644index 0000000000..e62d5109ab--- /dev/null+++ b/backend/src/db/migrations/20260401124650_certificate-inventory-views.ts@@ -0,0 +1,36 @@+import { Knex } from "knex";++import { TableName } from "../schemas";+import { createOnUpdateTrigger, dropOnUpdateTrigger } from "../utils";++export async function up(knex: Knex): Promise<void> {+ if (!(await knex.schema.hasTable(TableName.CertificateInventoryView))) {+ await knex.schema.createTable(TableName.CertificateInventoryView, (t) => {+ t.uuid("id", { primaryKey: true }).defaultTo(knex.fn.uuid());++ t.string("projectId").notNullable();+ t.foreign("projectId").references("id").inTable(TableName.Project).onDelete("CASCADE");++ t.string("name", 255).notNullable();+ t.jsonb("filters").notNullable().defaultTo("{}");+ t.jsonb("columns").nullable();++ t.uuid("createdByUserId").nullable();+ t.foreign("createdByUserId").references("id").inTable(TableName.Users).onDelete("SET NULL");++ t.timestamps(true, true, true);++ t.index(["projectId", "createdByUserId"]);+ t.unique(["projectId", "name", "createdByUserId"]);+ });++ await createOnUpdateTrigger(knex, TableName.CertificateInventoryView);+ }+}++export async function down(knex: Knex): Promise<void> {+ if (await knex.schema.hasTable(TableName.CertificateInventoryView)) {+ await dropOnUpdateTrigger(knex, TableName.CertificateInventoryView);+ await knex.schema.dropTable(TableName.CertificateInventoryView);+ }+}diff --git a/backend/src/db/schemas/certificate-inventory-views.ts b/backend/src/db/schemas/certificate-inventory-views.tsnew file mode 100644index 0000000000..f63e6b7f96--- /dev/null+++ b/backend/src/db/schemas/certificate-inventory-views.ts@@ -0,0 +1,25 @@+// Code generated by automation script, DO NOT EDIT.+// Automated by pulling database and generating zod schema+// To update. Just run npm run generate:schema+// Written by akhilmhdh.++import { z } from "zod";++import { TImmutableDBKeys } from "./models";++export const CertificateInventoryViewsSchema = z.object({+ id: z.string().uuid(),+ projectId: z.string(),+ name: z.string(),+ filters: z.unknown().default({}),+ columns: z.unknown().nullable().optional(),+ createdByUserId: z.string().uuid().nullable().optional(),+ createdAt: z.date(),+ updatedAt: z.date()+});++export type TCertificateInventoryViews = z.infer<typeof CertificateInventoryViewsSchema>;+export type TCertificateInventoryViewsInsert = Omit<z.input<typeof CertificateInventoryViewsSchema>, TImmutableDBKeys>;+export type TCertificateInventoryViewsUpdate = Partial<+ Omit<z.input<typeof CertificateInventoryViewsSchema>, TImmutableDBKeys>+>;diff --git a/backend/src/db/schemas/index.ts b/backend/src/db/schemas/index.tsindex 3dbfc57412..0aec1aa73e 100644--- a/backend/src/db/schemas/index.ts+++ b/backend/src/db/schemas/index.ts@@ -34,6 +34,7 @@ export * from "./certificate-authority-crl";export * from "./certificate-authority-secret";export * from "./certificate-bodies";export * from "./certificate-cleanup-configs";+export * from "./certificate-inventory-views";export * from "./certificate-requests";export * from "./certificate-secrets";export * from "./certificate-syncs";diff --git a/backend/src/db/schemas/models.ts b/backend/src/db/schemas/models.tsindex 134cde6731..c90f1888fd 100644--- a/backend/src/db/schemas/models.ts+++ b/backend/src/db/schemas/models.ts@@ -255,6 +255,9 @@ export enum TableName {// PKI CleanupCertificateCleanupConfig = "certificate_cleanup_configs",+ // PKI Inventory Views+ CertificateInventoryView = "certificate_inventory_views",+// AIAiMcpServer = "ai_mcp_servers",AiMcpServerTool = "ai_mcp_server_tools",diff --git a/backend/src/ee/services/audit-log/audit-log-types.ts b/backend/src/ee/services/audit-log/audit-log-types.tsindex 817b71b417..caf197e124 100644--- a/backend/src/ee/services/audit-log/audit-log-types.ts+++ b/backend/src/ee/services/audit-log/audit-log-types.ts@@ -379,6 +379,9 @@ export enum EventType {GET_PKI_ALERT = "get-pki-alert",UPDATE_PKI_ALERT = "update-pki-alert",DELETE_PKI_ALERT = "delete-pki-alert",+ CREATE_CERTIFICATE_INVENTORY_VIEW = "create-certificate-inventory-view",+ UPDATE_CERTIFICATE_INVENTORY_VIEW = "update-certificate-inventory-view",+ DELETE_CERTIFICATE_INVENTORY_VIEW = "delete-certificate-inventory-view",CREATE_PKI_COLLECTION = "create-pki-collection",GET_PKI_COLLECTION = "get-pki-collection",UPDATE_PKI_COLLECTION = "update-pki-collection",@@ -2990,6 +2993,29 @@ interface DeletePkiCollectionItem {};}+interface CreateCertificateInventoryView {+ type: EventType.CREATE_CERTIFICATE_INVENTORY_VIEW;+ metadata: {+ viewId: string;+ name: string;+ };+}++interface UpdateCertificateInventoryView {+ type: EventType.UPDATE_CERTIFICATE_INVENTORY_VIEW;+ metadata: {+ viewId: string;+ name?: string;+ };+}++interface DeleteCertificateInventoryView {+ type: EventType.DELETE_CERTIFICATE_INVENTORY_VIEW;+ metadata: {+ viewId: string;+ };+}+interface CreatePkiSubscriber {type: EventType.CREATE_PKI_SUBSCRIBER;metadata: {@@ -5947,6 +5973,9 @@ export type Event =| GetPkiCollectionItems| AddPkiCollectionItem| DeletePkiCollectionItem+ | CreateCertificateInventoryView+ | UpdateCertificateInventoryView+ | DeleteCertificateInventoryView| CreatePkiSubscriber| UpdatePkiSubscriber| DeletePkiSubscriberdiff --git a/backend/src/keystore/keystore.ts b/backend/src/keystore/keystore.tsindex f6aba5e0e5..3e71338c81 100644--- a/backend/src/keystore/keystore.ts+++ b/backend/src/keystore/keystore.ts@@ -103,7 +103,10 @@ export const KeyStorePrefixes = {TelemetryIdentifyIdentity: (dedupKey: string) => `telemetry-identify-identity:${dedupKey}` as const,TelemetryGroupIdentify: (orgId: string) => `telemetry-group-identify:${orgId}` as const,- SecretEtag: (projectId: string) => `secret-etag:${projectId}` as const+ SecretEtag: (projectId: string) => `secret-etag:${projectId}` as const,++ CertDashboardStats: (projectId: string) => `cert-dashboard-stats:${projectId}` as const,+ CertActivityTrend: (projectId: string, range: string) => `cert-activity-trend:${projectId}:${range}` as const};export const KeyStoreTtls = {diff --git a/backend/src/lib/api-docs/constants.ts b/backend/src/lib/api-docs/constants.tsindex cc11399d7a..ba5cbe5d2e 100644--- a/backend/src/lib/api-docs/constants.ts+++ b/backend/src/lib/api-docs/constants.ts@@ -1025,7 +1025,20 @@ export const PROJECTS = {metadata:"Filter by metadata key-value pairs. Each entry should have a key (required) and optionally a value to match against.",extendedKeyUsage:- "Filter by extended key usage. Only certificates containing this EKU will be returned (e.g. 'codeSigning', 'serverAuth')."+ "Filter by extended key usage. Only certificates containing this EKU will be returned (e.g. 'codeSigning', 'serverAuth').",+ keyAlgorithm: "Filter by key algorithm (e.g. 'RSA_2048', 'EC_prime256v1').",+ signatureAlgorithm: "Filter by signature algorithm (e.g. 'RSA-SHA256', 'ECDSA-SHA256').",+ keySize: "Filter by key size in bits (e.g. 2048, 4096, 256).",+ keySizes: "Filter by multiple key sizes in bits (e.g. [2048, 4096]).",+ caIds: "Filter by certificate authority IDs.",+ enrollmentTypes: "Filter by enrollment types (e.g. 'api', 'est', 'acme', 'scep').",+ source: "Filter by certificate source ('issued', 'discovered', 'imported').",+ notAfterFrom: "Filter certificates expiring on or after this date.",+ notAfterTo: "Filter certificates expiring on or before this date.",+ notBeforeFrom: "Filter certificates issued on or after this date.",+ notBeforeTo: "Filter certificates issued on or before this date.",+ sortBy: "Column to sort by (e.g. 'notAfter', 'notBefore', 'commonName').",+ sortOrder: "Sort direction: 'asc' or 'desc'."},LIST_PKI_SUBSCRIBERS: {projectId: "The ID of the project to list PKI subscribers for."diff --git a/backend/src/server/routes/index.ts b/backend/src/server/routes/index.tsindex 4ffd91afe8..37e825e920 100644--- a/backend/src/server/routes/index.ts+++ b/backend/src/server/routes/index.ts@@ -251,6 +251,8 @@ import { certificateCleanupConfigDALFactory } from "@app/services/certificate-climport { certificateCleanupQueueFactory } from "@app/services/certificate-cleanup/certificate-cleanup-queue";import { certificateCleanupServiceFactory } from "@app/services/certificate-cleanup/certificate-cleanup-service";import { certificateEstV3ServiceFactory } from "@app/services/certificate-est-v3/certificate-est-v3-service";+import { certificateInventoryViewDALFactory } from "@app/services/certificate-inventory-view/certificate-inventory-view-dal";+import { certificateInventoryViewServiceFactory } from "@app/services/certificate-inventory-view/certificate-inventory-view-service";import { certificatePolicyDALFactory } from "@app/services/certificate-policy/certificate-policy-dal";import { certificatePolicyServiceFactory } from "@app/services/certificate-policy/certificate-policy-service";import { certificateProfileDALFactory } from "@app/services/certificate-profile/certificate-profile-dal";@@ -1241,6 +1243,7 @@ export const registerRoutes = async (const acmeOrderAuthDAL = pkiAcmeOrderAuthDALFactory(db);const acmeChallengeDAL = pkiAcmeChallengeDALFactory(db);const certificateCleanupConfigDAL = certificateCleanupConfigDALFactory(db);+ const certificateInventoryViewDAL = certificateInventoryViewDALFactory(db);const certificateDAL = certificateDALFactory(db);const certificateBodyDAL = certificateBodyDALFactory(db);const certificateSecretDAL = certificateSecretDALFactory(db);@@ -2072,6 +2075,11 @@ export const registerRoutes = async (permissionService});+ const certificateInventoryViewService = certificateInventoryViewServiceFactory({+ certificateInventoryViewDAL,+ permissionService+ });+const certificateCleanupQueue = certificateCleanupQueueFactory({db,queueService,@@ -3074,6 +3082,7 @@ export const registerRoutes = async (auditLogStream: auditLogStreamService,certificate: certificateService,certificateCleanup: certificateCleanupService,+ certificateInventoryView: certificateInventoryViewService,certificateV3: certificateV3Service,certificateRequest: certificateRequestService,certificateEstV3: certificateEstV3Service,diff --git a/backend/src/server/routes/v1/certificate-inventory-view-router.ts b/backend/src/server/routes/v1/certificate-inventory-view-router.tsnew file mode 100644index 0000000000..36b487ad0c--- /dev/null+++ b/backend/src/server/routes/v1/certificate-inventory-view-router.ts@@ -0,0 +1,228 @@+import { z } from "zod";++import { CertificateInventoryViewsSchema } from "@app/db/schemas";+import { EventType } from "@app/ee/services/audit-log/audit-log-types";+import { ApiDocsTags } from "@app/lib/api-docs";+import { readLimit, writeLimit } from "@app/server/config/rateLimiter";+import { verifyAuth } from "@app/server/plugins/auth/verify-auth";+import { AuthMode } from "@app/services/auth/auth-type";++const InventoryViewFiltersSchema = z+ .object({+ status: z.string().max(100).optional(),+ notAfterTo: z.coerce.date().optional(),+ notAfterFrom: z.coerce.date().optional(),+ notBeforeTo: z.coerce.date().optional(),+ notBeforeFrom: z.coerce.date().optional(),+ enrollmentTypes: z.array(z.string().max(64)).max(10).optional(),+ keyAlgorithm: z.string().max(64).optional(),+ keySizes: z.array(z.number().int().positive()).max(10).optional(),+ caIds: z.array(z.string().uuid()).max(50).optional(),+ profileIds: z.array(z.string().uuid()).max(50).optional(),+ source: z.string().max(64).optional()+ })+ .strict();++const ColumnsSchema = z.array(z.string().max(64)).max(20);++export const registerCertificateInventoryViewRouter = async (server: FastifyZodProvider) => {+ server.route({+ method: "GET",+ url: "/:projectId/certificate-inventory-views",+ config: {+ rateLimit: readLimit+ },+ schema: {+ hide: false,+ operationId: "listCertificateInventoryViews",+ tags: [ApiDocsTags.PkiCertificates],+ description: "List system and custom certificate inventory views for a project.",+ params: z.object({+ projectId: z.string().trim()+ }),+ response: {+ 200: z.object({+ systemViews: z.array(+ z.object({+ id: z.string(),+ name: z.string(),+ filters: z.object({+ status: z.array(z.string()).optional(),+ notAfterTo: z.string().optional()+ }),+ columns: z.null(),+ isSystem: z.literal(true),+ createdByUserId: z.null()+ })+ ),+ customViews: z.array(+ CertificateInventoryViewsSchema.extend({+ isSystem: z.literal(false)+ })+ )+ })+ }+ },+ onRequest: verifyAuth([AuthMode.JWT, AuthMode.IDENTITY_ACCESS_TOKEN]),+ handler: async (req) => {+ return server.services.certificateInventoryView.listViews({+ projectId: req.params.projectId,+ actorId: req.permission.id,+ actorOrgId: req.permission.orgId,+ actorAuthMethod: req.permission.authMethod,+ actor: req.permission.type+ });+ }+ });++ server.route({+ method: "POST",+ url: "/:projectId/certificate-inventory-views",+ config: {+ rateLimit: writeLimit+ },+ schema: {+ hide: false,+ operationId: "createCertificateInventoryView",+ tags: [ApiDocsTags.PkiCertificates],+ description: "Create a custom certificate inventory view.",+ params: z.object({+ projectId: z.string().trim()+ }),+ body: z.object({+ name: z.string().trim().min(1).max(255),+ filters: InventoryViewFiltersSchema.default({}),+ columns: ColumnsSchema.optional()+ }),+ response: {+ 200: z.object({+ view: CertificateInventoryViewsSchema+ })+ }+ },+ onRequest: verifyAuth([AuthMode.JWT]),+ handler: async (req) => {+ const view = await server.services.certificateInventoryView.createView({+ projectId: req.params.projectId,+ name: req.body.name,+ filters: req.body.filters,+ columns: req.body.columns,+ actorId: req.permission.id,+ actorOrgId: req.permission.orgId,+ actorAuthMethod: req.permission.authMethod,+ actor: req.permission.type+ });+ await server.services.auditLog.createAuditLog({+ ...req.auditLogInfo,+ projectId: req.params.projectId,+ event: {+ type: EventType.CREATE_CERTIFICATE_INVENTORY_VIEW,+ metadata: {+ viewId: view.id,+ name: view.name+ }+ }+ });+ return { view };+ }+ });++ server.route({+ method: "PATCH",+ url: "/:projectId/certificate-inventory-views/:viewId",+ config: {+ rateLimit: writeLimit+ },+ schema: {+ hide: false,+ operationId: "updateCertificateInventoryView",+ tags: [ApiDocsTags.PkiCertificates],+ description: "Update a custom certificate inventory view.",+ params: z.object({+ projectId: z.string().trim(),+ viewId: z.string().uuid()+ }),+ body: z.object({+ name: z.string().trim().min(1).max(255).optional(),+ filters: InventoryViewFiltersSchema.optional(),+ columns: ColumnsSchema.optional()+ }),+ response: {+ 200: z.object({+ view: CertificateInventoryViewsSchema+ })+ }+ },+ onRequest: verifyAuth([AuthMode.JWT]),+ handler: async (req) => {+ const view = await server.services.certificateInventoryView.updateView({+ viewId: req.params.viewId,+ projectId: req.params.projectId,+ name: req.body.name,+ filters: req.body.filters,+ columns: req.body.columns,+ actorId: req.permission.id,+ actorOrgId: req.permission.orgId,+ actorAuthMethod: req.permission.authMethod,+ actor: req.permission.type+ });+ await server.services.auditLog.createAuditLog({+ ...req.auditLogInfo,+ projectId: req.params.projectId,+ event: {+ type: EventType.UPDATE_CERTIFICATE_INVENTORY_VIEW,+ metadata: {+ viewId: view.id,+ name: view.name+ }+ }+ });+ return { view };+ }+ });++ server.route({+ method: "DELETE",+ url: "/:projectId/certificate-inventory-views/:viewId",+ config: {+ rateLimit: writeLimit+ },+ schema: {+ hide: false,+ operationId: "deleteCertificateInventoryView",+ tags: [ApiDocsTags.PkiCertificates],+ description: "Delete a custom certificate inventory view.",+ params: z.object({+ projectId: z.string().trim(),+ viewId: z.string().uuid()+ }),+ response: {+ 200: z.object({+ view: CertificateInventoryViewsSchema+ })+ }+ },+ onRequest: verifyAuth([AuthMode.JWT]),+ handler: async (req) => {+ const view = await server.services.certificateInventoryView.deleteView({+ viewId: req.params.viewId,+ projectId: req.params.projectId,+ actorId: req.permission.id,+ actorOrgId: req.permission.orgId,+ actorAuthMethod: req.permission.authMethod,+ actor: req.permission.type+ });+ await server.services.auditLog.createAuditLog({+ ...req.auditLogInfo,+ projectId: req.params.projectId,+ event: {+ type: EventType.DELETE_CERTIFICATE_INVENTORY_VIEW,+ metadata: {+ viewId: req.params.viewId+ }+ }+ });+ return { view };+ }+ });+};diff --git a/backend/src/server/routes/v1/index.ts b/backend/src/server/routes/v1/index.tsindex c00256cc40..ac2328d170 100644--- a/backend/src/server/routes/v1/index.ts+++ b/backend/src/server/routes/v1/index.ts@@ -15,6 +15,7 @@ import { registerCaRouter } from "./certificate-authority-router";import { CERTIFICATE_AUTHORITY_REGISTER_ROUTER_MAP } from "./certificate-authority-routers";import { registerGeneralCertificateAuthorityRouter } from "./certificate-authority-routers/general-certificate-authority-router";import { registerCertificateCleanupRouter } from "./certificate-cleanup-router";+import { registerCertificateInventoryViewRouter } from "./certificate-inventory-view-router";import { registerCertificatePolicyRouter } from "./certificate-policy-router";import { registerCertificateProfilesRouter } from "./certificate-profiles-router";import { registerCertificateRouter } from "./certificate-router";@@ -152,6 +153,7 @@ export const registerV1Routes = async (server: FastifyZodProvider) => {await server.register(async (projectRouter) => {await projectRouter.register(registerProjectRouter);+ await projectRouter.register(registerCertificateInventoryViewRouter);await projectRouter.register(registerProjectMembershipRouter);await projectRouter.register(registerProjectIdentityRouter);await projectRouter.register(registerProjectEnvRouter);diff --git a/backend/src/server/routes/v1/project-router.ts b/backend/src/server/routes/v1/project-router.tsindex 9d78a0ceec..6cf804fb9d 100644--- a/backend/src/server/routes/v1/project-router.ts+++ b/backend/src/server/routes/v1/project-router.ts@@ -1308,18 +1308,41 @@ export const registerProjectRouter = async (server: FastifyZodProvider) => {).optional().describe(PROJECTS.SEARCH_CERTIFICATES.metadata),- extendedKeyUsage: z.string().trim().optional().describe(PROJECTS.SEARCH_CERTIFICATES.extendedKeyUsage)+ extendedKeyUsage: z.string().trim().optional().describe(PROJECTS.SEARCH_CERTIFICATES.extendedKeyUsage),+ keyAlgorithm: z.string().trim().optional().describe(PROJECTS.SEARCH_CERTIFICATES.keyAlgorithm),+ signatureAlgorithm: z.string().trim().optional().describe(PROJECTS.SEARCH_CERTIFICATES.signatureAlgorithm),+ keySize: z.number().optional().describe(PROJECTS.SEARCH_CERTIFICATES.keySize),+ keySizes: z.array(z.number()).optional().describe(PROJECTS.SEARCH_CERTIFICATES.keySizes),+ caIds: z.array(z.string().uuid()).optional().describe(PROJECTS.SEARCH_CERTIFICATES.caIds),+ enrollmentTypes: z.array(z.string().trim()).optional().describe(PROJECTS.SEARCH_CERTIFICATES.enrollmentTypes),+ source: z.string().trim().optional().describe(PROJECTS.SEARCH_CERTIFICATES.source),+ notAfterFrom: z.coerce.date().optional().describe(PROJECTS.SEARCH_CERTIFICATES.notAfterFrom),+ notAfterTo: z.coerce.date().optional().describe(PROJECTS.SEARCH_CERTIFICATES.notAfterTo),+ notBeforeFrom: z.coerce.date().optional().describe(PROJECTS.SEARCH_CERTIFICATES.notBeforeFrom),+ notBeforeTo: z.coerce.date().optional().describe(PROJECTS.SEARCH_CERTIFICATES.notBeforeTo),+ sortBy: z+ .enum(["notAfter", "notBefore", "createdAt", "commonName", "keyAlgorithm", "status"])+ .optional()+ .describe(PROJECTS.SEARCH_CERTIFICATES.sortBy),+ sortOrder: z.enum(["asc", "desc"]).optional().describe(PROJECTS.SEARCH_CERTIFICATES.sortOrder)}),response: {200: z.object({- certificates: z.array(CertificatesSchema.extend({ hasPrivateKey: z.boolean() })),+ certificates: z.array(+ CertificatesSchema.extend({+ hasPrivateKey: z.boolean(),+ caName: z.string().nullable().optional(),+ profileName: z.string().nullable().optional(),+ enrollmentType: z.string().nullable().optional()+ })+ ),totalCount: z.number()})}},onRequest: verifyAuth([AuthMode.JWT, AuthMode.IDENTITY_ACCESS_TOKEN]),handler: async (req) => {- const { metadata, ...filters } = req.body;+ const { metadata, sortBy, sortOrder, ...filters } = req.body;const { certificates, totalCount } = await server.services.project.listProjectCertificates({filter: {projectId: req.params.projectId,@@ -1330,12 +1353,111 @@ export const registerProjectRouter = async (server: FastifyZodProvider) => {actorAuthMethod: req.permission.authMethod,actor: req.permission.type,...filters,- metadataFilter: metadata+ metadataFilter: metadata,+ sortBy,+ sortOrder});return { certificates, totalCount };}});+ server.route({+ method: "GET",+ url: "/:projectId/certificates/dashboard-stats",+ config: {+ rateLimit: readLimit+ },+ schema: {+ hide: false,+ operationId: "getCertificateDashboardStats",+ tags: [ApiDocsTags.PkiCertificates],+ description: "Get aggregated dashboard statistics for certificates in a project.",+ params: z.object({+ projectId: z.string().trim()+ }),+ response: {+ 200: z.object({+ totals: z.object({+ total: z.number(),+ active: z.number(),+ expiringSoon: z.number(),+ expired: z.number(),+ revoked: z.number()+ }),+ expiringSoonNoAutoRenewal: z.number(),+ expiredNotRenewed: z.number(),+ distributions: z.object({+ byEnrollmentMethod: z.array(z.object({ label: z.string(), count: z.number() })),+ byAlgorithm: z.array(z.object({ label: z.string(), count: z.number() })),+ byCA: z.array(z.object({ id: z.string(), label: z.string(), count: z.number() })),+ byStatus: z.array(z.object({ label: z.string(), count: z.number() }))+ }),+ expirationBuckets: z.array(z.object({ bucket: z.string(), count: z.number() }))+ })+ }+ },+ onRequest: verifyAuth([AuthMode.JWT, AuthMode.IDENTITY_ACCESS_TOKEN]),+ handler: async (req) => {+ return server.services.project.getDashboardStats({+ filter: {+ projectId: req.params.projectId,+ type: ProjectFilterType.ID+ },+ actorId: req.permission.id,+ actorOrgId: req.permission.orgId,+ actorAuthMethod: req.permission.authMethod,+ actor: req.permission.type+ });+ }+ });++ server.route({+ method: "GET",+ url: "/:projectId/certificates/activity-trend",+ config: {+ rateLimit: readLimit+ },+ schema: {+ hide: false,+ operationId: "getCertificateActivityTrend",+ tags: [ApiDocsTags.PkiCertificates],+ description: "Get certificate lifecycle activity trend over time.",+ params: z.object({+ projectId: z.string().trim()+ }),+ querystring: z.object({+ range: z.enum(["7d", "30d", "6m"]).optional().default("30d")+ }),+ response: {+ 200: z.object({+ periods: z.array(+ z.object({+ period: z.string(),+ issued: z.number(),+ expired: z.number(),+ revoked: z.number(),+ renewed: z.number()+ })+ )+ })+ }+ },+ onRequest: verifyAuth([AuthMode.JWT, AuthMode.IDENTITY_ACCESS_TOKEN]),+ handler: async (req) => {+ return server.services.project.getActivityTrend({+ filter: {+ projectId: req.params.projectId,+ type: ProjectFilterType.ID+ },+ range: req.query.range,+ actorId: req.permission.id,+ actorOrgId: req.permission.orgId,+ actorAuthMethod: req.permission.authMethod,+ actor: req.permission.type+ });+ }+ });+server.route({method: "GET",url: "/:projectId/pki-alerts",diff --git a/backend/src/services/certificate-inventory-view/certificate-inventory-view-dal.ts b/backend/src/services/certificate-inventory-view/certificate-inventory-view-dal.tsnew file mode 100644index 0000000000..896f51c9e2--- /dev/null+++ b/backend/src/services/certificate-inventory-view/certificate-inventory-view-dal.ts@@ -0,0 +1,30 @@+import { TDbClient } from "@app/db";+import { TableName, TCertificateInventoryViews } from "@app/db/schemas";+import { DatabaseError } from "@app/lib/errors";+import { ormify } from "@app/lib/knex";++export type TCertificateInventoryViewDALFactory = ReturnType<typeof certificateInventoryViewDALFactory>;++export const certificateInventoryViewDALFactory = (db: TDbClient) => {+ const orm = ormify(db, TableName.CertificateInventoryView);++ const findByProjectId = async (projectId: string, userId?: string): Promise<TCertificateInventoryViews[]> => {+ try {+ const query = db+ .replicaNode()(TableName.CertificateInventoryView)+ .where({ projectId })+ .andWhere((qb) => {+ if (userId) {+ void qb.where({ createdByUserId: userId });+ }+ })+ .orderBy("name", "asc");++ return (await query) as TCertificateInventoryViews[];+ } catch (error) {+ throw new DatabaseError({ error, name: "Find certificate inventory views by project" });+ }+ };++ return { ...orm, findByProjectId };+};diff --git a/backend/src/services/certificate-inventory-view/certificate-inventory-view-service.ts b/backend/src/services/certificate-inventory-view/certificate-inventory-view-service.tsnew file mode 100644index 0000000000..e9554751af--- /dev/null+++ b/backend/src/services/certificate-inventory-view/certificate-inventory-view-service.ts@@ -0,0 +1,206 @@+import { ForbiddenError } from "@casl/ability";++import { ActionProjectType } from "@app/db/schemas";+import { BadRequestError, NotFoundError } from "@app/lib/errors";+import { TProjectPermission } from "@app/lib/types";++import { TPermissionServiceFactory } from "../../ee/services/permission/permission-service-types";+import {+ ProjectPermissionCertificateActions,+ ProjectPermissionSub+} from "../../ee/services/permission/project-permission";+import { TCertificateInventoryViewDALFactory } from "./certificate-inventory-view-dal";+import {+ TCreateInventoryViewDTO,+ TDeleteInventoryViewDTO,+ TListInventoryViewsDTO,+ TUpdateInventoryViewDTO+} from "./certificate-inventory-view-types";++type TSystemViewFilters = {+ status?: string[];+ notAfterTo?: string;+};++type TSystemView = {+ id: string;+ name: string;+ filters: TSystemViewFilters;+ columns: null;+ isSystem: true;+ createdByUserId: null;+};++const SYSTEM_VIEWS: TSystemView[] = [+ { id: "system-all", name: "All Certificates", filters: {}, columns: null, isSystem: true, createdByUserId: null },+ {+ id: "system-expiring-7d",+ name: "Expiring in 7 days",+ filters: { status: ["active"], notAfterTo: "+7d" },+ columns: null,+ isSystem: true,+ createdByUserId: null+ },+ {+ id: "system-expiring-30d",+ name: "Expiring in 30 days",+ filters: { status: ["active"], notAfterTo: "+30d" },+ columns: null,+ isSystem: true,+ createdByUserId: null+ },+ {+ id: "system-expired",+ name: "Expired",+ filters: { status: ["expired"] },+ columns: null,+ isSystem: true,+ createdByUserId: null+ },+ {+ id: "system-revoked",+ name: "Revoked",+ filters: { status: ["revoked"] },+ columns: null,+ isSystem: true,+ createdByUserId: null+ }+];++type TCertificateInventoryViewServiceFactoryDep = {+ certificateInventoryViewDAL: TCertificateInventoryViewDALFactory;+ permissionService: Pick<TPermissionServiceFactory, "getProjectPermission">;+};++export type TCertificateInventoryViewServiceFactory = ReturnType<typeof certificateInventoryViewServiceFactory>;++export const certificateInventoryViewServiceFactory = ({+ certificateInventoryViewDAL,+ permissionService+}: TCertificateInventoryViewServiceFactoryDep) => {+ const checkProjectPermission = async (+ dto: Pick<TProjectPermission, "actor" | "actorId" | "actorOrgId" | "actorAuthMethod"> & { projectId: string },+ action: ProjectPermissionCertificateActions = ProjectPermissionCertificateActions.Read+ ) => {+ const { permission } = await permissionService.getProjectPermission({+ actor: dto.actor,+ actorId: dto.actorId,+ projectId: dto.projectId,+ actorAuthMethod: dto.actorAuthMethod,+ actorOrgId: dto.actorOrgId,+ actionProjectType: ActionProjectType.CertificateManager+ });++ ForbiddenError.from(permission).throwUnlessCan(action, ProjectPermissionSub.Certificates);++ return permission;+ };++ const listViews = async ({ projectId, actor, actorId, actorOrgId, actorAuthMethod }: TListInventoryViewsDTO) => {+ await checkProjectPermission({ projectId, actor, actorId, actorOrgId, actorAuthMethod });++ const customViews = await certificateInventoryViewDAL.findByProjectId(projectId, actorId);++ return {+ systemViews: SYSTEM_VIEWS,+ customViews: customViews.map((v) => ({+ ...v,+ isSystem: false as const+ }))+ };+ };++ const createView = async ({+ projectId,+ name,+ filters,+ columns,+ actor,+ actorId,+ actorOrgId,+ actorAuthMethod+ }: TCreateInventoryViewDTO) => {+ await checkProjectPermission(+ { projectId, actor, actorId, actorOrgId, actorAuthMethod },+ ProjectPermissionCertificateActions.Edit+ );++ const view = await certificateInventoryViewDAL.create({+ projectId,+ name,+ filters: JSON.stringify(filters),+ columns: columns ? JSON.stringify(columns) : undefined,+ createdByUserId: actorId+ });++ return view;+ };++ const updateView = async ({+ viewId,+ projectId,+ name,+ filters,+ columns,+ actor,+ actorId,+ actorOrgId,+ actorAuthMethod+ }: TUpdateInventoryViewDTO) => {+ await checkProjectPermission(+ { projectId, actor, actorId, actorOrgId, actorAuthMethod },+ ProjectPermissionCertificateActions.Edit+ );++ const existing = await certificateInventoryViewDAL.findById(viewId);+ if (!existing || existing.projectId !== projectId) {+ throw new NotFoundError({ message: "View not found" });+ }++ if (existing.createdByUserId !== actorId) {+ throw new BadRequestError({ message: "You can only update your own views" });+ }++ const view = await certificateInventoryViewDAL.updateById(viewId, {+ ...(name !== undefined && { name }),+ ...(filters !== undefined && { filters: JSON.stringify(filters) }),+ ...(columns !== undefined && { columns: columns ? JSON.stringify(columns) : null })+ });++ return view;+ };++ const deleteView = async ({+ viewId,+ projectId,+ actor,+ actorId,+ actorOrgId,+ actorAuthMethod+ }: TDeleteInventoryViewDTO) => {+ await checkProjectPermission(+ { projectId, actor, actorId, actorOrgId, actorAuthMethod },+ ProjectPermissionCertificateActions.Edit+ );++ const existing = await certificateInventoryViewDAL.findById(viewId);+ if (!existing || existing.projectId !== projectId) {+ throw new NotFoundError({ message: "View not found" });+ }++ if (existing.createdByUserId !== actorId) {+ throw new BadRequestError({ message: "You can only delete your own views" });+ }++ await certificateInventoryViewDAL.deleteById(viewId);++ return existing;+ };++ return {+ listViews,+ createView,+ updateView,+ deleteView+ };+};diff --git a/backend/src/services/certificate-inventory-view/certificate-inventory-view-types.ts b/backend/src/services/certificate-inventory-view/certificate-inventory-view-types.tsnew file mode 100644index 0000000000..59d940e9c0--- /dev/null+++ b/backend/src/services/certificate-inventory-view/certificate-inventory-view-types.ts@@ -0,0 +1,39 @@+import { TProjectPermission } from "@app/lib/types";++export type TInventoryViewFilters = {+ status?: string;+ notAfterTo?: Date;+ notAfterFrom?: Date;+ notBeforeTo?: Date;+ notBeforeFrom?: Date;+ enrollmentTypes?: string[];+ keyAlgorithm?: string;+ keySizes?: number[];+ caIds?: string[];+ profileIds?: string[];+ source?: string;+};++export type TListInventoryViewsDTO = {+ projectId: string;+} & Omit<TProjectPermission, "projectId">;++export type TCreateInventoryViewDTO = {+ projectId: string;+ name: string;+ filters: TInventoryViewFilters;+ columns?: string[];+} & Omit<TProjectPermission, "projectId">;++export type TUpdateInventoryViewDTO = {+ viewId: string;+ projectId: string;+ name?: string;+ filters?: TInventoryViewFilters;+ columns?: string[];+} & Omit<TProjectPermission, "projectId">;++export type TDeleteInventoryViewDTO = {+ viewId: string;+ projectId: string;+} & Omit<TProjectPermission, "projectId">;diff --git a/backend/src/services/certificate/certificate-dal.ts b/backend/src/services/certificate/certificate-dal.tsindex 7e0c2a3528..46b991b9db 100644--- a/backend/src/services/certificate/certificate-dal.ts+++ b/backend/src/services/certificate/certificate-dal.ts@@ -12,6 +12,7 @@ import {import { isUuidV4 } from "@app/lib/validator";import { applyMetadataFilter } from "@app/services/resource-metadata/resource-metadata-fns";+import { keySizeToAlgorithms } from "./certificate-fns";import { CertStatus } from "./certificate-types";export type TCertificateDALFactory = ReturnType<typeof certificateDALFactory>;@@ -48,19 +49,7 @@ export const certificateDALFactory = (db: TDbClient) => {}};- const countCertificatesInProject = async ({- projectId,- friendlyName,- commonName,- search,- status,- profileIds,- fromDate,- toDate,- metadataFilter,- extendedKeyUsage- }: {- projectId: string;+ type TInventoryFilterParams = {friendlyName?: string;commonName?: string;search?: string;@@ -70,91 +59,186 @@ export const certificateDALFactory = (db: TDbClient) => {toDate?: Date;metadataFilter?: Array<{ key: string; value?: string }>;extendedKeyUsage?: string;- }) => {- try {- interface CountResult {- count: string;- }+ keyAlgorithm?: string;+ signatureAlgorithm?: string;+ keySize?: number;+ keySizes?: number[];+ caIds?: string[];+ enrollmentTypes?: string[];+ source?: string;+ notAfterFrom?: Date;+ notAfterTo?: Date;+ notBeforeFrom?: Date;+ notBeforeTo?: Date;+ };- let query = db- .replicaNode()(TableName.Certificate)- .join(TableName.CertificateAuthority, `${TableName.Certificate}.caId`, `${TableName.CertificateAuthority}.id`)- .join(TableName.Project, `${TableName.CertificateAuthority}.projectId`, `${TableName.Project}.id`)- .where(`${TableName.Project}.id`, projectId);+ const applyInventoryFilters = (+ query: Knex.QueryBuilder,+ filters: TInventoryFilterParams,+ hasProfileJoin: boolean+ ): Knex.QueryBuilder => {+ let q = query;- if (friendlyName) {- const sanitizedValue = sanitizeSqlLikeString(friendlyName);- query = query.andWhere(`${TableName.Certificate}.friendlyName`, "like", `%${sanitizedValue}%`);- }+ if (filters.friendlyName) {+ const sanitizedValue = sanitizeSqlLikeString(filters.friendlyName);+ q = q.andWhere(`${TableName.Certificate}.friendlyName`, "like", `%${sanitizedValue}%`);+ }- if (commonName) {- const sanitizedValue = sanitizeSqlLikeString(commonName);- query = query.andWhere(`${TableName.Certificate}.commonName`, "like", `%${sanitizedValue}%`);- }+ if (filters.commonName) {+ const sanitizedValue = sanitizeSqlLikeString(filters.commonName);+ q = q.andWhere(`${TableName.Certificate}.commonName`, "like", `%${sanitizedValue}%`);+ }- if (search) {- const sanitizedValue = sanitizeSqlLikeString(search);- query = query.andWhere((qb) => {- void qb- .where(`${TableName.Certificate}.commonName`, "like", `%${sanitizedValue}%`)- .orWhere(`${TableName.Certificate}.altNames`, "like", `%${sanitizedValue}%`)- .orWhere(`${TableName.Certificate}.serialNumber`, "like", `%${sanitizedValue}%`)- .orWhere(`${TableName.Certificate}.friendlyName`, "like", `%${sanitizedValue}%`);-- if (isUuidV4(sanitizedValue)) {- void qb.orWhere(`${TableName.Certificate}.id`, sanitizedValue);+ if (filters.search) {+ const sanitizedValue = sanitizeSqlLikeString(filters.search);+ q = q.andWhere((qb: Knex.QueryBuilder) => {+ void qb+ .where(`${TableName.Certificate}.commonName`, "like", `%${sanitizedValue}%`)+ .orWhere(`${TableName.Certificate}.altNames`, "like", `%${sanitizedValue}%`)+ .orWhere(`${TableName.Certificate}.serialNumber`, "like", `%${sanitizedValue}%`)+ .orWhere(`${TableName.Certificate}.friendlyName`, "like", `%${sanitizedValue}%`);++ if (isUuidV4(sanitizedValue)) {+ void qb.orWhere(`${TableName.Certificate}.id`, sanitizedValue);+ }+ });+ }++ if (filters.status) {+ const now = new Date();+ const statuses = Array.isArray(filters.status) ? filters.status : [filters.status];++ q = q.andWhere((qb: Knex.QueryBuilder) => {+ statuses.forEach((statusValue, index) => {+ const whereMethod = index === 0 ? "where" : "orWhere";++ if (statusValue === CertStatus.ACTIVE) {+ void qb[whereMethod]((innerQb: Knex.QueryBuilder) => {+ void innerQb+ .where(`${TableName.Certificate}.notAfter`, ">", now)+ .andWhere(`${TableName.Certificate}.status`, "!=", CertStatus.REVOKED);+ });+ } else if (statusValue === CertStatus.EXPIRED) {+ void qb[whereMethod]((innerQb: Knex.QueryBuilder) => {+ void innerQb+ .where(`${TableName.Certificate}.notAfter`, "<=", now)+ .andWhere(`${TableName.Certificate}.status`, "!=", CertStatus.REVOKED);+ });+ } else {+ void qb[whereMethod](`${TableName.Certificate}.status`, statusValue);}});- }+ });+ }++ if (filters.fromDate) {+ q = q.andWhere(`${TableName.Certificate}.createdAt`, ">=", filters.fromDate);+ }- if (status) {- const now = new Date();- const statuses = Array.isArray(status) ? status : [status];-- query = query.andWhere((qb) => {- statuses.forEach((statusValue, index) => {- const whereMethod = index === 0 ? "where" : "orWhere";-- if (statusValue === CertStatus.ACTIVE) {- void qb[whereMethod]((innerQb) => {- void innerQb- .where(`${TableName.Certificate}.notAfter`, ">", now)- .andWhere(`${TableName.Certificate}.status`, "!=", CertStatus.REVOKED);- });- } else if (statusValue === CertStatus.EXPIRED) {- void qb[whereMethod]((innerQb) => {- void innerQb- .where(`${TableName.Certificate}.notAfter`, "<=", now)- .andWhere(`${TableName.Certificate}.status`, "!=", CertStatus.REVOKED);- });- } else {- void qb[whereMethod](`${TableName.Certificate}.status`, statusValue);- }- });+ if (filters.toDate) {+ q = q.andWhere(`${TableName.Certificate}.createdAt`, "<=", filters.toDate);+ }++ if (filters.profileIds) {+ q = q.whereIn(`${TableName.Certificate}.profileId`, filters.profileIds);+ }++ if (filters.metadataFilter && filters.metadataFilter.length > 0) {+ q = applyMetadataFilter(q, filters.metadataFilter, "certificateId", TableName.Certificate);+ }++ if (filters.extendedKeyUsage) {+ q = q.whereRaw(`"${TableName.Certificate}"."extendedKeyUsages" @> ARRAY[?]::text[]`, [filters.extendedKeyUsage]);+ }++ if (filters.keyAlgorithm) {+ q = q.andWhere(`${TableName.Certificate}.keyAlgorithm`, filters.keyAlgorithm);+ }++ if (filters.signatureAlgorithm) {+ q = q.andWhere(`${TableName.Certificate}.signatureAlgorithm`, filters.signatureAlgorithm);+ }++ if (filters.keySize) {+ const algorithms = keySizeToAlgorithms(filters.keySize);+ q = q.whereIn(`${TableName.Certificate}.keyAlgorithm`, algorithms);+ }++ if (filters.keySizes && filters.keySizes.length > 0) {+ const allAlgorithms = filters.keySizes.flatMap((size) => keySizeToAlgorithms(size));+ q = q.whereIn(`${TableName.Certificate}.keyAlgorithm`, allAlgorithms);+ }++ if (filters.caIds) {+ q = q.whereIn(`${TableName.Certificate}.caId`, filters.caIds);+ }++ if (filters.enrollmentTypes && hasProfileJoin) {+ q = q.whereIn(`${TableName.PkiCertificateProfile}.enrollmentType`, filters.enrollmentTypes);+ }++ if (filters.source) {+ if (filters.source === "issued") {+ q = q.andWhere((qb: Knex.QueryBuilder) => {+ void qb.where(`${TableName.Certificate}.source`, "issued").orWhereNull(`${TableName.Certificate}.source`);});+ } else {+ q = q.andWhere(`${TableName.Certificate}.source`, filters.source);}+ }- if (fromDate) {- query = query.andWhere(`${TableName.Certificate}.createdAt`, ">=", fromDate);- }+ if (filters.notAfterFrom) {+ q = q.andWhere(`${TableName.Certificate}.notAfter`, ">=", filters.notAfterFrom);+ }- if (toDate) {- query = query.andWhere(`${TableName.Certificate}.createdAt`, "<=", toDate);- }+ if (filters.notAfterTo) {+ q = q.andWhere(`${TableName.Certificate}.notAfter`, "<=", filters.notAfterTo);+ }++ if (filters.notBeforeFrom) {+ q = q.andWhere(`${TableName.Certificate}.notBefore`, ">=", filters.notBeforeFrom);+ }- if (profileIds) {- query = query.whereIn(`${TableName.Certificate}.profileId`, profileIds);+ if (filters.notBeforeTo) {+ q = q.andWhere(`${TableName.Certificate}.notBefore`, "<=", filters.notBeforeTo);+ }++ return q;+ };++ const countCertificatesInProject = async (+ {+ projectId,+ ...filters+ }: {+ projectId: string;+ } & TInventoryFilterParams,+ permissionFilters?: ProcessedPermissionRules+ ) => {+ try {+ interface CountResult {+ count: string;}- if (metadataFilter && metadataFilter.length > 0) {- query = applyMetadataFilter(query, metadataFilter, "certificateId", TableName.Certificate);+ let query = db+ .replicaNode()(TableName.Certificate)+ .join(TableName.CertificateAuthority, `${TableName.Certificate}.caId`, `${TableName.CertificateAuthority}.id`)+ .join(TableName.Project, `${TableName.CertificateAuthority}.projectId`, `${TableName.Project}.id`)+ .where(`${TableName.Project}.id`, projectId);++ const hasEnrollmentTypeFilter = Boolean(filters.enrollmentTypes);+ if (hasEnrollmentTypeFilter) {+ query = query.leftJoin(+ TableName.PkiCertificateProfile,+ `${TableName.Certificate}.profileId`,+ `${TableName.PkiCertificateProfile}.id`+ );}- if (extendedKeyUsage) {- // PostgreSQL array containment: extendedKeyUsages @> ARRAY['codeSigning']::text[]- query = query.whereRaw(`"${TableName.Certificate}"."extendedKeyUsages" @> ARRAY[?]::text[]`, [- extendedKeyUsage- ]);+ query = applyInventoryFilters(query, filters, hasEnrollmentTypeFilter) as typeof query;++ if (permissionFilters) {+ query = applyProcessedPermissionRulesToQuery(query, TableName.Certificate, permissionFilters) as typeof query;}const count = await query.count("*").first();@@ -225,7 +309,7 @@ export const certificateDALFactory = (db: TDbClient) => {};const findActiveCertificatesForSync = async (- filter: Partial<TCertificates & { friendlyName?: string; commonName?: string }>,+ filter: Partial<Omit<TCertificates, "status"> & TInventoryFilterParams>,options?: { limit?: number; offset?: number },permissionFilters?: ProcessedPermissionRules): Promise<(TCertificates & { hasPrivateKey: boolean })[]> => {@@ -356,29 +440,37 @@ export const certificateDALFactory = (db: TDbClient) => {}};+ type TCertificateWithInventoryFields = TCertificates & {+ hasPrivateKey: boolean;+ caName?: string | null;+ profileName?: string | null;+ enrollmentType?: string | null;+ };+const findWithPrivateKeyInfo = async (- filter: Partial<- TCertificates & {- friendlyName?: string;- commonName?: string;- search?: string;- status?: string | string[];- profileIds?: string[];- fromDate?: Date;- toDate?: Date;- metadataFilter?: Array<{ key: string; value?: string }>;- extendedKeyUsage?: string;- }- >,+ filter: Partial<Omit<TCertificates, "status"> & TInventoryFilterParams>,options?: { offset?: number; limit?: number; sort?: [string, "asc" | "desc"][] },permissionFilters?: ProcessedPermissionRules- ): Promise<(TCertificates & { hasPrivateKey: boolean })[]> => {+ ): Promise<TCertificateWithInventoryFields[]> => {try {let query = db.replicaNode()(TableName.Certificate).leftJoin(TableName.CertificateSecret, `${TableName.Certificate}.id`, `${TableName.CertificateSecret}.certId`)+ .leftJoin(+ TableName.CertificateAuthority,+ `${TableName.Certificate}.caId`,+ `${TableName.CertificateAuthority}.id`+ )+ .leftJoin(+ TableName.PkiCertificateProfile,+ `${TableName.Certificate}.profileId`,+ `${TableName.PkiCertificateProfile}.id`+ ).select(selectAllTableCols(TableName.Certificate))- .select(db.ref(`${TableName.CertificateSecret}.certId`).as("privateKeyRef"));+ .select(db.ref(`${TableName.CertificateSecret}.certId`).as("privateKeyRef"))+ .select(db.ref("name").withSchema(TableName.CertificateAuthority).as("caName"))+ .select(db.ref("slug").withSchema(TableName.PkiCertificateProfile).as("profileName"))+ .select(db.ref("enrollmentType").withSchema(TableName.PkiCertificateProfile).as("enrollmentType"));const {friendlyName,@@ -390,6 +482,17 @@ export const certificateDALFactory = (db: TDbClient) => {toDate,metadataFilter,extendedKeyUsage,+ keyAlgorithm,+ signatureAlgorithm,+ keySize,+ keySizes,+ caIds,+ enrollmentTypes,+ source,+ notAfterFrom,+ notAfterTo,+ notBeforeFrom,+ notBeforeTo,...regularFilters} = filter;@@ -399,80 +502,32 @@ export const certificateDALFactory = (db: TDbClient) => {}});- if (friendlyName) {- const sanitizedValue = sanitizeSqlLikeString(friendlyName);- query = query.andWhere(`${TableName.Certificate}.friendlyName`, "like", `%${sanitizedValue}%`);- }-- if (commonName) {- const sanitizedValue = sanitizeSqlLikeString(commonName);- query = query.andWhere(`${TableName.Certificate}.commonName`, "like", `%${sanitizedValue}%`);- }-- if (search) {- const sanitizedValue = sanitizeSqlLikeString(search);- query = query.andWhere((qb) => {- void qb- .where(`${TableName.Certificate}.commonName`, "like", `%${sanitizedValue}%`)- .orWhere(`${TableName.Certificate}.altNames`, "like", `%${sanitizedValue}%`)- .orWhere(`${TableName.Certificate}.serialNumber`, "like", `%${sanitizedValue}%`)- .orWhere(`${TableName.Certificate}.friendlyName`, "like", `%${sanitizedValue}%`);-- if (isUuidV4(sanitizedValue)) {- void qb.orWhere(`${TableName.Certificate}.id`, sanitizedValue);- }- });- }-- if (status) {- const now = new Date();- const statuses = Array.isArray(status) ? status : [status];-- query = query.andWhere((qb) => {- statuses.forEach((statusValue, index) => {- const whereMethod = index === 0 ? "where" : "orWhere";-- if (statusValue === CertStatus.ACTIVE) {- void qb[whereMethod]((innerQb) => {- void innerQb- .where(`${TableName.Certificate}.notAfter`, ">", now)- .andWhere(`${TableName.Certificate}.status`, "!=", CertStatus.REVOKED);- });- } else if (statusValue === CertStatus.EXPIRED) {- void qb[whereMethod]((innerQb) => {- void innerQb- .where(`${TableName.Certificate}.notAfter`, "<=", now)- .andWhere(`${TableName.Certificate}.status`, "!=", CertStatus.REVOKED);- });- } else {- void qb[whereMethod](`${TableName.Certificate}.status`, statusValue);- }- });- });- }-- if (fromDate) {- query = query.andWhere(`${TableName.Certificate}.createdAt`, ">=", fromDate);- }-- if (toDate) {- query = query.andWhere(`${TableName.Certificate}.createdAt`, "<=", toDate);- }-- if (profileIds) {- query = query.whereIn(`${TableName.Certificate}.profileId`, profileIds);- }-- if (metadataFilter && metadataFilter.length > 0) {- query = applyMetadataFilter(query, metadataFilter, "certificateId", TableName.Certificate);- }-- if (extendedKeyUsage) {- // PostgreSQL array containment: extendedKeyUsages @> ARRAY['codeSigning']::text[]- query = query.whereRaw(`"${TableName.Certificate}"."extendedKeyUsages" @> ARRAY[?]::text[]`, [- extendedKeyUsage- ]);- }+ query = applyInventoryFilters(+ query,+ {+ friendlyName,+ commonName,+ search,+ status,+ profileIds,+ fromDate,+ toDate,+ metadataFilter,+ extendedKeyUsage,+ keyAlgorithm,+ signatureAlgorithm,+ keySize,+ keySizes,+ caIds,+ enrollmentTypes,+ source,+ notAfterFrom,+ notAfterTo,+ notBeforeFrom,+ notBeforeTo+ },+ true+ ) as typeof query;if (permissionFilters) {query = applyProcessedPermissionRulesToQuery(query, TableName.Certificate, permissionFilters) as typeof query;@@ -486,17 +541,15 @@ export const certificateDALFactory = (db: TDbClient) => {}if (options?.sort) {options.sort.forEach(([column, direction]) => {- query = query.orderBy(column, direction);+ query = query.orderBy(`${TableName.Certificate}.${column}`, direction);});}const results = await query;- return results.map((row) => {- return {- ...row,- hasPrivateKey: row.privateKeyRef !== null- };- });+ return results.map((row) => ({+ ...row,+ hasPrivateKey: row.privateKeyRef !== null+ }));} catch (error) {throw new DatabaseError({ error, name: "Find certificates with private key info" });}@@ -508,7 +561,6 @@ export const certificateDALFactory = (db: TDbClient) => {caType?: "internal" | "external" | null;};- // Flexible lookup filter for certificate queries - either id or serialNumber, not bothtype TCertificateLookupFilter = { id: string; serialNumber?: never } | { id?: never; serialNumber: string };const findWithFullDetails = async (@@ -516,8 +568,7 @@ export const certificateDALFactory = (db: TDbClient) => {tx?: Knex): Promise<TCertificateWithRequestDetails | undefined> => {try {- let query = (tx || db)- .replicaNode()(TableName.Certificate)+ let query = (tx || db.replicaNode())(TableName.Certificate).leftJoin(TableName.CertificateAuthority,`${TableName.Certificate}.caId`,@@ -538,7 +589,6 @@ export const certificateDALFactory = (db: TDbClient) => {.select(db.ref("slug").withSchema(TableName.PkiCertificateProfile).as("profileName")).select(db.ref("id").withSchema(TableName.InternalCertificateAuthority).as("internalCaId"));- // Dynamic where clause based on filterif (filter.id) {query = query.where(`${TableName.Certificate}.id`, filter.id);} else {@@ -566,6 +616,297 @@ export const certificateDALFactory = (db: TDbClient) => {}};+ const getDashboardStats = async (projectId: string) => {+ try {+ const now = new Date();+ const thirtyDaysFromNow = new Date(now.getTime() + 30 * 24 * 60 * 60 * 1000);++ interface TotalsRow {+ total: number;+ active: number;+ expiringSoon: number;+ expired: number;+ revoked: number;+ expiringSoonNoAutoRenewal: number;+ expiredNotRenewed: number;+ }++ interface LabelCount {+ label: string;+ count: string;+ }++ interface LabelCountWithId extends LabelCount {+ id: string;+ }++ interface BucketCount {+ bucket: string;+ count: string;+ }++ const [totalsRow] = await db+ .replicaNode()(TableName.Certificate)+ .join(TableName.CertificateAuthority, `${TableName.Certificate}.caId`, `${TableName.CertificateAuthority}.id`)+ .where(`${TableName.CertificateAuthority}.projectId`, projectId)+ .select(+ db.raw("COUNT(*)::int as total"),+ db.raw(+ `COUNT(*) FILTER (WHERE "${TableName.Certificate}"."notAfter" > ? AND "${TableName.Certificate}"."status" != ?)::int as active`,+ [now, CertStatus.REVOKED]+ ),+ db.raw(+ `COUNT(*) FILTER (WHERE "${TableName.Certificate}"."notAfter" > ? AND "${TableName.Certificate}"."notAfter" <= ? AND "${TableName.Certificate}"."status" != ?)::int as "expiringSoon"`,+ [now, thirtyDaysFromNow, CertStatus.REVOKED]+ ),+ db.raw(+ `COUNT(*) FILTER (WHERE "${TableName.Certificate}"."notAfter" <= ? AND "${TableName.Certificate}"."status" != ?)::int as expired`,+ [now, CertStatus.REVOKED]+ ),+ db.raw(`COUNT(*) FILTER (WHERE "${TableName.Certificate}"."status" = ?)::int as revoked`, [+ CertStatus.REVOKED+ ]),+ db.raw(+ `COUNT(*) FILTER (WHERE "${TableName.Certificate}"."notAfter" > ? AND "${TableName.Certificate}"."notAfter" <= ? AND "${TableName.Certificate}"."status" != ? AND "${TableName.Certificate}"."renewBeforeDays" IS NULL)::int as "expiringSoonNoAutoRenewal"`,+ [now, thirtyDaysFromNow, CertStatus.REVOKED]+ ),+ db.raw(+ `COUNT(*) FILTER (WHERE "${TableName.Certificate}"."notAfter" <= ? AND "${TableName.Certificate}"."status" != ? AND "${TableName.Certificate}"."renewedByCertificateId" IS NULL)::int as "expiredNotRenewed"`,+ [now, CertStatus.REVOKED]+ )+ );++ const totals = totalsRow as unknown as TotalsRow;++ const byAlgorithm = await db+ .replicaNode()(TableName.Certificate)+ .join(TableName.CertificateAuthority, `${TableName.Certificate}.caId`, `${TableName.CertificateAuthority}.id`)+ .where(`${TableName.CertificateAuthority}.projectId`, projectId)+ .select(`${TableName.Certificate}.keyAlgorithm as label`)+ .count("* as count")+ .groupBy(`${TableName.Certificate}.keyAlgorithm`);++ const byCA = await db+ .replicaNode()(TableName.Certificate)+ .join(TableName.CertificateAuthority, `${TableName.Certificate}.caId`, `${TableName.CertificateAuthority}.id`)+ .where(`${TableName.CertificateAuthority}.projectId`, projectId)+ .select(`${TableName.CertificateAuthority}.id as id`)+ .select(`${TableName.CertificateAuthority}.name as label`)+ .count("* as count")+ .groupBy(`${TableName.CertificateAuthority}.id`, `${TableName.CertificateAuthority}.name`);++ const byStatus = [+ { label: "Active", count: totals.active },+ { label: "Expired", count: totals.expired },+ { label: "Revoked", count: totals.revoked }+ ];++ const byEnrollmentMethod = await db+ .replicaNode()(TableName.Certificate)+ .join(TableName.CertificateAuthority, `${TableName.Certificate}.caId`, `${TableName.CertificateAuthority}.id`)+ .leftJoin(+ TableName.PkiCertificateProfile,+ `${TableName.Certificate}.profileId`,+ `${TableName.PkiCertificateProfile}.id`+ )+ .where(`${TableName.CertificateAuthority}.projectId`, projectId)+ .select(db.raw(`COALESCE("${TableName.PkiCertificateProfile}"."enrollmentType", 'API') as label`))+ .count("* as count")+ .groupBy("label");++ const sevenDaysFromNow = new Date(now.getTime() + 7 * 24 * 60 * 60 * 1000);+ const sixtyDaysFromNow = new Date(now.getTime() + 60 * 24 * 60 * 60 * 1000);+ const ninetyDaysFromNow = new Date(now.getTime() + 90 * 24 * 60 * 60 * 1000);++ const expirationBuckets = await db+ .replicaNode()(TableName.Certificate)+ .join(TableName.CertificateAuthority, `${TableName.Certificate}.caId`, `${TableName.CertificateAuthority}.id`)+ .where(`${TableName.CertificateAuthority}.projectId`, projectId)+ .where(`${TableName.Certificate}.status`, "!=", CertStatus.REVOKED)+ .select(+ db.raw(+ `CASE+ WHEN "${TableName.Certificate}"."notAfter" < ? THEN 'expired'+ WHEN "${TableName.Certificate}"."notAfter" <= ? THEN '0-7d'+ WHEN "${TableName.Certificate}"."notAfter" <= ? THEN '8-30d'+ WHEN "${TableName.Certificate}"."notAfter" <= ? THEN '31-60d'+ WHEN "${TableName.Certificate}"."notAfter" <= ? THEN '61-90d'+ ELSE '90d+'+ END as bucket`,+ [now, sevenDaysFromNow, thirtyDaysFromNow, sixtyDaysFromNow, ninetyDaysFromNow]+ )+ )+ .select(db.raw("count(*)::int as count"))+ .groupBy("bucket");++ return {+ totals: {+ total: totals.total,+ active: totals.active,+ expiringSoon: totals.expiringSoon,+ expired: totals.expired,+ revoked: totals.revoked+ },+ expiringSoonNoAutoRenewal: totals.expiringSoonNoAutoRenewal,+ expiredNotRenewed: totals.expiredNotRenewed,+ distributions: {+ byEnrollmentMethod: (byEnrollmentMethod as unknown as LabelCount[]).map((r) => ({+ label: r.label,+ count: Number(r.count)+ })),+ byAlgorithm: (byAlgorithm as unknown as LabelCount[]).map((r) => ({+ label: r.label,+ count: Number(r.count)+ })),+ byCA: (byCA as unknown as LabelCountWithId[]).map((r) => ({+ id: r.id,+ label: r.label || "Unknown",+ count: Number(r.count)+ })),+ byStatus+ },+ expirationBuckets: (expirationBuckets as unknown as BucketCount[]).map((r) => ({+ bucket: r.bucket,+ count: Number(r.count)+ }))+ };+ } catch (error) {+ throw new DatabaseError({ error, name: "Get dashboard stats" });+ }+ };++ const getActivityTrend = async (projectId: string, daysBack: number) => {+ try {+ const startDate = new Date();+ startDate.setDate(startDate.getDate() - daysBack);+ startDate.setHours(0, 0, 0, 0);+ const now = new Date();++ const useDaily = daysBack <= 30;++ if (!useDaily) {+ startDate.setDate(1);+ }+ const truncUnit = useDaily ? "day" : "month";+ const dateFormat = useDaily ? "YYYY-MM-DD" : "YYYY-MM";++ const issued = await db+ .replicaNode()(TableName.Certificate)+ .join(TableName.CertificateAuthority, `${TableName.Certificate}.caId`, `${TableName.CertificateAuthority}.id`)+ .where(`${TableName.CertificateAuthority}.projectId`, projectId)+ .where(`${TableName.Certificate}.notBefore`, ">=", startDate)+ .where(`${TableName.Certificate}.notBefore`, "<=", now)+ .select(+ db.raw(+ `to_char(date_trunc('${truncUnit}', "${TableName.Certificate}"."notBefore"), '${dateFormat}') as period`+ )+ )+ .select(db.raw("count(*)::int as count"))+ .groupBy("period")+ .orderBy("period");++ const expired = await db+ .replicaNode()(TableName.Certificate)+ .join(TableName.CertificateAuthority, `${TableName.Certificate}.caId`, `${TableName.CertificateAuthority}.id`)+ .where(`${TableName.CertificateAuthority}.projectId`, projectId)+ .where(`${TableName.Certificate}.notAfter`, ">=", startDate)+ .where(`${TableName.Certificate}.notAfter`, "<=", now)+ .where(`${TableName.Certificate}.status`, "!=", CertStatus.REVOKED)+ .select(+ db.raw(+ `to_char(date_trunc('${truncUnit}', "${TableName.Certificate}"."notAfter"), '${dateFormat}') as period`+ )+ )+ .select(db.raw("count(*)::int as count"))+ .groupBy("period")+ .orderBy("period");++ const revoked = await db+ .replicaNode()(TableName.Certificate)+ .join(TableName.CertificateAuthority, `${TableName.Certificate}.caId`, `${TableName.CertificateAuthority}.id`)+ .where(`${TableName.CertificateAuthority}.projectId`, projectId)+ .where(`${TableName.Certificate}.status`, CertStatus.REVOKED)+ .where(`${TableName.Certificate}.revokedAt`, ">=", startDate)+ .where(`${TableName.Certificate}.revokedAt`, "<=", now)+ .select(+ db.raw(+ `to_char(date_trunc('${truncUnit}', "${TableName.Certificate}"."revokedAt"), '${dateFormat}') as period`+ )+ )+ .select(db.raw("count(*)::int as count"))+ .groupBy("period")+ .orderBy("period");++ const renewed = await db+ .replicaNode()(TableName.Certificate)+ .join(TableName.CertificateAuthority, `${TableName.Certificate}.caId`, `${TableName.CertificateAuthority}.id`)+ .where(`${TableName.CertificateAuthority}.projectId`, projectId)+ .whereNotNull(`${TableName.Certificate}.renewedFromCertificateId`)+ .where(`${TableName.Certificate}.notBefore`, ">=", startDate)+ .where(`${TableName.Certificate}.notBefore`, "<=", now)+ .select(+ db.raw(+ `to_char(date_trunc('${truncUnit}', "${TableName.Certificate}"."notBefore"), '${dateFormat}') as period`+ )+ )+ .select(db.raw("count(*)::int as count"))+ .groupBy("period")+ .orderBy("period");++ const periods: Array<{+ period: string;+ issued: number;+ expired: number;+ revoked: number;+ renewed: number;+ }> = [];+ interface PeriodCount {+ period: string;+ count: string;+ }++ const typedIssued = issued as unknown as PeriodCount[];+ const typedExpired = expired as unknown as PeriodCount[];+ const typedRevoked = revoked as unknown as PeriodCount[];+ const typedRenewed = renewed as unknown as PeriodCount[];++ const issuedMap = new Map(typedIssued.map((r) => [r.period, r.count]));+ const expiredMap = new Map(typedExpired.map((r) => [r.period, r.count]));+ const revokedMap = new Map(typedRevoked.map((r) => [r.period, r.count]));+ const renewedMap = new Map(typedRenewed.map((r) => [r.period, r.count]));++ const cursor = new Date(startDate);+ while (cursor <= now) {+ let periodKey: string;+ if (useDaily) {+ periodKey = `${cursor.getFullYear()}-${String(cursor.getMonth() + 1).padStart(2, "0")}-${String(cursor.getDate()).padStart(2, "0")}`;+ } else {+ periodKey = `${cursor.getFullYear()}-${String(cursor.getMonth() + 1).padStart(2, "0")}`;+ }+ const issuedCount = issuedMap.get(periodKey);+ const expiredCount = expiredMap.get(periodKey);+ const revokedCount = revokedMap.get(periodKey);+ const renewedCount = renewedMap.get(periodKey);+ periods.push({+ period: periodKey,+ issued: issuedCount ? Number(issuedCount) : 0,+ expired: expiredCount ? Number(expiredCount) : 0,+ revoked: revokedCount ? Number(revokedCount) : 0,+ renewed: renewedCount ? Number(renewedCount) : 0+ });+ if (useDaily) {+ cursor.setDate(cursor.getDate() + 1);+ } else {+ cursor.setMonth(cursor.getMonth() + 1);+ }+ }++ return { periods };+ } catch (error) {+ throw new DatabaseError({ error, name: "Get activity trend" });+ }+ };+return {...certificateOrm,countCertificatesInProject,@@ -578,6 +919,8 @@ export const certificateDALFactory = (db: TDbClient) => {findActiveCertificatesForSync,findCertificatesEligibleForRenewal,findWithPrivateKeyInfo,- findWithFullDetails+ findWithFullDetails,+ getDashboardStats,+ getActivityTrend};};diff --git a/backend/src/services/certificate/certificate-fns.ts b/backend/src/services/certificate/certificate-fns.tsindex f8827c4d9e..435f8f3462 100644--- a/backend/src/services/certificate/certificate-fns.ts+++ b/backend/src/services/certificate/certificate-fns.ts@@ -8,6 +8,7 @@ import { BadRequestError, NotFoundError } from "@app/lib/errors";import { parseDistinguishedName } from "../certificate-authority/certificate-authority-fns";import { getProjectKmsCertificateKeyId } from "../project/project-fns";import {+ CertKeyAlgorithm,CrlReason,TCertificateFingerprints,TCertificateSubject,@@ -15,6 +16,18 @@ import {TParsedCertificateBody} from "./certificate-types";+export const keySizeToAlgorithms = (keySize: number): string[] => {+ const map: Record<number, string[]> = {+ 2048: [CertKeyAlgorithm.RSA_2048],+ 3072: [CertKeyAlgorithm.RSA_3072],+ 4096: [CertKeyAlgorithm.RSA_4096],+ 256: [CertKeyAlgorithm.ECDSA_P256],+ 384: [CertKeyAlgorithm.ECDSA_P384],+ 521: [CertKeyAlgorithm.ECDSA_P521]+ };+ return map[keySize] ?? [];+};+export const revocationReasonToCrlCode = (crlReason: CrlReason) => {switch (crlReason) {case CrlReason.KEY_COMPROMISE:diff --git a/backend/src/services/project/project-service.ts b/backend/src/services/project/project-service.tsindex e46e742132..cf1bceb3b7 100644--- a/backend/src/services/project/project-service.ts+++ b/backend/src/services/project/project-service.ts@@ -91,6 +91,8 @@ import {TCreateProjectDTO,TDeleteProjectDTO,TDeleteProjectWorkflowIntegration,+ TGetActivityTrendDTO,+ TGetDashboardStatsDTO,TGetProjectDTO,TGetProjectKmsKey,TGetProjectSshConfig,@@ -120,6 +122,8 @@ import {TUpgradeProjectDTO} from "./project-types";+const DASHBOARD_CACHE_TTL = 300;+export const DEFAULT_PROJECT_ENVS = [{ name: "Development", slug: "dev" },{ name: "Staging", slug: "staging" },@@ -162,6 +166,8 @@ type TProjectServiceFactoryDep = {| "findWithPrivateKeyInfo"| "findActiveCertificatesForSync"| "countActiveCertificatesForSync"+ | "getDashboardStats"+ | "getActivityTrend">;certificateTemplateDAL: Pick<TCertificateTemplateDALFactory, "getCertTemplatesByProjectId">;pkiAlertDAL: Pick<TPkiAlertDALFactory, "find">;@@ -176,7 +182,7 @@ type TProjectServiceFactoryDep = {licenseService: Pick<TLicenseServiceFactory, "getPlan" | "invalidateGetPlan">;smtpService: Pick<TSmtpService, "sendMail">;orgDAL: Pick<TOrgDALFactory, "findOne" | "findEffectiveOrgMembership">;- keyStore: Pick<TKeyStoreFactory, "deleteItem" | "acquireLock">;+ keyStore: Pick<TKeyStoreFactory, "deleteItem" | "acquireLock" | "getItem" | "setItemWithExpiry">;roleDAL: Pick<TRoleDALFactory, "find" | "insertMany" | "delete">;kmsService: Pick<TKmsServiceFactory,@@ -1212,6 +1218,19 @@ export const projectServiceFactory = ({toDate,metadataFilter,extendedKeyUsage,+ keyAlgorithm,+ signatureAlgorithm,+ keySize,+ keySizes,+ caIds,+ enrollmentTypes,+ source,+ notAfterFrom,+ notAfterTo,+ notBeforeFrom,+ notBeforeTo,+ sortBy,+ sortOrder,actorId,actorOrgId,actorAuthMethod,@@ -1240,12 +1259,25 @@ export const projectServiceFactory = ({...(friendlyName && { friendlyName }),...(commonName && { commonName }),...(search && { search }),- ...(status && { status: Array.isArray(status) ? status[0] : status }),+ ...(status && {+ status: Array.isArray(status) ? status : status.split(",").map((s) => s.trim())+ }),...(profileIds && { profileIds }),...(fromDate && { fromDate }),...(toDate && { toDate }),...(metadataFilter && { metadataFilter }),- ...(extendedKeyUsage && { extendedKeyUsage })+ ...(extendedKeyUsage && { extendedKeyUsage }),+ ...(keyAlgorithm && { keyAlgorithm }),+ ...(signatureAlgorithm && { signatureAlgorithm }),+ ...(keySize && { keySize }),+ ...(keySizes && keySizes.length > 0 && { keySizes }),+ ...(caIds && { caIds }),+ ...(enrollmentTypes && { enrollmentTypes }),+ ...(source && { source }),+ ...(notAfterFrom && { notAfterFrom }),+ ...(notAfterTo && { notAfterTo }),+ ...(notBeforeFrom && { notBeforeFrom }),+ ...(notBeforeTo && { notBeforeTo })};const permissionFilters = getProcessedPermissionRules(permission,@@ -1253,6 +1285,18 @@ export const projectServiceFactory = ({ProjectPermissionSub.Certificates);+ const ALLOWED_SORT_COLUMNS = new Set([+ "notAfter",+ "notBefore",+ "createdAt",+ "commonName",+ "serialNumber",+ "keyAlgorithm",+ "status"+ ]);+ const validatedSortBy = sortBy && ALLOWED_SORT_COLUMNS.has(sortBy) ? sortBy : "notAfter";+ const validatedSortOrder = sortOrder === "asc" ? "asc" : "desc";+const certificates = forPkiSync? await certificateDAL.findActiveCertificatesForSync(regularFilters, { offset, limit }, permissionFilters): await certificateDAL.findWithPrivateKeyInfo(@@ -1260,7 +1304,7 @@ export const projectServiceFactory = ({{offset,limit,- sort: [["notAfter", "desc"]]+ sort: [[validatedSortBy, validatedSortOrder]]},permissionFilters);@@ -1270,17 +1314,28 @@ export const projectServiceFactory = ({...(regularFilters.friendlyName && { friendlyName: String(regularFilters.friendlyName) }),...(regularFilters.commonName && { commonName: String(regularFilters.commonName) }),...(regularFilters.search && { search: String(regularFilters.search) }),- ...(regularFilters.status && { status: String(regularFilters.status) }),+ ...(regularFilters.status && { status: regularFilters.status }),...(regularFilters.profileIds && { profileIds: regularFilters.profileIds }),...(regularFilters.fromDate && { fromDate: regularFilters.fromDate }),...(regularFilters.toDate && { toDate: regularFilters.toDate }),...(regularFilters.metadataFilter && { metadataFilter: regularFilters.metadataFilter }),- ...(regularFilters.extendedKeyUsage && { extendedKeyUsage: String(regularFilters.extendedKeyUsage) })+ ...(regularFilters.extendedKeyUsage && { extendedKeyUsage: String(regularFilters.extendedKeyUsage) }),+ ...(regularFilters.keyAlgorithm && { keyAlgorithm: String(regularFilters.keyAlgorithm) }),+ ...(regularFilters.signatureAlgorithm && { signatureAlgorithm: String(regularFilters.signatureAlgorithm) }),+ ...(regularFilters.keySize && { keySize: regularFilters.keySize }),+ ...(regularFilters.keySizes && { keySizes: regularFilters.keySizes }),+ ...(regularFilters.caIds && { caIds: regularFilters.caIds }),+ ...(regularFilters.enrollmentTypes && { enrollmentTypes: regularFilters.enrollmentTypes }),+ ...(regularFilters.source && { source: String(regularFilters.source) }),+ ...(regularFilters.notAfterFrom && { notAfterFrom: regularFilters.notAfterFrom }),+ ...(regularFilters.notAfterTo && { notAfterTo: regularFilters.notAfterTo }),+ ...(regularFilters.notBeforeFrom && { notBeforeFrom: regularFilters.notBeforeFrom }),+ ...(regularFilters.notBeforeTo && { notBeforeTo: regularFilters.notBeforeTo })};const count = forPkiSync? await certificateDAL.countActiveCertificatesForSync(countFilter)- : await certificateDAL.countCertificatesInProject(countFilter);+ : await certificateDAL.countCertificatesInProject(countFilter, permissionFilters);return {certificates,@@ -1288,6 +1343,74 @@ export const projectServiceFactory = ({};};+ const getDashboardStats = async ({ filter, actorId, actorOrgId, actorAuthMethod, actor }: TGetDashboardStatsDTO) => {+ const project = await projectDAL.findProjectByFilter(filter);+ const projectId = project.id;++ const { permission } = await permissionService.getProjectPermission({+ actor,+ actorId,+ projectId,+ actorAuthMethod,+ actorOrgId,+ actionProjectType: ActionProjectType.CertificateManager+ });++ ForbiddenError.from(permission).throwUnlessCan(+ ProjectPermissionCertificateActions.Read,+ ProjectPermissionSub.Certificates+ );++ const cacheKey = KeyStorePrefixes.CertDashboardStats(projectId);+ const cached = await keyStore.getItem(cacheKey);+ if (cached) {+ return JSON.parse(cached) as Awaited<ReturnType<typeof certificateDAL.getDashboardStats>>;+ }++ const stats = await certificateDAL.getDashboardStats(projectId);+ await keyStore.setItemWithExpiry(cacheKey, DASHBOARD_CACHE_TTL, JSON.stringify(stats));+ return stats;+ };++ const getActivityTrend = async ({+ filter,+ range = "30d",+ actorId,+ actorOrgId,+ actorAuthMethod,+ actor+ }: TGetActivityTrendDTO) => {+ const project = await projectDAL.findProjectByFilter(filter);+ const projectId = project.id;++ const { permission } = await permissionService.getProjectPermission({+ actor,+ actorId,+ projectId,+ actorAuthMethod,+ actorOrgId,+ actionProjectType: ActionProjectType.CertificateManager+ });++ ForbiddenError.from(permission).throwUnlessCan(+ ProjectPermissionCertificateActions.Read,+ ProjectPermissionSub.Certificates+ );++ const rangeDaysMap: Record<string, number> = { "7d": 7, "30d": 30, "6m": 180 };+ const daysBack = rangeDaysMap[range];++ const cacheKey = KeyStorePrefixes.CertActivityTrend(projectId, range);+ const cached = await keyStore.getItem(cacheKey);+ if (cached) {+ return JSON.parse(cached) as Awaited<ReturnType<typeof certificateDAL.getActivityTrend>>;+ }++ const trend = await certificateDAL.getActivityTrend(projectId, daysBack);+ await keyStore.setItemWithExpiry(cacheKey, DASHBOARD_CACHE_TTL, JSON.stringify(trend));+ return trend;+ };+/*** Return list of (PKI) alerts configured for project*/@@ -2316,6 +2439,8 @@ export const projectServiceFactory = ({upgradeProject,listProjectCas,listProjectCertificates,+ getDashboardStats,+ getActivityTrend,listProjectAlerts,listProjectPkiCollections,listProjectCertificateTemplates,diff --git a/backend/src/services/project/project-types.ts b/backend/src/services/project/project-types.tsindex cd35ab114b..b264280eed 100644--- a/backend/src/services/project/project-types.ts+++ b/backend/src/services/project/project-types.ts@@ -152,6 +152,28 @@ export type TListProjectCertsDTO = {toDate?: Date;metadataFilter?: Array<{ key: string; value?: string }>;extendedKeyUsage?: string;+ keyAlgorithm?: string;+ signatureAlgorithm?: string;+ keySize?: number;+ keySizes?: number[];+ caIds?: string[];+ enrollmentTypes?: string[];+ source?: string;+ notAfterFrom?: Date;+ notAfterTo?: Date;+ notBeforeFrom?: Date;+ notBeforeTo?: Date;+ sortBy?: string;+ sortOrder?: "asc" | "desc";+} & Omit<TProjectPermission, "projectId">;++export type TGetDashboardStatsDTO = {+ filter: Filter;+} & Omit<TProjectPermission, "projectId">;++export type TGetActivityTrendDTO = {+ filter: Filter;+ range?: string;} & Omit<TProjectPermission, "projectId">;export type TListProjectAlertsDTO = TProjectPermission;diff --git a/frontend/package-lock.json b/frontend/package-lock.jsonindex ab852cf019..3c930e8ec2 100644--- a/frontend/package-lock.json+++ b/frontend/package-lock.json@@ -103,6 +103,7 @@"react-markdown": "^10.0.1","react-select": "^5.9.0","react-toastify": "^10.0.6",+ "recharts": "^3.8.1","redaxios": "^0.5.1","rehype-raw": "^7.0.0","sonner": "^2.0.7",@@ -4796,6 +4797,42 @@"integrity": "sha512-A9+lCBZoaMJlVKcRBz2YByCG+Cp2t6nAnMnNba+XiWxnj6r4JUFqfsgwocMBZU9LPtdxC6wB56ySYpc7LQIoJg==","license": "MIT"},+ "node_modules/@reduxjs/toolkit": {+ "version": "2.11.2",+ "resolved": "https://registry.npmjs.org/@reduxjs/toolkit/-/toolkit-2.11.2.tgz",+ "integrity": "sha512-Kd6kAHTA6/nUpp8mySPqj3en3dm0tdMIgbttnQ1xFMVpufoj+ADi8pXLBsd4xzTRHQa7t/Jv8W5UnCuW4kuWMQ==",+ "license": "MIT",+ "dependencies": {+ "@standard-schema/spec": "^1.0.0",+ "@standard-schema/utils": "^0.3.0",+ "immer": "^11.0.0",+ "redux": "^5.0.1",+ "redux-thunk": "^3.1.0",+ "reselect": "^5.1.0"+ },+ "peerDependencies": {+ "react": "^16.9.0 || ^17.0.0 || ^18 || ^19",+ "react-redux": "^7.2.1 || ^8.1.3 || ^9.0.0"+ },+ "peerDependenciesMeta": {+ "react": {+ "optional": true+ },+ "react-redux": {+ "optional": true+ }+ }+ },+ "node_modules/@reduxjs/toolkit/node_modules/immer": {+ "version": "11.1.4",+ "resolved": "https://registry.npmjs.org/immer/-/immer-11.1.4.tgz",+ "integrity": "sha512-XREFCPo6ksxVzP4E0ekD5aMdf8WMwmdNaz6vuvxgI40UaEiu6q3p8X52aU6GdyvLY3XXX/8R7JOTXStz/nBbRw==",+ "license": "MIT",+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/immer"+ }+ },"node_modules/@rollup/plugin-inject": {"version": "5.0.5","resolved": "https://registry.npmjs.org/@rollup/plugin-inject/-/plugin-inject-5.0.5.tgz",@@ -5236,6 +5273,18 @@"url": "https://github.com/sponsors/sindresorhus"}},+ "node_modules/@standard-schema/spec": {+ "version": "1.1.0",+ "resolved": "https://registry.npmjs.org/@standard-schema/spec/-/spec-1.1.0.tgz",+ "integrity": "sha512-l2aFy5jALhniG5HgqrD6jXLi/rUWrKvqN/qJx6yoJsgKhblVd+iqqU4RCXavm/jPityDo5TCvKMnpjKnOriy0w==",+ "license": "MIT"+ },+ "node_modules/@standard-schema/utils": {+ "version": "0.3.0",+ "resolved": "https://registry.npmjs.org/@standard-schema/utils/-/utils-0.3.0.tgz",+ "integrity": "sha512-e7Mew686owMaPJVNNLs55PUvgz371nKgwsc4vxE49zsODpJEnxgxRo2y/OKrqueavXgZNMDVj3DdHFlaSAeU8g==",+ "license": "MIT"+ },"node_modules/@storybook/addon-a11y": {"version": "9.1.13","resolved": "https://registry.npmjs.org/@storybook/addon-a11y/-/addon-a11y-9.1.13.tgz",@@ -6544,6 +6593,12 @@"assertion-error": "^2.0.1"}},+ "node_modules/@types/d3-array": {+ "version": "3.2.2",+ "resolved": "https://registry.npmjs.org/@types/d3-array/-/d3-array-3.2.2.tgz",+ "integrity": "sha512-hOLWVbm7uRza0BYXpIIW5pxfrKe0W+D5lrFiAEYR+pb6w3N2SwSMaJbXdUfSEv+dT4MfHBLtn5js0LAWaO6otw==",+ "license": "MIT"+ },"node_modules/@types/d3-color": {"version": "3.1.3","resolved": "https://registry.npmjs.org/@types/d3-color/-/d3-color-3.1.3.tgz",@@ -6559,6 +6614,12 @@"@types/d3-selection": "*"}},+ "node_modules/@types/d3-ease": {+ "version": "3.0.2",+ "resolved": "https://registry.npmjs.org/@types/d3-ease/-/d3-ease-3.0.2.tgz",+ "integrity": "sha512-NcV1JjO5oDzoK26oMzbILE6HW7uVXOHLQvHshBUW4UMdZGfiY6v5BeQwh9a9tCzv+CeefZQHJt5SRgK154RtiA==",+ "license": "MIT"+ },"node_modules/@types/d3-interpolate": {"version": "3.0.4","resolved": "https://registry.npmjs.org/@types/d3-interpolate/-/d3-interpolate-3.0.4.tgz",@@ -6568,12 +6629,48 @@"@types/d3-color": "*"}},+ "node_modules/@types/d3-path": {+ "version": "3.1.1",+ "resolved": "https://registry.npmjs.org/@types/d3-path/-/d3-path-3.1.1.tgz",+ "integrity": "sha512-VMZBYyQvbGmWyWVea0EHs/BwLgxc+MKi1zLDCONksozI4YJMcTt8ZEuIR4Sb1MMTE8MMW49v0IwI5+b7RmfWlg==",+ "license": "MIT"+ },+ "node_modules/@types/d3-scale": {+ "version": "4.0.9",+ "resolved": "https://registry.npmjs.org/@types/d3-scale/-/d3-scale-4.0.9.tgz",+ "integrity": "sha512-dLmtwB8zkAeO/juAMfnV+sItKjlsw2lKdZVVy6LRr0cBmegxSABiLEpGVmSJJ8O08i4+sGR6qQtb6WtuwJdvVw==",+ "license": "MIT",+ "dependencies": {+ "@types/d3-time": "*"+ }+ },"node_modules/@types/d3-selection": {"version": "3.0.11","resolved": "https://registry.npmjs.org/@types/d3-selection/-/d3-selection-3.0.11.tgz","integrity": "sha512-bhAXu23DJWsrI45xafYpkQ4NtcKMwWnAC/vKrd2l+nxMFuvOT3XMYTIj2opv8vq8AO5Yh7Qac/nSeP/3zjTK0w==","license": "MIT"},+ "node_modules/@types/d3-shape": {+ "version": "3.1.8",+ "resolved": "https://registry.npmjs.org/@types/d3-shape/-/d3-shape-3.1.8.tgz",+ "integrity": "sha512-lae0iWfcDeR7qt7rA88BNiqdvPS5pFVPpo5OfjElwNaT2yyekbM0C9vK+yqBqEmHr6lDkRnYNoTBYlAgJa7a4w==",+ "license": "MIT",+ "dependencies": {+ "@types/d3-path": "*"+ }+ },+ "node_modules/@types/d3-time": {+ "version": "3.0.4",+ "resolved": "https://registry.npmjs.org/@types/d3-time/-/d3-time-3.0.4.tgz",+ "integrity": "sha512-yuzZug1nkAAaBlBBikKZTgzCeA+k1uy4ZFwWANOfKw5z5LRhV0gNA7gNkKm7HoK+HRN0wX3EkxGk0fpbWhmB7g==",+ "license": "MIT"+ },+ "node_modules/@types/d3-timer": {+ "version": "3.0.2",+ "resolved": "https://registry.npmjs.org/@types/d3-timer/-/d3-timer-3.0.2.tgz",+ "integrity": "sha512-Ps3T8E8dZDam6fUyNiMkekK3XUsaUEik+idO9/YjPtfj2qruF8tFBXS7XhtE4iIXBLxhmLjP3SXpLhVf21I9Lw==",+ "license": "MIT"+ },"node_modules/@types/d3-transition": {"version": "3.0.9","resolved": "https://registry.npmjs.org/@types/d3-transition/-/d3-transition-3.0.9.tgz",@@ -6800,6 +6897,12 @@"resolved": "https://registry.npmjs.org/@types/unist/-/unist-3.0.3.tgz","integrity": "sha512-ko/gIFJRv177XgZsZcBwnqJN5x/Gien8qNOn0D5bQU/zAzVf9Zt3BlcUiLqhV9y4ARk0GbT3tnUiPNgnTXzc/Q=="},+ "node_modules/@types/use-sync-external-store": {+ "version": "0.0.6",+ "resolved": "https://registry.npmjs.org/@types/use-sync-external-store/-/use-sync-external-store-0.0.6.tgz",+ "integrity": "sha512-zFDAD+tlpf2r4asuHEj0XH6pY6i0g5NeAHPn+15wk3BV6JA69eERFXC1gyGThDkVa1zCyKr5jox1+2LbV/AMLg==",+ "license": "MIT"+ },"node_modules/@typescript-eslint/eslint-plugin": {"version": "8.34.0","resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.34.0.tgz",@@ -9163,6 +9266,18 @@"url": "https://polar.sh/cva"}},+ "node_modules/d3-array": {+ "version": "3.2.4",+ "resolved": "https://registry.npmjs.org/d3-array/-/d3-array-3.2.4.tgz",+ "integrity": "sha512-tdQAmyA18i4J7wprpYq8ClcxZy3SC31QMeByyCFyRt7BVHdREQZ5lpzoe5mFEYZUWe+oq8HBvk9JjpibyEV4Jg==",+ "license": "ISC",+ "dependencies": {+ "internmap": "1 - 2"+ },+ "engines": {+ "node": ">=12"+ }+ },"node_modules/d3-color": {"version": "3.1.0","resolved": "https://registry.npmjs.org/d3-color/-/d3-color-3.1.0.tgz",@@ -9203,6 +9318,15 @@"node": ">=12"}},+ "node_modules/d3-format": {+ "version": "3.1.2",+ "resolved": "https://registry.npmjs.org/d3-format/-/d3-format-3.1.2.tgz",+ "integrity": "sha512-AJDdYOdnyRDV5b6ArilzCPPwc1ejkHcoyFarqlPqT7zRYjhavcT3uSrqcMvsgh2CgoPbK3RCwyHaVyxYcP2Arg==",+ "license": "ISC",+ "engines": {+ "node": ">=12"+ }+ },"node_modules/d3-interpolate": {"version": "3.0.1","resolved": "https://registry.npmjs.org/d3-interpolate/-/d3-interpolate-3.0.1.tgz",@@ -9215,6 +9339,31 @@"node": ">=12"}},+ "node_modules/d3-path": {+ "version": "3.1.0",+ "resolved": "https://registry.npmjs.org/d3-path/-/d3-path-3.1.0.tgz",+ "integrity": "sha512-p3KP5HCf/bvjBSSKuXid6Zqijx7wIfNW+J/maPs+iwR35at5JCbLUT0LzF1cnjbCHWhqzQTIN2Jpe8pRebIEFQ==",+ "license": "ISC",+ "engines": {+ "node": ">=12"+ }+ },+ "node_modules/d3-scale": {+ "version": "4.0.2",+ "resolved": "https://registry.npmjs.org/d3-scale/-/d3-scale-4.0.2.tgz",+ "integrity": "sha512-GZW464g1SH7ag3Y7hXjf8RoUuAFIqklOAq3MRl4OaWabTFJY9PN/E1YklhXLh+OQ3fM9yS2nOkCoS+WLZ6kvxQ==",+ "license": "ISC",+ "dependencies": {+ "d3-array": "2.10.0 - 3",+ "d3-format": "1 - 3",+ "d3-interpolate": "1.2.0 - 3",+ "d3-time": "2.1.1 - 3",+ "d3-time-format": "2 - 4"+ },+ "engines": {+ "node": ">=12"+ }+ },"node_modules/d3-selection": {"version": "3.0.0","resolved": "https://registry.npmjs.org/d3-selection/-/d3-selection-3.0.0.tgz",@@ -9224,6 +9373,42 @@"node": ">=12"}},+ "node_modules/d3-shape": {+ "version": "3.2.0",+ "resolved": "https://registry.npmjs.org/d3-shape/-/d3-shape-3.2.0.tgz",+ "integrity": "sha512-SaLBuwGm3MOViRq2ABk3eLoxwZELpH6zhl3FbAoJ7Vm1gofKx6El1Ib5z23NUEhF9AsGl7y+dzLe5Cw2AArGTA==",+ "license": "ISC",+ "dependencies": {+ "d3-path": "^3.1.0"+ },+ "engines": {+ "node": ">=12"+ }+ },+ "node_modules/d3-time": {+ "version": "3.1.0",+ "resolved": "https://registry.npmjs.org/d3-time/-/d3-time-3.1.0.tgz",+ "integrity": "sha512-VqKjzBLejbSMT4IgbmVgDjpkYrNWUYJnbCGo874u7MMKIWsILRX+OpX/gTk8MqjpT1A/c6HY2dCA77ZN0lkQ2Q==",+ "license": "ISC",+ "dependencies": {+ "d3-array": "2 - 3"+ },+ "engines": {+ "node": ">=12"+ }+ },+ "node_modules/d3-time-format": {+ "version": "4.1.0",+ "resolved": "https://registry.npmjs.org/d3-time-format/-/d3-time-format-4.1.0.tgz",+ "integrity": "sha512-dJxPBlzC7NugB2PDLwo9Q8JiTR3M3e4/XANkreKSUxF8vvXKqm1Yfq4Q5dl8budlunRVlUUaDUgFt7eA8D6NLg==",+ "license": "ISC",+ "dependencies": {+ "d3-time": "1 - 3"+ },+ "engines": {+ "node": ">=12"+ }+ },"node_modules/d3-timer": {"version": "3.0.1","resolved": "https://registry.npmjs.org/d3-timer/-/d3-timer-3.0.1.tgz",@@ -9372,6 +9557,12 @@"node": ">=0.10.0"}},+ "node_modules/decimal.js-light": {+ "version": "2.5.1",+ "resolved": "https://registry.npmjs.org/decimal.js-light/-/decimal.js-light-2.5.1.tgz",+ "integrity": "sha512-qIMFpTMZmny+MMIitAB6D7iVPEorVw6YQRWkvarTkT4tBeSLLiHzcwj6q0MmYSFCiVpiqPJTJEYIrpcPzVEIvg==",+ "license": "MIT"+ },"node_modules/decode-named-character-reference": {"version": "1.0.2","resolved": "https://registry.npmjs.org/decode-named-character-reference/-/decode-named-character-reference-1.0.2.tgz",@@ -9854,6 +10045,16 @@"url": "https://github.com/sponsors/ljharb"}},+ "node_modules/es-toolkit": {+ "version": "1.45.1",+ "resolved": "https://registry.npmjs.org/es-toolkit/-/es-toolkit-1.45.1.tgz",+ "integrity": "sha512-/jhoOj/Fx+A+IIyDNOvO3TItGmlMKhtX8ISAHKE90c4b/k1tqaqEZ+uUqfpU8DMnW5cgNJv606zS55jGvza0Xw==",+ "license": "MIT",+ "workspaces": [+ "docs",+ "benchmarks"+ ]+ },"node_modules/esbuild": {"version": "0.25.11","resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.25.11.tgz",@@ -10598,6 +10799,12 @@"node": ">=0.10.0"}},+ "node_modules/eventemitter3": {+ "version": "5.0.4",+ "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-5.0.4.tgz",+ "integrity": "sha512-mlsTRyGaPBjPedk6Bvw+aqbsXDtoAyAzm5MO7JgU+yVRyMQ5O8bD4Kcci7BS85f93veegeCPkL8R4GLClnjLFw==",+ "license": "MIT"+ },"node_modules/events": {"version": "3.3.0","resolved": "https://registry.npmjs.org/events/-/events-3.3.0.tgz",@@ -11619,6 +11826,16 @@"node": ">= 4"}},+ "node_modules/immer": {+ "version": "10.2.0",+ "resolved": "https://registry.npmjs.org/immer/-/immer-10.2.0.tgz",+ "integrity": "sha512-d/+XTN3zfODyjr89gM3mPq1WNX2B8pYsu7eORitdwyA2sBubnTl3laYlBk4sXY5FUa5qTZGBDPJICVbvqzjlbw==",+ "license": "MIT",+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/immer"+ }+ },"node_modules/import-fresh": {"version": "3.3.0","resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz",@@ -11694,6 +11911,15 @@"node": ">= 0.4"}},+ "node_modules/internmap": {+ "version": "2.0.3",+ "resolved": "https://registry.npmjs.org/internmap/-/internmap-2.0.3.tgz",+ "integrity": "sha512-5Hh7Y1wQbvY5ooGgPbDaL5iYLAPzMTUrjMulskHLH6wnv/A+1q5rgEaiuqEjB+oxGXIVZs1FF+R/KPN3ZSQYYg==",+ "license": "ISC",+ "engines": {+ "node": ">=12"+ }+ },"node_modules/iobuffer": {"version": "5.4.0","resolved": "https://registry.npmjs.org/iobuffer/-/iobuffer-5.4.0.tgz",@@ -14990,6 +15216,29 @@"react": ">=18"}},+ "node_modules/react-redux": {+ "version": "9.2.0",+ "resolved": "https://registry.npmjs.org/react-redux/-/react-redux-9.2.0.tgz",+ "integrity": "sha512-ROY9fvHhwOD9ySfrF0wmvu//bKCQ6AeZZq1nJNtbDC+kk5DuSuNX/n6YWYF/SYy7bSba4D4FSz8DJeKY/S/r+g==",+ "license": "MIT",+ "dependencies": {+ "@types/use-sync-external-store": "^0.0.6",+ "use-sync-external-store": "^1.4.0"+ },+ "peerDependencies": {+ "@types/react": "^18.2.25 || ^19",+ "react": "^18.0 || ^19",+ "redux": "^5.0.0"+ },+ "peerDependenciesMeta": {+ "@types/react": {+ "optional": true+ },+ "redux": {+ "optional": true+ }+ }+ },"node_modules/react-remove-scroll": {"version": "2.6.0","resolved": "https://registry.npmjs.org/react-remove-scroll/-/react-remove-scroll-2.6.0.tgz",@@ -15188,6 +15437,36 @@"node": ">=0.10.0"}},+ "node_modules/recharts": {+ "version": "3.8.1",+ "resolved": "https://registry.npmjs.org/recharts/-/recharts-3.8.1.tgz",+ "integrity": "sha512-mwzmO1s9sFL0TduUpwndxCUNoXsBw3u3E/0+A+cLcrSfQitSG62L32N69GhqUrrT5qKcAE3pCGVINC6pqkBBQg==",+ "license": "MIT",+ "workspaces": [+ "www"+ ],+ "dependencies": {+ "@reduxjs/toolkit": "^1.9.0 || 2.x.x",+ "clsx": "^2.1.1",+ "decimal.js-light": "^2.5.1",+ "es-toolkit": "^1.39.3",+ "eventemitter3": "^5.0.1",+ "immer": "^10.1.1",+ "react-redux": "8.x.x || 9.x.x",+ "reselect": "5.1.1",+ "tiny-invariant": "^1.3.3",+ "use-sync-external-store": "^1.2.2",+ "victory-vendor": "^37.0.2"+ },+ "engines": {+ "node": ">=18"+ },+ "peerDependencies": {+ "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",+ "react-dom": "^16.0.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",+ "react-is": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0"+ }+ },"node_modules/redaxios": {"version": "0.5.1","resolved": "https://registry.npmjs.org/redaxios/-/redaxios-0.5.1.tgz",@@ -15223,6 +15502,21 @@"node": ">=8"}},+ "node_modules/redux": {+ "version": "5.0.1",+ "resolved": "https://registry.npmjs.org/redux/-/redux-5.0.1.tgz",+ "integrity": "sha512-M9/ELqF6fy8FwmkpnF0S3YKOqMyoWJ4+CS5Efg2ct3oY9daQvd/Pc71FpGZsVsbl3Cpb+IIcjBDUnnyBdQbq4w==",+ "license": "MIT"+ },+ "node_modules/redux-thunk": {+ "version": "3.1.0",+ "resolved": "https://registry.npmjs.org/redux-thunk/-/redux-thunk-3.1.0.tgz",+ "integrity": "sha512-NW2r5T6ksUKXCabzhL9z+h206HQw/NJkcLm1GPImRQ8IzfXwRGqjVhKJGauHirT0DAuyy6hjdnMZaRoAcy0Klw==",+ "license": "MIT",+ "peerDependencies": {+ "redux": "^5.0.0"+ }+ },"node_modules/reflect-metadata": {"version": "0.2.2","resolved": "https://registry.npmjs.org/reflect-metadata/-/reflect-metadata-0.2.2.tgz",@@ -15337,6 +15631,12 @@"integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==","license": "ISC"},+ "node_modules/reselect": {+ "version": "5.1.1",+ "resolved": "https://registry.npmjs.org/reselect/-/reselect-5.1.1.tgz",+ "integrity": "sha512-K/BG6eIky/SBpzfHZv/dd+9JBFiS4SWV7FIujVyJRux6e45+73RaUHXLmIR1f7WOMaQ0U1km6qwklRQxpJJY0w==",+ "license": "MIT"+ },"node_modules/resolve": {"version": "1.22.8","resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.8.tgz",@@ -17010,6 +17310,28 @@"url": "https://opencollective.com/unified"}},+ "node_modules/victory-vendor": {+ "version": "37.3.6",+ "resolved": "https://registry.npmjs.org/victory-vendor/-/victory-vendor-37.3.6.tgz",+ "integrity": "sha512-SbPDPdDBYp+5MJHhBCAyI7wKM3d5ivekigc2Dk2s7pgbZ9wIgIBYGVw4zGHBml/qTFbexrofXW6Gu4noGxrOwQ==",+ "license": "MIT AND ISC",+ "dependencies": {+ "@types/d3-array": "^3.0.3",+ "@types/d3-ease": "^3.0.0",+ "@types/d3-interpolate": "^3.0.1",+ "@types/d3-scale": "^4.0.2",+ "@types/d3-shape": "^3.1.0",+ "@types/d3-time": "^3.0.0",+ "@types/d3-timer": "^3.0.0",+ "d3-array": "^3.1.6",+ "d3-ease": "^3.0.1",+ "d3-interpolate": "^3.0.1",+ "d3-scale": "^4.0.2",+ "d3-shape": "^3.1.0",+ "d3-time": "^3.0.0",+ "d3-timer": "^3.0.1"+ }+ },"node_modules/vite": {"version": "6.4.1","resolved": "https://registry.npmjs.org/vite/-/vite-6.4.1.tgz",diff --git a/frontend/package.json b/frontend/package.jsonindex 2f770fdf7f..302add6185 100644--- a/frontend/package.json+++ b/frontend/package.json@@ -115,6 +115,7 @@"react-markdown": "^10.0.1","react-select": "^5.9.0","react-toastify": "^10.0.6",+ "recharts": "^3.8.1","redaxios": "^0.5.1","rehype-raw": "^7.0.0","sonner": "^2.0.7",diff --git a/frontend/src/helpers/project.ts b/frontend/src/helpers/project.tsindex 649458a6e5..3cbd87ced2 100644--- a/frontend/src/helpers/project.ts+++ b/frontend/src/helpers/project.ts@@ -74,7 +74,7 @@ export const getProjectHomePage = (type: ProjectType, environments: ProjectEnv[]case ProjectType.SecretManager:return "/organizations/$orgId/projects/secret-management/$projectId/overview" as const;case ProjectType.CertificateManager:- return "/organizations/$orgId/projects/cert-manager/$projectId/policies" as const;+ return "/organizations/$orgId/projects/cert-manager/$projectId/overview" as const;case ProjectType.SecretScanning:return `/organizations/$orgId/projects/${type}/$projectId/data-sources` as const;case ProjectType.PAM:diff --git a/frontend/src/hooks/api/certificateInventoryViews/index.tsx b/frontend/src/hooks/api/certificateInventoryViews/index.tsxnew file mode 100644index 0000000000..3993387886--- /dev/null+++ b/frontend/src/hooks/api/certificateInventoryViews/index.tsx@@ -0,0 +1,14 @@+export {+ useCreateCertificateInventoryView,+ useDeleteCertificateInventoryView,+ useUpdateCertificateInventoryView+} from "./mutations";+export { useListCertificateInventoryViews } from "./queries";+export type {+ TCertificateInventoryView,+ TCreateInventoryViewDTO,+ TDeleteInventoryViewDTO,+ TListInventoryViewsResponse,+ TSystemView,+ TUpdateInventoryViewDTO+} from "./types";diff --git a/frontend/src/hooks/api/certificateInventoryViews/mutations.tsx b/frontend/src/hooks/api/certificateInventoryViews/mutations.tsxnew file mode 100644index 0000000000..42baf0cde6--- /dev/null+++ b/frontend/src/hooks/api/certificateInventoryViews/mutations.tsx@@ -0,0 +1,61 @@+import { useMutation, useQueryClient } from "@tanstack/react-query";++import { apiRequest } from "@app/config/request";++import { certificateInventoryViewKeys } from "./queries";+import {+ TCertificateInventoryView,+ TCreateInventoryViewDTO,+ TDeleteInventoryViewDTO,+ TUpdateInventoryViewDTO+} from "./types";++export const useCreateCertificateInventoryView = () => {+ const queryClient = useQueryClient();++ return useMutation({+ mutationFn: async ({ projectId, name, filters, columns }: TCreateInventoryViewDTO) => {+ const { data } = await apiRequest.post<{ view: TCertificateInventoryView }>(+ `/api/v1/projects/${projectId}/certificate-inventory-views`,+ { name, filters, columns }+ );+ return data.view;+ },+ onSuccess: (_, { projectId }) => {+ queryClient.invalidateQueries({ queryKey: certificateInventoryViewKeys.list(projectId) });+ }+ });+};++export const useUpdateCertificateInventoryView = () => {+ const queryClient = useQueryClient();++ return useMutation({+ mutationFn: async ({ projectId, viewId, name, filters, columns }: TUpdateInventoryViewDTO) => {+ const { data } = await apiRequest.patch<{ view: TCertificateInventoryView }>(+ `/api/v1/projects/${projectId}/certificate-inventory-views/${viewId}`,+ { name, filters, columns }+ );+ return data.view;+ },+ onSuccess: (_, { projectId }) => {+ queryClient.invalidateQueries({ queryKey: certificateInventoryViewKeys.list(projectId) });+ }+ });+};++export const useDeleteCertificateInventoryView = () => {+ const queryClient = useQueryClient();++ return useMutation({+ mutationFn: async ({ projectId, viewId }: TDeleteInventoryViewDTO) => {+ const { data } = await apiRequest.delete<{ view: TCertificateInventoryView }>(+ `/api/v1/projects/${projectId}/certificate-inventory-views/${viewId}`+ );+ return data.view;+ },+ onSuccess: (_, { projectId }) => {+ queryClient.invalidateQueries({ queryKey: certificateInventoryViewKeys.list(projectId) });+ }+ });+};diff --git a/frontend/src/hooks/api/certificateInventoryViews/queries.tsx b/frontend/src/hooks/api/certificateInventoryViews/queries.tsxnew file mode 100644index 0000000000..4ef515b074--- /dev/null+++ b/frontend/src/hooks/api/certificateInventoryViews/queries.tsx@@ -0,0 +1,23 @@+import { useQuery } from "@tanstack/react-query";++import { apiRequest } from "@app/config/request";++import { TListInventoryViewsResponse } from "./types";++export const certificateInventoryViewKeys = {+ all: ["certificateInventoryViews"] as const,+ list: (projectId: string) => [...certificateInventoryViewKeys.all, { projectId }] as const+};++export const useListCertificateInventoryViews = (projectId: string) => {+ return useQuery({+ queryKey: certificateInventoryViewKeys.list(projectId),+ queryFn: async () => {+ const { data } = await apiRequest.get<TListInventoryViewsResponse>(+ `/api/v1/projects/${projectId}/certificate-inventory-views`+ );+ return data;+ },+ enabled: Boolean(projectId)+ });+};diff --git a/frontend/src/hooks/api/certificateInventoryViews/types.ts b/frontend/src/hooks/api/certificateInventoryViews/types.tsnew file mode 100644index 0000000000..f5496a5a31--- /dev/null+++ b/frontend/src/hooks/api/certificateInventoryViews/types.ts@@ -0,0 +1,63 @@+export type TInventoryViewFilters = {+ status?: string;+ notAfterTo?: string | Date;+ notAfterFrom?: string | Date;+ notBeforeTo?: string | Date;+ notBeforeFrom?: string | Date;+ enrollmentTypes?: string[];+ keyAlgorithm?: string;+ keySizes?: number[];+ caIds?: string[];+ profileIds?: string[];+ source?: string;+};++export type TCertificateInventoryView = {+ id: string;+ projectId: string;+ name: string;+ filters: TInventoryViewFilters;+ columns: string[] | null;+ createdByUserId: string | null;+ createdAt: string;+ updatedAt: string;+};++export type TSystemViewFilters = {+ status?: string[];+ notAfterTo?: string;+};++export type TSystemView = {+ id: string;+ name: string;+ filters: TSystemViewFilters;+ columns: null;+ isSystem: true;+ createdByUserId: null;+};++export type TListInventoryViewsResponse = {+ systemViews: TSystemView[];+ customViews: (TCertificateInventoryView & { isSystem: false })[];+};++export type TCreateInventoryViewDTO = {+ projectId: string;+ name: string;+ filters: TInventoryViewFilters;+ columns?: string[];+};++export type TUpdateInventoryViewDTO = {+ projectId: string;+ viewId: string;+ name?: string;+ filters?: TInventoryViewFilters;+ columns?: string[];+};++export type TDeleteInventoryViewDTO = {+ projectId: string;+ viewId: string;+};diff --git a/frontend/src/hooks/api/certificates/index.tsx b/frontend/src/hooks/api/certificates/index.tsxindex a08eae84f3..5f133e7864 100644--- a/frontend/src/hooks/api/certificates/index.tsx+++ b/frontend/src/hooks/api/certificates/index.tsx@@ -11,17 +11,24 @@ export {} from "./mutations";export {useGetCert,+ useGetCertActivityTrend,useGetCertBody,useGetCertBundle,+ useGetCertDashboardStats,useGetCertificateById,useGetCertificateRequest,useListCertificateRequests} from "./queries";export type {+ TActivityTrendPoint,+ TActivityTrendResponse,TCertificate,TCertificateByIdResponse,TCertificateRequestDetails,TCertificateRequestListItem,+ TDashboardDistribution,+ TDashboardStats,+ TExpirationBucket,TListCertificateRequestsParams,TListCertificateRequestsResponse,TUpdateCertificateDTOdiff --git a/frontend/src/hooks/api/certificates/queries.tsx b/frontend/src/hooks/api/certificates/queries.tsxindex ebf34ee852..1d29dcc450 100644--- a/frontend/src/hooks/api/certificates/queries.tsx+++ b/frontend/src/hooks/api/certificates/queries.tsx@@ -3,9 +3,11 @@ import { useQuery } from "@tanstack/react-query";import { apiRequest } from "@app/config/request";import {+ TActivityTrendResponse,TCertificate,TCertificateByIdResponse,TCertificateRequestDetails,+ TDashboardStats,TListCertificateRequestsParams,TListCertificateRequestsResponse} from "./types";@@ -33,6 +35,11 @@ export const certKeys = {params.sortBy,params.sortOrder,params.metadataFilter+ ],+ getDashboardStats: (projectId: string) => [{ projectId }, "cert-dashboard-stats"],+ getActivityTrend: (projectId: string, range: string) => [+ { projectId, range },+ "cert-activity-trend"]};@@ -139,3 +146,34 @@ export const useGetCertificateRequest = (requestId: string, projectSlug: string)enabled: Boolean(requestId) && Boolean(projectSlug)});};++const DASHBOARD_STALE_TIME = 5 * 60 * 1000; // 5 minutes++export const useGetCertDashboardStats = (projectId: string) => {+ return useQuery({+ queryKey: certKeys.getDashboardStats(projectId),+ queryFn: async () => {+ const { data } = await apiRequest.get<TDashboardStats>(+ `/api/v1/projects/${projectId}/certificates/dashboard-stats`+ );+ return data;+ },+ enabled: Boolean(projectId),+ staleTime: DASHBOARD_STALE_TIME+ });+};++export const useGetCertActivityTrend = (projectId: string, range = "6m") => {+ return useQuery({+ queryKey: certKeys.getActivityTrend(projectId, range),+ queryFn: async () => {+ const { data } = await apiRequest.get<TActivityTrendResponse>(+ `/api/v1/projects/${projectId}/certificates/activity-trend`,+ { params: { range } }+ );+ return data;+ },+ enabled: Boolean(projectId),+ staleTime: DASHBOARD_STALE_TIME+ });+};diff --git a/frontend/src/hooks/api/certificates/types.ts b/frontend/src/hooks/api/certificates/types.tsindex 0880123359..b68ffed5bd 100644--- a/frontend/src/hooks/api/certificates/types.ts+++ b/frontend/src/hooks/api/certificates/types.ts@@ -47,6 +47,7 @@ export type TCertificate = {};caName?: string | null;profileName?: string | null;+ enrollmentType?: string | null;caType?: "internal" | "external" | null;source?: TCertificateSource;discoveryMetadata?: {@@ -239,3 +240,45 @@ export type TListCertificateRequestsParams = {sortOrder?: "asc" | "desc";metadataFilter?: Array<{ key: string; value?: string }>;};++export type TDashboardDistribution = {+ id?: string;+ label: string;+ count: number;+};++export type TExpirationBucket = {+ bucket: string;+ count: number;+};++export type TDashboardStats = {+ totals: {+ total: number;+ active: number;+ expiringSoon: number;+ expired: number;+ revoked: number;+ };+ expiringSoonNoAutoRenewal: number;+ expiredNotRenewed: number;+ distributions: {+ byEnrollmentMethod: TDashboardDistribution[];+ byAlgorithm: TDashboardDistribution[];+ byCA: TDashboardDistribution[];+ byStatus: TDashboardDistribution[];+ };+ expirationBuckets: TExpirationBucket[];+};++export type TActivityTrendPoint = {+ period: string;+ issued: number;+ expired: number;+ revoked: number;+ renewed: number;+};++export type TActivityTrendResponse = {+ periods: TActivityTrendPoint[];+};diff --git a/frontend/src/hooks/api/projects/queries.tsx b/frontend/src/hooks/api/projects/queries.tsxindex e38971423a..d00de22c14 100644--- a/frontend/src/hooks/api/projects/queries.tsx+++ b/frontend/src/hooks/api/projects/queries.tsx@@ -273,12 +273,9 @@ export const useUpdateWorkspaceAuditLogsRetention = () => {return useMutation<Project, object, UpdateAuditLogsRetentionDTO>({mutationFn: async ({ projectId, auditLogsRetentionDays }) => {- const { data } = await apiRequest.put(- `/api/v1/projects/${projectId}/audit-logs-retention`,- {- auditLogsRetentionDays- }- );+ const { data } = await apiRequest.put(`/api/v1/projects/${projectId}/audit-logs-retention`, {+ auditLogsRetentionDays+ });return data.project;},onSuccess: () => {@@ -525,7 +522,20 @@ export const useListWorkspaceCertificates = ({fromDate,toDate,metadataFilter,- extendedKeyUsage+ extendedKeyUsage,+ keyAlgorithm,+ signatureAlgorithm,+ keySize,+ keySizes,+ caIds,+ enrollmentTypes,+ source,+ notAfterFrom,+ notAfterTo,+ notBeforeFrom,+ notBeforeTo,+ sortBy,+ sortOrder}: {projectId: string;offset: number;@@ -540,6 +550,19 @@ export const useListWorkspaceCertificates = ({toDate?: Date;metadataFilter?: Array<{ key: string; value?: string }>;extendedKeyUsage?: string;+ keyAlgorithm?: string;+ signatureAlgorithm?: string;+ keySize?: number;+ keySizes?: number[];+ caIds?: string[];+ enrollmentTypes?: string[];+ source?: string;+ notAfterFrom?: Date;+ notAfterTo?: Date;+ notBeforeFrom?: Date;+ notBeforeTo?: Date;+ sortBy?: string;+ sortOrder?: "asc" | "desc";}) => {return useQuery({queryKey: projectKeys.specificProjectCertificates({@@ -555,7 +578,20 @@ export const useListWorkspaceCertificates = ({fromDate,toDate,metadataFilter,- extendedKeyUsage+ extendedKeyUsage,+ keyAlgorithm,+ signatureAlgorithm,+ keySize,+ keySizes,+ caIds,+ enrollmentTypes,+ source,+ notAfterFrom,+ notAfterTo,+ notBeforeFrom,+ notBeforeTo,+ sortBy,+ sortOrder}),queryFn: async () => {const {@@ -574,7 +610,20 @@ export const useListWorkspaceCertificates = ({...(fromDate && { fromDate: fromDate.toISOString() }),...(toDate && { toDate: toDate.toISOString() }),...(metadataFilter && metadataFilter.length > 0 && { metadata: metadataFilter }),- ...(extendedKeyUsage && { extendedKeyUsage })+ ...(extendedKeyUsage && { extendedKeyUsage }),+ ...(keyAlgorithm && { keyAlgorithm }),+ ...(signatureAlgorithm && { signatureAlgorithm }),+ ...(keySize && { keySize }),+ ...(keySizes && keySizes.length > 0 && { keySizes }),+ ...(caIds && caIds.length > 0 && { caIds }),+ ...(enrollmentTypes && enrollmentTypes.length > 0 && { enrollmentTypes }),+ ...(source && { source }),+ ...(notAfterFrom && { notAfterFrom: notAfterFrom.toISOString() }),+ ...(notAfterTo && { notAfterTo: notAfterTo.toISOString() }),+ ...(notBeforeFrom && { notBeforeFrom: notBeforeFrom.toISOString() }),+ ...(notBeforeTo && { notBeforeTo: notBeforeTo.toISOString() }),+ ...(sortBy && { sortBy }),+ ...(sortOrder && { sortOrder })});diff --git a/frontend/src/hooks/api/projects/query-keys.tsx b/frontend/src/hooks/api/projects/query-keys.tsxindex 8eea9a64dc..589f6c2b4d 100644--- a/frontend/src/hooks/api/projects/query-keys.tsx+++ b/frontend/src/hooks/api/projects/query-keys.tsx@@ -54,7 +54,20 @@ export const projectKeys = {fromDate,toDate,metadataFilter,- extendedKeyUsage+ extendedKeyUsage,+ keyAlgorithm,+ signatureAlgorithm,+ keySize,+ keySizes,+ caIds,+ enrollmentTypes,+ source,+ notAfterFrom,+ notAfterTo,+ notBeforeFrom,+ notBeforeTo,+ sortBy,+ sortOrder}: {projectId: string;offset: number;@@ -69,6 +82,19 @@ export const projectKeys = {toDate?: Date;metadataFilter?: Array<{ key: string; value?: string }>;extendedKeyUsage?: string;+ keyAlgorithm?: string;+ signatureAlgorithm?: string;+ keySize?: number;+ keySizes?: number[];+ caIds?: string[];+ enrollmentTypes?: string[];+ source?: string;+ notAfterFrom?: Date;+ notAfterTo?: Date;+ notBeforeFrom?: Date;+ notBeforeTo?: Date;+ sortBy?: string;+ sortOrder?: "asc" | "desc";}) =>[...projectKeys.forProjectCertificates(projectId),@@ -84,7 +110,20 @@ export const projectKeys = {fromDate,toDate,metadataFilter,- extendedKeyUsage+ extendedKeyUsage,+ keyAlgorithm,+ signatureAlgorithm,+ keySize,+ keySizes,+ caIds,+ enrollmentTypes,+ source,+ notAfterFrom,+ notAfterTo,+ notBeforeFrom,+ notBeforeTo,+ sortBy,+ sortOrder}] as const,getProjectPkiAlerts: (projectId: string) => [{ projectId }, "project-pki-alerts"] as const,diff --git a/frontend/src/layouts/OrganizationLayout/components/OrgSidebar/CertManagerNav.tsx b/frontend/src/layouts/OrganizationLayout/components/OrgSidebar/CertManagerNav.tsxindex 3828c99ad6..6c4f1674ed 100644--- a/frontend/src/layouts/OrganizationLayout/components/OrgSidebar/CertManagerNav.tsx+++ b/frontend/src/layouts/OrganizationLayout/components/OrgSidebar/CertManagerNav.tsx@@ -4,6 +4,7 @@ import {Cable,FileKey,FileText,+ LayoutDashboard,Monitor,PenTool,Plug,@@ -44,6 +45,11 @@ export const CertManagerNav = ({const templates = templatesData?.certificateTemplates || [];const items: NavItem[] = [+ {+ label: "Dashboard",+ icon: LayoutDashboard,+ pathSuffix: "overview"+ },{label: "Certificates",icon: FileKey,diff --git a/frontend/src/pages/cert-manager/CertificatesPage/components/ActiveFilterChips.tsx b/frontend/src/pages/cert-manager/CertificatesPage/components/ActiveFilterChips.tsxnew file mode 100644index 0000000000..bae66a9ba3--- /dev/null+++ b/frontend/src/pages/cert-manager/CertificatesPage/components/ActiveFilterChips.tsx@@ -0,0 +1,78 @@+import { XIcon } from "lucide-react";++import { Badge, Tooltip, TooltipContent, TooltipTrigger } from "@app/components/v3";++import { type FilterRule, getFilterChipLabel, getFilterMultiSelectLabels } from "./inventory-types";++type Props = {+ rules: FilterRule[];+ onRemove: (ruleId: string) => void;+ onClearAll: () => void;+ dynamicFieldOptions?: Record<string, { value: string; label: string }[]>;+};++const FilterChip = ({+ rule,+ onRemove,+ dynamicFieldOptions+}: {+ rule: FilterRule;+ onRemove: () => void;+ dynamicFieldOptions?: Record<string, { value: string; label: string }[]>;+}) => {+ const label = getFilterChipLabel(rule, dynamicFieldOptions);+ const isCollapsed = Array.isArray(rule.value) && rule.value.length > 1;++ const chip = (+ <Badge variant="neutral" className="gap-1.5 pr-1">+ <span>{label}</span>+ <button+ type="button"+ onClick={onRemove}+ className="rounded p-0.5 text-muted transition-colors hover:text-red-400"+ >+ <XIcon className="size-3" />+ </button>+ </Badge>+ );++ if (!isCollapsed) return chip;++ const expandedLabels = getFilterMultiSelectLabels(rule, dynamicFieldOptions);++ return (+ <Tooltip>+ <TooltipTrigger asChild>{chip}</TooltipTrigger>+ <TooltipContent side="bottom" className="max-w-xs">+ <ul className="list-none space-y-0.5 text-xs">+ {expandedLabels.map((lbl) => (+ <li key={lbl}>{lbl}</li>+ ))}+ </ul>+ </TooltipContent>+ </Tooltip>+ );+};++export const ActiveFilterChips = ({ rules, onRemove, onClearAll, dynamicFieldOptions }: Props) => {+ if (rules.length === 0) return null;++ return (+ <div className="mb-3 flex flex-wrap items-center gap-2">+ <span className="text-xs text-muted">Active filters:</span>+ {rules.map((rule) => (+ <FilterChip+ key={rule.id}+ rule={rule}+ onRemove={() => onRemove(rule.id)}+ dynamicFieldOptions={dynamicFieldOptions}+ />+ ))}+ <button type="button" onClick={onClearAll}>+ <Badge variant="ghost" className="cursor-pointer">+ Clear all+ </Badge>+ </button>+ </div>+ );+};diff --git a/frontend/src/pages/cert-manager/CertificatesPage/components/CertificatesSection.tsx b/frontend/src/pages/cert-manager/CertificatesPage/components/CertificatesSection.tsxindex c4e386406c..fb14ffb4c3 100644--- a/frontend/src/pages/cert-manager/CertificatesPage/components/CertificatesSection.tsx+++ b/frontend/src/pages/cert-manager/CertificatesPage/components/CertificatesSection.tsx@@ -1,10 +1,9 @@-import { faArrowRight } from "@fortawesome/free-solid-svg-icons";-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";+import { ArrowRightIcon } from "lucide-react";import { createNotification } from "@app/components/notifications";import { ProjectPermissionCan } from "@app/components/permissions";-import { Button, DeleteActionModal } from "@app/components/v2";-import { DocumentationLinkBadge } from "@app/components/v3";+import { DeleteActionModal } from "@app/components/v2";+import { Button, DocumentationLinkBadge } from "@app/components/v3";import {ProjectPermissionCertificateActions,ProjectPermissionSub,@@ -24,12 +23,15 @@ import { CertificatesTable } from "./CertificatesTable";type CertificatesSectionProps = {externalFilter?: {- certificateId?: string;search?: string;};+ dashboardFilters?: import("./inventory-types").FilterRule[];};-export const CertificatesSection = ({ externalFilter }: CertificatesSectionProps) => {+export const CertificatesSection = ({+ externalFilter,+ dashboardFilters+}: CertificatesSectionProps) => {const { currentProject } = useProject();const { mutateAsync: deleteCert } = useDeleteCert();const { mutateAsync: downloadCertPkcs12 } = useDownloadCertPkcs12();@@ -98,9 +100,9 @@ export const CertificatesSection = ({ externalFilter }: CertificatesSectionPropstext: "PKCS12 certificate downloaded successfully",type: "success"});- } catch (error: any) {+ } catch (error) {createNotification({- text: error?.message || "Failed to download PKCS12 certificate",+ text: error instanceof Error ? error.message : "Failed to download PKCS12 certificate",type: "error"});}@@ -110,9 +112,14 @@ export const CertificatesSection = ({ externalFilter }: CertificatesSectionPropsreturn (<div className="mb-6 rounded-lg border border-mineshaft-600 bg-mineshaft-900 p-4"><div className="mb-4 flex justify-between">- <div className="flex items-center gap-x-2">- <p className="text-xl font-medium text-mineshaft-100">Certificates</p>- <DocumentationLinkBadge href="https://infisical.com/docs/documentation/platform/pki/certificates/overview" />+ <div>+ <div className="flex items-center gap-x-2">+ <p className="text-xl font-medium text-mineshaft-100">Certificates</p>+ <DocumentationLinkBadge href="https://infisical.com/docs/documentation/platform/pki/certificates/overview" />+ </div>+ <p className="mt-1 text-sm text-muted">+ View, filter, and manage all certificates across your project.+ </p></div><div className="flex gap-2"><ProjectPermissionCan@@ -121,18 +128,22 @@ export const CertificatesSection = ({ externalFilter }: CertificatesSectionProps>{(isAllowed) => (<Button- variant="outline_bg"- leftIcon={<FontAwesomeIcon icon={faArrowRight} />}+ variant="outline"onClick={() => handlePopUpOpen("certificateImport")}- isDisabled={!isAllowed}+ disabled={!isAllowed}>+ <ArrowRightIcon className="mr-1.5 size-4" />Import</Button>)}</ProjectPermissionCan></div></div>- <CertificatesTable handlePopUpOpen={handlePopUpOpen} externalFilter={externalFilter} />+ <CertificatesTable+ handlePopUpOpen={handlePopUpOpen}+ externalFilter={externalFilter}+ dashboardFilters={dashboardFilters}+ /><CertificateImportModal popUp={popUp} handlePopUpToggle={handlePopUpToggle} /><CertificateCertModal popUp={popUp} handlePopUpToggle={handlePopUpToggle} /><CertificateExportModaldiff --git a/frontend/src/pages/cert-manager/CertificatesPage/components/CertificatesTable.tsx b/frontend/src/pages/cert-manager/CertificatesPage/components/CertificatesTable.tsxindex 3722147a7a..f564ae43aa 100644--- a/frontend/src/pages/cert-manager/CertificatesPage/components/CertificatesTable.tsx+++ b/frontend/src/pages/cert-manager/CertificatesPage/components/CertificatesTable.tsx@@ -1,25 +1,23 @@/* eslint-disable no-nested-ternary */-import { useEffect, useMemo, useState } from "react";+import { useCallback, useEffect, useMemo, useState } from "react";import { subject } from "@casl/ability";-import {- faBan,- faCertificate,- faClockRotateLeft,- faEllipsis,- faEye,- faFileExport,- faFilter,- faLink,- faMagnifyingGlass,- faQuestionCircle,- faRedo,- faSearch,- faTrash-} from "@fortawesome/free-solid-svg-icons";-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";import { useNavigate } from "@tanstack/react-router";import { format } from "date-fns";-import { twMerge } from "tailwind-merge";+import {+ ArrowDownIcon,+ ArrowUpIcon,+ BanIcon,+ ClockIcon,+ DownloadIcon,+ EyeIcon,+ FileOutputIcon,+ FilterIcon,+ LinkIcon,+ MoreHorizontalIcon,+ RefreshCwIcon,+ SearchIcon,+ Trash2Icon+} from "lucide-react";import { createNotification } from "@app/components/notifications";import { ProjectPermissionCan } from "@app/components/permissions";@@ -29,29 +27,33 @@ import {} from "@app/components/utilities/certificateDisplayUtils";import { truncateSerialNumber } from "@app/components/utilities/serialNumberUtils";import {- Button,- DropdownMenu,- DropdownMenuContent,- DropdownMenuItem,- DropdownMenuTrigger,- EmptyState,- FilterableSelect,- IconButton,- Input,- Pagination,- Select,- SelectItem,- Table,- TableContainer,- TableSkeleton,- TBody,- Td,- Th,- THead,+ Badge,+ InputGroup,+ InputGroupAddon,+ InputGroupInput,+ Popover,+ PopoverContent,+ PopoverTrigger,+ Skeleton,Tooltip,- Tr-} from "@app/components/v2";-import { Badge } from "@app/components/v3";+ TooltipContent,+ TooltipTrigger,+ UnstableDropdownMenu,+ UnstableDropdownMenuContent,+ UnstableDropdownMenuItem,+ UnstableDropdownMenuTrigger,+ UnstableEmpty,+ UnstableEmptyHeader,+ UnstableEmptyTitle,+ UnstableIconButton,+ UnstablePagination,+ UnstableTable,+ UnstableTableBody,+ UnstableTableCell,+ UnstableTableHead,+ UnstableTableHeader,+ UnstableTableRow+} from "@app/components/v3";import {ProjectPermissionCertificateActions,ProjectPermissionPkiSyncActions,@@ -64,30 +66,31 @@ import { useUpdateRenewalConfig } from "@app/hooks/api";import { caSupportsCapability } from "@app/hooks/api/ca/constants";import { CaCapability, CaType } from "@app/hooks/api/ca/enums";import { useListCasByProjectId } from "@app/hooks/api/ca/queries";+import {+ useDeleteCertificateInventoryView,+ useListCertificateInventoryViews+} from "@app/hooks/api/certificateInventoryViews";+import type {+ TInventoryViewFilters,+ TSystemViewFilters+} from "@app/hooks/api/certificateInventoryViews/types";import { useListCertificateProfiles } from "@app/hooks/api/certificateProfiles";import { CertSource, CertStatus } from "@app/hooks/api/certificates/enums";import { useListWorkspaceCertificates } from "@app/hooks/api/projects";import { UsePopUpState } from "@app/hooks/usePopUp";-import {- type MetadataFilterEntry,- MetadataFilterSection-} from "../../components/MetadataFilterSection";+import { ActiveFilterChips } from "./ActiveFilterChips";import {getCertSourceLabel,getCertValidUntilBadgeDetails,isExpiringWithinOneDay} from "./CertificatesTable.utils";--enum CertificateStatus {- Active = "active",- Expired = "expired",- Revoked = "revoked"-}--type CertificateFilters = {- status?: CertificateStatus;-};+import { ColumnVisibilityToggle, getDefaultVisibleColumns } from "./ColumnVisibilityToggle";+import { certificatesToCSV, downloadCSV } from "./csvExport";+import { FilterBuilder } from "./FilterBuilder";+import { type FilterRule, filtersToSearchParams } from "./inventory-types";+import { SaveViewModal } from "./SaveViewModal";+import { ViewsDropdown } from "./ViewsDropdown";type Props = {handlePopUpOpen: (@@ -117,34 +120,72 @@ type Props = {}) => void;externalFilter?: {- certificateId?: string;search?: string;};+ dashboardFilters?: FilterRule[];};const PER_PAGE_INIT = 25;+const VIEW_STORAGE_KEY = "cert-inventory-active-view";+const MS_PER_DAY = 86_400_000;+const SEARCH_DEBOUNCE_MS = 500;++const getEnrollmentMethodBadge = (enrollmentType: string | null | undefined) => {+ if (!enrollmentType) return null;+ const label = enrollmentType.toUpperCase();+ return <Badge variant="ghost">{label}</Badge>;+};++const SortIcon = ({+ column,+ sortBy: sb,+ sortOrder: so+}: {+ column: string;+ sortBy?: string;+ sortOrder?: string;+}) => {+ if (!sb || sb !== column) return null;+ const Icon = so === "asc" ? ArrowUpIcon : ArrowDownIcon;+ return <Icon className="ml-1 inline-block size-3" />;+};-export const CertificatesTable = ({ handlePopUpOpen, externalFilter }: Props) => {+export const CertificatesTable = ({ handlePopUpOpen, externalFilter, dashboardFilters }: Props) => {const [page, setPage] = useState(1);const [perPage, setPerPage] = useState(PER_PAGE_INIT);- const [pendingSearch, setPendingSearch] = useState(externalFilter?.search || "");- const [pendingProfileIds, setPendingProfileIds] = useState<string[]>([]);- const [pendingFilters, setPendingFilters] = useState<CertificateFilters>({});- const [pendingMetadataFilters, setPendingMetadataFilters] = useState<MetadataFilterEntry[]>([]);-+ const [search, setSearch] = useState(externalFilter?.search || "");const [appliedSearch, setAppliedSearch] = useState(externalFilter?.search || "");- const [appliedProfileIds, setAppliedProfileIds] = useState<string[]>([]);- const [appliedFilters, setAppliedFilters] = useState<CertificateFilters>({});- const [appliedMetadataFilters, setAppliedMetadataFilters] = useState<MetadataFilterEntry[]>([]);++ const [appliedFilters, setAppliedFilters] = useState<FilterRule[]>(+ dashboardFilters?.length ? dashboardFilters : []+ );+ const [pendingFilters, setPendingFilters] = useState<FilterRule[]>([]);+ const [isFilterOpen, setIsFilterOpen] = useState(false);++ const hasDashboardFilters = Boolean(dashboardFilters?.length);+ const [activeViewId, setActiveViewId] = useState<string | null>(() => {+ if (hasDashboardFilters) return null;+ try {+ return localStorage.getItem(VIEW_STORAGE_KEY) || "system-all";+ } catch {+ return "system-all";+ }+ });+ const [isSaveViewOpen, setIsSaveViewOpen] = useState(false);+ const [hasRestoredView, setHasRestoredView] = useState(hasDashboardFilters);++ const [sortBy, setSortBy] = useState<string | undefined>(undefined);+ const [sortOrder, setSortOrder] = useState<"asc" | "desc" | undefined>(undefined);++ const [visibleColumns, setVisibleColumns] = useState<Set<string>>(getDefaultVisibleColumns);useEffect(() => {const timeoutId = setTimeout(() => {- setAppliedSearch(pendingSearch);+ setAppliedSearch(search);setPage(1);- }, 500);-+ }, SEARCH_DEBOUNCE_MS);return () => clearTimeout(timeoutId);- }, [pendingSearch]);+ }, [search]);const navigate = useNavigate();const { currentOrg } = useOrganization();@@ -156,39 +197,13 @@ export const CertificatesTable = ({ handlePopUpOpen, externalFilter }: Props) =>limit: 100});- const backendStatus = appliedFilters.status ? [appliedFilters.status] : undefined;-- const profileIds = useMemo(() => {- if (!appliedProfileIds.length) return undefined;- return appliedProfileIds;- }, [appliedProfileIds]);-- const activeMetadataFilters = useMemo(() => {- const filtered = appliedMetadataFilters- .filter((m) => m.key.trim())- .map(({ key, value }) => ({ key, ...(value?.trim() ? { value } : {}) }));- return filtered.length > 0 ? filtered : undefined;- }, [appliedMetadataFilters]);-- const { data, isPending } = useListWorkspaceCertificates({- projectId: currentProject?.id ?? "",- offset: (page - 1) * perPage,- limit: perPage,- search: appliedSearch.trim() || undefined,- status: backendStatus,- ...(profileIds && { profileIds }),- ...(activeMetadataFilters && { metadataFilter: activeMetadataFilters })- });-- const { mutateAsync: updateRenewalConfig } = useUpdateRenewalConfig();- // TODO: Use subscription.pkiLegacyTemplates to block legacy templates creation- const isLegacyTemplatesEnabled = true;-const { data: caData } = useListCasByProjectId(currentProject?.id ?? "");+ const { data: viewsData } = useListCertificateInventoryViews(currentProject?.id ?? "");+ const { mutateAsync: deleteView } = useDeleteCertificateInventoryView();+ const { mutateAsync: updateRenewalConfig } = useUpdateRenewalConfig();const caCapabilityMap = useMemo(() => {if (!caData) return {};-const map: Record<string, CaType> = {};caData.forEach((ca) => {map[ca.id] = ca.type;@@ -196,305 +211,569 @@ export const CertificatesTable = ({ handlePopUpOpen, externalFilter }: Props) =>return map;}, [caData]);+ const dynamicFieldOptions = useMemo(() => {+ const options: Record<string, { value: string; label: string }[]> = {};+ if (caData) {+ options.caId = caData.map((ca) => ({+ value: ca.id,+ label: ca.name || ca.id+ }));+ }+ if (profilesData?.certificateProfiles) {+ options.profileId = profilesData.certificateProfiles.map((p) => ({+ value: p.id,+ label: p.slug+ }));+ }+ return options;+ }, [caData, profilesData]);++ const filterSearchParams = useMemo(() => filtersToSearchParams(appliedFilters), [appliedFilters]);++ const { data, isPending } = useListWorkspaceCertificates({+ projectId: currentProject?.id ?? "",+ offset: (page - 1) * perPage,+ limit: perPage,+ search: appliedSearch.trim() || undefined,+ status: filterSearchParams.status as string | undefined,+ profileIds: filterSearchParams.profileIds as string[] | undefined,+ keyAlgorithm: filterSearchParams.keyAlgorithm,+ keySizes: filterSearchParams.keySizes,+ caIds: filterSearchParams.caIds,+ enrollmentTypes: filterSearchParams.enrollmentTypes,+ notAfterFrom: filterSearchParams.notAfterFrom+ ? new Date(filterSearchParams.notAfterFrom)+ : undefined,+ notAfterTo: filterSearchParams.notAfterTo ? new Date(filterSearchParams.notAfterTo) : undefined,+ notBeforeFrom: filterSearchParams.notBeforeFrom+ ? new Date(filterSearchParams.notBeforeFrom)+ : undefined,+ notBeforeTo: filterSearchParams.notBeforeTo+ ? new Date(filterSearchParams.notBeforeTo)+ : undefined,+ source: filterSearchParams.source,+ sortBy,+ sortOrder+ });+const certificates = data?.certificates || [];+ const handleSort = useCallback(+ (column: string) => {+ if (sortBy === column) {+ setSortOrder((prev) => (prev === "asc" ? "desc" : "asc"));+ } else {+ setSortBy(column);+ setSortOrder("asc");+ }+ setPage(1);+ },+ [sortBy]+ );+const handleDisableAutoRenewal = async (certificateId: string, commonName: string) => {if (!currentProject?.slug) {createNotification({- text: "Unable to disable auto-renewal: Project not found. Please refresh the page and try again.",+ text: "Unable to disable auto-renewal: Project not found.",type: "error"});return;}+ try {+ await updateRenewalConfig({+ certificateId,+ projectSlug: currentProject.slug,+ enableAutoRenewal: false+ });+ createNotification({+ text: `Auto-renewal disabled for ${commonName}`,+ type: "success"+ });+ } catch {+ createNotification({+ text: "Failed to disable auto-renewal",+ type: "error"+ });+ }+ };- await updateRenewalConfig({- certificateId,- projectSlug: currentProject.slug,- enableAutoRenewal: false- });-- createNotification({- text: `Auto-renewal disabled for ${commonName}`,- type: "success"- });+ const persistViewId = (viewId: string | null) => {+ try {+ if (viewId) {+ localStorage.setItem(VIEW_STORAGE_KEY, viewId);+ } else {+ localStorage.removeItem(VIEW_STORAGE_KEY);+ }+ } catch {+ // localStorage may be unavailable+ }};- const handleClearFilters = () => {- setPendingSearch("");- setPendingFilters({});- setPendingProfileIds([]);- setPendingMetadataFilters([]);- setAppliedSearch("");- setAppliedFilters({});- setAppliedProfileIds([]);- setAppliedMetadataFilters([]);+ const handleApplyFilters = () => {+ setAppliedFilters(pendingFilters);+ setActiveViewId(null);+ persistViewId(null);setPage(1);+ setIsFilterOpen(false);};- const handleClearStatus = () => {- setPendingFilters((prev) => ({ ...prev, status: undefined }));+ const handleRemoveFilter = (ruleId: string) => {+ const next = appliedFilters.filter((r) => r.id !== ruleId);+ setAppliedFilters(next);+ setPendingFilters(next);+ setActiveViewId(null);+ persistViewId(null);+ setPage(1);};- const handleClearProfiles = () => {- setPendingProfileIds([]);+ const handleClearAllFilters = () => {+ setAppliedFilters([]);+ setPendingFilters([]);+ setActiveViewId("system-all");+ persistViewId("system-all");+ setPage(1);};- const isTableFiltered = Boolean(- appliedFilters.status ||- appliedProfileIds.length ||- appliedMetadataFilters.some((m) => m.key.trim())+ const handleSelectView = useCallback(+ (viewId: string, filters: TInventoryViewFilters | TSystemViewFilters) => {+ setActiveViewId(viewId);+ persistViewId(viewId);+ setAppliedFilters([]);+ setPendingFilters([]);+ setPage(1);++ if (viewId === "system-all") {+ // do nothing+ } else if (viewId === "system-expiring-7d") {+ const now = new Date();+ const in7d = new Date(now.getTime() + 7 * MS_PER_DAY);+ setAppliedFilters([+ { id: "sv-status", field: "status", operator: "in", value: ["active"] },+ {+ id: "sv-expiry",+ field: "notAfter",+ operator: "before",+ value: in7d.toISOString().split("T")[0]+ }+ ]);+ } else if (viewId === "system-expiring-30d") {+ const now = new Date();+ const in30d = new Date(now.getTime() + 30 * MS_PER_DAY);+ setAppliedFilters([+ { id: "sv-status", field: "status", operator: "in", value: ["active"] },+ {+ id: "sv-expiry",+ field: "notAfter",+ operator: "before",+ value: in30d.toISOString().split("T")[0]+ }+ ]);+ } else if (viewId === "system-expired") {+ setAppliedFilters([+ { id: "sv-status", field: "status", operator: "in", value: ["expired"] }+ ]);+ } else if (viewId === "system-revoked") {+ setAppliedFilters([+ { id: "sv-status", field: "status", operator: "in", value: ["revoked"] }+ ]);+ } else {+ const customFilters = filters as TInventoryViewFilters;+ const rules: FilterRule[] = [];+ if (customFilters.status) {+ const statusArr = customFilters.status.split(",");+ if (statusArr.length > 0) {+ rules.push({ id: "cv-status", field: "status", operator: "in", value: statusArr });+ }+ }+ if (customFilters.notAfterTo) {+ const d = new Date(customFilters.notAfterTo);+ rules.push({+ id: "cv-notAfterTo",+ field: "notAfter",+ operator: "before",+ value: d.toISOString().split("T")[0]+ });+ }+ if (customFilters.notAfterFrom) {+ const d = new Date(customFilters.notAfterFrom);+ rules.push({+ id: "cv-notAfterFrom",+ field: "notAfter",+ operator: "after",+ value: d.toISOString().split("T")[0]+ });+ }+ if (customFilters.notBeforeTo) {+ const d = new Date(customFilters.notBeforeTo);+ rules.push({+ id: "cv-notBeforeTo",+ field: "notBefore",+ operator: "before",+ value: d.toISOString().split("T")[0]+ });+ }+ if (customFilters.notBeforeFrom) {+ const d = new Date(customFilters.notBeforeFrom);+ rules.push({+ id: "cv-notBeforeFrom",+ field: "notBefore",+ operator: "after",+ value: d.toISOString().split("T")[0]+ });+ }+ if (customFilters.enrollmentTypes && customFilters.enrollmentTypes.length > 0) {+ rules.push({+ id: "cv-enrollment",+ field: "enrollmentType",+ operator: "in",+ value: customFilters.enrollmentTypes+ });+ }+ if (customFilters.keyAlgorithm) {+ rules.push({+ id: "cv-algo",+ field: "keyAlgorithm",+ operator: "is",+ value: customFilters.keyAlgorithm+ });+ }+ if (customFilters.keySizes && customFilters.keySizes.length > 0) {+ rules.push({+ id: "cv-keysize",+ field: "keySize",+ operator: "in",+ value: customFilters.keySizes.map(String)+ });+ }+ if (customFilters.caIds && customFilters.caIds.length > 0) {+ rules.push({ id: "cv-ca", field: "caId", operator: "in", value: customFilters.caIds });+ }+ if (customFilters.profileIds && customFilters.profileIds.length > 0) {+ rules.push({+ id: "cv-profile",+ field: "profileId",+ operator: "in",+ value: customFilters.profileIds+ });+ }+ if (customFilters.source) {+ rules.push({+ id: "cv-source",+ field: "source",+ operator: "is",+ value: customFilters.source+ });+ }+ setAppliedFilters(rules);+ }+ },+ []);- const hasFilterChanges = useMemo(() => {- const pendingStatus = pendingFilters.status ?? undefined;- const appliedStatus = appliedFilters.status ?? undefined;- const statusChanged = pendingStatus !== appliedStatus;- const profileIdsChanged =- JSON.stringify([...pendingProfileIds].sort()) !==- JSON.stringify([...appliedProfileIds].sort());- const metadataChanged =- JSON.stringify(pendingMetadataFilters) !== JSON.stringify(appliedMetadataFilters);- return statusChanged || profileIdsChanged || metadataChanged;- }, [- pendingFilters.status,- appliedFilters.status,- pendingProfileIds,- appliedProfileIds,- pendingMetadataFilters,- appliedMetadataFilters- ]);+ const handleDeleteView = async (viewId: string) => {+ if (!currentProject?.id) return;+ try {+ await deleteView({ projectId: currentProject.id, viewId });+ createNotification({ text: "View deleted", type: "success" });+ if (activeViewId === viewId) {+ handleClearAllFilters();+ }+ } catch {+ createNotification({ text: "Failed to delete view", type: "error" });+ }+ };++ useEffect(() => {+ if (hasRestoredView || !viewsData) return;+ setHasRestoredView(true);++ if (!activeViewId || activeViewId === "system-all") return;++ const systemView = viewsData.systemViews.find((v) => v.id === activeViewId);+ if (systemView) {+ handleSelectView(systemView.id, systemView.filters);+ return;+ }++ const customView = viewsData.customViews.find((v) => v.id === activeViewId);+ if (customView) {+ handleSelectView(customView.id, customView.filters);+ return;+ }++ setActiveViewId("system-all");+ persistViewId("system-all");+ }, [viewsData, hasRestoredView, handleSelectView]);++ const handleExportCSV = () => {+ if (!certificates.length) return;+ const csv = certificatesToCSV(certificates);+ downloadCSV(csv, `certificates-export-${new Date().toISOString().split("T")[0]}.csv`);+ };++ const isTableFiltered = appliedFilters.length > 0;return (<div>- <div className="mb-4 flex gap-2">- <Input- value={pendingSearch}- onChange={(e) => setPendingSearch(e.target.value)}- leftIcon={<FontAwesomeIcon icon={faMagnifyingGlass} />}- placeholder="Search by SAN, CN, ID or Serial Number"- className="flex-1"- />- <DropdownMenu>- <DropdownMenuTrigger asChild>- <IconButton- ariaLabel="Filter Certificates"- variant="plain"- size="sm"- className={twMerge(- "flex h-10 w-11 items-center justify-center overflow-hidden border border-mineshaft-600 bg-mineshaft-800 p-0 transition-all hover:border-primary/60 hover:bg-primary/10",- isTableFiltered && "border-primary/50 text-primary"- )}- >- <FontAwesomeIcon icon={faFilter} />- </IconButton>- </DropdownMenuTrigger>- <DropdownMenuContent- sideOffset={2}- className="max-h-[70vh] thin-scrollbar w-80 overflow-y-auto p-4"- align="end"- >- <div className="space-y-4">- <div className="flex items-center justify-between">- <h3 className="text-sm font-medium text-mineshaft-100">Filters</h3>- <span className="text-xs text-bunker-300">- {isTableFiltered && (- <button- type="button"- onClick={handleClearFilters}- className="cursor-pointer text-primary hover:text-primary-600"- >- Clear filters- </button>- )}- </span>- </div>-- <div className="space-y-2">- <div className="flex items-center justify-between">- <span className="text-xs font-medium text-bunker-300 uppercase">- Certificate Profiles- </span>- {pendingProfileIds.length > 0 && (- <button- type="button"- onClick={handleClearProfiles}- className="cursor-pointer text-xs text-primary hover:text-primary-600"- >- Clear- </button>- )}- </div>- <FilterableSelect- value={pendingProfileIds.map((id) => ({- value: id,- label: profilesData?.certificateProfiles?.find((p) => p.id === id)?.slug || id- }))}- onChange={(selectedOptions) => {- const ids = Array.isArray(selectedOptions)- ? selectedOptions.map((opt) => opt.value)- : [];- setPendingProfileIds(ids);- }}- options={- profilesData?.certificateProfiles?.map((profile) => ({- value: profile.id,- label: profile.slug- })) || []- }- placeholder="Select certificate profiles..."- className="w-full border-mineshaft-600 bg-mineshaft-700 text-bunker-200"- isMulti- isLoading={!profilesData}- maxMenuHeight={120}- />- </div>-- <div className="space-y-2">- <div className="flex items-center justify-between">- <span className="text-xs font-medium text-bunker-300 uppercase">Status</span>- {pendingFilters.status && (- <button- type="button"- onClick={handleClearStatus}- className="cursor-pointer text-xs text-primary hover:text-primary-600"- >- Clear- </button>- )}- </div>- <Select- value={pendingFilters.status || "all"}- onValueChange={(value: string) => {- setPendingFilters((prev) => ({- ...prev,- status: value === "all" ? undefined : (value as CertificateStatus)- }));- }}- placeholder="All statuses"- className="w-full border-mineshaft-600 bg-mineshaft-700 text-bunker-200"- position="popper"- dropdownContainerClassName="max-w-none"+ <div className="mb-4 flex items-center gap-2">+ <InputGroup className="flex-1">+ <InputGroupAddon>+ <SearchIcon />+ </InputGroupAddon>+ <InputGroupInput+ value={search}+ onChange={(e) => setSearch(e.target.value)}+ placeholder="Search by SAN, CN, ID or Serial Number"+ />+ </InputGroup>++ <Popover+ open={isFilterOpen}+ onOpenChange={(open) => {+ if (open) setPendingFilters([...appliedFilters]);+ setIsFilterOpen(open);+ }}+ >+ <PopoverTrigger asChild>+ <div className="relative">+ <UnstableIconButton+ variant={isTableFiltered ? "project" : "outline"}+ size="md"+ aria-label="Filter Certificates"+ >+ <FilterIcon />+ </UnstableIconButton>+ {isTableFiltered && (+ <Badge+ variant="default"+ className="pointer-events-none absolute -top-2 -right-2.5 min-w-[18px] justify-center px-1 py-0 text-[10px] font-bold">- <SelectItem value="all">All statuses</SelectItem>- <SelectItem value={CertificateStatus.Active}>Active</SelectItem>- <SelectItem value={CertificateStatus.Expired}>Expired</SelectItem>- <SelectItem value={CertificateStatus.Revoked}>Revoked</SelectItem>- </Select>- </div>-- <MetadataFilterSection- entries={pendingMetadataFilters}- onChange={setPendingMetadataFilters}- />-- <div className="pt-2">- <Button+ {appliedFilters.length}+ </Badge>+ )}+ </div>+ </PopoverTrigger>+ <PopoverContent sideOffset={4} className="w-[680px] overflow-visible p-0" align="end">+ <FilterBuilder+ rules={pendingFilters}+ onChange={setPendingFilters}+ onApply={handleApplyFilters}+ onCancel={() => {+ setPendingFilters(appliedFilters);+ setIsFilterOpen(false);+ }}+ onClearAll={() => {+ handleClearAllFilters();+ setIsFilterOpen(false);+ }}+ onSaveView={() => setIsSaveViewOpen(true)}+ dynamicFieldOptions={dynamicFieldOptions}+ />+ </PopoverContent>+ </Popover>++ <UnstableIconButton+ variant="outline"+ size="md"+ aria-label="Export CSV"+ onClick={handleExportCSV}+ disabled={!certificates.length}+ >+ <DownloadIcon />+ </UnstableIconButton>++ <ViewsDropdown+ activeViewId={activeViewId}+ systemViews={viewsData?.systemViews || []}+ customViews={viewsData?.customViews || []}+ onSelectView={handleSelectView}+ onDeleteView={(viewId) => {+ handleDeleteView(viewId);+ }}+ />++ <ColumnVisibilityToggle visibleColumns={visibleColumns} onChange={setVisibleColumns} />+ </div>++ <ActiveFilterChips+ rules={appliedFilters}+ onRemove={handleRemoveFilter}+ onClearAll={handleClearAllFilters}+ dynamicFieldOptions={dynamicFieldOptions}+ />++ <UnstableTable>+ <UnstableTableHeader>+ <UnstableTableRow>+ {visibleColumns.has("sanCn") && (+ <UnstableTableHead className="max-w-[200px] min-w-[120px]">+ SAN / CN+ </UnstableTableHead>+ )}+ {visibleColumns.has("serialNumber") && (+ <UnstableTableHead className="max-w-[120px] min-w-[90px]">Serial #</UnstableTableHead>+ )}+ {visibleColumns.has("enrollmentMethod") && (+ <UnstableTableHead className="w-[110px]">Enrollment Method</UnstableTableHead>+ )}+ {visibleColumns.has("status") && (+ <UnstableTableHead className="w-[80px]">Status</UnstableTableHead>+ )}+ {visibleColumns.has("health") && (+ <UnstableTableHead className="w-[110px]">Health</UnstableTableHead>+ )}+ {visibleColumns.has("issuedAt") && (+ <UnstableTableHead+ className="w-[100px] cursor-pointer"+ onClick={() => handleSort("notBefore")}+ >+ Issued+ <SortIcon column="notBefore" sortBy={sortBy} sortOrder={sortOrder} />+ </UnstableTableHead>+ )}+ {visibleColumns.has("expiresAt") && (+ <UnstableTableHead+ className="w-[100px] cursor-pointer"+ onClick={() => handleSort("notAfter")}+ >+ Expires+ <SortIcon column="notAfter" sortBy={sortBy} sortOrder={sortOrder} />+ </UnstableTableHead>+ )}+ {visibleColumns.has("ca") && (+ <UnstableTableHead className="max-w-[130px] min-w-[80px]">CA</UnstableTableHead>+ )}+ {visibleColumns.has("profile") && (+ <UnstableTableHead className="max-w-[120px] min-w-[80px]">Profile</UnstableTableHead>+ )}+ {visibleColumns.has("algorithm") && (+ <UnstableTableHead className="w-[90px]">Algorithm</UnstableTableHead>+ )}+ {visibleColumns.has("source") && (+ <UnstableTableHead className="w-[80px]">Source</UnstableTableHead>+ )}+ <UnstableTableHead className="w-5" />+ </UnstableTableRow>+ </UnstableTableHeader>+ <UnstableTableBody>+ {isPending &&+ Array.from({ length: 10 }).map((_, i) => (+ <UnstableTableRow key={`skeleton-${i + 1}`}>+ {Array.from({ length: visibleColumns.size + 1 }).map((__, j) => (+ <UnstableTableCell key={`skeleton-cell-${j + 1}`}>+ <Skeleton className="h-4 w-full" />+ </UnstableTableCell>+ ))}+ </UnstableTableRow>+ ))}+ {!isPending &&+ certificates.map((certificate) => {+ const { variant, label } = getCertValidUntilBadgeDetails(certificate.notAfter);+ const isRevoked = certificate.status === CertStatus.REVOKED;+ const isExpired = new Date(certificate.notAfter) < new Date();+ const isExpiringWithinDay = isExpiringWithinOneDay(certificate.notAfter);+ const hasFailed = Boolean(certificate.renewalError);+ const isAutoRenewalEnabled = Boolean(+ certificate.renewBeforeDays && certificate.renewBeforeDays > 0+ );+ const canShowAutoRenewalIcon = Boolean(+ certificate.profileId &&+ certificate.hasPrivateKey !== false &&+ !certificate.renewedByCertificateId &&+ !isRevoked &&+ !isExpired &&+ !isExpiringWithinDay+ );+ const { originalDisplayName } = getCertificateDisplayName(certificate, 64, "—");++ return (+ <UnstableTableRow+ className="group"+ key={`certificate-${certificate.id}`}onClick={() => {- setAppliedFilters(pendingFilters);- setAppliedProfileIds(pendingProfileIds);- setAppliedMetadataFilters(pendingMetadataFilters);- setPage(1);+ navigate({+ to: "/organizations/$orgId/projects/cert-manager/$projectId/certificates/$certificateId",+ params: {+ orgId: currentOrg.id,+ projectId: currentProject.id,+ certificateId: certificate.id+ }+ });}}- className="w-full bg-primary font-medium text-black hover:bg-primary-600"- size="sm"- isDisabled={!hasFilterChanges}>- Apply Filters- </Button>- </div>- </div>- </DropdownMenuContent>- </DropdownMenu>- </div>- <TableContainer>- <Table>- <THead>- <Tr>- <Th className="w-1/4">SAN / CN</Th>- <Th>Serial Number</Th>- <Th className="w-24">- Source- <Tooltip content="How this certificate was added. Managed: issued and lifecycle-managed by Infisical. Discovered: found via network scan (discovery jobs). Imported: manually uploaded by a user.">- <FontAwesomeIcon icon={faQuestionCircle} size="sm" className="ml-1" />- </Tooltip>- </Th>- <Th className="w-24">Status</Th>- <Th>Issued At</Th>- <Th>Expiring At</Th>- <Th className="w-12" />- </Tr>- </THead>- <TBody>- {isPending && <TableSkeleton columns={6} innerKey="project-cas" />}- {!isPending &&- certificates.map((certificate) => {- const { variant, label } = getCertValidUntilBadgeDetails(certificate.notAfter);-- const isRevoked = certificate.status === CertStatus.REVOKED;- const isExpired = new Date(certificate.notAfter) < new Date();- const isExpiringWithinDay = isExpiringWithinOneDay(certificate.notAfter);- const hasFailed = Boolean(certificate.renewalError);- const isAutoRenewalEnabled = Boolean(- certificate.renewBeforeDays && certificate.renewBeforeDays > 0- );-- const canShowAutoRenewalIcon = Boolean(- certificate.profileId &&- certificate.hasPrivateKey !== false &&- !certificate.renewedByCertificateId &&- !isRevoked &&- !isExpired &&- !isExpiringWithinDay- );-- const { originalDisplayName } = getCertificateDisplayName(certificate, 64, "—");-- return (- <Tr- className="group h-10 cursor-pointer hover:bg-mineshaft-700"- key={`certificate-${certificate.id}`}- onClick={() => {- navigate({- to: "/organizations/$orgId/projects/cert-manager/$projectId/certificates/$certificateId",- params: {- orgId: currentOrg.id,- projectId: currentProject.id,- certificateId: certificate.id- }- });- }}- >- <Td className="max-w-0">+ {visibleColumns.has("sanCn") && (+ <UnstableTableCell isTruncatable><CertificateDisplayName cert={certificate} maxLength={64} fallback="—" />- </Td>- <Td>- <div className="max-w-xs truncate" title={certificate.serialNumber || "N/A"}>- {truncateSerialNumber(certificate.serialNumber)}- </div>- </Td>- <Td>- <Badge variant="ghost">- {getCertSourceLabel(certificate.source ?? null)}- </Badge>- </Td>- <Td>- {certificate.status === CertStatus.REVOKED ? (+ </UnstableTableCell>+ )}+ {visibleColumns.has("serialNumber") && (+ <UnstableTableCell isTruncatable>+ {truncateSerialNumber(certificate.serialNumber)}+ </UnstableTableCell>+ )}+ {visibleColumns.has("enrollmentMethod") && (+ <UnstableTableCell>+ {getEnrollmentMethodBadge(certificate.enrollmentType)}+ </UnstableTableCell>+ )}+ {visibleColumns.has("status") && (+ <UnstableTableCell>+ {isRevoked ? (<Badge variant="danger">Revoked</Badge>+ ) : isExpired ? (+ <Badge variant="danger">Expired</Badge>+ ) : (+ <Badge variant="success">Active</Badge>+ )}+ </UnstableTableCell>+ )}+ {visibleColumns.has("health") && (+ <UnstableTableCell>+ {isRevoked ? (+ <Badge variant="danger">Critical</Badge>) : (<Badge variant={variant}>{label}</Badge>)}- </Td>- <Td>+ </UnstableTableCell>+ )}+ {visibleColumns.has("issuedAt") && (+ <UnstableTableCell>{certificate.notBefore- ? format(new Date(certificate.notBefore), "yyyy-MM-dd")+ ? format(new Date(certificate.notBefore), "MMM d, yyyy"): "-"}- </Td>- <Td>+ </UnstableTableCell>+ )}+ {visibleColumns.has("expiresAt") && (+ <UnstableTableCell>{certificate.notAfter- ? format(new Date(certificate.notAfter), "yyyy-MM-dd")+ ? format(new Date(certificate.notAfter), "MMM d, yyyy"): "-"}- </Td>- <Td className="flex items-center justify-end gap-2">+ </UnstableTableCell>+ )}+ {visibleColumns.has("ca") && (+ <UnstableTableCell isTruncatable>{certificate.caName || "-"}</UnstableTableCell>+ )}+ {visibleColumns.has("profile") && (+ <UnstableTableCell isTruncatable>+ {certificate.profileName || "-"}+ </UnstableTableCell>+ )}+ {visibleColumns.has("algorithm") && (+ <UnstableTableCell>+ <span className="text-xs">+ {certificate.keyAlgorithm?.replace("_", "-") || "-"}+ </span>+ </UnstableTableCell>+ )}+ {visibleColumns.has("source") && (+ <UnstableTableCell>+ <Badge variant="ghost">+ {getCertSourceLabel(certificate.source ?? null)}+ </Badge>+ </UnstableTableCell>+ )}+ <UnstableTableCell>+ <div className="flex items-center justify-end gap-2"><divclassName={`transition-opacity ${(() => {if (!canShowAutoRenewalIcon) return "";@@ -514,74 +793,76 @@ export const CertificatesTable = ({ handlePopUpOpen, externalFilter }: Props) =>}));+ const tooltipText = (() => {+ if (hasFailed && certificate.renewalError) {+ return `Auto-renewal failed: ${certificate.renewalError}`;+ }+ if (isAutoRenewalEnabled) {+ const daysUntilExpiry = Math.ceil(+ (new Date(certificate.notAfter).getTime() -+ new Date().getTime()) /+ MS_PER_DAY+ );+ const daysUntilRenewal = Math.max(+ 0,+ daysUntilExpiry - (certificate.renewBeforeDays || 0)+ );+ return `Auto-renews in ${daysUntilRenewal}d`;+ }+ return "Set auto renewal";+ })();+return (- <Tooltip- content={(() => {- if (hasFailed && certificate.renewalError) {- return `Auto-renewal failed: ${certificate.renewalError}`;- }- if (isAutoRenewalEnabled) {- const expiryDate = new Date(certificate.notAfter);- const now = new Date();- const daysUntilExpiry = Math.ceil(- (expiryDate.getTime() - now.getTime()) / (24 * 60 * 60 * 1000)- );- const daysUntilRenewal = Math.max(- 0,- daysUntilExpiry - (certificate.renewBeforeDays || 0)- );- return `Auto-renews in ${daysUntilRenewal}d`;- }- return "Set auto renewal";- })()}- >- <button- type="button"- className={(() => {- if (hasFailed) return "pr-1 text-red-500 hover:text-red-400";- return "pr-1 text-primary-500 hover:text-primary-400";- })()}- aria-label="Certificate auto-renewal"- onClick={(e) => {- e.stopPropagation();- if (!canEditCertificate) return;- if (hasFailed) return;-- handlePopUpOpen("manageRenewal", {- certificateId: certificate.id,- commonName: originalDisplayName,- profileId: certificate.profileId || "",- renewBeforeDays: certificate.renewBeforeDays || 7,- ttlDays: Math.ceil(- (new Date(certificate.notAfter).getTime() -- new Date(certificate.notBefore).getTime()) /- (24 * 60 * 60 * 1000)- ),- notAfter: certificate.notAfter,- renewalError: certificate.renewalError,- renewedFromCertificateId:- certificate.renewedFromCertificateId,- renewedByCertificateId: certificate.renewedByCertificateId- });- }}- >- <FontAwesomeIcon icon={faClockRotateLeft} />- </button>+ <Tooltip>+ <TooltipTrigger asChild>+ <button+ type="button"+ className="cursor-pointer"+ aria-label="Certificate auto-renewal"+ onClick={(e) => {+ e.stopPropagation();+ if (!canEditCertificate) return;+ if (hasFailed) return;++ handlePopUpOpen("manageRenewal", {+ certificateId: certificate.id,+ commonName: originalDisplayName,+ profileId: certificate.profileId || "",+ renewBeforeDays: certificate.renewBeforeDays || 7,+ ttlDays: Math.ceil(+ (new Date(certificate.notAfter).getTime() -+ new Date(certificate.notBefore).getTime()) /+ MS_PER_DAY+ ),+ notAfter: certificate.notAfter,+ renewalError: certificate.renewalError,+ renewedFromCertificateId:+ certificate.renewedFromCertificateId,+ renewedByCertificateId: certificate.renewedByCertificateId+ });+ }}+ >+ <Badge variant={hasFailed ? "danger" : "info"} isSquare>+ <ClockIcon className="size-3" />+ </Badge>+ </button>+ </TooltipTrigger>+ <TooltipContent>{tooltipText}</TooltipContent></Tooltip>);})()}</div>- <DropdownMenu>- <DropdownMenuTrigger asChild className="rounded-lg">- <IconButton- variant="plain"- ariaLabel="More options"- className="h-max bg-transparent p-0"+ <UnstableDropdownMenu>+ <UnstableDropdownMenuTrigger asChild>+ <UnstableIconButton+ variant="ghost"+ size="xs"+ onClick={(e) => e.stopPropagation()}>- <FontAwesomeIcon size="lg" icon={faEllipsis} />- </IconButton>- </DropdownMenuTrigger>- <DropdownMenuContent align="start" className="p-1">+ <MoreHorizontalIcon />+ </UnstableIconButton>+ </UnstableDropdownMenuTrigger>+ <UnstableDropdownMenuContent align="end" sideOffset={2}><ProjectPermissionCanI={ProjectPermissionCertificateActions.Read}a={subject(ProjectPermissionSub.Certificates, {@@ -593,10 +874,8 @@ export const CertificatesTable = ({ handlePopUpOpen, externalFilter }: Props) =>})}>{(isAllowed) => (- <DropdownMenuItem- className={twMerge(- !isAllowed && "pointer-events-none cursor-not-allowed opacity-50"- )}+ <UnstableDropdownMenuItem+ isDisabled={!isAllowed}onClick={(e) => {e.stopPropagation();handlePopUpOpen("certificateExport", {@@ -604,44 +883,37 @@ export const CertificatesTable = ({ handlePopUpOpen, externalFilter }: Props) =>serialNumber: certificate.serialNumber});}}- disabled={!isAllowed}- icon={<FontAwesomeIcon icon={faFileExport} />}>+ <FileOutputIcon />Export Certificate- </DropdownMenuItem>+ </UnstableDropdownMenuItem>+ )}+ </ProjectPermissionCan>+ <ProjectPermissionCan+ I={ProjectPermissionCertificateActions.Read}+ a={subject(ProjectPermissionSub.Certificates, {+ commonName: certificate.commonName,+ altNames: certificate.altNames?.split(",").map((s) => s.trim()),+ serialNumber: certificate.serialNumber,+ friendlyName: certificate.friendlyName,+ metadata: certificate.metadata+ })}+ >+ {(isAllowed) => (+ <UnstableDropdownMenuItem+ isDisabled={!isAllowed}+ onClick={(e) => {+ e.stopPropagation();+ handlePopUpOpen("certificateCert", {+ serialNumber: certificate.serialNumber+ });+ }}+ >+ <EyeIcon />+ View Details+ </UnstableDropdownMenuItem>)}</ProjectPermissionCan>- {isLegacyTemplatesEnabled && (- <ProjectPermissionCan- I={ProjectPermissionCertificateActions.Read}- a={subject(ProjectPermissionSub.Certificates, {- commonName: certificate.commonName,- altNames: certificate.altNames?.split(",").map((s) => s.trim()),- serialNumber: certificate.serialNumber,- friendlyName: certificate.friendlyName,- metadata: certificate.metadata- })}- >- {(isAllowed) => (- <DropdownMenuItem- className={twMerge(- !isAllowed &&- "pointer-events-none cursor-not-allowed opacity-50"- )}- onClick={(e) => {- e.stopPropagation();- handlePopUpOpen("certificateCert", {- serialNumber: certificate.serialNumber- });- }}- disabled={!isAllowed}- icon={<FontAwesomeIcon icon={faEye} />}- >- View Details- </DropdownMenuItem>- )}- </ProjectPermissionCan>- )}{(() => {const canManageRenewal =certificate.profileId &&@@ -665,50 +937,42 @@ export const CertificatesTable = ({ handlePopUpOpen, externalFilter }: Props) =>metadata: certificate.metadata})}>- {(isAllowed) => {- return (- <DropdownMenuItem- className={twMerge(- !isAllowed &&- "pointer-events-none cursor-not-allowed opacity-50"- )}- onClick={(e) => {- e.stopPropagation();- const notAfterDate = new Date(certificate.notAfter);- const notBeforeDate = certificate.notBefore- ? new Date(certificate.notBefore)- : new Date(- notAfterDate.getTime() - 365 * 24 * 60 * 60 * 1000- );- const ttlDays = Math.max(- 1,- Math.ceil(- (notAfterDate.getTime() - notBeforeDate.getTime()) /- (24 * 60 * 60 * 1000)- )- );- handlePopUpOpen("manageRenewal", {- certificateId: certificate.id,- commonName: certificate.commonName,- profileId: certificate.profileId,- renewBeforeDays: certificate.renewBeforeDays,- ttlDays,- notAfter: certificate.notAfter,- renewalError: certificate.renewalError,- renewedFromCertificateId:- certificate.renewedFromCertificateId,- renewedByCertificateId: certificate.renewedByCertificateId- });- }}- disabled={!isAllowed}- icon={<FontAwesomeIcon icon={faRedo} />}- >- {isAutoRenewalEnabled- ? "Manage auto renewal"- : "Enable auto renewal"}- </DropdownMenuItem>- );- }}+ {(isAllowed) => (+ <UnstableDropdownMenuItem+ isDisabled={!isAllowed}+ onClick={(e) => {+ e.stopPropagation();+ const notAfterDate = new Date(certificate.notAfter);+ const notBeforeDate = certificate.notBefore+ ? new Date(certificate.notBefore)+ : new Date(notAfterDate.getTime() - 365 * MS_PER_DAY);+ const ttlDays = Math.max(+ 1,+ Math.ceil(+ (notAfterDate.getTime() - notBeforeDate.getTime()) /+ MS_PER_DAY+ )+ );+ handlePopUpOpen("manageRenewal", {+ certificateId: certificate.id,+ commonName: certificate.commonName,+ profileId: certificate.profileId,+ renewBeforeDays: certificate.renewBeforeDays,+ ttlDays,+ notAfter: certificate.notAfter,+ renewalError: certificate.renewalError,+ renewedFromCertificateId:+ certificate.renewedFromCertificateId,+ renewedByCertificateId: certificate.renewedByCertificateId+ });+ }}+ >+ <RefreshCwIcon />+ {isAutoRenewalEnabled+ ? "Manage auto renewal"+ : "Enable auto renewal"}+ </UnstableDropdownMenuItem>+ )}</ProjectPermissionCan>);})()}@@ -736,11 +1000,8 @@ export const CertificatesTable = ({ handlePopUpOpen, externalFilter }: Props) =>})}>{(isAllowed) => (- <DropdownMenuItem- className={twMerge(- !isAllowed &&- "pointer-events-none cursor-not-allowed opacity-50"- )}+ <UnstableDropdownMenuItem+ isDisabled={!isAllowed}onClick={async (e) => {e.stopPropagation();await handleDisableAutoRenewal(@@ -748,11 +1009,10 @@ export const CertificatesTable = ({ handlePopUpOpen, externalFilter }: Props) =>certificate.commonName);}}- disabled={!isAllowed}- icon={<FontAwesomeIcon icon={faBan} />}>+ <BanIcon />Disable auto renewal- </DropdownMenuItem>+ </UnstableDropdownMenuItem>)}</ProjectPermissionCan>);@@ -779,11 +1039,8 @@ export const CertificatesTable = ({ handlePopUpOpen, externalFilter }: Props) =>})}>{(isAllowed) => (- <DropdownMenuItem- className={twMerge(- !isAllowed &&- "pointer-events-none cursor-not-allowed opacity-50"- )}+ <UnstableDropdownMenuItem+ isDisabled={!isAllowed}onClick={(e) => {e.stopPropagation();handlePopUpOpen("renewCertificate", {@@ -791,11 +1048,10 @@ export const CertificatesTable = ({ handlePopUpOpen, externalFilter }: Props) =>commonName: certificate.commonName});}}- disabled={!isAllowed}- icon={<FontAwesomeIcon icon={faRedo} />}>+ <RefreshCwIcon />Renew Now- </DropdownMenuItem>+ </UnstableDropdownMenuItem>)}</ProjectPermissionCan>);@@ -808,11 +1064,8 @@ export const CertificatesTable = ({ handlePopUpOpen, externalFilter }: Props) =>a={ProjectPermissionSub.PkiSyncs}>{(isAllowed) => (- <DropdownMenuItem- className={twMerge(- !isAllowed &&- "pointer-events-none cursor-not-allowed opacity-50"- )}+ <UnstableDropdownMenuItem+ isDisabled={!isAllowed}onClick={(e) => {e.stopPropagation();handlePopUpOpen("managePkiSyncs", {@@ -820,11 +1073,10 @@ export const CertificatesTable = ({ handlePopUpOpen, externalFilter }: Props) =>commonName: certificate.commonName});}}- disabled={!isAllowed}- icon={<FontAwesomeIcon icon={faLink} />}>+ <LinkIcon />Manage PKI Syncs- </DropdownMenuItem>+ </UnstableDropdownMenuItem>)}</ProjectPermissionCan>)}@@ -854,22 +1106,19 @@ export const CertificatesTable = ({ handlePopUpOpen, externalFilter }: Props) =>})}>{(isAllowed) => (- <DropdownMenuItem- className={twMerge(- !isAllowed &&- "pointer-events-none cursor-not-allowed opacity-50"- )}+ <UnstableDropdownMenuItem+ variant="danger"+ isDisabled={!isAllowed}onClick={(e) => {e.stopPropagation();handlePopUpOpen("revokeCertificate", {certificateId: certificate.id});}}- disabled={!isAllowed}- icon={<FontAwesomeIcon icon={faBan} />}>+ <BanIcon />Revoke Certificate- </DropdownMenuItem>+ </UnstableDropdownMenuItem>)}</ProjectPermissionCan>);@@ -885,10 +1134,9 @@ export const CertificatesTable = ({ handlePopUpOpen, externalFilter }: Props) =>})}>{(isAllowed) => (- <DropdownMenuItem- className={twMerge(- !isAllowed && "pointer-events-none cursor-not-allowed opacity-50"- )}+ <UnstableDropdownMenuItem+ variant="danger"+ isDisabled={!isAllowed}onClick={(e) => {e.stopPropagation();handlePopUpOpen("deleteCertificate", {@@ -896,41 +1144,51 @@ export const CertificatesTable = ({ handlePopUpOpen, externalFilter }: Props) =>commonName: certificate.commonName});}}- disabled={!isAllowed}- icon={<FontAwesomeIcon icon={faTrash} />}>+ <Trash2Icon />Delete Certificate- </DropdownMenuItem>+ </UnstableDropdownMenuItem>)}</ProjectPermissionCan>- </DropdownMenuContent>- </DropdownMenu>- </Td>- </Tr>- );- })}- </TBody>- </Table>- {!isPending && (data?.totalCount || 0) >= PER_PAGE_INIT && (- <Pagination- count={data?.totalCount || 0}- page={page}- perPage={perPage}- onChangePage={(newPage) => setPage(newPage)}- onChangePerPage={(newPerPage) => setPerPage(newPerPage)}- />- )}- {!isPending && !certificates.length && (- <EmptyState- title={- data?.certificates?.length+ </UnstableDropdownMenuContent>+ </UnstableDropdownMenu>+ </div>+ </UnstableTableCell>+ </UnstableTableRow>+ );+ })}+ </UnstableTableBody>+ </UnstableTable>+ {!isPending && (data?.totalCount || 0) >= PER_PAGE_INIT && (+ <UnstablePagination+ count={data?.totalCount || 0}+ page={page}+ perPage={perPage}+ onChangePage={(newPage) => setPage(newPage)}+ onChangePerPage={(newPerPage) => setPerPage(newPerPage)}+ />+ )}+ {!isPending && !certificates.length && (+ <UnstableEmpty className="border">+ <UnstableEmptyHeader>+ <UnstableEmptyTitle>+ {isTableFiltered || appliedSearch? "No certificates match search..."- : "No certificates have been issued"- }- icon={data?.certificates?.length ? faSearch : faCertificate}- />- )}- </TableContainer>+ : "No certificates have been issued"}+ </UnstableEmptyTitle>+ </UnstableEmptyHeader>+ </UnstableEmpty>+ )}++ <SaveViewModal+ isOpen={isSaveViewOpen}+ onOpenChange={setIsSaveViewOpen}+ projectId={currentProject?.id ?? ""}+ filters={appliedFilters.length > 0 ? appliedFilters : pendingFilters}+ onViewCreated={(viewId, viewFilters) => {+ handleSelectView(viewId, viewFilters);+ }}+ /></div>);};diff --git a/frontend/src/pages/cert-manager/CertificatesPage/components/ColumnVisibilityToggle.tsx b/frontend/src/pages/cert-manager/CertificatesPage/components/ColumnVisibilityToggle.tsxnew file mode 100644index 0000000000..d950b592d5--- /dev/null+++ b/frontend/src/pages/cert-manager/CertificatesPage/components/ColumnVisibilityToggle.tsx@@ -0,0 +1,100 @@+import { Columns3Icon } from "lucide-react";++import {+ UnstableDropdownMenu,+ UnstableDropdownMenuCheckboxItem,+ UnstableDropdownMenuContent,+ UnstableDropdownMenuLabel,+ UnstableDropdownMenuTrigger,+ UnstableIconButton+} from "@app/components/v3";++export type ColumnDef = {+ key: string;+ label: string;+ defaultVisible: boolean;+};++export const INVENTORY_COLUMNS: ColumnDef[] = [+ { key: "sanCn", label: "SAN / CN", defaultVisible: true },+ { key: "serialNumber", label: "Serial Number", defaultVisible: true },+ { key: "enrollmentMethod", label: "Enrollment Method", defaultVisible: true },+ { key: "status", label: "Status", defaultVisible: true },+ { key: "health", label: "Health", defaultVisible: true },+ { key: "issuedAt", label: "Issued", defaultVisible: true },+ { key: "expiresAt", label: "Expires", defaultVisible: true },+ { key: "ca", label: "CA", defaultVisible: true },+ { key: "profile", label: "Profile", defaultVisible: true },+ { key: "algorithm", label: "Algorithm", defaultVisible: true },+ { key: "source", label: "Source", defaultVisible: false }+];++const STORAGE_KEY = "cert-inventory-columns";++export const getDefaultVisibleColumns = (): Set<string> => {+ try {+ const stored = localStorage.getItem(STORAGE_KEY);+ if (stored) {+ return new Set(JSON.parse(stored) as string[]);+ }+ } catch {+ // ignore+ }+ return new Set(INVENTORY_COLUMNS.filter((c) => c.defaultVisible).map((c) => c.key));+};++export const saveVisibleColumns = (columns: Set<string>) => {+ try {+ localStorage.setItem(STORAGE_KEY, JSON.stringify([...columns]));+ } catch {+ // ignore+ }+};++type Props = {+ visibleColumns: Set<string>;+ onChange: (columns: Set<string>) => void;+};++export const ColumnVisibilityToggle = ({ visibleColumns, onChange }: Props) => {+ const hasHiddenColumns = visibleColumns.size < INVENTORY_COLUMNS.length;++ const handleToggle = (key: string) => {+ const next = new Set(visibleColumns);+ if (next.has(key)) {+ next.delete(key);+ } else {+ next.add(key);+ }+ onChange(next);+ saveVisibleColumns(next);+ };++ return (+ <UnstableDropdownMenu>+ <UnstableDropdownMenuTrigger asChild>+ <div className="relative">+ <UnstableIconButton+ variant={hasHiddenColumns ? "project" : "outline"}+ size="md"+ aria-label="Toggle columns"+ >+ <Columns3Icon />+ </UnstableIconButton>+ </div>+ </UnstableDropdownMenuTrigger>+ <UnstableDropdownMenuContent sideOffset={2} className="w-52" align="end">+ <UnstableDropdownMenuLabel>Columns</UnstableDropdownMenuLabel>+ {INVENTORY_COLUMNS.map((col) => (+ <UnstableDropdownMenuCheckboxItem+ key={col.key}+ checked={visibleColumns.has(col.key)}+ onCheckedChange={() => handleToggle(col.key)}+ >+ {col.label}+ </UnstableDropdownMenuCheckboxItem>+ ))}+ </UnstableDropdownMenuContent>+ </UnstableDropdownMenu>+ );+};diff --git a/frontend/src/pages/cert-manager/CertificatesPage/components/FilterBuilder.tsx b/frontend/src/pages/cert-manager/CertificatesPage/components/FilterBuilder.tsxnew file mode 100644index 0000000000..139c7befd3--- /dev/null+++ b/frontend/src/pages/cert-manager/CertificatesPage/components/FilterBuilder.tsx@@ -0,0 +1,313 @@+import { format } from "date-fns";+import { CalendarIcon, PlusIcon, Trash2Icon } from "lucide-react";++import {+ Button,+ Calendar,+ FilterableSelect,+ Popover,+ PopoverContent,+ PopoverTrigger,+ Select,+ SelectContent,+ SelectItem,+ SelectTrigger,+ SelectValue,+ UnstableIconButton,+ UnstableInput+} from "@app/components/v3";++import { FILTER_FIELDS, type FilterFieldDefinition, type FilterRule } from "./inventory-types";++type Props = {+ rules: FilterRule[];+ onChange: (rules: FilterRule[]) => void;+ onApply: () => void;+ onCancel: () => void;+ onClearAll: () => void;+ onSaveView: () => void;+ dynamicFieldOptions?: Record<string, { value: string; label: string }[]>;+};++const getFieldDef = (+ fieldKey: string,+ dynamicOptions?: Record<string, { value: string; label: string }[]>+): FilterFieldDefinition => {+ const baseDef = FILTER_FIELDS.find((f) => f.key === fieldKey);+ if (!baseDef) return FILTER_FIELDS[0];++ if (dynamicOptions && dynamicOptions[fieldKey]) {+ return { ...baseDef, options: dynamicOptions[fieldKey] };+ }+ return baseDef;+};++const DatePickerInput = ({+ value,+ onChange+}: {+ value: string | null;+ onChange: (val: string) => void;+}) => {+ const selectedDate = value ? new Date(value) : undefined;++ return (+ <Popover>+ <PopoverTrigger asChild>+ <Button+ variant="outline"+ size="md"+ data-empty={!value}+ className="w-full justify-start text-left font-normal data-[empty=true]:text-muted"+ >+ <CalendarIcon className="mr-1.5 size-3.5" />+ {selectedDate ? format(selectedDate, "MM/dd/yyyy") : <span>Pick a date</span>}+ </Button>+ </PopoverTrigger>+ <PopoverContent align="start" className="w-auto p-0">+ <Calendar+ mode="single"+ selected={selectedDate}+ onSelect={(date) => {+ if (date) {+ onChange(format(date, "yyyy-MM-dd"));+ }+ }}+ />+ </PopoverContent>+ </Popover>+ );+};++const FilterRow = ({+ rule,+ onUpdate,+ onRemove,+ dynamicFieldOptions: dynOpts+}: {+ rule: FilterRule;+ onUpdate: (updated: FilterRule) => void;+ onRemove: () => void;+ dynamicFieldOptions?: Record<string, { value: string; label: string }[]>;+}) => {+ const fieldDef = getFieldDef(rule.field, dynOpts);++ const handleFieldChange = (newField: string) => {+ const newDef = getFieldDef(newField, dynOpts);+ onUpdate({+ ...rule,+ field: newField,+ operator: newDef.operators[0]?.value || "is",+ value: newDef.valueType === "multi-select" ? [] : null+ });+ };++ const renderValueInput = () => {+ const options = fieldDef.options || [];++ switch (fieldDef.valueType) {+ case "multi-select": {+ const currentValues = Array.isArray(rule.value) ? rule.value : [];+ const selectedOptions = currentValues+ .map((v) => {+ const opt = options.find((o) => o.value === v);+ return opt ? { value: opt.value, label: opt.label } : null;+ })+ .filter(Boolean) as { value: string; label: string }[];++ return (+ <FilterableSelect+ isMulti+ value={selectedOptions}+ onChange={(opts) => {+ const selected = Array.isArray(opts) ? opts.map((o) => o.value) : [];+ onUpdate({ ...rule, value: selected });+ }}+ options={options}+ placeholder="Select..."+ className="w-full text-sm"+ maxMenuHeight={160}+ />+ );+ }+ case "select":+ return (+ <Select+ value={(rule.value as string) || ""}+ onValueChange={(val: string) => onUpdate({ ...rule, value: val })}+ >+ <SelectTrigger className="w-full">+ <SelectValue placeholder="Select..." />+ </SelectTrigger>+ <SelectContent position="popper" align="start">+ {options.map((opt) => (+ <SelectItem key={opt.value} value={opt.value}>+ {opt.label}+ </SelectItem>+ ))}+ </SelectContent>+ </Select>+ );+ case "date":+ return (+ <DatePickerInput+ value={(rule.value as string) || null}+ onChange={(val) => onUpdate({ ...rule, value: val })}+ />+ );+ case "number":+ return (+ <UnstableInput+ type="number"+ value={rule.value !== null ? String(rule.value) : ""}+ onChange={(e) =>+ onUpdate({ ...rule, value: e.target.value ? Number(e.target.value) : null })+ }+ placeholder="Value"+ className="w-full"+ />+ );+ default:+ return (+ <UnstableInput+ value={(rule.value as string) || ""}+ onChange={(e) => onUpdate({ ...rule, value: e.target.value })}+ placeholder="Value"+ className="w-full"+ />+ );+ }+ };++ return (+ <div className="flex items-start gap-2">+ <Select value={rule.field} onValueChange={handleFieldChange}>+ <SelectTrigger className="w-[180px] shrink-0">+ <SelectValue />+ </SelectTrigger>+ <SelectContent position="popper" align="start">+ {FILTER_FIELDS.map((f) => (+ <SelectItem key={f.key} value={f.key}>+ {f.label}+ </SelectItem>+ ))}+ </SelectContent>+ </Select>++ <Select+ value={rule.operator}+ onValueChange={(newOp: string) => onUpdate({ ...rule, operator: newOp })}+ >+ <SelectTrigger className="w-[100px] shrink-0">+ <SelectValue />+ </SelectTrigger>+ <SelectContent position="popper" align="start">+ {fieldDef.operators.map((op) => (+ <SelectItem key={op.value} value={op.value}>+ {op.label}+ </SelectItem>+ ))}+ </SelectContent>+ </Select>++ <div className="min-w-0 flex-1">{renderValueInput()}</div>++ <UnstableIconButton+ variant="ghost"+ size="xs"+ onClick={onRemove}+ aria-label="Remove filter"+ className="mt-1.5 shrink-0 hover:text-red-400"+ >+ <Trash2Icon />+ </UnstableIconButton>+ </div>+ );+};++export const FilterBuilder = ({+ rules,+ onChange,+ onApply,+ onCancel,+ onClearAll,+ onSaveView,+ dynamicFieldOptions+}: Props) => {+ const handleAddRule = () => {+ const defaultField = FILTER_FIELDS[0];+ onChange([+ ...rules,+ {+ id: crypto.randomUUID(),+ field: defaultField.key,+ operator: defaultField.operators[0]?.value || "is",+ value: defaultField.valueType === "multi-select" ? [] : null+ }+ ]);+ };++ const handleUpdateRule = (index: number, updated: FilterRule) => {+ const newRules = [...rules];+ newRules[index] = updated;+ onChange(newRules);+ };++ const handleRemoveRule = (index: number) => {+ onChange(rules.filter((_, i) => i !== index));+ };++ return (+ <div className="space-y-3 p-4">+ <div className="flex items-center justify-between">+ <span className="text-sm font-medium text-foreground">Filters</span>+ {rules.length > 0 && (+ <Button variant="ghost" size="xs" onClick={onClearAll} className="h-auto p-0 text-xs">+ Clear all+ </Button>+ )}+ </div>++ {rules.length === 0 ? (+ <p className="py-3 text-center text-xs text-muted">+ No filters applied. Click "Add filter" to get started.+ </p>+ ) : (+ <div className="space-y-1.5">+ {rules.map((rule, index) => (+ <div key={rule.id}>+ {index > 0 && (+ <div className="py-0.5 pl-1 text-[10px] font-medium text-muted uppercase">AND</div>+ )}+ <FilterRow+ rule={rule}+ onUpdate={(updated) => handleUpdateRule(index, updated)}+ onRemove={() => handleRemoveRule(index)}+ dynamicFieldOptions={dynamicFieldOptions}+ />+ </div>+ ))}+ </div>+ )}++ <Button variant="ghost" size="xs" onClick={handleAddRule} className="gap-1">+ <PlusIcon />+ Add filter+ </Button>++ <div className="flex items-center justify-between border-t border-border pt-3">+ <Button variant="outline" size="xs" onClick={onSaveView}>+ Save as View...+ </Button>+ <div className="flex items-center gap-2">+ <Button variant="ghost" size="sm" onClick={onCancel}>+ Cancel+ </Button>+ <Button variant="project" size="sm" onClick={onApply}>+ Apply Filters+ </Button>+ </div>+ </div>+ </div>+ );+};diff --git a/frontend/src/pages/cert-manager/CertificatesPage/components/SaveViewModal.tsx b/frontend/src/pages/cert-manager/CertificatesPage/components/SaveViewModal.tsxnew file mode 100644index 0000000000..e84511c1b7--- /dev/null+++ b/frontend/src/pages/cert-manager/CertificatesPage/components/SaveViewModal.tsx@@ -0,0 +1,101 @@+import { useState } from "react";++import { createNotification } from "@app/components/notifications";+import {+ Button,+ Dialog,+ DialogClose,+ DialogContent,+ DialogFooter,+ DialogHeader,+ DialogTitle,+ UnstableInput+} from "@app/components/v3";+import { useCreateCertificateInventoryView } from "@app/hooks/api/certificateInventoryViews";+import type { TInventoryViewFilters } from "@app/hooks/api/certificateInventoryViews/types";++import { type FilterRule, filtersToSearchParams } from "./inventory-types";++type Props = {+ isOpen: boolean;+ onOpenChange: (isOpen: boolean) => void;+ projectId: string;+ filters: FilterRule[];+ onViewCreated?: (viewId: string, filters: TInventoryViewFilters) => void;+};++export const SaveViewModal = ({+ isOpen,+ onOpenChange,+ projectId,+ filters,+ onViewCreated+}: Props) => {+ const [name, setName] = useState("");+ const { mutateAsync: createView, isPending } = useCreateCertificateInventoryView();++ const handleSave = async () => {+ if (!name.trim()) return;++ try {+ const apiFilters = filtersToSearchParams(filters);+ const result = await createView({+ projectId,+ name: name.trim(),+ filters: apiFilters+ });+ createNotification({+ text: `View "${name}" saved successfully`,+ type: "success"+ });+ setName("");+ onOpenChange(false);+ if (onViewCreated && result?.id) {+ onViewCreated(result.id, apiFilters);+ }+ } catch {+ createNotification({+ text: "Failed to save view",+ type: "error"+ });+ }+ };++ return (+ <Dialog+ open={isOpen}+ onOpenChange={(open) => {+ if (!open) setName("");+ onOpenChange(open);+ }}+ >+ <DialogContent className="max-w-md">+ <DialogHeader>+ <DialogTitle>Save View As</DialogTitle>+ </DialogHeader>+ <form+ onSubmit={(e) => {+ e.preventDefault();+ handleSave();+ }}+ >+ <UnstableInput+ value={name}+ onChange={(e) => setName(e.target.value)}+ placeholder="Enter view name"+ autoFocus+ className="mt-2"+ />+ <DialogFooter className="mt-6">+ <DialogClose asChild>+ <Button variant="ghost">Cancel</Button>+ </DialogClose>+ <Button type="submit" variant="project" isPending={isPending} isDisabled={!name.trim()}>+ Save+ </Button>+ </DialogFooter>+ </form>+ </DialogContent>+ </Dialog>+ );+};diff --git a/frontend/src/pages/cert-manager/CertificatesPage/components/ViewsDropdown.tsx b/frontend/src/pages/cert-manager/CertificatesPage/components/ViewsDropdown.tsxnew file mode 100644index 0000000000..39de85f168--- /dev/null+++ b/frontend/src/pages/cert-manager/CertificatesPage/components/ViewsDropdown.tsx@@ -0,0 +1,101 @@+import { ChevronDownIcon, Trash2Icon } from "lucide-react";++import {+ UnstableDropdownMenu,+ UnstableDropdownMenuContent,+ UnstableDropdownMenuLabel,+ UnstableDropdownMenuRadioGroup,+ UnstableDropdownMenuRadioItem,+ UnstableDropdownMenuSeparator,+ UnstableDropdownMenuTrigger+} from "@app/components/v3";+import { TSystemView } from "@app/hooks/api/certificateInventoryViews";+import type {+ TCertificateInventoryView,+ TInventoryViewFilters,+ TSystemViewFilters+} from "@app/hooks/api/certificateInventoryViews/types";++type Props = {+ activeViewId: string | null;+ systemViews: TSystemView[];+ customViews: (TCertificateInventoryView & { isSystem: false })[];+ onSelectView: (viewId: string, filters: TInventoryViewFilters | TSystemViewFilters) => void;+ onDeleteView: (viewId: string) => void;+};++export const ViewsDropdown = ({+ activeViewId,+ systemViews,+ customViews,+ onSelectView,+ onDeleteView+}: Props) => {+ const activeView =+ systemViews.find((v) => v.id === activeViewId) ||+ customViews.find((v) => v.id === activeViewId);+ const label = activeView?.name || "All Certificates";++ return (+ <UnstableDropdownMenu>+ <UnstableDropdownMenuTrigger asChild>+ <button+ type="button"+ aria-label="Select certificate view"+ className="flex h-9 w-[190px] items-center justify-between rounded-md border border-border px-3 text-sm text-foreground transition-all hover:border-foreground/50 hover:bg-foreground/20"+ >+ <span className="truncate">{label}</span>+ <ChevronDownIcon className="size-3.5 shrink-0 text-muted" />+ </button>+ </UnstableDropdownMenuTrigger>+ <UnstableDropdownMenuContent sideOffset={2} className="w-64" align="end">+ <UnstableDropdownMenuLabel>System Views</UnstableDropdownMenuLabel>+ <UnstableDropdownMenuRadioGroup value={activeViewId || "system-all"}>+ {systemViews.map((view) => (+ <UnstableDropdownMenuRadioItem+ key={view.id}+ value={view.id}+ onClick={() => onSelectView(view.id, view.filters)}+ >+ {view.name}+ </UnstableDropdownMenuRadioItem>+ ))}+ </UnstableDropdownMenuRadioGroup>++ <UnstableDropdownMenuSeparator />++ <UnstableDropdownMenuLabel>Custom Views</UnstableDropdownMenuLabel>+ {customViews.length === 0 ? (+ <div className="px-2 py-2 text-center text-xs text-muted">+ No custom views saved yet.+ <br />+ Apply filters and click "Save as View"+ </div>+ ) : (+ <UnstableDropdownMenuRadioGroup value={activeViewId || ""}>+ {customViews.map((view) => (+ <UnstableDropdownMenuRadioItem+ key={view.id}+ value={view.id}+ className="group"+ onClick={() => onSelectView(view.id, view.filters as Record<string, unknown>)}+ >+ <span className="flex-1">{view.name}</span>+ <button+ type="button"+ onClick={(e) => {+ e.stopPropagation();+ onDeleteView(view.id);+ }}+ className="ml-2 text-muted opacity-0 transition-opacity group-hover:opacity-100 hover:text-red-400"+ >+ <Trash2Icon className="size-3.5" />+ </button>+ </UnstableDropdownMenuRadioItem>+ ))}+ </UnstableDropdownMenuRadioGroup>+ )}+ </UnstableDropdownMenuContent>+ </UnstableDropdownMenu>+ );+};diff --git a/frontend/src/pages/cert-manager/CertificatesPage/components/csvExport.ts b/frontend/src/pages/cert-manager/CertificatesPage/components/csvExport.tsnew file mode 100644index 0000000000..31e9a6ad80--- /dev/null+++ b/frontend/src/pages/cert-manager/CertificatesPage/components/csvExport.ts@@ -0,0 +1,47 @@+import { TCertificate } from "@app/hooks/api/certificates/types";++const CSV_COLUMNS = [+ { key: "commonName", header: "Common Name" },+ { key: "altNames", header: "SANs" },+ { key: "serialNumber", header: "Serial Number" },+ { key: "status", header: "Status" },+ { key: "enrollmentType", header: "Enrollment Method" },+ { key: "keyAlgorithm", header: "Algorithm" },+ { key: "notBefore", header: "Issued" },+ { key: "notAfter", header: "Expires" },+ { key: "caName", header: "CA" },+ { key: "profileName", header: "Profile" },+ { key: "source", header: "Source" }+] as const;++const escapeCSV = (value: string | null | undefined): string => {+ if (value === null || value === undefined) return "";+ const str = String(value);+ if (str.includes(",") || str.includes('"') || str.includes("\n")) {+ return `"${str.replace(/"/g, '""')}"`;+ }+ return str;+};++export const certificatesToCSV = (certificates: TCertificate[]): string => {+ const header = CSV_COLUMNS.map((col) => col.header).join(",");+ const rows = certificates.map((cert) =>+ CSV_COLUMNS.map((col) => {+ const value = cert[col.key as keyof TCertificate];+ if (value === null || value === undefined) return "";+ if (typeof value === "object") return escapeCSV(JSON.stringify(value));+ return escapeCSV(String(value));+ }).join(",")+ );+ return [header, ...rows].join("\n");+};++export const downloadCSV = (csv: string, filename: string) => {+ const blob = new Blob([csv], { type: "text/csv;charset=utf-8;" });+ const url = URL.createObjectURL(blob);+ const link = document.createElement("a");+ link.href = url;+ link.download = filename;+ link.click();+ URL.revokeObjectURL(url);+};diff --git a/frontend/src/pages/cert-manager/CertificatesPage/components/inventory-types.ts b/frontend/src/pages/cert-manager/CertificatesPage/components/inventory-types.tsnew file mode 100644index 0000000000..46be045d55--- /dev/null+++ b/frontend/src/pages/cert-manager/CertificatesPage/components/inventory-types.ts@@ -0,0 +1,230 @@+import type { TInventoryViewFilters } from "@app/hooks/api/certificateInventoryViews/types";++export type FilterRule = {+ id: string;+ field: string;+ operator: string;+ value: string | string[] | number | Date | null;+};++export type FilterFieldDefinition = {+ key: string;+ label: string;+ operators: { value: string; label: string }[];+ valueType: "text" | "number" | "date" | "select" | "multi-select";+ options?: { value: string; label: string }[];+};++export const FILTER_FIELDS: FilterFieldDefinition[] = [+ {+ key: "status",+ label: "Status",+ operators: [{ value: "in", label: "in" }],+ valueType: "multi-select",+ options: [+ { value: "active", label: "Active" },+ { value: "expired", label: "Expired" },+ { value: "revoked", label: "Revoked" }+ ]+ },+ {+ key: "notAfter",+ label: "Expiration Date",+ operators: [+ { value: "before", label: "before" },+ { value: "after", label: "after" }+ ],+ valueType: "date"+ },+ {+ key: "notBefore",+ label: "Issued Date",+ operators: [+ { value: "before", label: "before" },+ { value: "after", label: "after" }+ ],+ valueType: "date"+ },+ {+ key: "enrollmentType",+ label: "Enrollment Method",+ operators: [{ value: "in", label: "in" }],+ valueType: "multi-select",+ options: [+ { value: "acme", label: "ACME" },+ { value: "api", label: "API" },+ { value: "est", label: "EST" },+ { value: "scep", label: "SCEP" }+ ]+ },+ {+ key: "keyAlgorithm",+ label: "Algorithm",+ operators: [{ value: "is", label: "is" }],+ valueType: "select",+ options: [+ { value: "RSA_2048", label: "RSA-2048" },+ { value: "RSA_3072", label: "RSA-3072" },+ { value: "RSA_4096", label: "RSA-4096" },+ { value: "EC_prime256v1", label: "ECDSA-P256" },+ { value: "EC_secp384r1", label: "ECDSA-P384" },+ { value: "EC_secp521r1", label: "ECDSA-P521" }+ ]+ },+ {+ key: "keySize",+ label: "Key Size",+ operators: [{ value: "in", label: "in" }],+ valueType: "multi-select",+ options: [+ { value: "256", label: "256-bit (ECDSA)" },+ { value: "384", label: "384-bit (ECDSA)" },+ { value: "521", label: "521-bit (ECDSA)" },+ { value: "2048", label: "2048-bit (RSA)" },+ { value: "3072", label: "3072-bit (RSA)" },+ { value: "4096", label: "4096-bit (RSA)" }+ ]+ },+ {+ key: "source",+ label: "Source",+ operators: [{ value: "is", label: "is" }],+ valueType: "select",+ options: [+ { value: "issued", label: "Managed" },+ { value: "discovered", label: "Discovered" },+ { value: "imported", label: "Imported" }+ ]+ },+ {+ key: "caId",+ label: "Certificate Authority",+ operators: [{ value: "in", label: "in" }],+ valueType: "multi-select",+ options: []+ },+ {+ key: "profileId",+ label: "Profile",+ operators: [{ value: "in", label: "in" }],+ valueType: "multi-select",+ options: []+ }+];++export const filtersToSearchParams = (rules: FilterRule[]): TInventoryViewFilters => {+ const params: TInventoryViewFilters = {};++ rules.forEach((rule) => {+ switch (rule.field) {+ case "status":+ if (Array.isArray(rule.value) && rule.value.length > 0) {+ params.status = rule.value.join(",");+ }+ break;+ case "notAfter":+ if (rule.operator === "before" && rule.value) {+ params.notAfterTo = new Date(rule.value as string);+ } else if (rule.operator === "after" && rule.value) {+ params.notAfterFrom = new Date(rule.value as string);+ }+ break;+ case "notBefore":+ if (rule.operator === "before" && rule.value) {+ params.notBeforeTo = new Date(rule.value as string);+ } else if (rule.operator === "after" && rule.value) {+ params.notBeforeFrom = new Date(rule.value as string);+ }+ break;+ case "enrollmentType":+ if (Array.isArray(rule.value) && rule.value.length > 0) {+ params.enrollmentTypes = rule.value;+ }+ break;+ case "keyAlgorithm":+ if (rule.value) {+ params.keyAlgorithm = rule.value as string;+ }+ break;+ case "source":+ if (rule.value) {+ params.source = rule.value as string;+ }+ break;+ case "keySize":+ if (Array.isArray(rule.value) && rule.value.length > 0) {+ params.keySizes = rule.value.map(Number);+ }+ break;+ case "caId":+ if (Array.isArray(rule.value) && rule.value.length > 0) {+ params.caIds = rule.value;+ }+ break;+ case "profileId":+ if (Array.isArray(rule.value) && rule.value.length > 0) {+ params.profileIds = rule.value;+ }+ break;+ default:+ break;+ }+ });++ return params;+};++export const getFilterChipLabel = (+ rule: FilterRule,+ dynamicFieldOptions?: Record<string, { value: string; label: string }[]>+): string => {+ const baseDef = FILTER_FIELDS.find((f) => f.key === rule.field);+ const fieldLabel = baseDef?.label || rule.field;++ const options =+ dynamicFieldOptions && dynamicFieldOptions[rule.field]+ ? dynamicFieldOptions[rule.field]+ : baseDef?.options || [];++ if (Array.isArray(rule.value)) {+ const values = rule.value;+ if (values.length === 1) {+ const opt = options.find((o) => o.value === values[0]);+ return `${fieldLabel}: ${opt?.label || values[0]}`;+ }+ return `${fieldLabel}: ${values.length} selected`;+ }++ if (rule.value instanceof Date) {+ return `${fieldLabel} ${rule.operator} ${rule.value.toLocaleDateString()}`;+ }++ if (typeof rule.value === "string" && (rule.field === "notAfter" || rule.field === "notBefore")) {+ return `${fieldLabel} ${rule.operator} ${rule.value}`;+ }++ if (typeof rule.value === "number") {+ return `${fieldLabel}: ${rule.value}`;+ }++ const opt = options.find((o) => o.value === rule.value);+ return `${fieldLabel}: ${opt?.label || rule.value}`;+};++export const getFilterMultiSelectLabels = (+ rule: FilterRule,+ dynamicFieldOptions?: Record<string, { value: string; label: string }[]>+): string[] => {+ if (!Array.isArray(rule.value)) return [];++ const baseDef = FILTER_FIELDS.find((f) => f.key === rule.field);+ const options =+ dynamicFieldOptions && dynamicFieldOptions[rule.field]+ ? dynamicFieldOptions[rule.field]+ : baseDef?.options || [];++ return rule.value.map((v) => {+ const opt = options.find((o) => o.value === v);+ return opt?.label || String(v);+ });+};diff --git a/frontend/src/pages/cert-manager/DashboardPage/DashboardPage.tsx b/frontend/src/pages/cert-manager/DashboardPage/DashboardPage.tsxnew file mode 100644index 0000000000..f5c0fddf86--- /dev/null+++ b/frontend/src/pages/cert-manager/DashboardPage/DashboardPage.tsx@@ -0,0 +1,97 @@+import { useCallback, useState } from "react";+import { Helmet } from "react-helmet";+import { useTranslation } from "react-i18next";+import { useNavigate } from "@tanstack/react-router";++import { ProjectPermissionCan } from "@app/components/permissions";+import { PageHeader } from "@app/components/v2";+import { UnstablePageLoader } from "@app/components/v3";+import { useProject } from "@app/context";+import {+ ProjectPermissionCertificateActions,+ ProjectPermissionSub+} from "@app/context/ProjectPermissionContext/types";+import { useGetCertActivityTrend, useGetCertDashboardStats } from "@app/hooks/api/certificates";+import { ProjectType } from "@app/hooks/api/projects/types";++import {+ ActivityTrend,+ CodeSigningSection,+ DistributionCharts,+ ExpirationTimeline,+ KpiCards+} from "./components";++export const DashboardPage = () => {+ const { t } = useTranslation();+ const { currentProject } = useProject();+ const navigate = useNavigate();+ const [trendRange, setTrendRange] = useState("30d");++ const { data: stats, isPending: isStatsLoading } = useGetCertDashboardStats(+ currentProject?.id || ""+ );+ const { data: trendData } = useGetCertActivityTrend(currentProject?.id || "", trendRange);++ const navigateToInventory = useCallback(+ (filters: Record<string, string | undefined>) => {+ navigate({+ to: "/organizations/$orgId/projects/cert-manager/$projectId/policies",+ params: {+ orgId: currentProject?.orgId || "",+ projectId: currentProject?.id || ""+ },+ // eslint-disable-next-line @typescript-eslint/no-explicit-any+ search: { selectedTab: "certificates", ...filters } as any+ });+ },+ [navigate, currentProject]+ );++ if (!currentProject) {+ return <UnstablePageLoader />;+ }++ return (+ <div className="h-full bg-bunker-800">+ <Helmet>+ <title>{t("common.head-title", { title: "Certificate Dashboard" })}</title>+ </Helmet>+ <div className="mx-auto flex flex-col bg-bunker-800 text-white">+ <div className="mx-auto mb-6 w-full max-w-8xl">+ <PageHeader+ scope={ProjectType.CertificateManager}+ title="Certificate Dashboard"+ description="At-a-glance view of your certificate estate."+ />+ <ProjectPermissionCan+ renderGuardBanner+ I={ProjectPermissionCertificateActions.Read}+ a={ProjectPermissionSub.Certificates}+ >+ {isStatsLoading || !stats ? (+ <UnstablePageLoader />+ ) : (+ <div className="flex flex-col gap-6">+ <KpiCards stats={stats} onNavigate={navigateToInventory} />+ <div className="grid auto-rows-[1fr] grid-cols-1 gap-4 sm:grid-cols-2 xl:grid-cols-4">+ <DistributionCharts stats={stats} onNavigate={navigateToInventory} />+ <ExpirationTimeline+ buckets={stats.expirationBuckets}+ onNavigate={navigateToInventory}+ />+ </div>+ <CodeSigningSection projectId={currentProject.id} />+ <ActivityTrend+ data={trendData?.periods || []}+ currentRange={trendRange}+ onRangeChange={setTrendRange}+ />+ </div>+ )}+ </ProjectPermissionCan>+ </div>+ </div>+ </div>+ );+};diff --git a/frontend/src/pages/cert-manager/DashboardPage/components/ActivityTrend.tsx b/frontend/src/pages/cert-manager/DashboardPage/components/ActivityTrend.tsxnew file mode 100644index 0000000000..1288411f5f--- /dev/null+++ b/frontend/src/pages/cert-manager/DashboardPage/components/ActivityTrend.tsx@@ -0,0 +1,132 @@+import {+ CartesianGrid,+ Legend,+ Line,+ LineChart,+ ResponsiveContainer,+ Tooltip,+ XAxis,+ YAxis+} from "recharts";++import {+ Button,+ UnstableCard,+ UnstableCardContent,+ UnstableCardHeader,+ UnstableCardTitle,+ UnstableEmpty,+ UnstableEmptyHeader,+ UnstableEmptyTitle+} from "@app/components/v3";+import type { TActivityTrendPoint } from "@app/hooks/api/certificates";++import { formatTickLabel, legendFormatter, nonZeroDot, TREND_COLORS } from "./chart-theme";++type Props = {+ data: TActivityTrendPoint[];+ onRangeChange: (range: string) => void;+ currentRange: string;+};++const SERIES_KEYS = ["issued", "expired", "revoked", "renewed"];++const ranges = [+ { label: "7D", value: "7d" },+ { label: "30D", value: "30d" },+ { label: "6M", value: "6m" }+];++export const ActivityTrend = ({ data, onRangeChange, currentRange }: Props) => {+ const hasAnyData = data.some(+ (d) => d.issued > 0 || d.expired > 0 || d.revoked > 0 || d.renewed > 0+ );+ return (+ <UnstableCard>+ <UnstableCardHeader className="flex-row items-center gap-2">+ <UnstableCardTitle className="text-sm">Certificate Activity Trend</UnstableCardTitle>+ <div className="ml-auto flex gap-0.5 pr-5">+ {ranges.map((r) => (+ <Button+ key={r.value}+ size="xs"+ variant={currentRange === r.value ? "neutral" : "ghost"}+ onClick={() => onRangeChange(r.value)}+ >+ {r.label}+ </Button>+ ))}+ </div>+ </UnstableCardHeader>+ <UnstableCardContent>+ {!hasAnyData ? (+ <UnstableEmpty className="h-[250px]">+ <UnstableEmptyHeader>+ <UnstableEmptyTitle>No activity in this period</UnstableEmptyTitle>+ </UnstableEmptyHeader>+ </UnstableEmpty>+ ) : (+ <ResponsiveContainer width="100%" height={250}>+ <LineChart data={data} margin={{ top: 5, right: 20, bottom: 5, left: 0 }}>+ <CartesianGrid strokeDasharray="3 3" stroke="var(--color-border)" />+ <XAxis+ dataKey="period"+ tickFormatter={formatTickLabel}+ tick={{ fill: "var(--color-muted)", fontSize: 12 }}+ axisLine={{ stroke: "var(--color-border)" }}+ />+ <YAxis+ tick={{ fill: "var(--color-muted)", fontSize: 12 }}+ axisLine={{ stroke: "var(--color-border)" }}+ allowDecimals={false}+ />+ <Tooltip+ contentStyle={{+ backgroundColor: "var(--color-popover)",+ border: "1px solid var(--color-border)",+ borderRadius: "6px",+ color: "var(--color-foreground)"+ }}+ />+ <Legend formatter={legendFormatter} />+ <Line+ type="monotone"+ dataKey="issued"+ stroke={TREND_COLORS.issued}+ strokeWidth={2}+ dot={nonZeroDot("issued", TREND_COLORS.issued, SERIES_KEYS)}+ activeDot={{ r: 4 }}+ />+ <Line+ type="monotone"+ dataKey="expired"+ stroke={TREND_COLORS.expired}+ strokeWidth={2}+ dot={nonZeroDot("expired", TREND_COLORS.expired, SERIES_KEYS)}+ activeDot={{ r: 4 }}+ strokeDasharray="4 2"+ />+ <Line+ type="monotone"+ dataKey="revoked"+ stroke={TREND_COLORS.revoked}+ strokeWidth={2}+ dot={nonZeroDot("revoked", TREND_COLORS.revoked, SERIES_KEYS)}+ activeDot={{ r: 4 }}+ strokeDasharray="6 3"+ />+ <Line+ type="monotone"+ dataKey="renewed"+ stroke={TREND_COLORS.renewed}+ strokeWidth={2}+ dot={nonZeroDot("renewed", TREND_COLORS.renewed, SERIES_KEYS)}+ activeDot={{ r: 4 }}+ />+ </LineChart>+ </ResponsiveContainer>+ )}+ </UnstableCardContent>+ </UnstableCard>+ );+};diff --git a/frontend/src/pages/cert-manager/DashboardPage/components/CodeSigningSection.tsx b/frontend/src/pages/cert-manager/DashboardPage/components/CodeSigningSection.tsxnew file mode 100644index 0000000000..a71d3bffa4--- /dev/null+++ b/frontend/src/pages/cert-manager/DashboardPage/components/CodeSigningSection.tsx@@ -0,0 +1,244 @@+import { useMemo, useState } from "react";+import { format } from "date-fns";+import {+ CartesianGrid,+ Legend,+ Line,+ LineChart,+ ResponsiveContainer,+ Tooltip,+ XAxis,+ YAxis+} from "recharts";++import {+ Button,+ Select,+ SelectContent,+ SelectItem,+ SelectTrigger,+ SelectValue,+ UnstableCard,+ UnstableCardContent,+ UnstableCardHeader,+ UnstableCardTitle,+ UnstableEmpty,+ UnstableEmptyHeader,+ UnstableEmptyTitle+} from "@app/components/v3";+import {+ SigningOperationStatus,+ TSigningOperation,+ useListSigners,+ useListSigningOperations+} from "@app/hooks/api/signers";++import { formatTickLabel, legendFormatter, nonZeroDot, TREND_COLORS } from "./chart-theme";++type Props = {+ projectId: string;+};++const ALL_SIGNERS = "__all__";++const ranges = [+ { label: "7D", value: "7d", days: 7 },+ { label: "30D", value: "30d", days: 30 },+ { label: "6M", value: "6m", days: 180 }+];++const buildTrendData = (operations: TSigningOperation[], daysBack: number) => {+ const useDaily = daysBack <= 30;+ const formatKey = useDaily ? "yyyy-MM-dd" : "yyyy-MM";+ const bucketMap = new Map<string, { success: number; failed: number }>();++ operations.forEach((op) => {+ const key = format(new Date(op.createdAt), formatKey);+ const entry = bucketMap.get(key) || { success: 0, failed: 0 };+ if (op.status === SigningOperationStatus.Success) {+ entry.success += 1;+ } else {+ entry.failed += 1;+ }+ bucketMap.set(key, entry);+ });++ const now = new Date();+ const cursor = new Date();+ cursor.setDate(cursor.getDate() - daysBack);+ cursor.setHours(0, 0, 0, 0);+ if (!useDaily) cursor.setDate(1);++ const result: { period: string; success: number; failed: number }[] = [];+ while (cursor <= now) {+ const key = format(cursor, formatKey);+ const entry = bucketMap.get(key) || { success: 0, failed: 0 };+ result.push({ period: key, ...entry });+ if (useDaily) {+ cursor.setDate(cursor.getDate() + 1);+ } else {+ cursor.setMonth(cursor.getMonth() + 1);+ }+ }+ return result;+};++export const CodeSigningSection = ({ projectId }: Props) => {+ const { data: signersData } = useListSigners({ projectId, limit: 100 });+ const signers = signersData?.signers || [];++ const [selectedSignerId, setSelectedSignerId] = useState<string>(ALL_SIGNERS);+ const [currentRange, setCurrentRange] = useState("30d");+ const activeDays = ranges.find((r) => r.value === currentRange)?.days || 30;++ const signerIds = signers.map((s) => s.id);+ const firstSignerId = signerIds[0] || "";+ const secondSignerId = signerIds[1] || "";+ const thirdSignerId = signerIds[2] || "";+ const fourthSignerId = signerIds[3] || "";+ const fifthSignerId = signerIds[4] || "";++ const { data: ops1 } = useListSigningOperations({ signerId: firstSignerId, limit: 100 });+ const { data: ops2 } = useListSigningOperations({ signerId: secondSignerId, limit: 100 });+ const { data: ops3 } = useListSigningOperations({ signerId: thirdSignerId, limit: 100 });+ const { data: ops4 } = useListSigningOperations({ signerId: fourthSignerId, limit: 100 });+ const { data: ops5 } = useListSigningOperations({ signerId: fifthSignerId, limit: 100 });++ const allOperationsMap = useMemo(() => {+ const map = new Map<string, TSigningOperation[]>();+ const queryResults = [+ { id: firstSignerId, data: ops1 },+ { id: secondSignerId, data: ops2 },+ { id: thirdSignerId, data: ops3 },+ { id: fourthSignerId, data: ops4 },+ { id: fifthSignerId, data: ops5 }+ ];+ queryResults.forEach(({ id, data }) => {+ if (id && data?.operations) {+ map.set(id, data.operations);+ }+ });+ return map;+ }, [+ firstSignerId,+ secondSignerId,+ thirdSignerId,+ fourthSignerId,+ fifthSignerId,+ ops1,+ ops2,+ ops3,+ ops4,+ ops5+ ]);++ const filteredOperations = useMemo(() => {+ let ops: TSigningOperation[];+ if (selectedSignerId === ALL_SIGNERS) {+ ops = Array.from(allOperationsMap.values()).flat();+ } else {+ ops = allOperationsMap.get(selectedSignerId) || [];+ }+ const cutoffDate = new Date();+ cutoffDate.setDate(cutoffDate.getDate() - activeDays);+ return ops+ .filter((op) => new Date(op.createdAt) >= cutoffDate)+ .sort((a, b) => new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime());+ }, [selectedSignerId, allOperationsMap, activeDays]);++ const trendData = useMemo(+ () => buildTrendData(filteredOperations, activeDays),+ [filteredOperations, activeDays]+ );++ if (signers.length === 0) {+ return null;+ }++ return (+ <UnstableCard>+ <UnstableCardHeader className="flex-row items-center gap-2">+ <UnstableCardTitle className="text-sm">Code Signing Activity</UnstableCardTitle>+ <div className="ml-auto flex items-center gap-2 pr-5">+ <div className="flex gap-0.5">+ {ranges.map((r) => (+ <Button+ key={r.value}+ size="xs"+ variant={currentRange === r.value ? "neutral" : "ghost"}+ onClick={() => setCurrentRange(r.value)}+ >+ {r.label}+ </Button>+ ))}+ </div>+ <Select value={selectedSignerId} onValueChange={setSelectedSignerId}>+ <SelectTrigger size="sm" className="w-[160px]">+ <SelectValue placeholder="Select signer" />+ </SelectTrigger>+ <SelectContent>+ <SelectItem value={ALL_SIGNERS}>All Signers</SelectItem>+ {signers.map((s) => (+ <SelectItem key={s.id} value={s.id}>+ {s.name}+ </SelectItem>+ ))}+ </SelectContent>+ </Select>+ </div>+ </UnstableCardHeader>+ <UnstableCardContent>+ {trendData.length === 0 ? (+ <UnstableEmpty className="h-[250px]">+ <UnstableEmptyHeader>+ <UnstableEmptyTitle>No signing operations yet</UnstableEmptyTitle>+ </UnstableEmptyHeader>+ </UnstableEmpty>+ ) : (+ <ResponsiveContainer width="100%" height={250}>+ <LineChart data={trendData} margin={{ top: 5, right: 20, bottom: 5, left: 0 }}>+ <CartesianGrid strokeDasharray="3 3" stroke="var(--color-border)" />+ <XAxis+ dataKey="period"+ tickFormatter={formatTickLabel}+ tick={{ fill: "var(--color-muted)", fontSize: 12 }}+ axisLine={{ stroke: "var(--color-border)" }}+ />+ <YAxis+ tick={{ fill: "var(--color-muted)", fontSize: 12 }}+ axisLine={{ stroke: "var(--color-border)" }}+ allowDecimals={false}+ />+ <Tooltip+ contentStyle={{+ backgroundColor: "var(--color-popover)",+ border: "1px solid var(--color-border)",+ borderRadius: "6px",+ color: "var(--color-foreground)"+ }}+ />+ <Legend formatter={legendFormatter} />+ <Line+ type="monotone"+ dataKey="success"+ stroke={TREND_COLORS.renewed}+ strokeWidth={2}+ dot={nonZeroDot("success", TREND_COLORS.renewed)}+ activeDot={{ r: 4 }}+ />+ <Line+ type="monotone"+ dataKey="failed"+ stroke={TREND_COLORS.expired}+ strokeWidth={2}+ dot={nonZeroDot("failed", TREND_COLORS.expired)}+ activeDot={{ r: 4 }}+ strokeDasharray="4 2"+ />+ </LineChart>+ </ResponsiveContainer>+ )}+ </UnstableCardContent>+ </UnstableCard>+ );+};diff --git a/frontend/src/pages/cert-manager/DashboardPage/components/DistributionCharts.tsx b/frontend/src/pages/cert-manager/DashboardPage/components/DistributionCharts.tsxnew file mode 100644index 0000000000..4c5d862309--- /dev/null+++ b/frontend/src/pages/cert-manager/DashboardPage/components/DistributionCharts.tsx@@ -0,0 +1,211 @@+import { Cell, Pie, PieChart, ResponsiveContainer, Tooltip as RechartsTooltip } from "recharts";++import {+ Tooltip,+ TooltipContent,+ TooltipTrigger,+ UnstableCard,+ UnstableCardContent,+ UnstableCardHeader,+ UnstableCardTitle,+ UnstableEmpty,+ UnstableEmptyHeader,+ UnstableEmptyTitle+} from "@app/components/v3";+import type { TDashboardDistribution, TDashboardStats } from "@app/hooks/api/certificates";+import { certKeyAlgorithmToNameMap } from "@app/hooks/api/certificates/constants";++import { CHART_COLORS, CHART_COLORS_HEX } from "./chart-theme";++type Props = {+ stats: TDashboardStats;+ onNavigate: (filters: Record<string, string | undefined>) => void;+};++type ChartKey = "enrollmentMethod" | "algorithm" | "ca";++const DonutChart = ({+ title,+ subtitle,+ data,+ chartKey,+ onSegmentClick+}: {+ title: string;+ subtitle?: string;+ data: TDashboardDistribution[];+ chartKey: ChartKey;+ onSegmentClick?: (entry: TDashboardDistribution) => void;+}) => {+ const nonZeroData = data.filter((d) => d.count > 0);+ const total = data.reduce((sum, d) => sum + d.count, 0);+ const chartId = title.replace(/\s+/g, "-").toLowerCase();+ const formatLabel = (label: string) => {+ if (chartKey === "algorithm") {+ return (+ (certKeyAlgorithmToNameMap as Record<string, string>)[label] ?? label.replace(/_/g, " ")+ );+ }+ if (chartKey === "enrollmentMethod") return label.toUpperCase();+ return label;+ };++ return (+ <UnstableCard className="flex h-full flex-col border-none">+ <UnstableCardHeader className="pb-0">+ <div>+ <UnstableCardTitle className="text-base font-semibold">{title}</UnstableCardTitle>+ {subtitle && <p className="mt-0.5 text-xs text-muted">{subtitle}</p>}+ </div>+ </UnstableCardHeader>+ <UnstableCardContent className="flex flex-1 items-end pt-2">+ {nonZeroData.length === 0 ? (+ <UnstableEmpty className="h-[200px]">+ <UnstableEmptyHeader>+ <UnstableEmptyTitle>No data available</UnstableEmptyTitle>+ </UnstableEmptyHeader>+ </UnstableEmpty>+ ) : (+ <div className="flex w-full items-center gap-3">+ <div className="w-[120px] shrink-0">+ <ResponsiveContainer width="100%" height={120}>+ <PieChart>+ <defs>+ {nonZeroData.map((entry, idx) => {+ const hex = CHART_COLORS_HEX[idx % CHART_COLORS_HEX.length];+ return (+ <linearGradient+ key={`grad-${entry.label}`}+ id={`grad-${chartId}-${idx}`}+ x1="0"+ y1="0"+ x2="1"+ y2="1"+ >+ <stop offset="0%" stopColor={hex} stopOpacity={1} />+ <stop offset="100%" stopColor={hex} stopOpacity={0.6} />+ </linearGradient>+ );+ })}+ </defs>+ <Pie+ data={nonZeroData}+ dataKey="count"+ nameKey="label"+ cx="50%"+ cy="50%"+ innerRadius={32}+ outerRadius={52}+ paddingAngle={2}+ cursor="pointer"+ stroke="none"+ onClick={(_entry, idx) => onSegmentClick?.(nonZeroData[idx])}+ >+ {nonZeroData.map((entry, idx) => (+ <Cell key={entry.label} fill={`url(#grad-${chartId}-${idx})`} />+ ))}+ </Pie>+ <RechartsTooltip+ contentStyle={{+ backgroundColor: "var(--color-popover)",+ border: "1px solid var(--color-border)",+ borderRadius: "6px",+ color: "var(--color-foreground)"+ }}+ />+ </PieChart>+ </ResponsiveContainer>+ </div>+ <div className="min-w-0 flex-1">+ <div className="space-y-1.5">+ {nonZeroData.map((entry, idx) => {+ const pct = total > 0 ? Math.round((entry.count / total) * 100) : 0;+ return (+ <button+ key={entry.label}+ type="button"+ className="flex w-full cursor-pointer items-center gap-2 rounded px-1 py-0.5 text-xs transition-colors hover:bg-foreground/5"+ onClick={() => onSegmentClick?.(entry)}+ >+ <span+ className="h-2.5 w-2.5 shrink-0 rounded-full"+ style={{ backgroundColor: CHART_COLORS[idx % CHART_COLORS.length] }}+ />+ <Tooltip>+ <TooltipTrigger asChild>+ <span className="min-w-0 flex-1 truncate text-left text-foreground">+ {formatLabel(entry.label)}+ </span>+ </TooltipTrigger>+ <TooltipContent side="top">{formatLabel(entry.label)}</TooltipContent>+ </Tooltip>+ <span className="shrink-0 text-right text-muted">{pct}%</span>+ <span className="shrink-0 text-right font-medium text-foreground">+ {entry.count}+ </span>+ </button>+ );+ })}+ </div>+ <div className="mt-2 flex items-center border-t border-border px-1 pt-2 text-xs">+ <span className="flex-1 font-medium text-foreground">Total</span>+ <span className="shrink-0 text-right font-semibold text-foreground">{total}</span>+ </div>+ </div>+ </div>+ )}+ </UnstableCardContent>+ </UnstableCard>+ );+};++export const DistributionCharts = ({ stats, onNavigate }: Props) => {+ const charts: {+ title: string;+ subtitle?: string;+ chartKey: ChartKey;+ data: TDashboardDistribution[];+ }[] = [+ {+ title: "By Enrollment Method",+ subtitle: "Distribution by enrollment type",+ chartKey: "enrollmentMethod",+ data: stats.distributions.byEnrollmentMethod+ },+ {+ title: "By Algorithm",+ subtitle: "Distribution by key algorithm",+ chartKey: "algorithm",+ data: stats.distributions.byAlgorithm+ },+ {+ title: "By Issuing CA",+ subtitle: "Distribution by certificate authority",+ chartKey: "ca",+ data: stats.distributions.byCA+ }+ ];++ return (+ <>+ {charts.map((chart) => (+ <DonutChart+ key={chart.chartKey}+ title={chart.title}+ subtitle={chart.subtitle}+ chartKey={chart.chartKey}+ data={chart.data}+ onSegmentClick={(entry) => {+ if (chart.chartKey === "enrollmentMethod") {+ onNavigate({ filterEnrollmentType: entry.label });+ } else if (chart.chartKey === "algorithm") {+ onNavigate({ filterKeyAlgorithm: entry.label });+ } else if (chart.chartKey === "ca" && entry.id) {+ onNavigate({ filterCaId: entry.id });+ }+ }}+ />+ ))}+ </>+ );+};diff --git a/frontend/src/pages/cert-manager/DashboardPage/components/ExpirationTimeline.tsx b/frontend/src/pages/cert-manager/DashboardPage/components/ExpirationTimeline.tsxnew file mode 100644index 0000000000..2322a0af50--- /dev/null+++ b/frontend/src/pages/cert-manager/DashboardPage/components/ExpirationTimeline.tsx@@ -0,0 +1,177 @@+import { useMemo } from "react";+import { Cell, Pie, PieChart, ResponsiveContainer, Tooltip as RechartsTooltip } from "recharts";++import {+ Tooltip,+ TooltipContent,+ TooltipTrigger,+ UnstableCard,+ UnstableCardContent,+ UnstableCardHeader,+ UnstableCardTitle,+ UnstableEmpty,+ UnstableEmptyHeader,+ UnstableEmptyTitle+} from "@app/components/v3";+import type { TExpirationBucket } from "@app/hooks/api/certificates";++import { CHART_COLORS, CHART_COLORS_HEX } from "./chart-theme";++type Props = {+ buckets: TExpirationBucket[];+ onNavigate: (filters: Record<string, string | undefined>) => void;+};++const DONUT_SEGMENTS = [+ {+ label: "< 7 days",+ sourceBuckets: ["expired", "0-7d"],+ filter: { filterExpiresDays: "7" }+ },+ {+ label: "7-30 days",+ sourceBuckets: ["8-30d"],+ filter: { filterExpiresAfterDays: "7", filterExpiresDays: "30" }+ },+ {+ label: "> 30 days",+ sourceBuckets: ["31-60d", "61-90d", "90d+"],+ filter: { filterExpiresAfterDays: "30" }+ }+];++export const ExpirationTimeline = ({ buckets, onNavigate }: Props) => {+ const bucketMap = useMemo(() => {+ const map = new Map<string, number>();+ buckets.forEach((b) => map.set(b.bucket, b.count));+ return map;+ }, [buckets]);++ const chartData = useMemo(+ () =>+ DONUT_SEGMENTS.map((seg, idx) => ({+ label: seg.label,+ count: seg.sourceBuckets.reduce((sum, key) => sum + (bucketMap.get(key) || 0), 0),+ color: CHART_COLORS[idx % CHART_COLORS.length],+ segIdx: idx,+ filter: seg.filter+ })),+ [bucketMap]+ );++ const nonZeroData = chartData.filter((d) => d.count > 0);+ const total = chartData.reduce((sum, d) => sum + d.count, 0);++ return (+ <UnstableCard className="flex h-full flex-col border-none">+ <UnstableCardHeader className="pb-0">+ <UnstableCardTitle className="text-base font-semibold">+ Expiration Timeline+ </UnstableCardTitle>+ <p className="mt-0.5 text-xs text-muted">Certificates by time to expiry</p>+ </UnstableCardHeader>+ <UnstableCardContent className="flex flex-1 items-end pt-2">+ {nonZeroData.length === 0 ? (+ <UnstableEmpty className="h-[200px]">+ <UnstableEmptyHeader>+ <UnstableEmptyTitle>No expiration data</UnstableEmptyTitle>+ </UnstableEmptyHeader>+ </UnstableEmpty>+ ) : (+ <div className="flex w-full items-center gap-3">+ <div className="w-[120px] shrink-0">+ <ResponsiveContainer width="100%" height={120}>+ <PieChart>+ <defs>+ {nonZeroData.map((item) => {+ const hex = CHART_COLORS_HEX[item.segIdx % CHART_COLORS_HEX.length];+ return (+ <linearGradient+ key={`grad-exp-${item.label}`}+ id={`grad-exp-${item.segIdx}`}+ x1="0"+ y1="0"+ x2="1"+ y2="1"+ >+ <stop offset="0%" stopColor={hex} stopOpacity={1} />+ <stop offset="100%" stopColor={hex} stopOpacity={0.6} />+ </linearGradient>+ );+ })}+ </defs>+ <Pie+ data={nonZeroData}+ dataKey="count"+ nameKey="label"+ cx="50%"+ cy="50%"+ innerRadius={32}+ outerRadius={52}+ paddingAngle={2}+ cursor="pointer"+ stroke="none"+ onClick={(_entry, idx) => {+ const item = nonZeroData[idx];+ if (item.filter) onNavigate(item.filter);+ }}+ >+ {nonZeroData.map((item) => (+ <Cell key={item.label} fill={`url(#grad-exp-${item.segIdx})`} />+ ))}+ </Pie>+ <RechartsTooltip+ contentStyle={{+ backgroundColor: "var(--color-popover)",+ border: "1px solid var(--color-border)",+ borderRadius: "6px",+ color: "var(--color-foreground)"+ }}+ />+ </PieChart>+ </ResponsiveContainer>+ </div>+ <div className="min-w-0 flex-1">+ <div className="space-y-1.5">+ {chartData.map((item, idx) => {+ const pct = total > 0 ? Math.round((item.count / total) * 100) : 0;+ return (+ <button+ key={item.label}+ type="button"+ className="flex w-full cursor-pointer items-center gap-2 rounded px-1 py-0.5 text-xs transition-colors hover:bg-foreground/5"+ onClick={() => {+ if (item.filter) onNavigate(item.filter);+ }}+ >+ <span+ className="h-2.5 w-2.5 shrink-0 rounded-full"+ style={{ backgroundColor: CHART_COLORS[idx % CHART_COLORS.length] }}+ />+ <Tooltip>+ <TooltipTrigger asChild>+ <span className="min-w-0 flex-1 truncate text-left text-foreground">+ {item.label}+ </span>+ </TooltipTrigger>+ <TooltipContent side="top">{item.label}</TooltipContent>+ </Tooltip>+ <span className="shrink-0 text-right text-muted">{pct}%</span>+ <span className="shrink-0 text-right font-medium text-foreground">+ {item.count}+ </span>+ </button>+ );+ })}+ </div>+ <div className="mt-2 flex items-center border-t border-border px-1 pt-2 text-xs">+ <span className="flex-1 font-medium text-foreground">Total</span>+ <span className="shrink-0 text-right font-semibold text-foreground">{total}</span>+ </div>+ </div>+ </div>+ )}+ </UnstableCardContent>+ </UnstableCard>+ );+};diff --git a/frontend/src/pages/cert-manager/DashboardPage/components/KpiCards.tsx b/frontend/src/pages/cert-manager/DashboardPage/components/KpiCards.tsxnew file mode 100644index 0000000000..47476d2d6f--- /dev/null+++ b/frontend/src/pages/cert-manager/DashboardPage/components/KpiCards.tsx@@ -0,0 +1,133 @@+import { AlertTriangle, FileCheck, FileClock, FileKey, FileX } from "lucide-react";++import { Badge, UnstableCard, UnstableCardContent } from "@app/components/v3";+import type { TDashboardStats } from "@app/hooks/api/certificates";++type Props = {+ stats: TDashboardStats;+ onNavigate: (filters: Record<string, string | undefined>) => void;+};++const cards = [+ {+ key: "total" as const,+ label: "Total Certificates",+ subtitle: "All certificates",+ icon: FileKey,+ iconClass: "text-org",+ iconBg: "bg-org/10 border-org/20",+ filters: {} as Record<string, string>+ },+ {+ key: "active" as const,+ label: "Active",+ subtitle: "Currently valid",+ icon: FileCheck,+ iconClass: "text-success",+ iconBg: "bg-success/10 border-success/20",+ filters: { filterStatus: "active" }+ },+ {+ key: "expiringSoon" as const,+ label: "Expiring Soon",+ subtitle: "In the next 30 days",+ icon: FileClock,+ iconClass: "text-warning",+ iconBg: "bg-warning/10 border-warning/20",+ filters: { filterStatus: "active", filterExpiresDays: "30" }+ },+ {+ key: "expired" as const,+ label: "Expired",+ subtitle: "Past validity",+ icon: FileX,+ iconClass: "text-danger",+ iconBg: "bg-danger/10 border-danger/20",+ filters: { filterStatus: "expired" }+ },+ {+ key: "revoked" as const,+ label: "Revoked",+ subtitle: "Manually revoked",+ icon: AlertTriangle,+ iconClass: "text-neutral",+ iconBg: "bg-neutral/10 border-neutral/20",+ filters: { filterStatus: "revoked" }+ }+];++const getBadge = (key: string, stats: TDashboardStats) => {+ const { total, active } = stats.totals;++ if (key === "total" && total > 0) {+ const pct = Math.round((active / total) * 100);+ return {+ variant: "org" as const,+ label: `${pct}% active`+ };+ }+ if (key === "active" && total > 0) {+ return {+ variant: "success" as const,+ label: "valid & trusted"+ };+ }+ if (key === "expiringSoon" && stats.expiringSoonNoAutoRenewal > 0) {+ return {+ variant: "warning" as const,+ label: `${stats.expiringSoonNoAutoRenewal} without auto-renewal`+ };+ }+ if (key === "expired" && stats.expiredNotRenewed > 0) {+ return {+ variant: "danger" as const,+ label: `${stats.expiredNotRenewed} not renewed`+ };+ }+ if (key === "revoked" && stats.totals.revoked > 0) {+ return {+ variant: "neutral" as const,+ label: "action required"+ };+ }+ return null;+};++export const KpiCards = ({ stats, onNavigate }: Props) => {+ return (+ <div className="grid grid-cols-1 gap-4 sm:grid-cols-2 md:grid-cols-3 xl:grid-cols-5">+ {cards.map((card) => {+ const Icon = card.icon;+ const count = stats.totals[card.key];+ const badge = getBadge(card.key, stats);+ return (+ <UnstableCard+ key={card.key}+ className="cursor-pointer gap-0 p-0 transition-colors hover:bg-container-hover"+ onClick={() => onNavigate(card.filters)}+ >+ <UnstableCardContent className="flex h-full flex-col p-4">+ <div className="flex items-start justify-between">+ <span className="text-base font-semibold text-foreground">{card.label}</span>+ <div+ className={`flex h-9 w-9 shrink-0 items-center justify-center rounded-lg border ${card.iconBg}`}+ >+ <Icon className={`h-[18px] w-[18px] ${card.iconClass}`} />+ </div>+ </div>+ <div className="mt-auto pt-6">+ <div className="flex items-baseline gap-2">+ <span className="text-3xl font-semibold text-foreground">{count}</span>+ <span className="text-xs text-muted">{card.subtitle}</span>+ </div>+ <div className="mt-3 min-h-[22px]">+ {badge && <Badge variant={badge.variant}>{badge.label}</Badge>}+ </div>+ </div>+ </UnstableCardContent>+ </UnstableCard>+ );+ })}+ </div>+ );+};diff --git a/frontend/src/pages/cert-manager/DashboardPage/components/chart-theme.tsx b/frontend/src/pages/cert-manager/DashboardPage/components/chart-theme.tsxnew file mode 100644index 0000000000..240198b2ba--- /dev/null+++ b/frontend/src/pages/cert-manager/DashboardPage/components/chart-theme.tsx@@ -0,0 +1,69 @@+export const CHART_COLORS = [+ "var(--color-info)",+ "var(--color-warning)",+ "var(--color-neutral)",+ "var(--color-accent)",+ "var(--color-muted)",+ "var(--color-success)",+ "var(--color-org)",+ "var(--color-danger)"+];++export const CHART_COLORS_HEX = [+ "#63b0bd",+ "#f1c40f",+ "#adaeb0",+ "#7d7f80",+ "#707174",+ "#2ecc71",+ "#30b3ff",+ "#e74c3c"+];++export const TREND_COLORS = {+ issued: "var(--color-org)",+ expired: "var(--color-danger)",+ revoked: "var(--color-neutral)",+ renewed: "var(--color-success)"+};++export const formatTickLabel = (value: string) => {+ if (value.length === 10) {+ const [, m, d] = value.split("-");+ const date = new Date(Number(value.slice(0, 4)), Number(m) - 1, Number(d));+ return date.toLocaleDateString("en-US", { month: "short", day: "numeric" });+ }+ const [year, month] = value.split("-");+ const date = new Date(Number(year), Number(month) - 1);+ return date.toLocaleDateString("en-US", { month: "short", year: "2-digit" });+};++export const legendFormatter = (value: string) => (+ <span className="text-xs text-muted capitalize">{value}</span>+);++export const nonZeroDot = (dataKey: string, color: string, seriesKeys?: string[]) => {+ return ({ cx, cy, payload }: { cx?: number; cy?: number; payload?: Record<string, number> }) => {+ if (cx == null || cy == null) return null;+ const val = payload?.[dataKey];+ if (!val || val === 0) return null;++ let offsetX = 0;+ if (seriesKeys) {+ const sameValKeys = seriesKeys.filter((k) => payload?.[k] === val);+ const myIdx = sameValKeys.indexOf(dataKey);+ offsetX = sameValKeys.length > 1 ? (myIdx - (sameValKeys.length - 1) / 2) * 6 : 0;+ }++ return (+ <circle+ cx={cx + offsetX}+ cy={cy}+ r={3}+ fill={color}+ stroke="var(--color-popover)"+ strokeWidth={1.5}+ />+ );+ };+};diff --git a/frontend/src/pages/cert-manager/DashboardPage/components/index.tsx b/frontend/src/pages/cert-manager/DashboardPage/components/index.tsxnew file mode 100644index 0000000000..3862c8a19c--- /dev/null+++ b/frontend/src/pages/cert-manager/DashboardPage/components/index.tsx@@ -0,0 +1,5 @@+export { ActivityTrend } from "./ActivityTrend";+export { CodeSigningSection } from "./CodeSigningSection";+export { DistributionCharts } from "./DistributionCharts";+export { ExpirationTimeline } from "./ExpirationTimeline";+export { KpiCards } from "./KpiCards";diff --git a/frontend/src/pages/cert-manager/DashboardPage/route-index.tsx b/frontend/src/pages/cert-manager/DashboardPage/route-index.tsxnew file mode 100644index 0000000000..a91fd8d56e--- /dev/null+++ b/frontend/src/pages/cert-manager/DashboardPage/route-index.tsx@@ -0,0 +1,12 @@+import { createFileRoute, redirect } from "@tanstack/react-router";++export const Route = createFileRoute(+ "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/cert-manager/$projectId/_cert-manager-layout/"+)({+ beforeLoad: ({ params }) => {+ throw redirect({+ to: "/organizations/$orgId/projects/cert-manager/$projectId/overview",+ params+ });+ }+});diff --git a/frontend/src/pages/cert-manager/DashboardPage/route.tsx b/frontend/src/pages/cert-manager/DashboardPage/route.tsxnew file mode 100644index 0000000000..39c11d3f79--- /dev/null+++ b/frontend/src/pages/cert-manager/DashboardPage/route.tsx@@ -0,0 +1,19 @@+import { createFileRoute } from "@tanstack/react-router";++import { DashboardPage } from "./DashboardPage";++export const Route = createFileRoute(+ "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/cert-manager/$projectId/_cert-manager-layout/overview"+)({+ component: DashboardPage,+ beforeLoad: ({ context }) => {+ return {+ breadcrumbs: [+ ...context.breadcrumbs,+ {+ label: "Dashboard"+ }+ ]+ };+ }+});diff --git a/frontend/src/pages/cert-manager/PoliciesPage/PoliciesPage.tsx b/frontend/src/pages/cert-manager/PoliciesPage/PoliciesPage.tsxindex 4ae2365448..33f686071d 100644--- a/frontend/src/pages/cert-manager/PoliciesPage/PoliciesPage.tsx+++ b/frontend/src/pages/cert-manager/PoliciesPage/PoliciesPage.tsx@@ -1,10 +1,11 @@-import { useState } from "react";+import { useMemo, useState } from "react";import { Helmet } from "react-helmet";import { useTranslation } from "react-i18next";import { useNavigate, useSearch } from "@tanstack/react-router";import { PermissionDeniedBanner } from "@app/components/permissions";-import { ContentLoader, PageHeader } from "@app/components/v2";+import { PageHeader } from "@app/components/v2";+import { UnstablePageLoader } from "@app/components/v3";import { useProject, useProjectPermission } from "@app/context";import {ProjectPermissionCertificateActions,@@ -31,13 +32,77 @@ export const PoliciesPage = () => {const { currentProject } = useProject();const { permission } = useProjectPermission();const navigate = useNavigate();- const { selectedTab } = useSearch({+ const searchParams = useSearch({from: "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/cert-manager/$projectId/_cert-manager-layout/policies"});- const activeTab = (selectedTab as TabSections) || TabSections.Certificates;+ const activeTab = (searchParams.selectedTab as TabSections) || TabSections.Certificates;const [certificateFilter, setCertificateFilter] = useState<{ search?: string }>({});+ const dashboardFilters = useMemo(() => {+ const filters: Array<{+ id: string;+ field: string;+ operator: string;+ value: string | string[];+ }> = [];+ if (searchParams.filterStatus) {+ filters.push({+ id: "dash-status",+ field: "status",+ operator: "in",+ value: [searchParams.filterStatus]+ });+ }+ if (searchParams.filterEnrollmentType) {+ filters.push({+ id: "dash-enrollment",+ field: "enrollmentType",+ operator: "in",+ value: [searchParams.filterEnrollmentType]+ });+ }+ if (searchParams.filterKeyAlgorithm) {+ filters.push({+ id: "dash-algorithm",+ field: "keyAlgorithm",+ operator: "is",+ value: searchParams.filterKeyAlgorithm+ });+ }+ if (searchParams.filterCaId) {+ filters.push({+ id: "dash-ca",+ field: "caId",+ operator: "in",+ value: [searchParams.filterCaId]+ });+ }+ if (searchParams.filterExpiresDays) {+ const days = Number(searchParams.filterExpiresDays);+ const futureDate = new Date();+ futureDate.setDate(futureDate.getDate() + days);+ filters.push({+ id: "dash-expires",+ field: "notAfter",+ operator: "before",+ value: futureDate.toISOString().split("T")[0]+ });+ }+ if (searchParams.filterExpiresAfterDays) {+ const days = Number(searchParams.filterExpiresAfterDays);+ const afterDate = new Date();+ afterDate.setDate(afterDate.getDate() + days);+ filters.push({+ id: "dash-expires-after",+ field: "notAfter",+ operator: "after",+ value: afterDate.toISOString().split("T")[0]+ });+ }+ return filters;+ }, [searchParams]);+const handleViewCertificateFromRequest = (certificateId: string) => {setCertificateFilter({ search: certificateId });navigate({@@ -60,7 +125,7 @@ export const PoliciesPage = () => {);if (!currentProject) {- return <ContentLoader />;+ return <UnstablePageLoader />;}return (@@ -77,7 +142,10 @@ export const PoliciesPage = () => {<div>{activeTab === TabSections.Certificates &&(canReadCertificates ? (- <CertificatesTab externalFilter={certificateFilter} />+ <CertificatesTab+ externalFilter={certificateFilter}+ dashboardFilters={dashboardFilters}+ />) : (<PermissionDeniedBanner />))}diff --git a/frontend/src/pages/cert-manager/PoliciesPage/components/CertificatesTab/CertificatesTab.tsx b/frontend/src/pages/cert-manager/PoliciesPage/components/CertificatesTab/CertificatesTab.tsxindex 24cc69c8a6..a84904f4a6 100644--- a/frontend/src/pages/cert-manager/PoliciesPage/components/CertificatesTab/CertificatesTab.tsx+++ b/frontend/src/pages/cert-manager/PoliciesPage/components/CertificatesTab/CertificatesTab.tsx@@ -1,12 +1,16 @@import { CertificatesSection } from "../../../CertificatesPage/components/CertificatesSection";+import type { FilterRule } from "../../../CertificatesPage/components/inventory-types";type Props = {externalFilter?: {certificateId?: string;search?: string;};+ dashboardFilters?: FilterRule[];};-export const CertificatesTab = ({ externalFilter }: Props) => {- return <CertificatesSection externalFilter={externalFilter} />;+export const CertificatesTab = ({ externalFilter, dashboardFilters }: Props) => {+ return (+ <CertificatesSection externalFilter={externalFilter} dashboardFilters={dashboardFilters} />+ );};diff --git a/frontend/src/pages/cert-manager/PoliciesPage/route.tsx b/frontend/src/pages/cert-manager/PoliciesPage/route.tsxindex 19524feabb..cc05db101b 100644--- a/frontend/src/pages/cert-manager/PoliciesPage/route.tsx+++ b/frontend/src/pages/cert-manager/PoliciesPage/route.tsx@@ -5,7 +5,13 @@ import { z } from "zod";import { PoliciesPage } from "./PoliciesPage";const policiesPageSearchSchema = z.object({- selectedTab: z.string().optional().default("certificates")+ selectedTab: z.string().optional().default("certificates"),+ filterStatus: z.string().optional(),+ filterEnrollmentType: z.string().optional(),+ filterKeyAlgorithm: z.string().optional(),+ filterCaId: z.string().optional(),+ filterExpiresDays: z.string().optional(),+ filterExpiresAfterDays: z.string().optional()});export const Route = createFileRoute(diff --git a/frontend/src/routeTree.gen.ts b/frontend/src/routeTree.gen.tsindex 948a8f6012..e56f45e315 100644--- a/frontend/src/routeTree.gen.ts+++ b/frontend/src/routeTree.gen.ts@@ -101,6 +101,7 @@ import { Route as projectAppConnectionsPageRouteCertManagerImport } from './pageimport { Route as projectAccessControlPageRouteCertManagerImport } from './pages/project/AccessControlPage/route-cert-manager'import { Route as projectAuditLogsPageRouteAiImport } from './pages/project/AuditLogsPage/route-ai'import { Route as projectAccessControlPageRouteAiImport } from './pages/project/AccessControlPage/route-ai'+import { Route as certManagerDashboardPageRouteIndexImport } from './pages/cert-manager/DashboardPage/route-index'import { Route as sshSettingsPageRouteImport } from './pages/ssh/SettingsPage/route'import { Route as sshSshHostsPageRouteImport } from './pages/ssh/SshHostsPage/route'import { Route as sshSshCertsPageRouteImport } from './pages/ssh/SshCertsPage/route'@@ -119,6 +120,7 @@ import { Route as kmsOverviewPageRouteImport } from './pages/kms/OverviewPage/roimport { Route as kmsKmipPageRouteImport } from './pages/kms/KmipPage/route'import { Route as certManagerSettingsPageRouteImport } from './pages/cert-manager/SettingsPage/route'import { Route as certManagerPoliciesPageRouteImport } from './pages/cert-manager/PoliciesPage/route'+import { Route as certManagerDashboardPageRouteImport } from './pages/cert-manager/DashboardPage/route'import { Route as certManagerCertificateAuthoritiesPageRouteImport } from './pages/cert-manager/CertificateAuthoritiesPage/route'import { Route as certManagerApprovalsPageRouteImport } from './pages/cert-manager/ApprovalsPage/route'import { Route as certManagerAlertingPageRouteImport } from './pages/cert-manager/AlertingPage/route'@@ -1235,6 +1237,13 @@ const projectAccessControlPageRouteAiRoute =getParentRoute: () => aiLayoutRoute,} as any)+const certManagerDashboardPageRouteIndexRoute =+ certManagerDashboardPageRouteIndexImport.update({+ id: '/',+ path: '/',+ getParentRoute: () => certManagerLayoutRoute,+ } as any)+const sshSettingsPageRouteRoute = sshSettingsPageRouteImport.update({id: '/settings',path: '/settings',@@ -1352,6 +1361,13 @@ const certManagerPoliciesPageRouteRoute =getParentRoute: () => certManagerLayoutRoute,} as any)+const certManagerDashboardPageRouteRoute =+ certManagerDashboardPageRouteImport.update({+ id: '/overview',+ path: '/overview',+ getParentRoute: () => certManagerLayoutRoute,+ } as any)+const certManagerCertificateAuthoritiesPageRouteRoute =certManagerCertificateAuthoritiesPageRouteImport.update({id: '/certificate-authorities',@@ -3165,6 +3181,13 @@ declare module '@tanstack/react-router' {preLoaderRoute: typeof certManagerCertificateAuthoritiesPageRouteImportparentRoute: typeof certManagerLayoutImport}+ '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/cert-manager/$projectId/_cert-manager-layout/overview': {+ id: '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/cert-manager/$projectId/_cert-manager-layout/overview'+ path: '/overview'+ fullPath: '/organizations/$orgId/projects/cert-manager/$projectId/overview'+ preLoaderRoute: typeof certManagerDashboardPageRouteImport+ parentRoute: typeof certManagerLayoutImport+ }'/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/cert-manager/$projectId/_cert-manager-layout/policies': {id: '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/cert-manager/$projectId/_cert-manager-layout/policies'path: '/policies'@@ -3291,6 +3314,13 @@ declare module '@tanstack/react-router' {preLoaderRoute: typeof sshSettingsPageRouteImportparentRoute: typeof sshLayoutImport}+ '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/cert-manager/$projectId/_cert-manager-layout/': {+ id: '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/cert-manager/$projectId/_cert-manager-layout/'+ path: '/'+ fullPath: '/organizations/$orgId/projects/cert-manager/$projectId/'+ preLoaderRoute: typeof certManagerDashboardPageRouteIndexImport+ parentRoute: typeof certManagerLayoutImport+ }'/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/ai/$projectId/_ai-layout/access-management': {id: '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/ai/$projectId/_ai-layout/access-management'path: '/access-management'@@ -4672,8 +4702,10 @@ interface certManagerLayoutRouteChildren {certManagerAlertingPageRouteRoute: typeof certManagerAlertingPageRouteRoutecertManagerApprovalsPageRouteRoute: typeof certManagerApprovalsPageRouteRoutecertManagerCertificateAuthoritiesPageRouteRoute: typeof certManagerCertificateAuthoritiesPageRouteRoute+ certManagerDashboardPageRouteRoute: typeof certManagerDashboardPageRouteRoutecertManagerPoliciesPageRouteRoute: typeof certManagerPoliciesPageRouteRoutecertManagerSettingsPageRouteRoute: typeof certManagerSettingsPageRouteRoute+ certManagerDashboardPageRouteIndexRoute: typeof certManagerDashboardPageRouteIndexRouteprojectAccessControlPageRouteCertManagerRoute: typeof projectAccessControlPageRouteCertManagerRouteprojectAppConnectionsPageRouteCertManagerRoute: typeof projectAppConnectionsPageRouteCertManagerRouteprojectAuditLogsPageRouteCertManagerRoute: typeof projectAuditLogsPageRouteCertManagerRoute@@ -4697,8 +4729,11 @@ const certManagerLayoutRouteChildren: certManagerLayoutRouteChildren = {certManagerApprovalsPageRouteRoute: certManagerApprovalsPageRouteRoute,certManagerCertificateAuthoritiesPageRouteRoute:certManagerCertificateAuthoritiesPageRouteRoute,+ certManagerDashboardPageRouteRoute: certManagerDashboardPageRouteRoute,certManagerPoliciesPageRouteRoute: certManagerPoliciesPageRouteRoute,certManagerSettingsPageRouteRoute: certManagerSettingsPageRouteRoute,+ certManagerDashboardPageRouteIndexRoute:+ certManagerDashboardPageRouteIndexRoute,projectAccessControlPageRouteCertManagerRoute:projectAccessControlPageRouteCertManagerRoute,projectAppConnectionsPageRouteCertManagerRoute:@@ -5830,6 +5865,7 @@ export interface FileRoutesByFullPath {'/organizations/$orgId/projects/cert-manager/$projectId/alerting': typeof certManagerAlertingPageRouteRoute'/organizations/$orgId/projects/cert-manager/$projectId/approvals': typeof certManagerApprovalsPageRouteRoute'/organizations/$orgId/projects/cert-manager/$projectId/certificate-authorities': typeof certManagerCertificateAuthoritiesPageRouteRoute+ '/organizations/$orgId/projects/cert-manager/$projectId/overview': typeof certManagerDashboardPageRouteRoute'/organizations/$orgId/projects/cert-manager/$projectId/policies': typeof certManagerPoliciesPageRouteRoute'/organizations/$orgId/projects/cert-manager/$projectId/settings': typeof certManagerSettingsPageRouteRoute'/organizations/$orgId/projects/kms/$projectId/kmip': typeof kmsKmipPageRouteRoute@@ -5848,6 +5884,7 @@ export interface FileRoutesByFullPath {'/organizations/$orgId/projects/ssh/$projectId/certificates': typeof sshSshCertsPageRouteRoute'/organizations/$orgId/projects/ssh/$projectId/overview': typeof sshSshHostsPageRouteRoute'/organizations/$orgId/projects/ssh/$projectId/settings': typeof sshSettingsPageRouteRoute+ '/organizations/$orgId/projects/cert-manager/$projectId/': typeof certManagerDashboardPageRouteIndexRoute'/organizations/$orgId/projects/ai/$projectId/access-management': typeof projectAccessControlPageRouteAiRoute'/organizations/$orgId/projects/ai/$projectId/audit-logs': typeof projectAuditLogsPageRouteAiRoute'/organizations/$orgId/projects/cert-manager/$projectId/access-management': typeof projectAccessControlPageRouteCertManagerRoute@@ -6083,7 +6120,7 @@ export interface FileRoutesByTo {'/organizations/$orgId/secret-manager/$projectId': typeof AuthenticateInjectOrgDetailsOrgLayoutOrganizationsOrgIdSecretManagerProjectIdRouteWithChildren'/organizations/$orgId/settings/oauth/callback': typeof organizationSettingsPageOauthCallbackPageRouteRoute'/organizations/$orgId/projects/ai/$projectId': typeof aiLayoutRouteWithChildren- '/organizations/$orgId/projects/cert-manager/$projectId': typeof certManagerLayoutRouteWithChildren+ '/organizations/$orgId/projects/cert-manager/$projectId': typeof certManagerDashboardPageRouteIndexRoute'/organizations/$orgId/projects/kms/$projectId': typeof kmsLayoutRouteWithChildren'/organizations/$orgId/projects/pam/$projectId': typeof pamLayoutRouteWithChildren'/organizations/$orgId/projects/secret-management/$projectId': typeof secretManagerLayoutRouteWithChildren@@ -6096,6 +6133,7 @@ export interface FileRoutesByTo {'/organizations/$orgId/projects/cert-manager/$projectId/alerting': typeof certManagerAlertingPageRouteRoute'/organizations/$orgId/projects/cert-manager/$projectId/approvals': typeof certManagerApprovalsPageRouteRoute'/organizations/$orgId/projects/cert-manager/$projectId/certificate-authorities': typeof certManagerCertificateAuthoritiesPageRouteRoute+ '/organizations/$orgId/projects/cert-manager/$projectId/overview': typeof certManagerDashboardPageRouteRoute'/organizations/$orgId/projects/cert-manager/$projectId/policies': typeof certManagerPoliciesPageRouteRoute'/organizations/$orgId/projects/cert-manager/$projectId/settings': typeof certManagerSettingsPageRouteRoute'/organizations/$orgId/projects/kms/$projectId/kmip': typeof kmsKmipPageRouteRoute@@ -6368,6 +6406,7 @@ export interface FileRoutesById {'/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/cert-manager/$projectId/_cert-manager-layout/alerting': typeof certManagerAlertingPageRouteRoute'/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/cert-manager/$projectId/_cert-manager-layout/approvals': typeof certManagerApprovalsPageRouteRoute'/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/cert-manager/$projectId/_cert-manager-layout/certificate-authorities': typeof certManagerCertificateAuthoritiesPageRouteRoute+ '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/cert-manager/$projectId/_cert-manager-layout/overview': typeof certManagerDashboardPageRouteRoute'/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/cert-manager/$projectId/_cert-manager-layout/policies': typeof certManagerPoliciesPageRouteRoute'/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/cert-manager/$projectId/_cert-manager-layout/settings': typeof certManagerSettingsPageRouteRoute'/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/kms/$projectId/_kms-layout/kmip': typeof kmsKmipPageRouteRoute@@ -6386,6 +6425,7 @@ export interface FileRoutesById {'/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/ssh/$projectId/_ssh-layout/certificates': typeof sshSshCertsPageRouteRoute'/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/ssh/$projectId/_ssh-layout/overview': typeof sshSshHostsPageRouteRoute'/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/ssh/$projectId/_ssh-layout/settings': typeof sshSettingsPageRouteRoute+ '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/cert-manager/$projectId/_cert-manager-layout/': typeof certManagerDashboardPageRouteIndexRoute'/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/ai/$projectId/_ai-layout/access-management': typeof projectAccessControlPageRouteAiRoute'/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/ai/$projectId/_ai-layout/audit-logs': typeof projectAuditLogsPageRouteAiRoute'/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/cert-manager/$projectId/_cert-manager-layout/access-management': typeof projectAccessControlPageRouteCertManagerRoute@@ -6643,6 +6683,7 @@ export interface FileRouteTypes {| '/organizations/$orgId/projects/cert-manager/$projectId/alerting'| '/organizations/$orgId/projects/cert-manager/$projectId/approvals'| '/organizations/$orgId/projects/cert-manager/$projectId/certificate-authorities'+ | '/organizations/$orgId/projects/cert-manager/$projectId/overview'| '/organizations/$orgId/projects/cert-manager/$projectId/policies'| '/organizations/$orgId/projects/cert-manager/$projectId/settings'| '/organizations/$orgId/projects/kms/$projectId/kmip'@@ -6661,6 +6702,7 @@ export interface FileRouteTypes {| '/organizations/$orgId/projects/ssh/$projectId/certificates'| '/organizations/$orgId/projects/ssh/$projectId/overview'| '/organizations/$orgId/projects/ssh/$projectId/settings'+ | '/organizations/$orgId/projects/cert-manager/$projectId/'| '/organizations/$orgId/projects/ai/$projectId/access-management'| '/organizations/$orgId/projects/ai/$projectId/audit-logs'| '/organizations/$orgId/projects/cert-manager/$projectId/access-management'@@ -6908,6 +6950,7 @@ export interface FileRouteTypes {| '/organizations/$orgId/projects/cert-manager/$projectId/alerting'| '/organizations/$orgId/projects/cert-manager/$projectId/approvals'| '/organizations/$orgId/projects/cert-manager/$projectId/certificate-authorities'+ | '/organizations/$orgId/projects/cert-manager/$projectId/overview'| '/organizations/$orgId/projects/cert-manager/$projectId/policies'| '/organizations/$orgId/projects/cert-manager/$projectId/settings'| '/organizations/$orgId/projects/kms/$projectId/kmip'@@ -7178,6 +7221,7 @@ export interface FileRouteTypes {| '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/cert-manager/$projectId/_cert-manager-layout/alerting'| '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/cert-manager/$projectId/_cert-manager-layout/approvals'| '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/cert-manager/$projectId/_cert-manager-layout/certificate-authorities'+ | '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/cert-manager/$projectId/_cert-manager-layout/overview'| '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/cert-manager/$projectId/_cert-manager-layout/policies'| '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/cert-manager/$projectId/_cert-manager-layout/settings'| '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/kms/$projectId/_kms-layout/kmip'@@ -7196,6 +7240,7 @@ export interface FileRouteTypes {| '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/ssh/$projectId/_ssh-layout/certificates'| '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/ssh/$projectId/_ssh-layout/overview'| '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/ssh/$projectId/_ssh-layout/settings'+ | '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/cert-manager/$projectId/_cert-manager-layout/'| '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/ai/$projectId/_ai-layout/access-management'| '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/ai/$projectId/_ai-layout/audit-logs'| '/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/cert-manager/$projectId/_cert-manager-layout/access-management'@@ -7884,8 +7929,10 @@ export const routeTree = rootRoute"/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/cert-manager/$projectId/_cert-manager-layout/alerting","/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/cert-manager/$projectId/_cert-manager-layout/approvals","/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/cert-manager/$projectId/_cert-manager-layout/certificate-authorities",+ "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/cert-manager/$projectId/_cert-manager-layout/overview","/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/cert-manager/$projectId/_cert-manager-layout/policies","/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/cert-manager/$projectId/_cert-manager-layout/settings",+ "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/cert-manager/$projectId/_cert-manager-layout/","/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/cert-manager/$projectId/_cert-manager-layout/access-management","/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/cert-manager/$projectId/_cert-manager-layout/app-connections","/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/cert-manager/$projectId/_cert-manager-layout/audit-logs",@@ -8012,6 +8059,10 @@ export const routeTree = rootRoute"filePath": "cert-manager/CertificateAuthoritiesPage/route.tsx","parent": "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/cert-manager/$projectId/_cert-manager-layout"},+ "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/cert-manager/$projectId/_cert-manager-layout/overview": {+ "filePath": "cert-manager/DashboardPage/route.tsx",+ "parent": "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/cert-manager/$projectId/_cert-manager-layout"+ },"/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/cert-manager/$projectId/_cert-manager-layout/policies": {"filePath": "cert-manager/PoliciesPage/route.tsx","parent": "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/cert-manager/$projectId/_cert-manager-layout"@@ -8084,6 +8135,10 @@ export const routeTree = rootRoute"filePath": "ssh/SettingsPage/route.tsx","parent": "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/ssh/$projectId/_ssh-layout"},+ "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/cert-manager/$projectId/_cert-manager-layout/": {+ "filePath": "cert-manager/DashboardPage/route-index.tsx",+ "parent": "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/cert-manager/$projectId/_cert-manager-layout"+ },"/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/ai/$projectId/_ai-layout/access-management": {"filePath": "project/AccessControlPage/route-ai.tsx","parent": "/_authenticate/_inject-org-details/_org-layout/organizations/$orgId/projects/ai/$projectId/_ai-layout"diff --git a/frontend/src/routes.ts b/frontend/src/routes.tsindex 9ef979376e..f279b460cb 100644--- a/frontend/src/routes.ts+++ b/frontend/src/routes.ts@@ -274,6 +274,8 @@ const secretManagerIntegrationsRedirect = route("/integrations", [const certManagerRoutes = route("/organizations/$orgId/projects/cert-manager/$projectId", [layout("cert-manager-layout", "cert-manager/layout.tsx", [+ index("cert-manager/DashboardPage/route-index.tsx"),+ route("/overview", "cert-manager/DashboardPage/route.tsx"),route("/policies", "cert-manager/PoliciesPage/route.tsx"),route("/subscribers", [index("cert-manager/PkiSubscribersPage/route.tsx"),