Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

Address PR comments

Carlos Monastyrski51c5758c3e75
diff --git a/frontend/src/pages/cert-manager/DashboardPage/DashboardPage.tsx b/frontend/src/pages/cert-manager/DashboardPage/DashboardPage.tsx
index 43491b16c6..3eb2ad0d5b 100644
--- a/frontend/src/pages/cert-manager/DashboardPage/DashboardPage.tsx
+++ b/frontend/src/pages/cert-manager/DashboardPage/DashboardPage.tsx
@@ -81,7 +81,7 @@ export const DashboardPage = () => {
) : (
<div className="flex flex-col gap-6">
<KpiCards stats={stats} onNavigate={navigateToInventory} />
- <div className="grid grid-cols-1 gap-4 lg:grid-cols-2">
+ <div className="grid grid-cols-1 gap-4 xl:grid-cols-2">
<DistributionCharts stats={stats} onNavigate={navigateToInventory} />
<ExpirationTimeline
buckets={stats.expirationBuckets}
diff --git a/frontend/src/pages/cert-manager/DashboardPage/components/ExpirationTimeline.tsx b/frontend/src/pages/cert-manager/DashboardPage/components/ExpirationTimeline.tsx
index a2d3d3331c..40d0b7ee2d 100644
--- a/frontend/src/pages/cert-manager/DashboardPage/components/ExpirationTimeline.tsx
+++ b/frontend/src/pages/cert-manager/DashboardPage/components/ExpirationTimeline.tsx
@@ -16,7 +16,7 @@ import {
} from "@app/components/v3";
import type { TExpirationBucket } from "@app/hooks/api/certificates";
-import { CHART_COLORS, CHART_COLORS_HEX, formatShare } from "./chart-theme";
+import { CHART_COLORS_HEX, formatShare } from "./chart-theme";
type Props = {
buckets: TExpirationBucket[];
@@ -53,7 +53,6 @@ export const ExpirationTimeline = ({ buckets, onNavigate }: Props) => {
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
})),
@@ -132,7 +131,7 @@ export const ExpirationTimeline = ({ buckets, onNavigate }: Props) => {
</div>
<div className="min-w-0 flex-1">
<div className="space-y-1.5">
- {chartData.map((item, idx) => {
+ {chartData.map((item) => {
const pct = formatShare(item.count, total);
return (
<button
@@ -145,7 +144,9 @@ export const ExpirationTimeline = ({ buckets, onNavigate }: Props) => {
>
<span
className="h-2.5 w-2.5 shrink-0 rounded-full"
- style={{ backgroundColor: CHART_COLORS[idx % CHART_COLORS.length] }}
+ style={{
+ backgroundColor: CHART_COLORS_HEX[item.segIdx % CHART_COLORS_HEX.length]
+ }}
/>
<Tooltip>
<TooltipTrigger asChild>
diff --git a/frontend/src/pages/cert-manager/DashboardPage/components/KpiCards.tsx b/frontend/src/pages/cert-manager/DashboardPage/components/KpiCards.tsx
index 20b0bafd12..d541f94dec 100644
--- a/frontend/src/pages/cert-manager/DashboardPage/components/KpiCards.tsx
+++ b/frontend/src/pages/cert-manager/DashboardPage/components/KpiCards.tsx
@@ -3,6 +3,8 @@ import { AlertTriangle, FileCheck, FileClock, FileKey, FileX } from "lucide-reac
import { Badge, Card, CardContent } from "@app/components/v3";
import type { TDashboardStats } from "@app/hooks/api/certificates";
+import { formatShare } from "./chart-theme";
+
type Props = {
stats: TDashboardStats;
onNavigate: (filters: Record<string, string | undefined>) => void;
@@ -60,10 +62,9 @@ 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`
+ label: `${formatShare(active, total)} active`
};
}
if (key === "active" && total > 0) {
diff --git a/frontend/src/pages/cert-manager/DashboardPage/components/PqcReadinessChart.tsx b/frontend/src/pages/cert-manager/DashboardPage/components/PqcReadinessChart.tsx
index 9b0f4dc4eb..6848c133af 100644
--- a/frontend/src/pages/cert-manager/DashboardPage/components/PqcReadinessChart.tsx
+++ b/frontend/src/pages/cert-manager/DashboardPage/components/PqcReadinessChart.tsx
@@ -13,7 +13,7 @@ import {
import type { TDashboardStats } from "@app/hooks/api/certificates";
import { isPqcAlgorithm } from "@app/hooks/api/certificates/constants";
-import { CHART_COLORS, CHART_COLORS_HEX } from "./chart-theme";
+import { CHART_COLORS_HEX, formatShare } from "./chart-theme";
type Props = {
stats: TDashboardStats;
@@ -111,7 +111,7 @@ export const PqcReadinessChart = ({ stats, onNavigate }: Props) => {
<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;
+ const pct = formatShare(entry.count, total);
return (
<button
key={entry.label}
@@ -121,12 +121,12 @@ export const PqcReadinessChart = ({ stats, onNavigate }: Props) => {
>
<span
className="h-2.5 w-2.5 shrink-0 rounded-full"
- style={{ backgroundColor: CHART_COLORS[idx % CHART_COLORS.length] }}
+ style={{ backgroundColor: CHART_COLORS_HEX[idx % CHART_COLORS_HEX.length] }}
/>
<span className="min-w-0 flex-1 truncate text-left text-foreground">
{entry.label}
</span>
- <span className="shrink-0 text-right text-muted">{pct}%</span>
+ <span className="shrink-0 text-right text-muted">{pct}</span>
<span className="shrink-0 text-right font-medium text-foreground">
{entry.count}
</span>
diff --git a/frontend/src/pages/cert-manager/DashboardPage/components/ValidityReadinessSection.tsx b/frontend/src/pages/cert-manager/DashboardPage/components/ValidityReadinessSection.tsx
index c6f4bb6aec..1fb1fabea5 100644
--- a/frontend/src/pages/cert-manager/DashboardPage/components/ValidityReadinessSection.tsx
+++ b/frontend/src/pages/cert-manager/DashboardPage/components/ValidityReadinessSection.tsx
@@ -23,7 +23,7 @@ import {
} 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, formatShare } from "./chart-theme";
type Props = {
stats: TDashboardStats;
@@ -292,7 +292,7 @@ const ValidityDistribution = ({ buckets }: { buckets: TDashboardStats["validityB
<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;
+ const pct = formatShare(item.count, total);
return (
<div
key={item.bucket}
@@ -310,7 +310,7 @@ const ValidityDistribution = ({ buckets }: { buckets: TDashboardStats["validityB
</TooltipTrigger>
<TooltipContent side="top">{item.compliance}</TooltipContent>
</Tooltip>
- <span className="shrink-0 text-right text-muted">{pct}%</span>
+ <span className="shrink-0 text-right text-muted">{pct}</span>
<span className="shrink-0 text-right font-medium text-foreground">
{item.count}
</span>
diff --git a/frontend/src/pages/cert-manager/DashboardPage/components/chart-theme.tsx b/frontend/src/pages/cert-manager/DashboardPage/components/chart-theme.tsx
index efa7886468..7e90a3b327 100644
--- a/frontend/src/pages/cert-manager/DashboardPage/components/chart-theme.tsx
+++ b/frontend/src/pages/cert-manager/DashboardPage/components/chart-theme.tsx
@@ -33,6 +33,7 @@ export const formatShare = (count: number, total: number) => {
if (total <= 0) return "0%";
const share = (count / total) * 100;
if (share > 0 && share < 1) return "<1%";
+ if (share > 99 && share < 100) return ">99%";
return `${Math.round(share)}%`;
};