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
fix: add back recharts, pki dashboard and manually chunk rechart dependencies
Scott Wilson28b0e19eee8a
diff --git a/frontend/package-lock.json b/frontend/package-lock.jsonindex 1a65835ca0..a981676478 100644--- a/frontend/package-lock.json+++ b/frontend/package-lock.json@@ -109,6 +109,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",@@ -4999,6 +5000,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",@@ -5481,6 +5518,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",@@ -6789,6 +6838,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",@@ -6804,6 +6859,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",@@ -6813,12 +6874,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",@@ -7045,6 +7142,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",@@ -9388,6 +9491,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",@@ -9428,6 +9543,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",@@ -9440,6 +9564,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",@@ -9449,6 +9598,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",@@ -9597,6 +9782,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",@@ -10079,6 +10270,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",@@ -10953,6 +11154,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",@@ -11957,8 +12164,6 @@"resolved": "https://registry.npmjs.org/immer/-/immer-10.2.0.tgz","integrity": "sha512-d/+XTN3zfODyjr89gM3mPq1WNX2B8pYsu7eORitdwyA2sBubnTl3laYlBk4sXY5FUa5qTZGBDPJICVbvqzjlbw==","license": "MIT",- "optional": true,- "peer": true,"funding": {"type": "opencollective","url": "https://opencollective.com/immer"@@ -12039,6 +12244,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",@@ -15296,6 +15510,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",@@ -15494,6 +15731,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",@@ -15529,6 +15796,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",@@ -15643,6 +15925,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",@@ -17378,6 +17666,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.2","resolved": "https://registry.npmjs.org/vite/-/vite-6.4.2.tgz",diff --git a/frontend/package.json b/frontend/package.jsonindex d02a2468f9..6c0f98a6fc 100644--- a/frontend/package.json+++ b/frontend/package.json@@ -137,6 +137,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/pages/cert-manager/DashboardPage/DashboardPage.tsx b/frontend/src/pages/cert-manager/DashboardPage/DashboardPage.tsxindex fefb121749..ddd55f19ad 100644--- a/frontend/src/pages/cert-manager/DashboardPage/DashboardPage.tsx+++ b/frontend/src/pages/cert-manager/DashboardPage/DashboardPage.tsx@@ -1,96 +1,95 @@-// import { useCallback, useState } from "react";-// import { Helmet } from "react-helmet";-// import { useTranslation } from "react-i18next";-// import { useNavigate } from "@tanstack/react-router";+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 { 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-// // ValidityReadinessSection-// } from "./components";+import {+ ActivityTrend,+ CodeSigningSection,+ DistributionCharts,+ ExpirationTimeline,+ KpiCards,+ ValidityReadinessSection+} from "./components";export const DashboardPage = () => {- return null;- // 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="flex flex-wrap gap-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}- // />- // <ValidityReadinessSection stats={stats} />- // </div>- // )}- // </ProjectPermissionCan>- // </div>- // </div>- // </div>- // );+ 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="flex flex-wrap gap-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}+ />+ <ValidityReadinessSection stats={stats} />+ </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.tsxindex 00382860be..2facd20ccd 100644--- a/frontend/src/pages/cert-manager/DashboardPage/components/ActivityTrend.tsx+++ b/frontend/src/pages/cert-manager/DashboardPage/components/ActivityTrend.tsx@@ -1,135 +1,135 @@-// // import {-// // CartesianGrid,-// // Legend,-// // Line,-// // LineChart,-// // ResponsiveContainer,-// // Tooltip,-// // XAxis,-// // YAxis-// // } from "recharts";+import {+ CartesianGrid,+ Legend,+ Line,+ LineChart,+ ResponsiveContainer,+ Tooltip,+ XAxis,+ YAxis+} from "recharts";-// import {-// Button,-// UnstableCard,-// UnstableCardAction,-// UnstableCardContent,-// UnstableCardHeader,-// UnstableCardTitle,-// UnstableEmpty,-// UnstableEmptyHeader,-// UnstableEmptyTitle-// } from "@app/components/v3";-// import type { TActivityTrendPoint } from "@app/hooks/api/certificates";+import {+ Button,+ UnstableCard,+ UnstableCardAction,+ 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";+import { formatTickLabel, legendFormatter, nonZeroDot, TREND_COLORS } from "./chart-theme";-// type Props = {-// data: TActivityTrendPoint[];-// onRangeChange: (range: string) => void;-// currentRange: string;-// };+type Props = {+ data: TActivityTrendPoint[];+ onRangeChange: (range: string) => void;+ currentRange: string;+};-// const SERIES_KEYS = ["issued", "expired", "revoked", "renewed"];+const SERIES_KEYS = ["issued", "expired", "revoked", "renewed"];-// const ranges = [-// { label: "7D", value: "7d" },-// { label: "30D", value: "30d" },-// { label: "6M", value: "6m" }-// ];+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>-// <UnstableCardTitle>Certificate Activity Trend</UnstableCardTitle>-// <UnstableCardAction>-// <div className="flex gap-0.5">-// {ranges.map((r) => (-// <Button-// key={r.value}-// size="xs"-// variant={currentRange === r.value ? "neutral" : "ghost"}-// onClick={() => onRangeChange(r.value)}-// >-// {r.label}-// </Button>-// ))}-// </div>-// </UnstableCardAction>-// </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>-// );-// };+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>+ <UnstableCardTitle>Certificate Activity Trend</UnstableCardTitle>+ <UnstableCardAction>+ <div className="flex gap-0.5">+ {ranges.map((r) => (+ <Button+ key={r.value}+ size="xs"+ variant={currentRange === r.value ? "neutral" : "ghost"}+ onClick={() => onRangeChange(r.value)}+ >+ {r.label}+ </Button>+ ))}+ </div>+ </UnstableCardAction>+ </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.tsxindex cb02606de4..a71d3bffa4 100644--- a/frontend/src/pages/cert-manager/DashboardPage/components/CodeSigningSection.tsx+++ b/frontend/src/pages/cert-manager/DashboardPage/components/CodeSigningSection.tsx@@ -1,244 +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>-// );-// };+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.tsxindex 5b26c0f465..dff0b4f6f6 100644--- a/frontend/src/pages/cert-manager/DashboardPage/components/DistributionCharts.tsx+++ b/frontend/src/pages/cert-manager/DashboardPage/components/DistributionCharts.tsx@@ -1,212 +1,212 @@-// import { Cell, Pie, PieChart, ResponsiveContainer, Tooltip as RechartsTooltip } from "recharts";+import { Cell, Pie, PieChart, ResponsiveContainer, Tooltip as RechartsTooltip } from "recharts";-// import {-// Tooltip,-// TooltipContent,-// TooltipTrigger,-// UnstableCard,-// UnstableCardContent,-// UnstableCardDescription,-// 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 {+ Tooltip,+ TooltipContent,+ TooltipTrigger,+ UnstableCard,+ UnstableCardContent,+ UnstableCardDescription,+ 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";+import { CHART_COLORS, CHART_COLORS_HEX } from "./chart-theme";-// type Props = {-// stats: TDashboardStats;-// onNavigate: (filters: Record<string, string | undefined>) => void;-// };+type Props = {+ stats: TDashboardStats;+ onNavigate: (filters: Record<string, string | undefined>) => void;+};-// type ChartKey = "enrollmentMethod" | "algorithm" | "ca";+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;-// };+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-auto min-w-[250px] flex-1 flex-col">-// <UnstableCardHeader className="pb-0">-// <UnstableCardTitle className="text-base font-semibold">{title}</UnstableCardTitle>-// {subtitle && (-// <UnstableCardDescription className="text-xs">{subtitle}</UnstableCardDescription>-// )}-// </UnstableCardHeader>-// <UnstableCardContent className="flex flex-1 items-center 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>-// );-// };+ return (+ <UnstableCard className="flex h-auto min-w-[250px] flex-1 flex-col">+ <UnstableCardHeader className="pb-0">+ <UnstableCardTitle className="text-base font-semibold">{title}</UnstableCardTitle>+ {subtitle && (+ <UnstableCardDescription className="text-xs">{subtitle}</UnstableCardDescription>+ )}+ </UnstableCardHeader>+ <UnstableCardContent className="flex flex-1 items-center 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-// }-// ];+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 });-// }-// }}-// />-// ))}-// </>-// );-// };+ 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.tsxindex d137620f44..c9a7544899 100644--- a/frontend/src/pages/cert-manager/DashboardPage/components/ExpirationTimeline.tsx+++ b/frontend/src/pages/cert-manager/DashboardPage/components/ExpirationTimeline.tsx@@ -1,180 +1,180 @@-// import { useMemo } from "react";-// import { Cell, Pie, PieChart, ResponsiveContainer, Tooltip as RechartsTooltip } from "recharts";+import { useMemo } from "react";+import { Cell, Pie, PieChart, ResponsiveContainer, Tooltip as RechartsTooltip } from "recharts";-// import {-// Tooltip,-// TooltipContent,-// TooltipTrigger,-// UnstableCard,-// UnstableCardContent,-// UnstableCardDescription,-// UnstableCardHeader,-// UnstableCardTitle,-// UnstableEmpty,-// UnstableEmptyHeader,-// UnstableEmptyTitle-// } from "@app/components/v3";-// import type { TExpirationBucket } from "@app/hooks/api/certificates";+import {+ Tooltip,+ TooltipContent,+ TooltipTrigger,+ UnstableCard,+ UnstableCardContent,+ UnstableCardDescription,+ 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";+import { CHART_COLORS, CHART_COLORS_HEX } from "./chart-theme";-// type Props = {-// buckets: TExpirationBucket[];-// onNavigate: (filters: Record<string, string | undefined>) => void;-// };+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" }-// }-// ];+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]);+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 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);+ const nonZeroData = chartData.filter((d) => d.count > 0);+ const total = chartData.reduce((sum, d) => sum + d.count, 0);-// return (-// <UnstableCard className="flex h-auto min-w-[250px] flex-1 flex-col">-// <UnstableCardHeader className="pb-0">-// <UnstableCardTitle className="text-base font-semibold">-// Expiration Timeline-// </UnstableCardTitle>-// <UnstableCardDescription className="text-xs">-// Certificates by time to expiry-// </UnstableCardDescription>-// </UnstableCardHeader>-// <UnstableCardContent className="flex flex-1 items-center 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>-// );-// };+ return (+ <UnstableCard className="flex h-auto min-w-[250px] flex-1 flex-col">+ <UnstableCardHeader className="pb-0">+ <UnstableCardTitle className="text-base font-semibold">+ Expiration Timeline+ </UnstableCardTitle>+ <UnstableCardDescription className="text-xs">+ Certificates by time to expiry+ </UnstableCardDescription>+ </UnstableCardHeader>+ <UnstableCardContent className="flex flex-1 items-center 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/ValidityReadinessSection.tsx b/frontend/src/pages/cert-manager/DashboardPage/components/ValidityReadinessSection.tsxindex 3816c88404..fd6efdd85c 100644--- a/frontend/src/pages/cert-manager/DashboardPage/components/ValidityReadinessSection.tsx+++ b/frontend/src/pages/cert-manager/DashboardPage/components/ValidityReadinessSection.tsx@@ -1,356 +1,356 @@-// import { useMemo } from "react";-// import {-// Bar,-// BarChart,-// CartesianGrid,-// Cell,-// Pie,-// PieChart,-// ResponsiveContainer,-// Tooltip as RechartsTooltip,-// XAxis,-// YAxis-// } from "recharts";+import { useMemo } from "react";+import {+ Bar,+ BarChart,+ CartesianGrid,+ Cell,+ Pie,+ PieChart,+ ResponsiveContainer,+ Tooltip as RechartsTooltip,+ XAxis,+ YAxis+} from "recharts";-// import {-// Tooltip,-// TooltipContent,-// TooltipTrigger,-// UnstableCard,-// UnstableCardContent,-// UnstableCardHeader,-// UnstableCardTitle-// } from "@app/components/v3";-// import type { TDashboardStats } from "@app/hooks/api/certificates";+import {+ Tooltip,+ TooltipContent,+ TooltipTrigger,+ UnstableCard,+ UnstableCardContent,+ UnstableCardHeader,+ UnstableCardTitle+} from "@app/components/v3";+import type { TDashboardStats } from "@app/hooks/api/certificates";-// import { CHART_COLORS, CHART_COLORS_HEX } from "./chart-theme";+import { CHART_COLORS, CHART_COLORS_HEX } from "./chart-theme";-// type Props = {-// stats: TDashboardStats;-// };+type Props = {+ stats: TDashboardStats;+};-// const ALL_PHASES = [-// {-// date: new Date("2026-03-15"),-// maxDays: 200,-// description: "Max validity reduced to 200 days"-// },-// {-// date: new Date("2027-03-15"),-// maxDays: 100,-// description: "Max validity reduced to 100 days"-// },-// {-// date: new Date("2029-03-15"),-// maxDays: 47,-// description: "Max validity reduced to 47 days"-// }-// ];+const ALL_PHASES = [+ {+ date: new Date("2026-03-15"),+ maxDays: 200,+ description: "Max validity reduced to 200 days"+ },+ {+ date: new Date("2027-03-15"),+ maxDays: 100,+ description: "Max validity reduced to 100 days"+ },+ {+ date: new Date("2029-03-15"),+ maxDays: 47,+ description: "Max validity reduced to 47 days"+ }+];-// const VALIDITY_BUCKET_CONFIG: Record<string, { label: string; compliance: string; color: string }> =-// {-// ">=200d": {-// label: "> 200 days",-// compliance: "Non-compliant (exceeds current limit)",-// color: CHART_COLORS_HEX[7]-// },-// "100-199d": {-// label: "100\u2013199 days",-// compliance: "Compliant until Mar 2027",-// color: CHART_COLORS_HEX[1]-// },-// "48-99d": {-// label: "48\u201399 days",-// compliance: "Compliant until Mar 2029",-// color: CHART_COLORS_HEX[0]-// },-// "<=47d": {-// label: "\u2264 47 days",-// compliance: "Fully compliant",-// color: CHART_COLORS_HEX[5]-// }-// };+const VALIDITY_BUCKET_CONFIG: Record<string, { label: string; compliance: string; color: string }> =+ {+ ">=200d": {+ label: "> 200 days",+ compliance: "Non-compliant (exceeds current limit)",+ color: CHART_COLORS_HEX[7]+ },+ "100-199d": {+ label: "100\u2013199 days",+ compliance: "Compliant until Mar 2027",+ color: CHART_COLORS_HEX[1]+ },+ "48-99d": {+ label: "48\u201399 days",+ compliance: "Compliant until Mar 2029",+ color: CHART_COLORS_HEX[0]+ },+ "<=47d": {+ label: "\u2264 47 days",+ compliance: "Fully compliant",+ color: CHART_COLORS_HEX[5]+ }+ };-// const BUCKET_ORDER = [">=200d", "100-199d", "48-99d", "<=47d"];+const BUCKET_ORDER = [">=200d", "100-199d", "48-99d", "<=47d"];-// const MandateCountdown = () => {-// const now = Date.now();-// const futurePhases = ALL_PHASES.filter(-// (p) => Math.ceil((p.date.getTime() - now) / (1000 * 60 * 60 * 24)) > 0-// );+const MandateCountdown = () => {+ const now = Date.now();+ const futurePhases = ALL_PHASES.filter(+ (p) => Math.ceil((p.date.getTime() - now) / (1000 * 60 * 60 * 24)) > 0+ );-// return (-// <UnstableCard className="flex h-full flex-col">-// <UnstableCardHeader className="pb-2">-// <UnstableCardTitle className="text-base font-semibold">-// CA/B Forum Mandate Deadlines-// </UnstableCardTitle>-// <p className="mt-0.5 text-xs text-muted">-// Upcoming reductions in maximum TLS certificate validity-// </p>-// </UnstableCardHeader>-// <UnstableCardContent className="flex flex-1 flex-col justify-center pt-2">-// <div className="space-y-2">-// {futurePhases.map((phase) => {-// const daysUntil = Math.ceil((phase.date.getTime() - now) / (1000 * 60 * 60 * 24));-// const isUrgent = daysUntil <= 90;+ return (+ <UnstableCard className="flex h-full flex-col">+ <UnstableCardHeader className="pb-2">+ <UnstableCardTitle className="text-base font-semibold">+ CA/B Forum Mandate Deadlines+ </UnstableCardTitle>+ <p className="mt-0.5 text-xs text-muted">+ Upcoming reductions in maximum TLS certificate validity+ </p>+ </UnstableCardHeader>+ <UnstableCardContent className="flex flex-1 flex-col justify-center pt-2">+ <div className="space-y-2">+ {futurePhases.map((phase) => {+ const daysUntil = Math.ceil((phase.date.getTime() - now) / (1000 * 60 * 60 * 24));+ const isUrgent = daysUntil <= 90;-// const [, colorWarning, , , , colorSuccess] = CHART_COLORS;-// const barColor = isUrgent ? colorWarning : colorSuccess;+ const [, colorWarning, , , , colorSuccess] = CHART_COLORS;+ const barColor = isUrgent ? colorWarning : colorSuccess;-// return (-// <div-// key={phase.maxDays}-// className="flex items-center gap-3 rounded-md border border-border bg-foreground/[0.02] px-3 py-2"-// >-// <div-// className="h-8 w-1 shrink-0 rounded-full"-// style={{ backgroundColor: barColor }}-// />-// <div className="min-w-0 flex-1">-// <div className="flex items-baseline gap-2">-// <span className="text-2xl font-bold text-foreground">{daysUntil}</span>-// <span className="text-sm text-accent">days</span>-// </div>-// <p className="mt-0.5 text-xs text-muted">{phase.description}</p>-// </div>-// <p className="shrink-0 text-right text-xs text-foreground/70">-// {phase.date.toLocaleDateString("en-US", {-// month: "short",-// day: "numeric",-// year: "numeric"-// })}-// </p>-// </div>-// );-// })}-// </div>-// </UnstableCardContent>-// </UnstableCard>-// );-// };+ return (+ <div+ key={phase.maxDays}+ className="flex items-center gap-3 rounded-md border border-border bg-foreground/[0.02] px-3 py-2"+ >+ <div+ className="h-8 w-1 shrink-0 rounded-full"+ style={{ backgroundColor: barColor }}+ />+ <div className="min-w-0 flex-1">+ <div className="flex items-baseline gap-2">+ <span className="text-2xl font-bold text-foreground">{daysUntil}</span>+ <span className="text-sm text-accent">days</span>+ </div>+ <p className="mt-0.5 text-xs text-muted">{phase.description}</p>+ </div>+ <p className="shrink-0 text-right text-xs text-foreground/70">+ {phase.date.toLocaleDateString("en-US", {+ month: "short",+ day: "numeric",+ year: "numeric"+ })}+ </p>+ </div>+ );+ })}+ </div>+ </UnstableCardContent>+ </UnstableCard>+ );+};-// const ProjectedRenewals = ({ activeCerts }: { activeCerts: number }) => {-// const data = useMemo(() => {-// if (activeCerts === 0) return [];-// return [-// { label: "Current", renewals: activeCerts, color: CHART_COLORS_HEX[0] },-// {-// label: "200-day",-// renewals: Math.ceil((365 / 200) * activeCerts),-// color: CHART_COLORS_HEX[1]-// },-// {-// label: "100-day",-// renewals: Math.ceil((365 / 100) * activeCerts),-// color: CHART_COLORS_HEX[6]-// },-// {-// label: "47-day",-// renewals: Math.ceil((365 / 47) * activeCerts),-// color: CHART_COLORS_HEX[7]-// }-// ];-// }, [activeCerts]);+const ProjectedRenewals = ({ activeCerts }: { activeCerts: number }) => {+ const data = useMemo(() => {+ if (activeCerts === 0) return [];+ return [+ { label: "Current", renewals: activeCerts, color: CHART_COLORS_HEX[0] },+ {+ label: "200-day",+ renewals: Math.ceil((365 / 200) * activeCerts),+ color: CHART_COLORS_HEX[1]+ },+ {+ label: "100-day",+ renewals: Math.ceil((365 / 100) * activeCerts),+ color: CHART_COLORS_HEX[6]+ },+ {+ label: "47-day",+ renewals: Math.ceil((365 / 47) * activeCerts),+ color: CHART_COLORS_HEX[7]+ }+ ];+ }, [activeCerts]);-// if (activeCerts === 0) return null;+ if (activeCerts === 0) return null;-// return (-// <UnstableCard className="flex h-full flex-col">-// <UnstableCardHeader className="pb-0">-// <UnstableCardTitle className="text-base font-semibold">-// Projected Annual Renewals-// </UnstableCardTitle>-// <p className="mt-0.5 text-xs text-muted">-// Estimated yearly renewal volume under each validity regime-// </p>-// </UnstableCardHeader>-// <UnstableCardContent className="flex flex-1 flex-col justify-end pt-4">-// <ResponsiveContainer width="100%" height={170}>-// <BarChart data={data} margin={{ top: 10, right: 10, left: 0, bottom: 0 }}>-// <CartesianGrid strokeDasharray="3 3" stroke="var(--color-border)" vertical={false} />-// <XAxis-// dataKey="label"-// tick={{ fontSize: 11, fill: "var(--color-muted)" }}-// axisLine={false}-// tickLine={false}-// />-// <YAxis-// tick={{ fontSize: 11, fill: "var(--color-muted)" }}-// axisLine={false}-// tickLine={false}-// width={40}-// />-// <RechartsTooltip-// contentStyle={{-// backgroundColor: "var(--color-popover)",-// border: "1px solid var(--color-border)",-// borderRadius: "6px",-// color: "var(--color-foreground)"-// }}-// itemStyle={{ color: "var(--color-foreground)" }}-// labelStyle={{ color: "var(--color-foreground)" }}-// formatter={(value) => [Number(value).toLocaleString(), "Renewals/year"]}-// cursor={{ fill: "none" }}-// />-// <defs>-// {data.map((entry) => (-// <linearGradient-// key={`grad-bar-${entry.label}`}-// id={`grad-bar-${entry.label}`}-// x1="0"-// y1="0"-// x2="0"-// y2="1"-// >-// <stop offset="0%" stopColor={entry.color} stopOpacity={1} />-// <stop offset="100%" stopColor={entry.color} stopOpacity={0.5} />-// </linearGradient>-// ))}-// </defs>-// <Bar dataKey="renewals" radius={[4, 4, 0, 0]} maxBarSize={48}>-// {data.map((entry) => (-// <Cell key={`bar-${entry.label}`} fill={`url(#grad-bar-${entry.label})`} />-// ))}-// </Bar>-// </BarChart>-// </ResponsiveContainer>-// <p className="mt-2 text-center text-xs text-muted">-// Based on {activeCerts.toLocaleString()} active certificate{activeCerts !== 1 ? "s" : ""}-// </p>-// </UnstableCardContent>-// </UnstableCard>-// );-// };+ return (+ <UnstableCard className="flex h-full flex-col">+ <UnstableCardHeader className="pb-0">+ <UnstableCardTitle className="text-base font-semibold">+ Projected Annual Renewals+ </UnstableCardTitle>+ <p className="mt-0.5 text-xs text-muted">+ Estimated yearly renewal volume under each validity regime+ </p>+ </UnstableCardHeader>+ <UnstableCardContent className="flex flex-1 flex-col justify-end pt-4">+ <ResponsiveContainer width="100%" height={170}>+ <BarChart data={data} margin={{ top: 10, right: 10, left: 0, bottom: 0 }}>+ <CartesianGrid strokeDasharray="3 3" stroke="var(--color-border)" vertical={false} />+ <XAxis+ dataKey="label"+ tick={{ fontSize: 11, fill: "var(--color-muted)" }}+ axisLine={false}+ tickLine={false}+ />+ <YAxis+ tick={{ fontSize: 11, fill: "var(--color-muted)" }}+ axisLine={false}+ tickLine={false}+ width={40}+ />+ <RechartsTooltip+ contentStyle={{+ backgroundColor: "var(--color-popover)",+ border: "1px solid var(--color-border)",+ borderRadius: "6px",+ color: "var(--color-foreground)"+ }}+ itemStyle={{ color: "var(--color-foreground)" }}+ labelStyle={{ color: "var(--color-foreground)" }}+ formatter={(value) => [Number(value).toLocaleString(), "Renewals/year"]}+ cursor={{ fill: "none" }}+ />+ <defs>+ {data.map((entry) => (+ <linearGradient+ key={`grad-bar-${entry.label}`}+ id={`grad-bar-${entry.label}`}+ x1="0"+ y1="0"+ x2="0"+ y2="1"+ >+ <stop offset="0%" stopColor={entry.color} stopOpacity={1} />+ <stop offset="100%" stopColor={entry.color} stopOpacity={0.5} />+ </linearGradient>+ ))}+ </defs>+ <Bar dataKey="renewals" radius={[4, 4, 0, 0]} maxBarSize={48}>+ {data.map((entry) => (+ <Cell key={`bar-${entry.label}`} fill={`url(#grad-bar-${entry.label})`} />+ ))}+ </Bar>+ </BarChart>+ </ResponsiveContainer>+ <p className="mt-2 text-center text-xs text-muted">+ Based on {activeCerts.toLocaleString()} active certificate{activeCerts !== 1 ? "s" : ""}+ </p>+ </UnstableCardContent>+ </UnstableCard>+ );+};-// const ValidityDistribution = ({ buckets }: { buckets: TDashboardStats["validityBuckets"] }) => {-// const chartData = useMemo(() => {-// if (!buckets) return [];-// const bucketMap = new Map(buckets.map((b) => [b.bucket, b.count]));-// return BUCKET_ORDER.map((key, idx) => ({-// bucket: key,-// count: bucketMap.get(key) || 0,-// segIdx: idx,-// ...VALIDITY_BUCKET_CONFIG[key]-// })).filter((d) => d.count > 0);-// }, [buckets]);+const ValidityDistribution = ({ buckets }: { buckets: TDashboardStats["validityBuckets"] }) => {+ const chartData = useMemo(() => {+ if (!buckets) return [];+ const bucketMap = new Map(buckets.map((b) => [b.bucket, b.count]));+ return BUCKET_ORDER.map((key, idx) => ({+ bucket: key,+ count: bucketMap.get(key) || 0,+ segIdx: idx,+ ...VALIDITY_BUCKET_CONFIG[key]+ })).filter((d) => d.count > 0);+ }, [buckets]);-// const total = chartData.reduce((sum, d) => sum + d.count, 0);+ const total = chartData.reduce((sum, d) => sum + d.count, 0);-// if (total === 0) return null;+ if (total === 0) return null;-// return (-// <UnstableCard className="flex h-full flex-col">-// <UnstableCardHeader className="pb-0">-// <UnstableCardTitle className="text-base font-semibold">-// Certificates by Validity Period-// </UnstableCardTitle>-// <p className="mt-0.5 text-xs text-muted">-// Active certificates grouped by issuance-to-expiry duration-// </p>-// </UnstableCardHeader>-// <UnstableCardContent className="flex flex-1 items-center pt-2">-// <div className="flex w-full items-center gap-3">-// <div className="w-[120px] shrink-0">-// <ResponsiveContainer width="100%" height={120}>-// <PieChart>-// <defs>-// {chartData.map((item) => (-// <linearGradient-// key={`grad-val-${item.segIdx}`}-// id={`grad-val-${item.segIdx}`}-// x1="0"-// y1="0"-// x2="1"-// y2="1"-// >-// <stop offset="0%" stopColor={item.color} stopOpacity={1} />-// <stop offset="100%" stopColor={item.color} stopOpacity={0.6} />-// </linearGradient>-// ))}-// </defs>-// <Pie-// data={chartData}-// dataKey="count"-// nameKey="label"-// cx="50%"-// cy="50%"-// innerRadius={32}-// outerRadius={52}-// paddingAngle={2}-// stroke="none"-// >-// {chartData.map((item) => (-// <Cell key={item.bucket} fill={`url(#grad-val-${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) => {-// const pct = total > 0 ? Math.round((item.count / total) * 100) : 0;-// return (-// <div-// key={item.bucket}-// className="flex w-full items-center gap-2 rounded px-1 py-0.5 text-xs"-// >-// <span-// className="h-2.5 w-2.5 shrink-0 rounded-full"-// style={{ backgroundColor: item.color }}-// />-// <Tooltip>-// <TooltipTrigger asChild>-// <span className="min-w-0 flex-1 truncate text-left text-foreground">-// {item.label}-// </span>-// </TooltipTrigger>-// <TooltipContent side="top">{item.compliance}</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>-// </div>-// );-// })}-// </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>-// );-// };+ return (+ <UnstableCard className="flex h-full flex-col">+ <UnstableCardHeader className="pb-0">+ <UnstableCardTitle className="text-base font-semibold">+ Certificates by Validity Period+ </UnstableCardTitle>+ <p className="mt-0.5 text-xs text-muted">+ Active certificates grouped by issuance-to-expiry duration+ </p>+ </UnstableCardHeader>+ <UnstableCardContent className="flex flex-1 items-center pt-2">+ <div className="flex w-full items-center gap-3">+ <div className="w-[120px] shrink-0">+ <ResponsiveContainer width="100%" height={120}>+ <PieChart>+ <defs>+ {chartData.map((item) => (+ <linearGradient+ key={`grad-val-${item.segIdx}`}+ id={`grad-val-${item.segIdx}`}+ x1="0"+ y1="0"+ x2="1"+ y2="1"+ >+ <stop offset="0%" stopColor={item.color} stopOpacity={1} />+ <stop offset="100%" stopColor={item.color} stopOpacity={0.6} />+ </linearGradient>+ ))}+ </defs>+ <Pie+ data={chartData}+ dataKey="count"+ nameKey="label"+ cx="50%"+ cy="50%"+ innerRadius={32}+ outerRadius={52}+ paddingAngle={2}+ stroke="none"+ >+ {chartData.map((item) => (+ <Cell key={item.bucket} fill={`url(#grad-val-${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) => {+ const pct = total > 0 ? Math.round((item.count / total) * 100) : 0;+ return (+ <div+ key={item.bucket}+ className="flex w-full items-center gap-2 rounded px-1 py-0.5 text-xs"+ >+ <span+ className="h-2.5 w-2.5 shrink-0 rounded-full"+ style={{ backgroundColor: item.color }}+ />+ <Tooltip>+ <TooltipTrigger asChild>+ <span className="min-w-0 flex-1 truncate text-left text-foreground">+ {item.label}+ </span>+ </TooltipTrigger>+ <TooltipContent side="top">{item.compliance}</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>+ </div>+ );+ })}+ </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 ValidityReadinessSection = ({ stats }: Props) => {-// const tlsActiveCerts = useMemo(-// () => (stats.validityBuckets || []).reduce((sum, b) => sum + b.count, 0),-// [stats.validityBuckets]-// );+export const ValidityReadinessSection = ({ stats }: Props) => {+ const tlsActiveCerts = useMemo(+ () => (stats.validityBuckets || []).reduce((sum, b) => sum + b.count, 0),+ [stats.validityBuckets]+ );-// if (tlsActiveCerts === 0) return null;+ if (tlsActiveCerts === 0) return null;-// return (-// <div className="flex flex-col gap-4">-// <h2 className="text-lg font-semibold text-foreground">47-Day Validity Readiness</h2>-// <div className="grid auto-rows-[1fr] grid-cols-1 gap-4 xl:grid-cols-3">-// <MandateCountdown />-// <ProjectedRenewals activeCerts={tlsActiveCerts} />-// <ValidityDistribution buckets={stats.validityBuckets} />-// </div>-// </div>-// );-// };+ return (+ <div className="flex flex-col gap-4">+ <h2 className="text-lg font-semibold text-foreground">47-Day Validity Readiness</h2>+ <div className="grid auto-rows-[1fr] grid-cols-1 gap-4 xl:grid-cols-3">+ <MandateCountdown />+ <ProjectedRenewals activeCerts={tlsActiveCerts} />+ <ValidityDistribution buckets={stats.validityBuckets} />+ </div>+ </div>+ );+};diff --git a/frontend/src/pages/cert-manager/DashboardPage/components/index.tsx b/frontend/src/pages/cert-manager/DashboardPage/components/index.tsxindex 7f4458dd25..88efe0c3fb 100644--- a/frontend/src/pages/cert-manager/DashboardPage/components/index.tsx+++ b/frontend/src/pages/cert-manager/DashboardPage/components/index.tsx@@ -1,6 +1,6 @@-// export { ActivityTrend } from "./ActivityTrend";-// export { CodeSigningSection } from "./CodeSigningSection";-// export { DistributionCharts } from "./DistributionCharts";-// export { ExpirationTimeline } from "./ExpirationTimeline";+export { ActivityTrend } from "./ActivityTrend";+export { CodeSigningSection } from "./CodeSigningSection";+export { DistributionCharts } from "./DistributionCharts";+export { ExpirationTimeline } from "./ExpirationTimeline";export { KpiCards } from "./KpiCards";-// export { ValidityReadinessSection } from "./ValidityReadinessSection";+export { ValidityReadinessSection } from "./ValidityReadinessSection";diff --git a/frontend/vite.config.ts b/frontend/vite.config.tsindex 56fd3e1831..d4040640ba 100644--- a/frontend/vite.config.ts+++ b/frontend/vite.config.ts@@ -48,7 +48,21 @@ export default defineConfig(({ mode }) => {output: {entryFileNames: `assets/[name]-${version}-[hash].js`,chunkFileNames: `assets/[name]-${version}-[hash].js`,- assetFileNames: `assets/[name]-${version}-[hash].[ext]`+ assetFileNames: `assets/[name]-${version}-[hash].[ext]`,+ // recharts/d3 has circular dependencies so we ensure+ // they remain in the same chunk so that the import resolution+ // doesn't lead to uninitailized import sequences+ manualChunks(id) {+ if (+ id.includes("node_modules/recharts") ||+ id.includes("node_modules/d3-") ||+ id.includes("node_modules/victory-vendor")+ ) {+ return "recharts";+ }++ return undefined;+ }}}},