Skip to content

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

fix(cert-manager): use a theme token for the Other slice and key it distinctly from a real category

Carlos Monastyrski70818b11afd0
diff --git a/frontend/src/pages/cert-manager/DashboardPage/components/DistributionCharts.tsx b/frontend/src/pages/cert-manager/DashboardPage/components/DistributionCharts.tsx
index ba0a98f9c4..b2cef4c95f 100644
--- a/frontend/src/pages/cert-manager/DashboardPage/components/DistributionCharts.tsx
+++ b/frontend/src/pages/cert-manager/DashboardPage/components/DistributionCharts.tsx
@@ -19,7 +19,7 @@ import { certKeyAlgorithmToNameMap } from "@app/hooks/api/certificates/constants
import {
CHART_COLORS_HEX,
- CHART_OTHER_COLOR_HEX,
+ CHART_OTHER_COLOR,
formatShare,
MAX_DONUT_SEGMENTS
} from "./chart-theme";
@@ -49,8 +49,12 @@ const foldTail = (data: TDashboardDistribution[]): Segment[] => {
];
};
+const OTHER_KEY = "__other__";
+
+const segmentKey = (segment: Segment) => (segment.groupedCount ? OTHER_KEY : segment.label);
+
const colorAt = (segment: Segment, idx: number) =>
- segment.groupedCount ? CHART_OTHER_COLOR_HEX : CHART_COLORS_HEX[idx % CHART_COLORS_HEX.length];
+ segment.groupedCount ? CHART_OTHER_COLOR : CHART_COLORS_HEX[idx % CHART_COLORS_HEX.length];
const DonutChart = ({
title,
@@ -101,7 +105,7 @@ const DonutChart = ({
const hex = colorAt(entry, idx);
return (
<linearGradient
- key={`grad-${entry.label}`}
+ key={`grad-${segmentKey(entry)}`}
id={`grad-${chartId}-${idx}`}
x1="0"
y1="0"
@@ -131,7 +135,7 @@ const DonutChart = ({
}}
>
{nonZeroData.map((entry, idx) => (
- <Cell key={entry.label} fill={`url(#grad-${chartId}-${idx})`} />
+ <Cell key={segmentKey(entry)} fill={`url(#grad-${chartId}-${idx})`} />
))}
</Pie>
<RechartsTooltip
@@ -152,7 +156,7 @@ const DonutChart = ({
const isOther = Boolean(entry.groupedCount);
return (
<button
- key={entry.label}
+ key={segmentKey(entry)}
type="button"
className={twMerge(
"flex w-full items-center gap-2 rounded px-1 py-0.5 text-xs transition-colors",
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 32ea444001..efa7886468 100644
--- a/frontend/src/pages/cert-manager/DashboardPage/components/chart-theme.tsx
+++ b/frontend/src/pages/cert-manager/DashboardPage/components/chart-theme.tsx
@@ -27,7 +27,7 @@ export const CHART_COLORS_HEX = [
export const MAX_DONUT_SEGMENTS = 6;
-export const CHART_OTHER_COLOR_HEX = "#8c8f96";
+export const CHART_OTHER_COLOR = "var(--color-muted)";
export const formatShare = (count: number, total: number) => {
if (total <= 0) return "0%";