ServerKit is a lightweight, modern server control panel for managing web applications, databases, and services on your VPS or dedicated server. Built with Python/Flask backend and React frontend.
Python astracloudflarecontrol-panelcyberpaneldnsfablehosting-control-panelhosting-panelkimi-k3server-managementserverkitubuntu-web-panelwebserver
feat(ui): compact KPI numbers so 6-digit Queue Bus counts stop overflowing
Juan Denis104d45dc16cb
diff --git a/frontend/src/components/ds/MetricCard.jsx b/frontend/src/components/ds/MetricCard.jsxindex 68b0ad0b..6fba1f87 100644--- a/frontend/src/components/ds/MetricCard.jsx+++ b/frontend/src/components/ds/MetricCard.jsx@@ -1,4 +1,5 @@import { cn } from '@/lib/utils';+import { formatCompact, formatFull } from '../../utils/formatNumber';// KPI / stat tile: icon chip + big value (+ optional unit) + label, with an// optional trend delta in the top-right.@@ -11,6 +12,9 @@ import { cn } from '@/lib/utils';// this heals silent API misuse where a page passed a prop the tile dropped.// `secondary` is read by KpiBand to force-fold a tile into the compact strip;// it is not a visual prop on the tile itself.+// `compact` opts a numeric tile into space-tight formatting: a value ≥ 1000 is+// rendered compact (107814 → "107.8K") with the exact grouped number as the+// hover title. Non-numeric values (or values under 1000) render verbatim.export function MetricCard({icon,tone,@@ -21,6 +25,7 @@ export function MetricCard({trend,trendDir = 'flat',onClick,+ compact = false,className,children,secondary: _secondary, // consumed by KpiBand, kept out of DOM props@@ -34,6 +39,13 @@ export function MetricCard({}const resolvedTone = tone || kind || 'accent';+ // Compact tiles fold ≥1000 numeric values to a short form and expose the+ // exact grouped number as the title so the precise count is one hover away.+ const numericValue = typeof value === 'number' ? value : Number(value);+ const useCompact = compact && Number.isFinite(numericValue) && Math.abs(numericValue) >= 1000;+ const displayValue = useCompact ? formatCompact(numericValue) : value;+ const valueTitle = useCompact ? String(formatFull(numericValue)) : undefined;+const inner = (<><div className="sk-kpi__top">@@ -42,8 +54,8 @@ export function MetricCard({<span className={cn('sk-kpi__trend', `sk-kpi__trend--${trendDir}`)}>{trend}</span>)}</div>- <div className="sk-kpi__val">- {value}+ <div className="sk-kpi__val" title={valueTitle}>+ {displayValue}{unit && <small> {unit}</small>}</div>{label && <div className="sk-kpi__label">{label}</div>}diff --git a/frontend/src/pages/QueueOperations.jsx b/frontend/src/pages/QueueOperations.jsxindex e1eb02d4..c7f0f9b0 100644--- a/frontend/src/pages/QueueOperations.jsx+++ b/frontend/src/pages/QueueOperations.jsx@@ -23,6 +23,7 @@ import { Input } from '@/components/ui/input';import { Label } from '@/components/ui/label';import { Textarea } from '@/components/ui/textarea';import { MetricCard, Pill } from '@/components/ds';+import { formatCompact, formatFull } from '../utils/formatNumber';const STATUS_KINDS = {pending: 'blue',@@ -280,10 +281,10 @@ const QueueOperations = () => {<span>Overview</span></div><div className="queue-rail-overview">- <MetricCard label="Groups" value={groups.length} />- <MetricCard label="Queues" value={totalQueues} />- <MetricCard label="Messages" value={totalMessages} />- <MetricCard label="Dead Letter" value={statusCounts.dead_letter || 0} kind="danger" />+ <MetricCard label="Groups" value={groups.length} compact />+ <MetricCard label="Queues" value={totalQueues} compact />+ <MetricCard label="Messages" value={totalMessages} compact />+ <MetricCard label="Dead Letter" value={statusCounts.dead_letter || 0} kind="danger" compact /></div></section>@@ -300,7 +301,7 @@ const QueueOperations = () => {><Server size={14} /><span>All groups</span>- <b>{totalQueues}</b>+ <b title={String(formatFull(totalQueues))}>{formatCompact(totalQueues)}</b></button>{groups.map(group => (<button@@ -314,7 +315,7 @@ const QueueOperations = () => {{group.owner_type === 'system' && (<span className="queue-group-badge">system</span>)}- <b>{group.stats?.queues || 0}</b>+ <b>{formatCompact(group.stats?.queues || 0)}</b></button>))}</div>@@ -332,7 +333,7 @@ const QueueOperations = () => {onClick={() => setMessageFilter('all')}><span><strong>All</strong><small>Any status</small></span>- <b>{totalMessages}</b>+ <b title={String(formatFull(totalMessages))}>{formatCompact(totalMessages)}</b></button>{STATUS_ORDER.map(status => (<button@@ -345,7 +346,7 @@ const QueueOperations = () => {<strong>{STATUS_LABELS[status]}</strong><small>{status}</small></span>- <b>{statusCounts[status] || 0}</b>+ <b title={String(formatFull(statusCounts[status] || 0))}>{formatCompact(statusCounts[status] || 0)}</b></button>))}</div>diff --git a/frontend/src/styles/components/_design-system.scss b/frontend/src/styles/components/_design-system.scssindex 783abe18..8618fc50 100644--- a/frontend/src/styles/components/_design-system.scss+++ b/frontend/src/styles/components/_design-system.scss@@ -155,6 +155,12 @@ $sk-tones: ('accent', 'green', 'cyan', 'amber', 'red', 'violet');&__val {font-family: var(--mono); font-size: 27px; font-weight: 600;letter-spacing: -0.02em; line-height: 1;+ // Even columns of digits, and a truncation guard so an un-migrated+ // 6-digit value degrades to an ellipsis instead of bursting the tile.+ font-variant-numeric: tabular-nums;+ white-space: nowrap;+ overflow: hidden;+ text-overflow: ellipsis;small { font-size: 14px; color: var(--text-faint); font-weight: 500; }}&__label { font-size: 12.5px; color: var(--text-dim); margin-top: 6px; }diff --git a/frontend/src/styles/pages/_queue-operations.scss b/frontend/src/styles/pages/_queue-operations.scssindex 667428bd..3e22e44c 100644--- a/frontend/src/styles/pages/_queue-operations.scss+++ b/frontend/src/styles/pages/_queue-operations.scss@@ -96,7 +96,9 @@.queue-rail-overview {display: grid;- grid-template-columns: 1fr 1fr;+ // minmax(0, 1fr) lets a wide value shrink/truncate within the narrow rail+ // instead of forcing the column (and the whole tile) to overflow.+ grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);gap: $space-3;}diff --git a/frontend/src/utils/formatNumber.js b/frontend/src/utils/formatNumber.jsnew file mode 100644index 00000000..772a3615--- /dev/null+++ b/frontend/src/utils/formatNumber.js@@ -0,0 +1,27 @@+// Number formatting helpers for KPI tiles and count badges.+//+// `formatCompact` renders large counts in a space-tight notation (107814 →+// "107.8K") so a 6-digit total never bursts a narrow tile; `formatFull` is the+// grouped exact form (107814 → "107,814") used as the hover title so the precise+// count stays one hover away. Non-finite / non-numeric input is returned+// unchanged, letting callers pass placeholders like '—' straight through.+const compactFormatter = new Intl.NumberFormat('en', {+ notation: 'compact',+ maximumFractionDigits: 1,+});++const fullFormatter = new Intl.NumberFormat('en');++export function formatCompact(value) {+ const n = typeof value === 'number' ? value : Number(value);+ if (!Number.isFinite(n)) return value;+ return compactFormatter.format(n);+}++export function formatFull(value) {+ const n = typeof value === 'number' ? value : Number(value);+ if (!Number.isFinite(n)) return value;+ return fullFormatter.format(n);+}++export default formatCompact;