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
refactor(servers,deployments,email,serverdetail): ListToolbar everywhere
Juan Denisdf34943b8a01
diff --git a/frontend/src/components/serverdetail/PackagesTab.jsx b/frontend/src/components/serverdetail/PackagesTab.jsxindex bd0fe0aa..19224c53 100644--- a/frontend/src/components/serverdetail/PackagesTab.jsx+++ b/frontend/src/components/serverdetail/PackagesTab.jsx@@ -5,6 +5,7 @@ import { useConfirm } from '../../hooks/useConfirm';import { Button } from '@/components/ui/button';import { Input } from '@/components/ui/input';import { Badge } from '@/components/ui/badge';+import { ListToolbar } from '../ds';import JobProgressModal from '../JobProgressModal';// Quick-install presets — packages most users want first when setting@@ -141,7 +142,14 @@ const PackagesTab = ({ serverId, serverStatus }) => {return (<div className="server-packages">- <div className="server-packages__toolbar">+ <ListToolbar+ tools={(+ <div className="server-packages__actions">+ <Button variant="outline" onClick={handleUpdateCache}>Update cache</Button>+ <Button variant="outline" onClick={handleUpgradeAll}>Upgrade all</Button>+ </div>+ )}+ ><form onSubmit={handleSearch} className="server-packages__search"><Inputvalue={searchQuery}@@ -152,11 +160,7 @@ const PackagesTab = ({ serverId, serverStatus }) => {{searching ? 'Searching…' : 'Search'}</Button></form>- <div className="server-packages__actions">- <Button variant="outline" onClick={handleUpdateCache}>Update cache</Button>- <Button variant="outline" onClick={handleUpgradeAll}>Upgrade all</Button>- </div>- </div>+ </ListToolbar><section className="server-packages__presets"><h3>Quick install</h3>diff --git a/frontend/src/components/serverdetail/ServicesTab.jsx b/frontend/src/components/serverdetail/ServicesTab.jsxindex 3bbfcb7e..d3c60bf5 100644--- a/frontend/src/components/serverdetail/ServicesTab.jsx+++ b/frontend/src/components/serverdetail/ServicesTab.jsx@@ -3,7 +3,7 @@ import api from '../../services/api';import { useToast } from '../../contexts/ToastContext';import { Button } from '@/components/ui/button';import { Input } from '@/components/ui/input';-import { Pill, ColumnsMenu, DataTable, DataTableFooter, SortMenu } from '../ds';+import { Pill, ColumnsMenu, DataTable, DataTableFooter, ListToolbar, SortMenu } from '../ds';import { useTableSort } from '@/hooks/useTableSort';import { useColumnVisibility } from '@/hooks/useColumnVisibility';import Modal from '../Modal';@@ -177,7 +177,27 @@ const ServicesTab = ({ serverId, serverStatus }) => {return (<div className="server-services">- <div className="server-services__toolbar">+ <ListToolbar+ tools={(+ <div className="server-services__actions">+ <Button variant="outline" onClick={loadUnits}>Refresh</Button>+ <Button+ variant="outline"+ onClick={reloadDaemon}+ disabled={busyUnit === '__daemon__'}+ >+ Reload daemon+ </Button>+ <SortMenu columns={unitColumns} sorts={sorts} onChange={setSorts} />+ <ColumnsMenu+ columns={unitColumns}+ hiddenKeys={hiddenKeys}+ onToggle={toggleColumn}+ onShowAll={showAllColumns}+ />+ </div>+ )}+ ><Inputvalue={search}onChange={(e) => setSearch(e.target.value)}@@ -196,24 +216,7 @@ const ServicesTab = ({ serverId, serverStatus }) => {</Button>))}</div>- <div className="server-services__actions">- <Button variant="outline" onClick={loadUnits}>Refresh</Button>- <Button- variant="outline"- onClick={reloadDaemon}- disabled={busyUnit === '__daemon__'}- >- Reload daemon- </Button>- <SortMenu columns={unitColumns} sorts={sorts} onChange={setSorts} />- <ColumnsMenu- columns={unitColumns}- hiddenKeys={hiddenKeys}- onToggle={toggleColumn}- onShowAll={showAllColumns}- />- </div>- </div>+ </ListToolbar>{loading ? (<p className="text-muted-foreground">Loading…</p>diff --git a/frontend/src/components/serverdetail/SurveyTab.jsx b/frontend/src/components/serverdetail/SurveyTab.jsxindex a5ab726e..d04334f7 100644--- a/frontend/src/components/serverdetail/SurveyTab.jsx+++ b/frontend/src/components/serverdetail/SurveyTab.jsx@@ -2,7 +2,7 @@ import { useState, useEffect, useCallback } from 'react';import api from '../../services/api';import { useToast } from '../../contexts/ToastContext';import { Button } from '@/components/ui/button';-import { DataTable, DataTableFooter, Pill } from '../ds';+import { DataTable, DataTableFooter, ListToolbar, Pill } from '../ds';import EmptyState from '../EmptyState';import {FileSearch,@@ -159,7 +159,19 @@ const SurveyTab = ({ serverId, serverStatus, server }) => {return (<div className="survey-tab">- <div className="survey-tab__toolbar">+ <ListToolbar+ tools={(+ <div className="survey-tab__toolbar-actions">+ <Button variant="outline" size="sm" onClick={loadCatalog}>+ <FileSearch size={14} /> {showCatalog ? 'Hide' : 'What we check'}+ </Button>+ <Button size="sm" onClick={refly} disabled={flying || serverStatus !== 'online'}>+ <RefreshCw size={14} className={flying ? 'spin' : ''} />+ {flying ? 'Surveying…' : (snapshots.length ? 'Re-fly survey' : 'Run survey')}+ </Button>+ </div>+ )}+ ><div className="survey-tab__toolbar-info">{takenAt ? (<span className="survey-tab__muted">Last flight {new Date(takenAt).toLocaleString()}</span>@@ -172,16 +184,7 @@ const SurveyTab = ({ serverId, serverStatus, server }) => {</Pill>)}</div>- <div className="survey-tab__toolbar-actions">- <Button variant="outline" size="sm" onClick={loadCatalog}>- <FileSearch size={14} /> {showCatalog ? 'Hide' : 'What we check'}- </Button>- <Button size="sm" onClick={refly} disabled={flying || serverStatus !== 'online'}>- <RefreshCw size={14} className={flying ? 'spin' : ''} />- {flying ? 'Surveying…' : (snapshots.length ? 'Re-fly survey' : 'Run survey')}- </Button>- </div>- </div>+ </ListToolbar>{serverStatus !== 'online' && !snapshots.length && (<p className="survey-tab__muted">The agent is offline — reconnect it to fly a survey.</p>diff --git a/frontend/src/pages/Deployments.jsx b/frontend/src/pages/Deployments.jsxindex 3ea7f5e9..09eca5da 100644--- a/frontend/src/pages/Deployments.jsx+++ b/frontend/src/pages/Deployments.jsx@@ -13,8 +13,9 @@ import {import api from '../services/api';import Modal from '../components/Modal';import Skeleton from '../components/Skeleton';+import EmptyState from '../components/EmptyState';import { Button } from '@/components/ui/button';-import { SegControl, SearchField } from '@/components/ds';+import { SegControl, SearchField, ListToolbar } from '@/components/ds';import { useTopbarActions } from '@/hooks/useTopbarActions';import RequiresDocker from '../components/RequiresDocker';import {@@ -173,19 +174,22 @@ const Deployments = () => {return (<RequiresDocker what="Deployments"><div className="sk-tabgroup__inner deployments-page">- <div className="deployments-page__toolbar">- <SegControl- value={statusFilter}- onChange={setStatusFilter}- options={STATUS_FILTERS.map(([value, label]) => ({- value,- label,- count: counts[value],- }))}- aria-label="Filter by status"- />+ <ListToolbar+ filters={(+ <SegControl+ value={statusFilter}+ onChange={setStatusFilter}+ options={STATUS_FILTERS.map(([value, label]) => ({+ value,+ label,+ count: counts[value],+ }))}+ aria-label="Filter by status"+ />+ )}+ ><select- className="deployments-page__server-select"+ className="sk-listhead__select"value={serverFilter}onChange={(e) => setServerFilter(e.target.value)}aria-label="Filter by target server"@@ -197,7 +201,7 @@ const Deployments = () => {</option>))}</select>- </div>+ </ListToolbar>{loading ? (<div className="deployments-page__loading" aria-busy="true">@@ -211,17 +215,13 @@ const Deployments = () => {))}</div>) : groups.length === 0 ? (- <div className="deployments-page__empty">- <PlayCircle size={34} />- <strong>- {jobs.length === 0 ? 'No deployment jobs yet' : 'No deploys match this filter'}- </strong>- <span>- {jobs.length === 0- ? 'Create a service from a repository or install a template to see activity here.'- : 'Try a different status, server, or search term.'}- </span>- </div>+ <EmptyState+ icon={PlayCircle}+ title={jobs.length === 0 ? 'No deployment jobs yet' : 'No deploys match this filter'}+ description={jobs.length === 0+ ? 'Create a service from a repository or install a template to see activity here.'+ : 'Try a different status, server, or search term.'}+ />) : (<div className="deployments-page__feed"><div className="deployments-page__feed-head" aria-hidden="true">diff --git a/frontend/src/pages/Email.jsx b/frontend/src/pages/Email.jsxindex a00046e7..187f0ff6 100644--- a/frontend/src/pages/Email.jsx+++ b/frontend/src/pages/Email.jsx@@ -14,7 +14,7 @@ import {} from 'lucide-react';import api from '../services/api';import useTabParam from '../hooks/useTabParam';-import { Pill, MetricCard, KpiBand, DataTable, SortMenu, ColumnsMenu, DataTableFooter, ViewMenu } from '@/components/ds';+import { Pill, MetricCard, KpiBand, DataTable, SortMenu, ColumnsMenu, DataTableFooter, ViewMenu, ListToolbar } from '@/components/ds';import PageLayout from '../layouts/PageLayout';import { Button } from '@/components/ui/button';import { Input } from '@/components/ui/input';@@ -242,7 +242,8 @@ function OverviewTab({ status, installed, onChange }) {keyField="id"storageKey="serverkit-table-email-components"footer={<DataTableFooter shown={serviceRows.length} total={serviceRows.length} noun="service" />}- emptyState={<div className="sk-email__empty">No service components reported.</div>}+ emptyTitle="No service components reported."+ emptyMessage=""/></section>);@@ -515,7 +516,21 @@ function AccountsTab({ domains }) {return (<section className="sk-email__section">- <div className="sk-email__filters">+ <ListToolbar+ className="sk-email__filters"+ tools={(+ <>+ <ViewMenu views={tableViews} />+ <SortMenu columns={accountColumns} sorts={sorts} onChange={setSorts} />+ <ColumnsMenu+ columns={accountColumns}+ hiddenKeys={hiddenKeys}+ onToggle={toggleColumn}+ onShowAll={showAllColumns}+ />+ </>+ )}+ ><label>Domain<select value={domainId} onChange={(e) => setDomainId(e.target.value)}>@@ -532,17 +547,7 @@ function AccountsTab({ domains }) {aria-label="Search accounts"/></label>- <div className="sk-email__tabletools">- <ViewMenu views={tableViews} />- <SortMenu columns={accountColumns} sorts={sorts} onChange={setSorts} />- <ColumnsMenu- columns={accountColumns}- hiddenKeys={hiddenKeys}- onToggle={toggleColumn}- onShowAll={showAllColumns}- />- </div>- </div>+ </ListToolbar><form className="sk-email__add" onSubmit={create}><Input@@ -577,11 +582,8 @@ function AccountsTab({ domains }) {hiddenKeys={hiddenKeys}loading={loading}footer={<DataTableFooter shown={filtered.length} total={accounts.length} noun="account" />}- emptyState={(- <div className="sk-email__empty">- {accounts.length === 0 ? 'No accounts in this domain.' : 'No accounts match this search.'}- </div>- )}+ emptyTitle={accounts.length === 0 ? 'No accounts in this domain.' : 'No accounts match this search.'}+ emptyMessage=""/></section>);@@ -880,7 +882,25 @@ function QueueTab() {return (<section className="sk-email__section">- <div className="sk-email__filters">+ <ListToolbar+ className="sk-email__filters"+ tools={(+ <>+ <ViewMenu views={tableViews} />+ <SortMenu columns={queueColumns} sorts={sorts} onChange={setSorts} />+ <ColumnsMenu+ columns={queueColumns}+ hiddenKeys={hiddenKeys}+ onToggle={toggleColumn}+ onShowAll={showAllColumns}+ />+ <div className="sk-email__actions">+ <Button variant="outline" size="sm" onClick={load}><RefreshCw size={14} /> Refresh</Button>+ <Button variant="outline" size="sm" onClick={flush}>Flush queue</Button>+ </div>+ </>+ )}+ ><label className="search-box"><Search size={16} /><Input@@ -891,21 +911,7 @@ function QueueTab() {aria-label="Search mail queue"/></label>- <div className="sk-email__tabletools">- <ViewMenu views={tableViews} />- <SortMenu columns={queueColumns} sorts={sorts} onChange={setSorts} />- <ColumnsMenu- columns={queueColumns}- hiddenKeys={hiddenKeys}- onToggle={toggleColumn}- onShowAll={showAllColumns}- />- </div>- <div className="sk-email__actions">- <Button variant="outline" size="sm" onClick={load}><RefreshCw size={14} /> Refresh</Button>- <Button variant="outline" size="sm" onClick={flush}>Flush queue</Button>- </div>- </div>+ </ListToolbar><DataTablecolumns={queueColumns}@@ -916,12 +922,8 @@ function QueueTab() {hiddenKeys={hiddenKeys}loading={loading}footer={<DataTableFooter shown={filtered.length} total={queue.length} noun="message" />}- emptyState={(- <div className="sk-email__empty">- <Inbox size={24} aria-hidden="true" />- <p>{queue.length === 0 ? 'The mail queue is empty.' : 'No messages match this search.'}</p>- </div>- )}+ emptyTitle={queue.length === 0 ? 'The mail queue is empty.' : 'No messages match this search.'}+ emptyMessage=""/></section>);diff --git a/frontend/src/pages/Servers.jsx b/frontend/src/pages/Servers.jsxindex 0c6e03eb..bbf0f6d3 100644--- a/frontend/src/pages/Servers.jsx+++ b/frontend/src/pages/Servers.jsx@@ -8,7 +8,7 @@ import Modal from '@/components/Modal';import { Button } from '@/components/ui/button';import { Input } from '@/components/ui/input';import {- ColumnsMenu, DataTable, DataTableFooter, Drawer, Gauge, Pill, SearchField, SegControl, SortChipBar, SortMenu, ViewMenu,+ ColumnsMenu, DataTable, DataTableFooter, Drawer, Gauge, ListToolbar, Pill, SearchField, SegControl, SortChipBar, SortMenu, ViewMenu,} from '@/components/ds';import { useTopbarActions } from '@/hooks/useTopbarActions';import { useTableSort } from '@/hooks/useTableSort';@@ -257,20 +257,42 @@ const Servers = () => {return (<div className="sk-tabgroup__inner servers-page">- <div className="servers-listhead">- <SegControl- value={selectedStatus}- onChange={setSelectedStatus}- options={STATUS_FILTERS.map((key) => ({- value: key,- label: key === 'all' ? 'All' : key.charAt(0).toUpperCase() + key.slice(1),- count: key === 'all' ? servers.length : (statusCounts[key] || 0),- }))}- aria-label="Filter by status"- />+ <ListToolbar+ filters={(+ <SegControl+ value={selectedStatus}+ onChange={setSelectedStatus}+ options={STATUS_FILTERS.map((key) => ({+ value: key,+ label: key === 'all' ? 'All' : key.charAt(0).toUpperCase() + key.slice(1),+ count: key === 'all' ? servers.length : (statusCounts[key] || 0),+ }))}+ aria-label="Filter by status"+ />+ )}+ count={(+ <>+ {filteredServers.length} of {servers.length} server{servers.length === 1 ? '' : 's'}+ <i>·</i>+ <b>{online} online</b>+ </>+ )}+ tools={(+ <>+ <ViewMenu views={tableViews} />+ <SortMenu columns={SERVER_COLUMNS} sorts={sorts} onChange={setSorts} />+ <ColumnsMenu+ columns={SERVER_COLUMNS}+ hiddenKeys={hiddenKeys}+ onToggle={toggleColumn}+ onShowAll={showAllColumns}+ />+ </>+ )}+ >{groups.length > 0 && (<select- className="servers-groupselect"+ className="sk-listhead__select"value={selectedGroup}onChange={(e) => setSelectedGroup(e.target.value)}aria-label="Filter by group"@@ -280,20 +302,7 @@ const Servers = () => {<option value="ungrouped">Ungrouped</option></select>)}- <span className="servers-count">- {filteredServers.length} of {servers.length} server{servers.length === 1 ? '' : 's'}- <i>·</i>- <b>{online} online</b>- </span>- <ViewMenu views={tableViews} />- <SortMenu columns={SERVER_COLUMNS} sorts={sorts} onChange={setSorts} />- <ColumnsMenu- columns={SERVER_COLUMNS}- hiddenKeys={hiddenKeys}- onToggle={toggleColumn}- onShowAll={showAllColumns}- />- </div>+ </ListToolbar><SortChipBar columns={SERVER_COLUMNS} sorts={sorts} onChange={setSorts} />diff --git a/frontend/src/styles/pages/_deployments.scss b/frontend/src/styles/pages/_deployments.scssindex ea64c0c1..5cb6705a 100644--- a/frontend/src/styles/pages/_deployments.scss+++ b/frontend/src/styles/pages/_deployments.scss@@ -17,28 +17,8 @@ $deploy-feed-cols: 20px minmax(0, 1fr) 132px 116px 56px 76px 14px;max-width: 1180px;margin: 0 auto;- &__toolbar {- display: flex;- align-items: center;- gap: $space-3;- margin-bottom: $space-4;- }-- &__server-select {- min-height: 34px;- padding: $space-1 $space-2;- background: var(--surface-2);- border: 1px solid var(--border);- border-radius: $radius-md;- color: $text-secondary;- font-size: $font-size-sm;- cursor: pointer;-- &:focus {- outline: none;- border-color: $accent-primary;- }- }+ // The toolbar row is the shared ListToolbar (.sk-listhead); the empty+ // state is the shared EmptyState component.&__loading {display: grid;@@ -53,22 +33,6 @@ $deploy-feed-cols: 20px minmax(0, 1fr) 132px 116px 56px 76px 14px;align-items: center;}- &__empty {- min-height: 320px;- display: flex;- flex-direction: column;- align-items: center;- justify-content: center;- gap: $space-2;- padding: $space-8;- color: $text-tertiary;- text-align: center;-- svg { color: $text-tertiary; opacity: 0.72; }- strong { color: $text-secondary; font-size: $font-size-sm; font-weight: $font-weight-semibold; }- span { max-width: 280px; font-size: $font-size-sm; line-height: 1.45; }- }-// ---- feed ----&__feed-head {display: grid;@@ -320,12 +284,6 @@ $deploy-feed-cols: 20px minmax(0, 1fr) 132px 116px 56px 76px 14px;@media (max-width: $breakpoint-md) {.deployments-page {- &__toolbar {- width: 100%;- flex-direction: column;- align-items: stretch;- }-.sk-seg { overflow-x: auto; }// Below the grid's natural width the feed scrolls sideways rather thandiff --git a/frontend/src/styles/pages/_email.scss b/frontend/src/styles/pages/_email.scssindex d80ec688..55730019 100644--- a/frontend/src/styles/pages/_email.scss+++ b/frontend/src/styles/pages/_email.scss@@ -99,13 +99,11 @@.sk-email__actions { justify-content: flex-end; }}- // ── Filters / toolbar row (domain select + search) ──────+ // ── Filters toolbar (domain select + search) ────────────+ // The row layout is the shared ListToolbar (.sk-listhead); this class+ // rides along on it to keep the eyebrow labels, select chrome and+ // search-box sizing below.&__filters {- display: flex;- align-items: center;- gap: $space-3;- flex-wrap: wrap;-> label {display: flex;align-items: center;@@ -142,14 +140,6 @@}}- // Sort/column menus pinned to the right of the filters toolbar- &__tabletools {- display: flex;- align-items: center;- gap: $space-2;- margin-left: auto;- }-// ── Inline create/add forms (domain + account) ──────────&__add,&__form {diff --git a/frontend/src/styles/pages/_server-packages.scss b/frontend/src/styles/pages/_server-packages.scssindex cdad3439..ad4e4e2f 100644--- a/frontend/src/styles/pages/_server-packages.scss+++ b/frontend/src/styles/pages/_server-packages.scss@@ -8,12 +8,7 @@flex-direction: column;gap: 1.25rem;- &__toolbar {- display: flex;- gap: 0.75rem;- align-items: center;- flex-wrap: wrap;- }+ // The toolbar row is the shared ListToolbar (.sk-listhead).&__search {display: flex;diff --git a/frontend/src/styles/pages/_server-services.scss b/frontend/src/styles/pages/_server-services.scssindex 3f36f259..ba3df6a4 100644--- a/frontend/src/styles/pages/_server-services.scss+++ b/frontend/src/styles/pages/_server-services.scss@@ -8,12 +8,7 @@flex-direction: column;gap: 1rem;- &__toolbar {- display: flex;- gap: 0.75rem;- align-items: center;- flex-wrap: wrap;- }+ // The toolbar row is the shared ListToolbar (.sk-listhead).&__search {flex: 1 1 280px;diff --git a/frontend/src/styles/pages/_server-survey.scss b/frontend/src/styles/pages/_server-survey.scssindex 8fe81eef..6c3f3110 100644--- a/frontend/src/styles/pages/_server-survey.scss+++ b/frontend/src/styles/pages/_server-survey.scss@@ -5,13 +5,7 @@flex-direction: column;gap: $space-5;- &__toolbar {- display: flex;- align-items: center;- justify-content: space-between;- gap: $space-4;- flex-wrap: wrap;- }+ // The toolbar row is the shared ListToolbar (.sk-listhead).&__toolbar-info {display: flex;diff --git a/frontend/src/styles/pages/_servers.scss b/frontend/src/styles/pages/_servers.scssindex c6862bf8..01562343 100644--- a/frontend/src/styles/pages/_servers.scss+++ b/frontend/src/styles/pages/_servers.scss@@ -7,40 +7,10 @@// override was for the old full-bleed ops workspace, and left the table// running under the right edge of the viewport.-// ---------- Fleet list (design-mock layout) -----------// Filters on the left, the count on the right, one table below. What used to-// be a left rail of dials and navs is now these two controls plus columns.-.servers-listhead {- display: flex;- align-items: center;- gap: $space-3;- margin-bottom: $space-4;- flex-wrap: wrap;-}--.servers-groupselect {- height: 32px;- padding: 0 $space-3;- border: 1px solid var(--border);- border-radius: 8px;- background: var(--surface-2);- color: var(--text-dim);- font-size: 12.5px;-}--.servers-count {- margin-left: auto;- display: inline-flex;- align-items: center;- gap: 6px;- font-family: var(--mono);- font-size: 11.5px;- color: var(--text-faint);- white-space: nowrap;-- i { font-style: normal; opacity: 0.5; }- b { color: var(--green); font-weight: 600; }-}+// ---------- Fleet list ----------+// The toolbar row is the shared ListToolbar (.sk-listhead in+// _design-system.scss); what used to be a left rail of dials and navs is now+// its filters plus table columns..servers-card {overflow-x: auto;@@ -804,7 +774,10 @@to { opacity: 1; transform: translateY(0); }}-.empty-state {+// Scoped under .servers-page: as a bare top-level `.empty-state` this block+// used to win the cascade app-wide over the shared styles in+// components/_empty-state.scss (see the specificity-hack comment there).+.servers-page .empty-state {text-align: center;padding: $space-16 $space-6;background: $bg-card;