diff --git a/src/apps/metrics-systems/components/MetricsDashboard.tsx b/src/apps/metrics-systems/components/MetricsDashboard.tsx index 7e4e7f0..51dfec2 100644 --- a/src/apps/metrics-systems/components/MetricsDashboard.tsx +++ b/src/apps/metrics-systems/components/MetricsDashboard.tsx @@ -430,6 +430,30 @@ const MetricsDashboard = ({ onConnectionStateChange, activeTab = 'system', onTab ) + // Custom tooltip that sorts values in descending order + const SortedTooltip = ({ active, payload, label }: { active?: boolean; payload?: Array<{ value: number; name: string; color: string }>; label?: string }) => { + if (active && payload && payload.length) { + const sortedPayload = [...payload].sort((a, b) => b.value - a.value) + return ( +
+

{label}

+ {sortedPayload.map((entry, index) => ( +

+ {entry.name}: {Number(entry.value).toFixed(1)}% +

+ ))} +
+ ) + } + return null + } + return (
@@ -795,10 +819,7 @@ const MetricsDashboard = ({ onConnectionStateChange, activeTab = 'system', onTab `${value}%`} /> - [`${Number(value).toFixed(2)}%`, name as string]} - /> + } /> {containerTimeseries.series.filter(s => s.metric_name === 'cpu_usage' && s.labels?.name).map((s, i) => { const colors = [COLORS.primary, COLORS.success, COLORS.warning, COLORS.danger, COLORS.info, COLORS.secondary] const shortName = s.labels!.name.replace('ubuntu-', '').replace('-1', '') @@ -899,10 +920,7 @@ const MetricsDashboard = ({ onConnectionStateChange, activeTab = 'system', onTab `${value}%`} /> - [`${Number(value).toFixed(1)}%`, name as string]} - /> + } /> {containerTimeseries.series.filter(s => s.metric_name === 'memory_usage_percent' && s.labels?.name).map((s, i) => { const colors = [COLORS.primary, COLORS.success, COLORS.warning, COLORS.danger, COLORS.info, COLORS.secondary] const shortName = s.labels!.name.replace('ubuntu-', '').replace('-1', '')