Skip to content

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.

fix(ds): KPI tiles use the KpiBand primitive everywhere, and one selection bar

Juan Denis6c1626ee140e
diff --git a/frontend/src/components/backups/ProtectionStatusCard.jsx b/frontend/src/components/backups/ProtectionStatusCard.jsx
index 40c67734..b794162d 100644
--- a/frontend/src/components/backups/ProtectionStatusCard.jsx
+++ b/frontend/src/components/backups/ProtectionStatusCard.jsx
@@ -1,4 +1,4 @@
-import { Pill, MetricCard } from '@/components/ds';
+import { Pill, MetricCard, KpiBand } from '@/components/ds';
import { Switch } from '@/components/ui/switch';
import { Button } from '@/components/ui/button';
import { Archive, Clock, DollarSign, HardDrive, Play, ExternalLink, Loader2 } from 'lucide-react';
@@ -117,7 +117,7 @@ const ProtectionStatusCard = ({
{statusAction}
</div>
- <div className="protection-status-card__kpis">
+ <KpiBand>
<MetricCard
tone="accent"
icon={<Clock size={16} />}
@@ -136,7 +136,7 @@ const ProtectionStatusCard = ({
value={policyView.storage_used_human}
label="Storage used"
/>
- </div>
+ </KpiBand>
<div className="protection-status-card__actions">
<Button variant="primary" size="sm" onClick={onBackupNow} disabled={backingUp}>
diff --git a/frontend/src/components/ds/KpiBand.jsx b/frontend/src/components/ds/KpiBand.jsx
index cfc5f5ed..439a898a 100644
--- a/frontend/src/components/ds/KpiBand.jsx
+++ b/frontend/src/components/ds/KpiBand.jsx
@@ -6,6 +6,13 @@ import { cn } from '@/lib/utils';
// every page's summary strip shares the same spacing + collapse behaviour
// instead of ~20 hand-rolled `*-kpis` grids.
//
+// Use it for EVERY row of tiles. A page that writes its own grid container is
+// one stylesheet edit away from tiles stacked full-width, and that has now
+// happened three times: twice when a rebuild dropped a `*-kpis` rule, and once
+// on Git, which shipped `className="dom-kpis"` that no stylesheet ever defined,
+// so the tiles were full-width blocks from the day it was written. There is
+// nothing to lose here — the grid is declared once, in _design-system.scss.
+//
// Props:
// dense — compact 5-column variant (tighter gap).
// max — how many tiles stay "primary" before folding (default 4, hard
diff --git a/frontend/src/components/ds/grid/GridBulkBar.jsx b/frontend/src/components/ds/grid/GridBulkBar.jsx
index 27c65197..d0c9613c 100644
--- a/frontend/src/components/ds/grid/GridBulkBar.jsx
+++ b/frontend/src/components/ds/grid/GridBulkBar.jsx
@@ -1,23 +1,42 @@
import { X } from 'lucide-react';
-// The selection bar. Appears only when rows are picked, and holds the actions
-// that only make sense in bulk — so the per-row menu doesn't have to carry
-// "…and 40 others" variants of everything.
+// The selection bar: one component, one place on screen. Appears only when rows
+// are picked, and holds the actions that only make sense in bulk — so the
+// per-row menu doesn't have to carry "…and 40 others" variants of everything.
//
// <GridBulkBar count={picked.length} noun="domain" onClear={…}>
// <button onClick={…}><RefreshCw size={13}/> Check DNS</button>
// <button className="is-danger" onClick={…}><Trash2 size={13}/> Remove</button>
// </GridBulkBar>
+//
+// It floats at the bottom of the viewport rather than sitting inline above the
+// table. Two reasons. It does not reflow the rows you are in the middle of
+// picking — an inline bar pushed the whole table down the moment you ticked the
+// first checkbox, moving the next row out from under the cursor. And it stays
+// put while you scroll a long list, so the actions are reachable from row 400
+// without scrolling back to the top.
+//
+// This used to exist twice: this component rendering inline at the top of the
+// list, and a hand-rolled copy inside ResourceListPage floating at the bottom.
+// Same feature, two places, two behaviours depending on which page you were on.
export function GridBulkBar({ count, noun = 'row', onClear, children }) {
if (!count) return null;
return (
- <div className="sk-gridbulk">
- <span className="sk-gridbulk__count">{count}</span>
- <span className="sk-gridbulk__label">{noun}{count === 1 ? '' : 's'} selected</span>
- <div className="sk-gridbulk__acts">{children}</div>
- <button type="button" className="sk-gridbulk__clear" onClick={onClear}>
- <X size={13} /> Clear
- </button>
+ <div className="sk-bulkbar" role="status">
+ <span className="sk-bulkbar__count">
+ {count} {noun}{count === 1 ? '' : 's'} selected
+ </span>
+ <div className="sk-bulkbar__actions">{children}</div>
+ {onClear && (
+ <button
+ type="button"
+ className="sk-bulkbar__clear"
+ onClick={onClear}
+ aria-label="Clear selection"
+ >
+ <X size={14} />
+ </button>
+ )}
</div>
);
}
diff --git a/frontend/src/components/layouts/ResourceListPage.jsx b/frontend/src/components/layouts/ResourceListPage.jsx
index d35a4a75..dc172be0 100644
--- a/frontend/src/components/layouts/ResourceListPage.jsx
+++ b/frontend/src/components/layouts/ResourceListPage.jsx
@@ -1,9 +1,9 @@
import { useCallback, useMemo, useState } from 'react';
-import { Search, Rows3, LayoutGrid, X } from 'lucide-react';
+import { Search, Rows3, LayoutGrid } from 'lucide-react';
import { cn } from '@/lib/utils';
import { SegControl, DataTableFooter, ListToolbar } from '@/components/ds';
import {
- GridViewPicker, GridChips, GridFilterButton, GridToolsMenu, GridFilterDrawer,
+ GridViewPicker, GridChips, GridFilterButton, GridToolsMenu, GridFilterDrawer, GridBulkBar,
useTableChrome,
} from '@/components/ds/grid';
import EmptyState from '../EmptyState';
@@ -422,24 +422,12 @@ export default function ResourceListPage({
</div>
)}
- {/* Floating bulk-actions pill: appears only while a selection is
- active, instead of a permanent bar reserving toolbar space. */}
- {selectedCount > 0 && (
- <div className="sk-bulkbar" role="status">
- <span className="sk-bulkbar__count">{selectedCount} selected</span>
- <div className="sk-bulkbar__actions">{bulkActions}</div>
- {onClearSelection && (
- <button
- type="button"
- className="sk-bulkbar__clear"
- onClick={onClearSelection}
- aria-label="Clear selection"
- >
- <X size={14} />
- </button>
- )}
- </div>
- )}
+ {/* The shared selection bar — this wrapper used to hand-roll its
+ own copy, which is how /domains ended up with one at the top of
+ the list and /services with a different one at the bottom. */}
+ <GridBulkBar count={selectedCount} noun={noun.replace(/s$/, '')} onClear={onClearSelection}>
+ {bulkActions}
+ </GridBulkBar>
<GridFilterDrawer {...chrome.drawerProps} />
{children}
diff --git a/frontend/src/pages/AgentFleet.jsx b/frontend/src/pages/AgentFleet.jsx
index fa5d7c91..6e7194da 100644
--- a/frontend/src/pages/AgentFleet.jsx
+++ b/frontend/src/pages/AgentFleet.jsx
@@ -29,7 +29,7 @@ import { Button } from '@/components/ui/button';
import { Input } from '@/components/ui/input';
import { Badge } from '@/components/ui/badge';
import { Tabs, TabsList, TabsTrigger } from '@/components/ui/tabs';
-import { MetricCard, Pill, Gauge, DataTable, DataTableFooter } from '@/components/ds';
+import { MetricCard, KpiBand, Pill, Gauge, DataTable, DataTableFooter } from '@/components/ds';
const AgentFleet = () => {
const [activeTab, setActiveTab] = useState('dashboard');
@@ -479,12 +479,12 @@ const AgentFleet = () => {
{/* ==================== Dashboard ==================== */}
{activeTab === 'dashboard' && health && (
<div className="space-y-6">
- <div className="fleet-kpis">
+ <KpiBand>
<MetricCard icon={<Server size={16} />} tone="accent" label="Total Agents" value={health.total_servers} />
<MetricCard icon={<CheckCircle size={16} />} tone="green" label="Online" value={health.online_servers} />
<MetricCard icon={<AlertCircle size={16} />} tone="red" label="Offline" value={health.offline_servers} />
<MetricCard icon={<Zap size={16} />} tone="cyan" label="Success Rate" value={`${health.command_success_rate}%`} />
- </div>
+ </KpiBand>
<div className="grid grid-cols-1 lg:grid-cols-2 gap-6">
<div className="card">
diff --git a/frontend/src/pages/FTPServer.jsx b/frontend/src/pages/FTPServer.jsx
index def0e7fd..21c8fdd7 100644
--- a/frontend/src/pages/FTPServer.jsx
+++ b/frontend/src/pages/FTPServer.jsx
@@ -6,7 +6,7 @@ import {
import useTabParam from '../hooks/useTabParam';
import { useTopbarActions } from '@/hooks/useTopbarActions';
import { api } from '../services/api';
-import { DataTable, DataTableFooter, MetricCard, Pill } from '@/components/ds';
+import { DataTable, DataTableFooter, MetricCard, KpiBand, Pill } from '@/components/ds';
import { useTableSort } from '@/hooks/useTableSort';
import { useColumnVisibility } from '@/hooks/useColumnVisibility';
import { useToast } from '../contexts/ToastContext';
@@ -454,7 +454,7 @@ function FTPServer() {
/>
) : (
<>
- <div className="ftp-kpis" role="group" aria-label="FTP server status">
+ <KpiBand role="group" aria-label="FTP server status">
<MetricCard
tone={isRunning ? 'green' : 'amber'}
icon={<Activity size={16} />}
@@ -487,7 +487,7 @@ function FTPServer() {
value={connections.length}
label="Active connections"
/>
- </div>
+ </KpiBand>
<Tabs value={activeTab} onValueChange={(val) => {
setActiveTab(val);
diff --git a/frontend/src/pages/Git.jsx b/frontend/src/pages/Git.jsx
index a128ddd1..7a2269cd 100644
--- a/frontend/src/pages/Git.jsx
+++ b/frontend/src/pages/Git.jsx
@@ -7,7 +7,7 @@ import { DangerZone } from '../components/DangerZone';
import EmptyState from '../components/EmptyState';
import Modal from '@/components/Modal';
import {
- Pill, MetricCard, SegControl, Drawer, DataTable, DataTableFooter,
+ Pill, MetricCard, KpiBand, SegControl, Drawer, DataTable, DataTableFooter,
ListToolbar,
} from '../components/ds';
import {
@@ -1012,39 +1012,39 @@ function Git({ basePath = '/git' }) {
switch (activeTab) {
case 'overview':
return (
- <div className="dom-kpis">
+ <KpiBand>
<MetricCard tone={status?.running ? 'green' : 'red'} icon={<Server size={16} />} value={status?.running ? 'Running' : 'Stopped'} label="Server status" />
<MetricCard tone="accent" icon={<Globe size={16} />} value={status?.url_path || '/gitea'} label="URL path" />
<MetricCard tone="cyan" icon={<Terminal size={16} />} value={status?.ssh_port || 'N/A'} label="SSH port" />
<MetricCard tone="violet" icon={<Tag size={16} />} value={status?.version || 'Unknown'} label="Gitea version" />
- </div>
+ </KpiBand>
);
case 'repositories':
return (
- <div className="dom-kpis">
+ <KpiBand>
<MetricCard tone="accent" icon={<FolderGit2 size={16} />} value={repositories.length} label="Repositories" />
<MetricCard tone="amber" icon={<Lock size={16} />} value={repoPrivateCount} label="Private" />
<MetricCard tone="cyan" icon={<GitBranch size={16} />} value={repoForkCount} label="Forks" />
<MetricCard tone="green" icon={<Clock size={16} />} value={repoUpdatedCount} label="Updated ≤7d" />
- </div>
+ </KpiBand>
);
case 'webhooks':
return (
- <div className="dom-kpis">
+ <KpiBand>
<MetricCard tone="accent" icon={<Webhook size={16} />} value={webhooks.length} label="Webhooks" />
<MetricCard tone="green" icon={<Server size={16} />} value={webhookActiveCount} label="Active" />
<MetricCard tone="gray" icon={<AlertCircle size={16} />} value={webhookInactiveCount} label="Inactive" />
<MetricCard tone="cyan" icon={<Rocket size={16} />} value={webhookDeployCount} label="Deploy on push" />
- </div>
+ </KpiBand>
);
case 'deployments':
return (
- <div className="dom-kpis">
+ <KpiBand>
<MetricCard tone="accent" icon={<Rocket size={16} />} value={deployments.length} label="Deployments" />
<MetricCard tone="green" icon={<Server size={16} />} value={deploymentSuccessCount} label="Success" />
<MetricCard tone="red" icon={<AlertTriangle size={16} />} value={deploymentFailedCount} label="Failed" />
<MetricCard tone="amber" icon={<Clock size={16} />} value={deploymentRunningCount} label="Running" />
- </div>
+ </KpiBand>
);
default:
return null;
diff --git a/frontend/src/pages/QueueDetail.jsx b/frontend/src/pages/QueueDetail.jsx
index 1c0eb7b8..ce275b4e 100644
--- a/frontend/src/pages/QueueDetail.jsx
+++ b/frontend/src/pages/QueueDetail.jsx
@@ -19,7 +19,7 @@ import { Label } from '@/components/ui/label';
import { Input } from '@/components/ui/input';
import { Textarea } from '@/components/ui/textarea';
import {
- DataTable, DataTableFooter, MetricCard, Pill, SortChipBar,
+ DataTable, DataTableFooter, MetricCard, KpiBand, Pill, SortChipBar,
} from '@/components/ds';
import {
useTableChrome, GridViewPicker, GridChips, GridFilterButton,
@@ -369,7 +369,7 @@ const QueueDetail = () => {
</div>
</div>
- <div className="queue-detail-stats">
+ <KpiBand>
<MetricCard label="Total" value={stats.total || 0} />
{STATUS_ORDER.map(s => (
<MetricCard
@@ -379,7 +379,7 @@ const QueueDetail = () => {
kind={s === 'failed' || s === 'dead_letter' ? 'danger' : undefined}
/>
))}
- </div>
+ </KpiBand>
<div className={`queue-detail-body ${selectedMessage ? 'has-panel' : ''}`}>
<div className="queue-detail-main">
diff --git a/frontend/src/styles/components/_datagrid.scss b/frontend/src/styles/components/_datagrid.scss
index 3d5e39b5..5655ce00 100644
--- a/frontend/src/styles/components/_datagrid.scss
+++ b/frontend/src/styles/components/_datagrid.scss
@@ -324,76 +324,10 @@
}
// ---------------------------------------------------------------- bulk bar
-.sk-gridbulk {
- display: flex;
- align-items: center;
- gap: 12px;
- white-space: nowrap;
- padding: 8px 10px 8px 14px;
- margin-bottom: 10px;
- border: 1px solid var(--accent-dim);
- background: linear-gradient(90deg, var(--accent-bg), var(--surface-2));
- border-radius: 11px;
- animation: sk-grid-pop 0.14s ease;
-
- &__count {
- font-family: var(--mono);
- font-size: 12px;
- font-weight: 600;
- color: #fff;
- background: var(--accent);
- border-radius: 7px;
- padding: 2px 8px;
- }
-
- &__label { font-size: 12.5px; color: var(--text); }
-
- &__acts {
- display: flex;
- align-items: center;
- gap: 4px;
- margin-left: 6px;
- overflow-x: auto;
- scrollbar-width: none;
-
- &::-webkit-scrollbar { display: none; }
-
- button {
- flex-shrink: 0;
- display: flex;
- align-items: center;
- gap: 7px;
- padding: 6px 10px;
- border: none;
- border-radius: 8px;
- background: transparent;
- font-size: 12.5px;
- color: var(--text-dim);
- cursor: pointer;
- transition: 0.12s;
-
- &:hover { background: var(--surface-3); color: var(--text); }
- &.is-danger:hover { background: var(--red-bg); color: var(--red); }
- }
- }
-
- &__clear {
- margin-left: auto;
- display: flex;
- align-items: center;
- gap: 6px;
- padding: 6px 10px;
- border: none;
- border-radius: 8px;
- background: transparent;
- font-size: 12.5px;
- color: var(--text-faint);
- cursor: pointer;
-
- &:hover { background: var(--surface-3); color: var(--text); }
- }
-}
-
+// The inline `.sk-gridbulk` bar lived here. GridBulkBar renders the floating
+// `.sk-bulkbar` pill now (see _design-system.scss) so a selection looks and
+// behaves the same on every table instead of being inline-at-the-top on some
+// pages and floating-at-the-bottom on others.
// ---------------------------------------------------------------- the grid
.sk-grid {
border: 1px solid var(--border-soft);
diff --git a/frontend/src/styles/components/_design-system.scss b/frontend/src/styles/components/_design-system.scss
index b268e22e..dd224299 100644
--- a/frontend/src/styles/components/_design-system.scss
+++ b/frontend/src/styles/components/_design-system.scss
@@ -882,10 +882,18 @@ $sk-tones: ('accent', 'green', 'cyan', 'amber', 'red', 'violet');
align-items: center;
gap: 12px;
padding: 7px 9px 7px 16px;
- background: var(--surface);
- border: 1px solid var(--border);
+ // It floats over a dark page in a dark pill, so at --surface with a hairline
+ // border it read as a smudge rather than a control. Lifted one step to
+ // --surface-2, given an accent-tinted rim and a deeper, wider shadow: the
+ // shadow is what actually separates it from the background, since two dark
+ // greys a few percent apart never will.
+ background: var(--surface-2);
+ border: 1px solid var(--border-strong);
border-radius: 999px;
- box-shadow: 0 10px 32px rgba(0, 0, 0, 0.35);
+ box-shadow:
+ 0 18px 44px rgba(0, 0, 0, 0.55),
+ 0 2px 10px rgba(0, 0, 0, 0.4),
+ 0 0 0 1px rgb(from var(--accent) r g b / 0.14);
animation: sk-bulkbar-in 0.16s ease-out;
&__count {
@@ -896,7 +904,41 @@ $sk-tones: ('accent', 'green', 'cyan', 'amber', 'red', 'violet');
white-space: nowrap;
}
- &__actions { display: inline-flex; align-items: center; gap: 6px; }
+ // Callers pass either shared <Button>s or plain <button>s — GridBulkBar's
+ // documented API is the latter, and an unstyled bare button renders as a
+ // white OS-default control sitting in a dark pill. Style them here so both
+ // shapes land the same, and scroll horizontally rather than letting a page
+ // with five bulk actions stretch the pill off both edges of the viewport.
+ &__actions {
+ display: inline-flex;
+ align-items: center;
+ gap: 4px;
+ min-width: 0;
+ overflow-x: auto;
+ scrollbar-width: none;
+
+ &::-webkit-scrollbar { display: none; }
+
+ > button:not(.ui-button) {
+ flex-shrink: 0;
+ display: inline-flex;
+ align-items: center;
+ gap: 7px;
+ padding: 6px 11px;
+ border: none;
+ border-radius: 8px;
+ background: transparent;
+ font-size: 12.5px;
+ color: var(--text-dim);
+ cursor: pointer;
+ white-space: nowrap;
+ transition: 0.12s;
+
+ &:hover { background: var(--surface-3); color: var(--text); }
+ &:focus-visible { outline: 2px solid var(--accent-dim); outline-offset: -2px; }
+ &.is-danger:hover { background: var(--red-bg); color: var(--red); }
+ }
+ }
&__clear {
display: inline-flex;
diff --git a/frontend/src/styles/pages/_fleet-monitor.scss b/frontend/src/styles/pages/_fleet-monitor.scss
index fc26cbfc..c518f0f0 100644
--- a/frontend/src/styles/pages/_fleet-monitor.scss
+++ b/frontend/src/styles/pages/_fleet-monitor.scss
@@ -6,21 +6,12 @@
// Monitor page: the Capacity section on /monitoring still renders them under
// the same class names.
-// KPI band (Total agents / Online / Offline / Success rate). The rule was lost
-// in the recovery rebuild, so the tiles stacked full-width.
-.fleet-kpis {
- display: grid;
- grid-template-columns: repeat(4, minmax(0, 1fr));
- gap: 14px;
- margin-bottom: $space-5;
-
- @media (max-width: 1100px) {
- grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
- }
- @media (max-width: 560px) {
- grid-template-columns: 1fr 1fr;
- }
-}
+// KPI band. The grid used to be re-declared here, and a previous rebuild lost
+// the rule and left the tiles stacked full-width — the same failure Git hit
+// again with a `dom-kpis` class that no stylesheet ever defined. The page uses
+// the <KpiBand> primitive now, so there is one definition of the grid and no
+// copy of it to lose. Only the page's own spacing stays.
+.sk-kpiband-wrap { margin-bottom: $space-5; }
// Amber warning row (queued commands, forecast errors)
.fleet-warnrow {
diff --git a/frontend/src/styles/pages/_ftp-server.scss b/frontend/src/styles/pages/_ftp-server.scss
index 77ba073b..d617f630 100644
--- a/frontend/src/styles/pages/_ftp-server.scss
+++ b/frontend/src/styles/pages/_ftp-server.scss
@@ -7,20 +7,9 @@
.ftp-server {
// ─── KPI strip (status / active server / users / connections) ───
- // Rule was lost in the recovery rebuild, so the tiles stacked full-width.
- .ftp-kpis {
- display: grid;
- grid-template-columns: repeat(4, minmax(0, 1fr));
- gap: 14px;
- margin-bottom: $space-5;
-
- @media (max-width: 1100px) {
- grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
- }
- @media (max-width: 560px) {
- grid-template-columns: 1fr 1fr;
- }
- }
+ // The grid lives in the <KpiBand> primitive now; re-declaring it here is how
+ // the rule got lost in a rebuild and left the tiles stacked full-width.
+ .sk-kpiband-wrap { margin-bottom: $space-5; }
// ─── Mono eyebrow section headers (Users / Connections / Logs) ───
.section-header {
diff --git a/frontend/src/styles/pages/_queue-operations.scss b/frontend/src/styles/pages/_queue-operations.scss
index 3e22e44c..88564b0c 100644
--- a/frontend/src/styles/pages/_queue-operations.scss
+++ b/frontend/src/styles/pages/_queue-operations.scss
@@ -589,11 +589,7 @@
}
}
-.queue-detail-stats {
- display: grid;
- grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
- gap: $space-3;
-}
+// Was a hand-rolled copy of the KpiBand grid; the page uses the primitive now.
.queue-detail-body {
display: grid;