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.

feat(ui): one row of chrome per table

Juan Denis1ede77724285
diff --git a/frontend/src/components/ds/ListToolbar.jsx b/frontend/src/components/ds/ListToolbar.jsx
index 485bcbf7..375c31d8 100644
--- a/frontend/src/components/ds/ListToolbar.jsx
+++ b/frontend/src/components/ds/ListToolbar.jsx
@@ -5,20 +5,26 @@ import { cn } from '@/lib/utils';
// .incidents-listhead, .wp-list__toolbar…) — same anatomy, a dozen names.
// This component is the anatomy:
//
-// [title?] [filters] [children] [count?] [tools]
+// [title?] [filters] [children] [tools?]
//
// <ListToolbar
// title="Cron jobs" // optional section title
// filters={<SegControl … />} // primary quick filters, left
-// count={<>12 of 20 jobs · <b>8 active</b></>} // mono meta, right
-// tools={<><ViewMenu … /><SortMenu … /><ColumnsMenu … /></>}
// >
// {/* optional extras between filters and the right group (e.g. a select) */}
// </ListToolbar>
//
-// Placement rule (see AGENTS.md "Page anatomy"): page-level actions,
-// FilterButton and SearchField live in the shared topbar; quick filters,
-// counts and the table menus live here.
+// Placement rule (see AGENTS.md "Page anatomy"): a table gets ONE row of chrome
+// — the GridViewPicker line — carrying search, the filter button and the "⋮",
+// either inline or hoisted into the shared topbar (useTopbarChrome). This
+// toolbar is for what is left: a quick-filter segment, a scope select, a
+// checkbox. A page with none of those renders no toolbar at all.
+//
+// `count` is DEPRECATED and has no core render site. It held a row count that
+// the view line above and the table footer below both already reported — the
+// same number three times, on the pages that had it. The footer is the one that
+// sits next to the rows it counts. Kept only so an extension passing it does not
+// crash; drop it on the next SDK major.
export function ListToolbar({ title, filters, count, tools, children, className }) {
return (
<div className={cn('sk-listhead', className)}>
diff --git a/frontend/src/components/ds/grid/GridViewPicker.jsx b/frontend/src/components/ds/grid/GridViewPicker.jsx
index 1dc17b4e..0ab953ba 100644
--- a/frontend/src/components/ds/grid/GridViewPicker.jsx
+++ b/frontend/src/components/ds/grid/GridViewPicker.jsx
@@ -12,10 +12,18 @@ import { cn } from '@/lib/utils';
// Built-in views ship in code; "My views" are the user's own, persisted through
// /api/v1/views by useTableViews. A modified view shows an asterisk plus an
// inline Save / Reset strip, so tweaking a built-in never silently destroys it.
-// `actions` is the table's own controls — the filter button and the "⋮". They
-// belong on the SAME line as the view name: a page whose toolbar has nothing
-// else in it was rendering an empty second bar just to hold two icons.
-export function GridViewPicker({ views, counts, onCreate, label = 'items', total, actions }) {
+//
+// `actions` is the table's own chrome — search, the filter button and the "⋮".
+// They belong on the SAME line as the view name, and this is the ONLY row of
+// chrome a table gets. A page that owns a top bar hoists that same node up
+// there instead (see useTopbarChrome) and passes nothing here; an inner or sub
+// table, which has no top bar of its own, passes it and keeps it inline.
+//
+// There is deliberately no row count. It was rendered twice on every page that
+// also had a toolbar underneath — once next to the view name, once on the right
+// of the second bar — and the footer already says how many rows there are,
+// under the rows it is counting.
+export function GridViewPicker({ views, counts, onCreate, label = 'items', actions }) {
const [open, setOpen] = useState(false);
const [menuFor, setMenuFor] = useState(null);
const [creating, setCreating] = useState(false);
@@ -145,10 +153,6 @@ export function GridViewPicker({ views, counts, onCreate, label = 'items', total
</PopoverContent>
</Popover>
- {total != null && (
- <span className="sk-viewbar__count">{total}</span>
- )}
-
{views.isDirty && (
<div className="sk-viewbar__dirty">
<AlertTriangle size={13} />
diff --git a/frontend/src/components/layouts/ResourceListPage.jsx b/frontend/src/components/layouts/ResourceListPage.jsx
index d579bc61..d35a4a75 100644
--- a/frontend/src/components/layouts/ResourceListPage.jsx
+++ b/frontend/src/components/layouts/ResourceListPage.jsx
@@ -10,6 +10,7 @@ import EmptyState from '../EmptyState';
import DataTable from '@/components/ds/DataTable';
import { useTableSort } from '@/hooks/useTableSort';
import { useColumnVisibility } from '@/hooks/useColumnVisibility';
+import { useTopbarChrome } from '@/hooks/useTopbarActions';
// Shared chrome for resource list pages (Services, Servers, …): the status
// filter + search toolbar, sort & column menus, the DataTable with a standard
@@ -92,8 +93,21 @@ export default function ResourceListPage({
filteredEmptyIcon,
filteredEmptyTitle = 'No results found',
filteredEmptyDescription = 'Try adjusting your search or filter.',
- // Opt-in card view: pass a renderer and the toolbar grows a list/cards
+ // Where the table's chrome (filter · "⋮") goes. `true` publishes it into the
+ // enclosing tab group's top bar, on the same line as the page's actions and
+ // search — the shape every top-level list page has. Set it false for a
+ // table nested inside a page that owns that bar already (a tab's inner
+ // table), and the chrome renders in the view row instead. Outside a tab
+ // group it falls back to the view row on its own.
+ chromeInTopbar = true,
+ // Opt-in card view: pass a renderer and the chrome grows a list/cards
// switch. Pages that omit it are table-only exactly as before.
+ //
+ // DEPRECATED for core: no core page passes it any more. A layout toggle is
+ // a third way to change what the table shows, next to views and filters,
+ // that none of them can save or share — the saved view is the one answer to
+ // "how do I want to look at this". Kept working because this component is
+ // SDK surface; remove on the next SDK major.
renderCard,
viewStorageKey,
// Row selection: pass selectedIds (Set) + handlers to get a native
@@ -213,6 +227,64 @@ export default function ResourceListPage({
const orderedColumns = chrome.columns;
const tableViews = chrome.views;
+ // The table's own chrome, built once and rendered in exactly ONE place:
+ // hoisted into the tab group's top bar next to the page's actions, or — for
+ // an inner table, or a page reused outside a tab group — in the view row.
+ // It used to be a second toolbar under the view row on every page, which
+ // for most of them was an otherwise empty bar holding two icons.
+ const chromeNode = (
+ <>
+ {view === 'list' && (
+ <>
+ <GridFilterButton
+ count={chrome.filterCount}
+ onClick={() => chrome.setDrawerOpen(true)}
+ />
+ <GridToolsMenu
+ {...chrome.toolsProps}
+ selectedRows={selectable && selectedIds
+ ? items.filter((i) => selectedIds.has(i[keyField]))
+ : []}
+ />
+ </>
+ )}
+ {renderCard && (
+ <div className="wp-list__viewswitch" role="group" aria-label="Layout">
+ {[['list', Rows3, 'List'], ['cards', LayoutGrid, 'Cards']].map(([key, Icon, label]) => (
+ <button
+ type="button"
+ key={key}
+ className={view === key ? 'is-active' : ''}
+ onClick={() => changeView(key)}
+ title={label}
+ aria-label={label}
+ aria-pressed={view === key}
+ >
+ <Icon size={15} />
+ </button>
+ ))}
+ </div>
+ )}
+ </>
+ );
+
+ // Nothing to host while the page is empty or still loading — the chrome
+ // acts on a table that isn't there.
+ const hasTable = !loading && resolvedTotal > 0;
+ const { hosted: chromeHoisted, portal: chromePortal } = useTopbarChrome(
+ chromeNode,
+ { enabled: chromeInTopbar && hasTable },
+ );
+
+ // Where the chrome lands when the top bar didn't take it: the view row if
+ // there is one, otherwise a bar of its own.
+ const hasPicker = !!viewPageKey && view === 'list';
+ const inlineChrome = chromeHoisted ? null : chromeNode;
+
+ // The quick-filter segment and any page extras still need a bar of their
+ // own; pages that have neither get no second row at all.
+ const hasToolbar = !!filters || !!toolbarExtra || (onSearchChange && !searchInTopbar);
+
// Paged AFTER the column rules, not before. Slicing `items` meant a page
// size of 25 took 25 unfiltered rows and THEN filtered them, so "show 25"
// could render three. `chrome.shownRows` is the same set the table renders,
@@ -244,6 +316,7 @@ export default function ResourceListPage({
return (
<div className={cn('sk-tabgroup__inner', className)}>
+ {chromePortal}
{header}
{resolvedTotal === 0 ? (
<EmptyState
@@ -260,72 +333,40 @@ export default function ResourceListPage({
Group and Columns are gone from the toolbar entirely —
they live in each column's own "⋮" now, next to the
column they act on. */}
- {viewPageKey && view === 'list' && (
+ {hasPicker && (
<GridViewPicker
views={tableViews}
label={noun}
- total={`${chrome.shownCount} of ${resolvedTotal} ${noun}`}
onCreate={chrome.createView}
+ actions={inlineChrome}
/>
)}
- <ListToolbar
- filters={filters && (
- <SegControl
- value={activeFilter}
- onChange={onFilterChange}
- options={filters}
- />
- )}
- tools={(
- <>
- {view === 'list' && (
- <>
- <GridFilterButton
- count={chrome.filterCount}
- onClick={() => chrome.setDrawerOpen(true)}
- />
- <GridToolsMenu
- {...chrome.toolsProps}
- selectedRows={selectable && selectedIds
- ? items.filter((i) => selectedIds.has(i[keyField]))
- : []}
- />
- </>
- )}
- {renderCard && (
- <div className="wp-list__viewswitch" role="group" aria-label="Layout">
- {[['list', Rows3, 'List'], ['cards', LayoutGrid, 'Cards']].map(([key, Icon, label]) => (
- <button
- type="button"
- key={key}
- className={view === key ? 'is-active' : ''}
- onClick={() => changeView(key)}
- title={label}
- aria-label={label}
- aria-pressed={view === key}
- >
- <Icon size={15} />
- </button>
- ))}
- </div>
- )}
- </>
- )}
- >
- {onSearchChange && !searchInTopbar && (
- <div className="wp-list__search">
- <Search size={15} aria-hidden="true" />
- <input
- type="text"
- value={searchTerm}
- onChange={(e) => onSearchChange(e.target.value)}
- placeholder={searchPlaceholder}
- aria-label={searchPlaceholder}
+ {(hasToolbar || (inlineChrome && !hasPicker)) && (
+ <ListToolbar
+ filters={filters && (
+ <SegControl
+ value={activeFilter}
+ onChange={onFilterChange}
+ options={filters}
/>
- </div>
- )}
- {toolbarExtra}
- </ListToolbar>
+ )}
+ tools={hasPicker ? undefined : inlineChrome}
+ >
+ {onSearchChange && !searchInTopbar && (
+ <div className="wp-list__search">
+ <Search size={15} aria-hidden="true" />
+ <input
+ type="text"
+ value={searchTerm}
+ onChange={(e) => onSearchChange(e.target.value)}
+ placeholder={searchPlaceholder}
+ aria-label={searchPlaceholder}
+ />
+ </div>
+ )}
+ {toolbarExtra}
+ </ListToolbar>
+ )}
{view === 'list' && <GridChips {...chrome.chipProps} />}
diff --git a/frontend/src/components/security/Fail2banTab.jsx b/frontend/src/components/security/Fail2banTab.jsx
index 3118a031..896c68b4 100644
--- a/frontend/src/components/security/Fail2banTab.jsx
+++ b/frontend/src/components/security/Fail2banTab.jsx
@@ -8,7 +8,7 @@ import Modal from '../Modal';
import { Button } from '@/components/ui/button';
import { Input } from '@/components/ui/input';
import { Label } from '@/components/ui/label';
-import { DataTable, DataTableFooter, ListToolbar, Pill } from '@/components/ds';
+import { DataTable, DataTableFooter, Pill } from '@/components/ds';
import {
useTableChrome, GridViewPicker, GridChips, GridFilterButton,
GridToolsMenu, GridFilterDrawer, applyFilters,
@@ -309,11 +309,8 @@ const Fail2banTab = () => {
<GridViewPicker
views={chrome.views}
label="bans"
- total={`${shownBans.length} of ${bans.length} bans`}
onCreate={chrome.createView}
- />
- <ListToolbar
- tools={(
+ actions={(
<>
<GridFilterButton
count={chrome.filterCount}
diff --git a/frontend/src/components/security/FirewallTab.jsx b/frontend/src/components/security/FirewallTab.jsx
index ddb13be7..343ec68c 100644
--- a/frontend/src/components/security/FirewallTab.jsx
+++ b/frontend/src/components/security/FirewallTab.jsx
@@ -511,11 +511,8 @@ const FirewallTab = () => {
<GridViewPicker
views={chrome.views}
label="rules"
- total={`${shownRules.length} of ${rules.length} rules`}
onCreate={chrome.createView}
- />
- <ListToolbar
- tools={(
+ actions={(
<>
<GridFilterButton
count={chrome.filterCount}
@@ -524,7 +521,11 @@ const FirewallTab = () => {
<GridToolsMenu {...chrome.toolsProps} onRefresh={loadData} />
</>
)}
- >
+ />
+ {/* The toolbar survives only because Add Rule needs a
+ home: this tab is nested, so there is no top bar
+ to hoist a create action into. */}
+ <ListToolbar>
<Button variant="default" size="sm" onClick={() => setShowPortModal(true)}>Add Rule</Button>
</ListToolbar>
diff --git a/frontend/src/components/security/IPListsTab.jsx b/frontend/src/components/security/IPListsTab.jsx
index feaf3afd..4556d939 100644
--- a/frontend/src/components/security/IPListsTab.jsx
+++ b/frontend/src/components/security/IPListsTab.jsx
@@ -239,7 +239,7 @@ const IPListsTab = () => {
// Cell markup/classNames identical to the hand-rolled table they replace.
const renderList = (listType, items, sortState, chrome) => {
// DataTable applies the column rules itself, so mirror them here for
- // the counts — a header that says "12 entries" above 3 filtered rows is
+ // the footer — a count reading "12 entries" under 3 filtered rows is
// the table lying about what you are looking at.
const shown = applyFilters(items, chrome.cfg.filters, chrome.columns);
return (
@@ -252,17 +252,18 @@ const IPListsTab = () => {
<GridViewPicker
views={chrome.views}
label={`${listType} entries`}
- total={shown.length === items.length
- ? `${items.length} entries`
- : `${shown.length} of ${items.length} entries`}
onCreate={chrome.createView}
+ actions={(
+ <>
+ <GridFilterButton
+ count={chrome.filterCount}
+ onClick={() => chrome.setDrawerOpen(true)}
+ />
+ <GridToolsMenu {...chrome.toolsProps} onRefresh={loadLists} />
+ </>
+ )}
/>
<div className="sec-tableactions">
- <GridFilterButton
- count={chrome.filterCount}
- onClick={() => chrome.setDrawerOpen(true)}
- />
- <GridToolsMenu {...chrome.toolsProps} onRefresh={loadLists} />
<Button variant="default" size="sm" onClick={() => setShowAddModal(listType)}>
Add to {listType}
</Button>
diff --git a/frontend/src/components/security/IntegrityTab.jsx b/frontend/src/components/security/IntegrityTab.jsx
index 9446564c..2160b4f3 100644
--- a/frontend/src/components/security/IntegrityTab.jsx
+++ b/frontend/src/components/security/IntegrityTab.jsx
@@ -271,10 +271,6 @@ const IntegrityTab = () => {
[shownRows, chrome.cfg.filters, chrome.columns],
);
- const countLabel = shownCount === changeRows.length
- ? `${changeRows.length} change${changeRows.length === 1 ? '' : 's'}`
- : `${shownCount} of ${changeRows.length} changes`;
-
function renderScopeCard(scope) {
const key = scope.scope;
const baseline = scope.baseline;
@@ -306,20 +302,10 @@ const IntegrityTab = () => {
: 'No baseline yet — create one to start tracking changes.'}
{check && ` · Last check ${formatAge(check.checked_at) || ''}`}
</p>
- {/* The scope's own actions share the toolbar with the
- table's controls, so opening the changes list does not
- grow a second row of buttons. */}
- <ListToolbar
- tools={isOpen ? (
- <>
- <GridFilterButton
- count={chrome.filterCount}
- onClick={() => chrome.setDrawerOpen(true)}
- />
- <GridToolsMenu {...chrome.toolsProps} onRefresh={load} />
- </>
- ) : null}
- >
+ {/* These act on the SCOPE and are there whether or not the
+ changes list is open, so they keep their own bar; the
+ table's chrome rides the view line below. */}
+ <ListToolbar>
<Button
variant="outline"
size="sm"
@@ -363,8 +349,16 @@ const IntegrityTab = () => {
<GridViewPicker
views={chrome.views}
label="changes"
- total={countLabel}
onCreate={chrome.createView}
+ actions={(
+ <>
+ <GridFilterButton
+ count={chrome.filterCount}
+ onClick={() => chrome.setDrawerOpen(true)}
+ />
+ <GridToolsMenu {...chrome.toolsProps} onRefresh={load} />
+ </>
+ )}
/>
<GridChips {...chrome.chipProps} />
</>
diff --git a/frontend/src/components/security/QuarantineTab.jsx b/frontend/src/components/security/QuarantineTab.jsx
index 5ebeebe8..fe48e6a6 100644
--- a/frontend/src/components/security/QuarantineTab.jsx
+++ b/frontend/src/components/security/QuarantineTab.jsx
@@ -3,7 +3,7 @@ import { ShieldCheck } from 'lucide-react';
import api from '../../services/api';
import EmptyState from '@/components/EmptyState';
import { Button } from '@/components/ui/button';
-import { DataTable, DataTableFooter, ListToolbar } from '@/components/ds';
+import { DataTable, DataTableFooter } from '@/components/ds';
import {
useTableChrome, GridViewPicker, GridChips, GridFilterButton,
GridToolsMenu, GridFilterDrawer, applyFilters,
@@ -217,13 +217,6 @@ const QuarantineTab = () => {
[files, chrome.cfg.filters, chrome.columns],
);
- // Null while the fetch is in flight: an empty `files` is "not known yet",
- // and "0 files" is a claim.
- const countLabel = loading ? null
- : shownCount === files.length
- ? `${files.length} file${files.length === 1 ? '' : 's'}`
- : `${shownCount} of ${files.length} files`;
-
return (
<div className="quarantine-tab">
{message && (
@@ -232,17 +225,16 @@ const QuarantineTab = () => {
</div>
)}
- {/* The view name replaces the old "Quarantined Files · N" eyebrow:
- the view IS what you are looking at, and two titles stacked read
- as two sections. */}
+ {/* One row of chrome. The view name replaces the old "Quarantined
+ Files · N" eyebrow — the view IS what you are looking at — and
+ the filter and the "⋮" ride the same line. Refresh is not
+ repeated as a button: it is in the "⋮" with the other
+ table-wide actions. */}
<GridViewPicker
views={chrome.views}
label="files"
- total={countLabel}
onCreate={chrome.createView}
- />
- <ListToolbar
- tools={(
+ actions={(
<>
<GridFilterButton
count={chrome.filterCount}
@@ -251,9 +243,7 @@ const QuarantineTab = () => {
<GridToolsMenu {...chrome.toolsProps} onRefresh={loadFiles} />
</>
)}
- >
- <Button variant="outline" size="sm" onClick={loadFiles}>Refresh</Button>
- </ListToolbar>
+ />
<GridChips {...chrome.chipProps} />
diff --git a/frontend/src/components/security/SSHKeysTab.jsx b/frontend/src/components/security/SSHKeysTab.jsx
index a9ec9402..984c7e71 100644
--- a/frontend/src/components/security/SSHKeysTab.jsx
+++ b/frontend/src/components/security/SSHKeysTab.jsx
@@ -197,18 +197,15 @@ const SSHKeysTab = () => {
return (
<div className="ssh-keys-tab">
{/* The view name replaces the old "SSH Authorized Keys" <h3>: one
- heading, and it now names the slice you are looking at. Add Key
- and Refresh stay put — they are actions, not filters. */}
+ heading, and it now names the slice you are looking at. The
+ table's chrome rides that same line; Add Key keeps its own bar
+ because it acts on the file, not on what you are looking at.
+ Refresh is gone from it — it is in the "⋮". */}
<GridViewPicker
views={chrome.views}
label="keys"
- // Null while the read is in flight: an empty `keys` means "not
- // known yet", and "0 of 0 keys" would be a claim.
- total={loading ? null : `${shownKeys.length} of ${keys.length} keys`}
onCreate={chrome.createView}
- />
- <ListToolbar
- tools={(
+ actions={(
<>
<GridFilterButton
count={chrome.filterCount}
@@ -217,13 +214,11 @@ const SSHKeysTab = () => {
<GridToolsMenu {...chrome.toolsProps} onRefresh={loadKeys} />
</>
)}
- >
+ />
+ <ListToolbar>
<Button variant="default" size="sm" onClick={() => setShowAddModal(true)}>
Add Key
</Button>
- <Button variant="outline" size="sm" onClick={loadKeys}>
- Refresh
- </Button>
</ListToolbar>
<GridChips {...chrome.chipProps} />
diff --git a/frontend/src/components/security/ScannerTab.jsx b/frontend/src/components/security/ScannerTab.jsx
index 8be899ea..4e80a76a 100644
--- a/frontend/src/components/security/ScannerTab.jsx
+++ b/frontend/src/components/security/ScannerTab.jsx
@@ -512,8 +512,8 @@ const ScannerTab = () => {
setHiddenKeys: historyCols.setHiddenKeys,
});
- // The tables filter internally, so mirror the rules here for the counts —
- // a header claiming "12 findings" above 3 filtered rows is the table lying
+ // The tables filter internally, so mirror the rules here for the footers —
+ // a count reading "12 findings" under 3 filtered rows is the table lying
// about what you are looking at.
const shownFindings = applyFilters(findings, findingsChrome.cfg.filters, findingsChrome.columns);
const shownHistory = applyFilters(history, historyChrome.cfg.filters, historyChrome.columns);
@@ -719,17 +719,20 @@ const ScannerTab = () => {
<GridViewPicker
views={findingsChrome.views}
label="findings"
- total={shownFindings.length === findings.length
- ? `${findings.length} findings`
- : `${shownFindings.length} of ${findings.length} findings`}
onCreate={findingsChrome.createView}
+ actions={(
+ <>
+ <GridFilterButton
+ count={findingsChrome.filterCount}
+ onClick={() => findingsChrome.setDrawerOpen(true)}
+ />
+ <GridToolsMenu {...findingsChrome.toolsProps} onRefresh={loadScanStatus} />
+ </>
+ )}
/>
<div className="sec-tableactions">
- <GridFilterButton
- count={findingsChrome.filterCount}
- onClick={() => findingsChrome.setDrawerOpen(true)}
- />
- <GridToolsMenu {...findingsChrome.toolsProps} onRefresh={loadScanStatus} />
+ {/* Dismiss throws the findings away rather than
+ narrowing them, so it stays out of the chrome. */}
<Button variant="outline" size="sm" onClick={() => setFindings([])}>Dismiss</Button>
</div>
</div>
@@ -755,22 +758,22 @@ const ScannerTab = () => {
<div className="card sec-flush">
<div className="card-header">
+ {/* Refresh is not repeated as a button next to the "⋮" that
+ already carries it. */}
<GridViewPicker
views={historyChrome.views}
label="scans"
- total={shownHistory.length === history.length
- ? `${history.length} scans`
- : `${shownHistory.length} of ${history.length} scans`}
onCreate={historyChrome.createView}
+ actions={(
+ <>
+ <GridFilterButton
+ count={historyChrome.filterCount}
+ onClick={() => historyChrome.setDrawerOpen(true)}
+ />
+ <GridToolsMenu {...historyChrome.toolsProps} onRefresh={loadHistory} />
+ </>
+ )}
/>
- <div className="sec-tableactions">
- <GridFilterButton
- count={historyChrome.filterCount}
- onClick={() => historyChrome.setDrawerOpen(true)}
- />
- <GridToolsMenu {...historyChrome.toolsProps} onRefresh={loadHistory} />
- <Button variant="outline" size="sm" onClick={loadHistory}>Refresh</Button>
- </div>
</div>
<GridChips {...historyChrome.chipProps} />
{history.length === 0 ? (
diff --git a/frontend/src/components/serverdetail/CloudflaredTab.jsx b/frontend/src/components/serverdetail/CloudflaredTab.jsx
index 535d3f87..e2b9cc9d 100644
--- a/frontend/src/components/serverdetail/CloudflaredTab.jsx
+++ b/frontend/src/components/serverdetail/CloudflaredTab.jsx
@@ -411,8 +411,8 @@ const CloudflaredTab = ({ serverId, serverStatus }) => {
) : (
<Pill kind="green">cloudflared ready{status?.version ? ` (${status.version})` : ''}</Pill>
)}
- {/* The tunnel count moved to the view bar below, where it
- can say how many of them the active view is showing. */}
+ {/* No tunnel count here — the table footer reports it,
+ under the rows it is counting. */}
</div>
<div className="cron-tab__actions">
<Button variant="outline" onClick={loadTunnels} disabled={notInstalled}>Refresh</Button>
@@ -467,7 +467,6 @@ const CloudflaredTab = ({ serverId, serverStatus }) => {
<GridViewPicker
views={chrome.views}
label="tunnels"
- total={`${chrome.shownCount} of ${tunnels.length} tunnels`}
onCreate={chrome.createView}
actions={(
<>
diff --git a/frontend/src/components/serverdetail/CronTab.jsx b/frontend/src/components/serverdetail/CronTab.jsx
index e6c9ab5f..f06be1a4 100644
--- a/frontend/src/components/serverdetail/CronTab.jsx
+++ b/frontend/src/components/serverdetail/CronTab.jsx
@@ -314,8 +314,8 @@ const CronTab = ({ serverId, serverStatus }) => {
) : (
<Pill kind="green">cron daemon active{status?.daemon ? ` (${status.daemon})` : ''}</Pill>
)}
- {/* The job count moved to the view bar below, where it can
- say how many of them the active view is showing. */}
+ {/* No job count here — the table footer reports it, under
+ the rows it is counting. */}
</div>
<div className="cron-tab__actions">
<Button variant="outline" onClick={loadJobs}>Refresh</Button>
@@ -343,7 +343,6 @@ const CronTab = ({ serverId, serverStatus }) => {
<GridViewPicker
views={chrome.views}
label="jobs"
- total={`${chrome.shownCount} of ${jobs.length} jobs`}
onCreate={chrome.createView}
actions={(
<>
diff --git a/frontend/src/components/serverdetail/ServicesTab.jsx b/frontend/src/components/serverdetail/ServicesTab.jsx
index 201e8caf..c26bf2f7 100644
--- a/frontend/src/components/serverdetail/ServicesTab.jsx
+++ b/frontend/src/components/serverdetail/ServicesTab.jsx
@@ -2,8 +2,7 @@ import { useCallback, useEffect, useMemo, useState } from 'react';
import api from '../../services/api';
import { useToast } from '../../contexts/ToastContext';
import { Button } from '@/components/ui/button';
-import { Input } from '@/components/ui/input';
-import { Pill, DataTable, DataTableFooter, ListToolbar } from '../ds';
+import { Pill, DataTable, DataTableFooter, ListToolbar, SearchField } from '../ds';
import {
useTableChrome, GridViewPicker, GridChips, GridFilterButton,
GridToolsMenu, GridFilterDrawer,
@@ -287,17 +286,21 @@ const ServicesTab = ({ serverId, serverStatus }) => {
return (
<div className="server-services">
- {/* The view name is the heading and carries the counts; the filter
- button and "⋮" ride it. The toolbar below keeps only what is
- the PAGE's rather than the table's: search, and the two systemd
- actions. */}
+ {/* The view name is the heading and the table's whole chrome rides
+ it: search, the filter button and the "⋮". The toolbar below
+ keeps only what belongs to systemd rather than to the table —
+ and not Refresh, which is "Refresh data" in the "⋮". */}
<GridViewPicker
views={chrome.views}
label="units"
- total={`${chrome.shownCount} of ${units.length} units`}
onCreate={chrome.createView}
actions={(
<>
+ <SearchField
+ value={search}
+ onSearch={setSearch}
+ placeholder="Filter by unit name…"
+ />
<GridFilterButton
count={chrome.filterCount}
onClick={() => chrome.setDrawerOpen(true)}
@@ -309,7 +312,6 @@ const ServicesTab = ({ serverId, serverStatus }) => {
<ListToolbar
tools={(
<div className="server-services__actions">
- <Button variant="outline" onClick={loadUnits}>Refresh</Button>
<Button
variant="outline"
onClick={reloadDaemon}
@@ -319,14 +321,7 @@ const ServicesTab = ({ serverId, serverStatus }) => {
</Button>
</div>
)}
- >
- <Input
- value={search}
- onChange={(e) => setSearch(e.target.value)}
- placeholder="Filter by unit name…"
- className="server-services__search"
- />
- </ListToolbar>
+ />
<GridChips {...chrome.chipProps} />
diff --git a/frontend/src/components/settings/ApiSettingsTab.jsx b/frontend/src/components/settings/ApiSettingsTab.jsx
index e1ff4197..04cdd82a 100644
--- a/frontend/src/components/settings/ApiSettingsTab.jsx
+++ b/frontend/src/components/settings/ApiSettingsTab.jsx
@@ -293,11 +293,8 @@ const ApiKeysSection = () => {
<GridViewPicker
views={chrome.views}
label="keys"
- total={loading ? null : `${chrome.shownCount} of ${keys.length} key${keys.length === 1 ? '' : 's'}`}
onCreate={chrome.createView}
- />
- <ListToolbar
- tools={(
+ actions={(
<>
<GridFilterButton
count={chrome.filterCount}
@@ -306,7 +303,11 @@ const ApiKeysSection = () => {
<GridToolsMenu {...chrome.toolsProps} onRefresh={loadKeys} />
</>
)}
- >
+ />
+ {/* The toolbar survives only because Create Key is the card's own
+ action, not the table's — everything that acts on the table
+ rides the view line above. */}
+ <ListToolbar>
<Button variant="default" size="sm" onClick={() => setShowModal(true)}>
<Plus size={14} /> Create Key
</Button>
diff --git a/frontend/src/components/settings/InvitationsTab.jsx b/frontend/src/components/settings/InvitationsTab.jsx
index bc359b72..ca26c559 100644
--- a/frontend/src/components/settings/InvitationsTab.jsx
+++ b/frontend/src/components/settings/InvitationsTab.jsx
@@ -277,11 +277,8 @@ const InvitationsTab = () => {
<GridViewPicker
views={chrome.views}
label="invitations"
- total={loading ? null : `${chrome.shownCount} of ${invitations.length} invitation${invitations.length === 1 ? '' : 's'}`}
onCreate={chrome.createView}
- />
- <ListToolbar
- tools={(
+ actions={(
<>
<GridFilterButton
count={chrome.filterCount}
@@ -290,7 +287,8 @@ const InvitationsTab = () => {
<GridToolsMenu {...chrome.toolsProps} onRefresh={loadInvitations} />
</>
)}
- >
+ />
+ <ListToolbar>
<Button variant="default" size="sm" onClick={() => setShowInviteModal(true)}>
<svg viewBox="0 0 24 24" width="14" height="14" stroke="currentColor" fill="none" strokeWidth="2">
<path d="M16 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2"/>
diff --git a/frontend/src/components/settings/MigrationHistoryTab.jsx b/frontend/src/components/settings/MigrationHistoryTab.jsx
index ddd7b46d..34bbaf6d 100644
--- a/frontend/src/components/settings/MigrationHistoryTab.jsx
+++ b/frontend/src/components/settings/MigrationHistoryTab.jsx
@@ -2,7 +2,7 @@ import { useState, useEffect, useCallback } from 'react';
import api from '../../services/api';
import { Database, Loader, CheckCircle, ArrowUpCircle, ShieldCheck } from 'lucide-react';
import { Badge } from '@/components/ui/badge';
-import { DataTable, ListToolbar } from '@/components/ds';
+import { DataTable } from '@/components/ds';
import {
useTableChrome, GridViewPicker, GridChips, GridFilterButton,
GridToolsMenu, GridFilterDrawer,
@@ -309,11 +309,8 @@ const MigrationHistoryTab = () => {
<GridViewPicker
views={chrome.views}
label="migrations"
- total={`${chrome.shownCount} of ${revisions.length} revision${revisions.length === 1 ? '' : 's'}`}
onCreate={chrome.createView}
- />
- <ListToolbar
- tools={(
+ actions={(
<>
<GridFilterButton
count={chrome.filterCount}
diff --git a/frontend/src/components/settings/RecycleBinTab.jsx b/frontend/src/components/settings/RecycleBinTab.jsx
index 76503c91..90df8fc9 100644
--- a/frontend/src/components/settings/RecycleBinTab.jsx
+++ b/frontend/src/components/settings/RecycleBinTab.jsx
@@ -1,5 +1,5 @@
import { useCallback, useEffect, useMemo, useState } from 'react';
-import { Trash2, Undo2, RefreshCw, Clock } from 'lucide-react';
+import { Trash2, Undo2, RefreshCw } from 'lucide-react';
import api from '@/services/api';
import { useToast } from '@/contexts/ToastContext';
import { useAuth } from '@/contexts/AuthContext';
@@ -282,21 +282,8 @@ export default function RecycleBinTab() {
<GridViewPicker
views={chrome.views}
label="items"
- total={`${shown.length} of ${items.length} item${items.length === 1 ? '' : 's'}`}
onCreate={chrome.createView}
- />
- {/* The retention note goes in the count slot: it is meta,
- not a tool, and that also spares
- `.recyclebin__retention`'s margin-left:auto from a flex
- row it was never written for. */}
- <ListToolbar
- filters={<SegControl value={kind} onChange={setKind} options={filters} />}
- count={(
- <span className="recyclebin__retention">
- <Clock size={13} /> kept {retentionDays} days
- </span>
- )}
- tools={(
+ actions={(
<>
<GridFilterButton
count={chrome.filterCount}
@@ -306,6 +293,12 @@ export default function RecycleBinTab() {
</>
)}
/>
+ {/* The toolbar survives only for the type quick-filter. The
+ retention window is already spelled out in the hint
+ above, so repeating it here bought nothing. */}
+ <ListToolbar
+ filters={<SegControl value={kind} onChange={setKind} options={filters} />}
+ />
<GridChips {...chrome.chipProps} />
diff --git a/frontend/src/components/settings/UsersTab.jsx b/frontend/src/components/settings/UsersTab.jsx
index 95dfcf1f..96a35933 100644
--- a/frontend/src/components/settings/UsersTab.jsx
+++ b/frontend/src/components/settings/UsersTab.jsx
@@ -360,11 +360,8 @@ const UsersTab = () => {
<GridViewPicker
views={chrome.views}
label="users"
- total={`${chrome.shownCount} of ${users.length} user${users.length === 1 ? '' : 's'}`}
onCreate={chrome.createView}
- />
- <ListToolbar
- tools={(
+ actions={(
<>
<GridFilterButton
count={chrome.filterCount}
@@ -373,7 +370,8 @@ const UsersTab = () => {
<GridToolsMenu {...chrome.toolsProps} onRefresh={loadUsers} />
</>
)}
- >
+ />
+ <ListToolbar>
<Button variant="default" onClick={handleAddUser}>
<svg viewBox="0 0 24 24" width="16" height="16" stroke="currentColor" fill="none" strokeWidth="2">
<line x1="12" y1="5" x2="12" y2="19"/>
diff --git a/frontend/src/hooks/useTopbarActions.js b/frontend/src/hooks/useTopbarActions.js
index 8bf14fb0..cb594cda 100644
--- a/frontend/src/hooks/useTopbarActions.js
+++ b/frontend/src/hooks/useTopbarActions.js
@@ -1,4 +1,5 @@
import { useEffect } from 'react';
+import { createPortal } from 'react-dom';
import { useOutletContext } from 'react-router-dom';
// Publish a page's top-bar actions into the enclosing TabGroupLayout header.
@@ -24,4 +25,50 @@ export function useTopbarActions(actions, deps = []) {
}, [setTopbarActions, ...deps]);
}
+// The SECOND top-bar slot: a table's own chrome — search, the filter button and
+// the "⋮". It is separate from useTopbarActions because the two are published
+// by different owners at different times. A page's actions ("Add domain") are
+// the page's; the chrome belongs to whichever table is on it, which may be a
+// shared wrapper like ResourceListPage that has no business overwriting what
+// the page put in the actions slot. One `setTopbarActions(node)` call per page
+// meant the wrapper and the page could only fight over it.
+//
+// Layout order in the bar is fixed so the search box never moves when a page
+// adds an action: [page actions] [search] [filter] [⋮].
+//
+// This PORTALS into a slot the layout renders, rather than handing the node up
+// through the layout's state the way useTopbarActions does. That is not a style
+// preference — publishing a node upward means an effect whose dependency list
+// has to describe everything the node closes over, and the chrome closes over
+// `chrome.toolsProps`, which useTableChrome rebuilds on every render. The effect
+// then fired every render, set state on the layout, and re-rendered the child:
+// "Maximum update depth exceeded", a hung tab group, and a request storm behind
+// it. A portal has no such dependency — the child renders its own node, into
+// someone else's DOM.
+//
+// Returns { hosted, portal }. `hosted` is false when there is no tab group above
+// (a page reused as a plain route) or when `enabled` is false — which is how an
+// inner table opts out: the route's top bar belongs to the page around it, so a
+// tab's table would be hijacking someone else's bar. Render `portal` anywhere
+// (it lands in the top bar regardless) and fall back to inline when not hosted:
+//
+// const chrome = <><SearchField…/><GridFilterButton…/><GridToolsMenu…/></>;
+// const { hosted, portal } = useTopbarChrome(chrome, { enabled: !inner });
+// return <>{portal}<GridViewPicker … actions={hosted ? null : chrome} /></>;
+export function useTopbarChrome(chrome, { enabled = true } = {}) {
+ const ctx = useOutletContext();
+ // `hasTopbarChrome` is a constant in the context, known on the FIRST render;
+ // the slot element only exists after the layout has committed. Deciding
+ // `hosted` from the constant keeps a page from rendering its chrome inline
+ // for one frame and then yanking it into the bar.
+ const hosted = !!ctx?.hasTopbarChrome && enabled;
+ const slot = ctx?.topbarChromeSlot;
+ const node = typeof chrome === 'function' ? chrome() : chrome;
+
+ return {
+ hosted,
+ portal: hosted && slot ? createPortal(node, slot) : null,
+ };
+}
+
export default useTopbarActions;
diff --git a/frontend/src/layouts/TabGroupLayout.jsx b/frontend/src/layouts/TabGroupLayout.jsx
index 01627b3c..6e173edd 100644
--- a/frontend/src/layouts/TabGroupLayout.jsx
+++ b/frontend/src/layouts/TabGroupLayout.jsx
@@ -52,8 +52,22 @@ function contributedIcon(inner) {
export default function TabGroupLayout({ tabs, groupId }) {
const location = useLocation();
const [actions, setActions] = useState(null);
+ // Two slots, not one. `actions` is the page's ("Add domain") and comes up
+ // through state; `chrome` is the table's (search · filter · "⋮") and is
+ // PORTALED into the empty div below by whatever renders the table — often a
+ // shared wrapper, which must not clobber the page's actions to get its two
+ // icons into the bar. The chrome goes through the DOM rather than through
+ // state because the node closes over values that change identity every
+ // render, and pushing that upward is an infinite render loop. See
+ // useTopbarChrome.
+ const [chromeSlot, setChromeSlot] = useState(null);
const { tabs: contributedTabs } = useContributions();
+ const outletContext = useMemo(
+ () => ({ setTopbarActions: setActions, topbarChromeSlot: chromeSlot, hasTopbarChrome: true }),
+ [chromeSlot],
+ );
+
// Merge extension-contributed tabs for this group into the strip.
// Dedup by `to` (core wins); optional numeric `order` picks the
// insertion index, default appends at the end.
@@ -95,10 +109,10 @@ export default function TabGroupLayout({ tabs, groupId }) {
<PageTopbar
navLabel={active.label}
tabs={mergedTabs}
- actions={actions}
+ actions={<>{actions}<span className="sk-topbar__chrome" ref={setChromeSlot} /></>}
/>
<div className="sk-tabgroup__content">
- <Outlet context={{ setTopbarActions: setActions }} />
+ <Outlet context={outletContext} />
</div>
</div>
);
diff --git a/frontend/src/pages/Backups.jsx b/frontend/src/pages/Backups.jsx
index 9407cb57..83f1a253 100644
--- a/frontend/src/pages/Backups.jsx
+++ b/frontend/src/pages/Backups.jsx
@@ -21,7 +21,7 @@ import {
import BackupsOverview from '../components/backups/BackupsOverview';
import SchedulesTable from '../components/backups/SchedulesTable';
import StorageDestinations from '../components/backups/StorageDestinations';
-import { useTopbarActions } from '@/hooks/useTopbarActions';
+import { useTopbarActions, useTopbarChrome } from '@/hooks/useTopbarActions';
import { useTableSort } from '@/hooks/useTableSort';
import { useColumnVisibility } from '@/hooks/useColumnVisibility';
@@ -726,6 +726,19 @@ const Backups = () => {
</>
), [activeTab, search]);
+ // The chrome acts on the snapshot table, so it is only published while that
+ // section is on screen — the other tabs are forms and a KPI band, with
+ // nothing to filter, sort or export.
+ const { portal: topbarChrome } = useTopbarChrome(
+ <>
+ <GridFilterButton
+ count={chrome.filterCount}
+ onClick={() => chrome.setDrawerOpen(true)}
+ />
+ <GridToolsMenu {...chrome.toolsProps} onRefresh={loadData} />
+ </>, { enabled: activeTab === 'snapshots' },
+ );
+
if (loading) {
return (
<div className="sk-tabgroup__inner backups-page">
@@ -736,6 +749,7 @@ const Backups = () => {
return (
<div className="sk-tabgroup__inner backups-page">
+ {topbarChrome}
{error && (
<div className="alert alert-danger">
{error}
@@ -759,30 +773,14 @@ const Backups = () => {
{activeTab === 'snapshots' && (
<>
- {/* One row of chrome: the view name IS the heading, it
- carries the count, and the filter button and "⋮" ride
- the same line. Search stays in the top bar with every
- other list page, and Refresh moved into the "⋮" — a
- whole toolbar holding one button was a second header.
-
- The count is `chrome.shownCount`, not the length of the
- array handed to the table: the column rules are applied
- inside <DataTable>, so counting the input array here
- would read "12 of 12" above a table showing 3. */}
+ {/* The view name is all this line carries: search, the
+ filter button and the "⋮" ride the tab group's top bar,
+ and the row count belongs to the footer, under the rows
+ it is counting. */}
<GridViewPicker
views={chrome.views}
label="snapshots"
- total={`${chrome.shownCount} of ${backups.length} snapshot${backups.length === 1 ? '' : 's'}`}
onCreate={chrome.createView}
- actions={(
- <>
- <GridFilterButton
- count={chrome.filterCount}
- onClick={() => chrome.setDrawerOpen(true)}
- />
- <GridToolsMenu {...chrome.toolsProps} onRefresh={loadData} />
- </>
- )}
/>
<GridChips {...chrome.chipProps} />
diff --git a/frontend/src/pages/CronJobs.jsx b/frontend/src/pages/CronJobs.jsx
index ccfa779e..f381245a 100644
--- a/frontend/src/pages/CronJobs.jsx
+++ b/frontend/src/pages/CronJobs.jsx
@@ -12,8 +12,7 @@ import {
import { Button } from '@/components/ui/button';
import { Switch } from '@/components/ui/switch';
import {
- Pill, SearchField, DataTable, Drawer,
- DataTableFooter, ListToolbar,
+ Pill, SearchField, DataTable, Drawer, DataTableFooter,
} from '@/components/ds';
import {
useTableChrome, GridViewPicker, GridChips, GridFilterButton,
@@ -467,13 +466,14 @@ const CronJobs = () => {
<GridViewPicker
views={chrome.views}
label="jobs"
- total={`${chrome.shownCount} of ${jobs.length} jobs`}
onCreate={chrome.createView}
- />
- <ListToolbar
- count={serviceNote && <span className="cron-servicenote">{serviceNote}</span>}
- tools={(
+ actions={(
<>
+ {/* The daemon's health rides with the chrome
+ rather than in a bar of its own: it is the
+ reason a "next run" may never happen, so it
+ belongs beside the table it invalidates. */}
+ {serviceNote && <span className="cron-servicenote">{serviceNote}</span>}
<GridFilterButton
count={chrome.filterCount}
onClick={() => chrome.setDrawerOpen(true)}
diff --git a/frontend/src/pages/DeliveryLog.jsx b/frontend/src/pages/DeliveryLog.jsx
index e689b9a6..fdb8a589 100644
--- a/frontend/src/pages/DeliveryLog.jsx
+++ b/frontend/src/pages/DeliveryLog.jsx
@@ -2,7 +2,7 @@ import { useState, useEffect, useCallback, useMemo, useRef } from 'react';
import { Send, Inbox } from 'lucide-react';
import api from '../services/api';
import {
- FilterDrawer, FilterButton, DataTable, DataTableFooter, ListToolbar,
+ FilterDrawer, FilterButton, DataTable, DataTableFooter,
} from '@/components/ds';
import {
useTableChrome, GridViewPicker, GridChips, GridFilterButton,
@@ -79,7 +79,6 @@ export default function DeliveryLog() {
const { isAdmin } = useAuth();
const toast = useToast();
const [deliveries, setDeliveries] = useState([]);
- const [stats, setStats] = useState(null);
const [status, setStatus] = useState('all');
const [channel, setChannel] = useState('all');
const [filtersOpen, setFiltersOpen] = useState(false);
@@ -93,7 +92,6 @@ export default function DeliveryLog() {
if (channel !== 'all') params.channel = channel;
const data = await api.getDeliveryLog(params);
setDeliveries(data.deliveries || []);
- setStats(data.stats || null);
} catch {
// leave the last good state on screen
} finally {
@@ -262,29 +260,24 @@ export default function DeliveryLog() {
<EmailProviders />
{/* The KPI band is gone: Sent / Pending / Failed are the first
- three built-in views, and "Total" — the one number that was a
- true whole-table aggregate rather than a count of the loaded
- page — is the second half of the meta line below. */}
+ three built-in views, and the row count belongs to the
+ footer, under the rows it is counting. */}
<GridViewPicker
views={chrome.views}
label="deliveries"
- total={`${chrome.shownCount} of ${stats?.total ?? deliveries.length} deliveries`}
onCreate={chrome.createView}
- />
- <ListToolbar
- // The chips below only ever show CLIENT rules, so the server
- // query the whole list was fetched under needs saying here —
- // otherwise a status preset silently changes what is loaded
- // with nothing on screen to explain it.
- count={(
- <>
- {status === 'all' ? 'all statuses' : status}
- <i>&middot;</i>
- {channel === 'all' ? 'all channels' : channel}
- </>
- )}
- tools={(
+ actions={(
<>
+ {/* The chips only ever show CLIENT rules, so the
+ server query the list was fetched under needs
+ saying here — otherwise a status preset silently
+ changes what is loaded with nothing on screen to
+ explain it. */}
+ <span className="sk-listhead__count">
+ {status === 'all' ? 'all statuses' : status}
+ <i>&middot;</i>
+ {channel === 'all' ? 'all channels' : channel}
+ </span>
<GridFilterButton
count={chrome.filterCount}
onClick={() => chrome.setDrawerOpen(true)}
diff --git a/frontend/src/pages/Domains.jsx b/frontend/src/pages/Domains.jsx
index 48be924c..907c8a06 100644
--- a/frontend/src/pages/Domains.jsx
+++ b/frontend/src/pages/Domains.jsx
@@ -612,7 +612,6 @@ const Domains = () => {
<GridViewPicker
views={grid.views}
label="domains"
- total={`${view.total} of ${rows.length} domains`}
onCreate={createView}
/>
diff --git a/frontend/src/pages/Email.jsx b/frontend/src/pages/Email.jsx
index 17a38db0..02ec61fd 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, DataTableFooter, ListToolbar } from '@/components/ds';
+import { Pill, MetricCard, KpiBand, DataTable, DataTableFooter, ListToolbar, SearchField } from '@/components/ds';
import PageLayout from '../layouts/PageLayout';
import { Button } from '@/components/ui/button';
import { Input } from '@/components/ui/input';
@@ -596,15 +596,14 @@ function AccountsTab({ domains }) {
return (
<section className="sk-email__section">
+ {/* One row of chrome: the view name and the table's own controls.
+ What stays in the toolbar below is not chrome — the domain
+ select is WHICH list you are looking at. */}
<GridViewPicker
views={chrome.views}
label="accounts"
- total={`${filtered.length} of ${accounts.length} accounts`}
onCreate={chrome.createView}
- />
- <ListToolbar
- className="sk-email__filters"
- tools={(
+ actions={(
<>
<GridFilterButton
count={chrome.filterCount}
@@ -613,7 +612,8 @@ function AccountsTab({ domains }) {
<GridToolsMenu {...chrome.toolsProps} onRefresh={load} />
</>
)}
- >
+ />
+ <ListToolbar className="sk-email__filters">
<label>
Domain
<select value={domainId} onChange={(e) => setDomainId(e.target.value)}>
@@ -1003,39 +1003,29 @@ function QueueTab() {
return (
<section className="sk-email__section">
+ {/* Everything that acts on the queue rides the view line, in the
+ same order the topbar pages use: action, search, filter, "⋮".
+ Refresh is not repeated as a button — it is in the "⋮". */}
<GridViewPicker
views={chrome.views}
label="messages"
- total={`${filtered.length} of ${queue.length} messages`}
onCreate={chrome.createView}
- />
- <ListToolbar
- className="sk-email__filters"
- tools={(
+ actions={(
<>
+ <Button variant="outline" size="sm" onClick={flush}>Flush queue</Button>
+ <SearchField
+ value={search}
+ onSearch={setSearch}
+ placeholder="Search queue by sender, recipient, or ID…"
+ />
<GridFilterButton
count={chrome.filterCount}
onClick={() => chrome.setDrawerOpen(true)}
/>
<GridToolsMenu {...chrome.toolsProps} onRefresh={load} />
- <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
- type="text"
- value={search}
- onChange={(e) => setSearch(e.target.value)}
- placeholder="Search queue by sender, recipient, or ID..."
- aria-label="Search mail queue"
- />
- </label>
- </ListToolbar>
+ />
<GridChips {...chrome.chipProps} />
diff --git a/frontend/src/pages/FleetProxy.jsx b/frontend/src/pages/FleetProxy.jsx
index e5ef14e6..ce18b7b3 100644
--- a/frontend/src/pages/FleetProxy.jsx
+++ b/frontend/src/pages/FleetProxy.jsx
@@ -3,11 +3,11 @@ import { Link } from 'react-router-dom';
import { AlertTriangle, Network, RefreshCw, Server as ServerIcon } from 'lucide-react';
import api from '../services/api';
import { useToast } from '../contexts/ToastContext';
-import { useTopbarActions } from '@/hooks/useTopbarActions';
+import { useTopbarActions, useTopbarChrome } from '@/hooks/useTopbarActions';
import { useTableSort } from '@/hooks/useTableSort';
import { useColumnVisibility } from '@/hooks/useColumnVisibility';
import { Button } from '@/components/ui/button';
-import { DataTable, ListToolbar, Pill } from '@/components/ds';
+import { DataTable, Pill } from '@/components/ds';
import {
useTableChrome, GridViewPicker, GridChips, GridFilterButton,
GridToolsMenu, GridFilterDrawer,
@@ -377,10 +377,21 @@ const FleetProxy = () => {
setGroupBy,
});
- const managed = rows.filter((row) => row.proxy_type && row.proxy_type !== 'nginx').length;
+ // Filter + "⋮" ride in the shared Servers top bar. The toolbar they used to
+ // sit in held nothing else but a re-count of the table underneath it.
+ const { portal: topbarChrome } = useTopbarChrome(
+ <>
+ <GridFilterButton
+ count={chrome.filterCount}
+ onClick={() => chrome.setDrawerOpen(true)}
+ />
+ <GridToolsMenu {...chrome.toolsProps} onRefresh={load} />
+ </>,
+ );
return (
<div className="sk-tabgroup__inner fleet-proxy">
+ {topbarChrome}
{error ? (
<div className="fleet-proxy__error">
<p>{error}</p>
@@ -391,29 +402,8 @@ const FleetProxy = () => {
<GridViewPicker
views={chrome.views}
label="servers"
- total={loading ? null : `${chrome.shownCount} of ${rows.length} server${rows.length === 1 ? '' : 's'}`}
onCreate={chrome.createView}
/>
- <ListToolbar
- // Null while the fetch is in flight: an empty `rows` is
- // "not known yet", and "0 servers" is a claim.
- count={loading ? null : (
- <>
- {rows.length} server{rows.length === 1 ? '' : 's'}
- <i>&middot;</i>
- <b>{managed} managed stack{managed === 1 ? '' : 's'}</b>
- </>
- )}
- tools={(
- <>
- <GridFilterButton
- count={chrome.filterCount}
- onClick={() => chrome.setDrawerOpen(true)}
- />
- <GridToolsMenu {...chrome.toolsProps} onRefresh={load} />
- </>
- )}
- />
<GridChips {...chrome.chipProps} />
diff --git a/frontend/src/pages/Git.jsx b/frontend/src/pages/Git.jsx
index 360ad60c..a128ddd1 100644
--- a/frontend/src/pages/Git.jsx
+++ b/frontend/src/pages/Git.jsx
@@ -1112,7 +1112,6 @@ function Git({ basePath = '/git' }) {
<GridViewPicker
views={repoChrome.views}
label="repositories"
- total={`${repoChrome.shownCount} of ${repositories.length} repositories`}
onCreate={repoChrome.createView}
actions={(
<>
@@ -1204,7 +1203,6 @@ function Git({ basePath = '/git' }) {
<GridViewPicker
views={webhookChrome.views}
label="webhooks"
- total={`${webhookChrome.shownCount} of ${webhooks.length} webhooks`}
onCreate={webhookChrome.createView}
actions={(
<>
diff --git a/frontend/src/pages/Incidents.jsx b/frontend/src/pages/Incidents.jsx
index e1cf64b9..f597d261 100644
--- a/frontend/src/pages/Incidents.jsx
+++ b/frontend/src/pages/Incidents.jsx
@@ -24,7 +24,7 @@ import { Button } from '@/components/ui/button';
import { Input } from '@/components/ui/input';
import { useTableSort } from '@/hooks/useTableSort';
import { useColumnVisibility } from '@/hooks/useColumnVisibility';
-import { useTopbarActions } from '@/hooks/useTopbarActions';
+import { useTopbarActions, useTopbarChrome } from '@/hooks/useTopbarActions';
import { IMPACT_TONE, INCIDENT_STATES } from '../components/monitoring/monitorShared';
// Built-in views. This page used to carry BOTH old affordances at once — a KPI
@@ -250,12 +250,6 @@ export default function Incidents() {
));
}, [items, search]);
- // TRUE aggregates — neither is a count of the rows this page renders, so
- // neither can be a preset. `openIncidents` counts the raw incidents array
- // (excluding host alerts) and `activeAlerts` is its own source. They ride
- // the view bar's meta line rather than a full-width band.
- const openIncidents = incidents.filter((i) => i.status !== 'resolved').length;
-
const onPostUpdate = async (state) => {
if (!selected || selected.kind !== 'incident') return;
try {
@@ -375,6 +369,16 @@ export default function Incidents() {
applyPage: applyViewPageState,
});
+ const { portal: topbarChrome } = useTopbarChrome(
+ <>
+ <GridFilterButton
+ count={chrome.filterCount}
+ onClick={() => chrome.setDrawerOpen(true)}
+ />
+ <GridToolsMenu {...chrome.toolsProps} onRefresh={load} />
+ </>,
+ );
+
if (loading) {
return (
<div className="sk-tabgroup__inner incidents-page">
@@ -389,23 +393,11 @@ export default function Incidents() {
return (
<div className="sk-tabgroup__inner incidents-page">
- {/* The two numbers that are NOT filters ride the meta line: neither
- counts the rows below it. A full-width band for them would be
- four tiles of which two only ever restated a segment. */}
+ {topbarChrome}
<GridViewPicker
views={chrome.views}
label="incidents"
- total={`${chrome.shownCount} of ${items.length} · ${openIncidents} open · ${activeAlerts.length} host alerts firing`}
onCreate={chrome.createView}
- actions={(
- <>
- <GridFilterButton
- count={chrome.filterCount}
- onClick={() => chrome.setDrawerOpen(true)}
- />
- <GridToolsMenu {...chrome.toolsProps} onRefresh={load} />
- </>
- )}
/>
<GridChips {...chrome.chipProps} />
diff --git a/frontend/src/pages/Jobs.jsx b/frontend/src/pages/Jobs.jsx
index 0380e28f..0766f372 100644
--- a/frontend/src/pages/Jobs.jsx
+++ b/frontend/src/pages/Jobs.jsx
@@ -15,7 +15,7 @@ import { useLocation, useNavigate } from 'react-router-dom';
import { ListChecks, RefreshCw, RotateCcw, XCircle, Play, Clock } from 'lucide-react';
import api from '../services/api';
import {
- Pill, DataTable, DataTableFooter, SegControl, ListToolbar,
+ Pill, DataTable, DataTableFooter, SegControl,
SearchField, FilterDrawer, FilterButton, countActiveFilters,
} from '@/components/ds';
import {
@@ -23,7 +23,7 @@ import {
} from '@/components/ds/grid';
import { Button } from '@/components/ui/button';
import EmptyState from '../components/EmptyState';
-import { useTopbarActions } from '@/hooks/useTopbarActions';
+import { useTopbarActions, useTopbarChrome } from '@/hooks/useTopbarActions';
import { useTableSort } from '@/hooks/useTableSort';
import { useColumnVisibility } from '@/hooks/useColumnVisibility';
import { useAuth } from '../contexts/AuthContext';
@@ -179,7 +179,6 @@ export default function Jobs() {
const scheduledView = location.pathname.endsWith('/scheduled');
const [jobs, setJobs] = useState([]);
const [total, setTotal] = useState(0);
- const [stats, setStats] = useState(null);
const [scheduled, setScheduled] = useState([]);
// Advanced filters live in the shared FilterDrawer (status + kind, single-
// select; '' = all). Search is a separate debounced term.
@@ -227,14 +226,15 @@ export default function Jobs() {
if (filters.status) params.status = filters.status;
if (filters.kind) params.kind = filters.kind;
if (q) params.q = q;
- const [jobsRes, statsRes, schedRes] = await Promise.all([
+ // No /jobs/stats call any more: its whole-table group-bys only ever
+ // fed the count line above the table, and the footer counts the
+ // rows the query actually returned.
+ const [jobsRes, schedRes] = await Promise.all([
api.getJobs(params),
- api.getJobStats().catch(() => null),
api.getScheduledJobs().catch(() => null),
]);
setJobs(jobsRes?.jobs || []);
setTotal(jobsRes?.total ?? (jobsRes?.jobs?.length || 0));
- setStats(statsRes?.stats || statsRes || null);
setScheduled(schedRes?.scheduled || schedRes?.jobs || schedRes || []);
} catch {
// Keep the last good state on screen rather than blanking the page.
@@ -388,6 +388,14 @@ export default function Jobs() {
rename: { filters: 'serverFilters' },
});
+ // Only the "⋮" is hoisted: the top bar's filter button already opens the
+ // SERVER query drawer, which sees rows this client never loaded, and a
+ // second one would open a weaker drawer over the loaded page only. Gated on
+ // the Activity tab because the chrome describes that table, not Scheduled.
+ const { portal: topbarChrome } = useTopbarChrome(
+ <GridToolsMenu {...chrome.toolsProps} onRefresh={load} />, { enabled: isAdmin && !scheduledView },
+ );
+
if (!isAdmin) {
return (
<div className="sk-tabgroup__inner jobs-page">
@@ -396,13 +404,8 @@ export default function Jobs() {
);
}
- const byStatus = stats?.by_status || {};
const hasFilters = Boolean(filters.status || filters.kind || q);
const totalPages = Math.max(1, Math.ceil(total / PAGE_SIZE));
- // The one number the grid genuinely cannot derive: a backend sum over every
- // Job row, not over the page. `total` is the count matching the current
- // query, which collapses to the same figure when nothing is filtered.
- const allJobs = stats?.total ?? total ?? 0;
const kindOptions = kinds
.map((k) => (typeof k === 'string' ? k : k.kind || k.name))
@@ -449,6 +452,7 @@ export default function Jobs() {
return (
<div className="sk-tabgroup__inner jobs-page">
+ {topbarChrome}
<div className="sk-jobs">
<div className="sk-jobs__viewswitch">
<SegControl
@@ -479,36 +483,13 @@ export default function Jobs() {
<>
{/* The KPI band is gone: three of its four tiles were a
status filter wearing a number, and those are views
- now. What a band could say and a grid cannot is the
- whole-table arithmetic — the job store is paginated,
- so these are backend group-bys over every row, not
- counts of the 50 on screen. They stay as meta text
- beside the count rather than a full-width row of
- cards restating what the view picker already offers. */}
+ now. The rest was whole-table arithmetic that only
+ ever restated what the view picker offers. */}
<GridViewPicker
views={chrome.views}
label="jobs"
- total={hasFilters
- ? `${chrome.shownCount} of ${total} matching · ${allJobs} jobs total`
- : `${chrome.shownCount} of ${allJobs} jobs`}
onCreate={chrome.createView}
/>
- <ListToolbar
- count={(
- <>
- {byStatus.running ?? 0} running
- <i>&middot;</i>
- {byStatus.pending ?? byStatus.queued ?? 0} queued
- <i>&middot;</i>
- <b>{byStatus.failed ?? 0} failed</b>
- </>
- )}
- // ONE filter button on this page, and it is the top
- // bar's: it opens the SERVER query drawer, which sees
- // rows this client never loaded. A second one here
- // opened a weaker drawer over the loaded page only.
- tools={<GridToolsMenu {...chrome.toolsProps} onRefresh={load} />}
- />
<GridChips {...chrome.chipProps} />
diff --git a/frontend/src/pages/MonitorDetail.jsx b/frontend/src/pages/MonitorDetail.jsx
index 5201610a..a7e28432 100644
--- a/frontend/src/pages/MonitorDetail.jsx
+++ b/frontend/src/pages/MonitorDetail.jsx
@@ -569,14 +569,13 @@ export default function MonitorDetail() {
section — a view picker above the chart or the config panes
would be naming something they do not show. The old panel
header is gone with it: its <h3> repeated the segment that is
- already lit above, and its "N results · live" is the picker's
- count line, so keeping both was two headers for one table. */}
+ already lit above, and its "N results" is what the table footer
+ reports, under the rows it is counting. */}
{section === 'checks' && (
<>
<GridViewPicker
views={chrome.views}
label="checks"
- total={`${chrome.shownCount} of ${rows.length} check${rows.length === 1 ? '' : 's'} · ${frozen ? 'frozen' : 'live'}`}
onCreate={chrome.createView}
actions={(
<>
diff --git a/frontend/src/pages/Monitors.jsx b/frontend/src/pages/Monitors.jsx
index 79bd9b1a..b297530b 100644
--- a/frontend/src/pages/Monitors.jsx
+++ b/frontend/src/pages/Monitors.jsx
@@ -28,7 +28,7 @@ import { Button } from '@/components/ui/button';
import { Input } from '@/components/ui/input';
import { Label } from '@/components/ui/label';
import { Switch } from '@/components/ui/switch';
-import { useTopbarActions } from '@/hooks/useTopbarActions';
+import { useTopbarActions, useTopbarChrome } from '@/hooks/useTopbarActions';
import { useTableSort } from '@/hooks/useTableSort';
import { useColumnVisibility } from '@/hooks/useColumnVisibility';
import useFocusParam from '@/hooks/useFocusParam';
@@ -183,7 +183,6 @@ export default function Monitors() {
const toast = useToast();
const [monitors, setMonitors] = useState([]);
- const [stats, setStats] = useState(null);
const [loading, setLoading] = useState(true);
const [q, setQ] = useState('');
const [filters, setFilters] = useState({ status: '', type: '' });
@@ -198,12 +197,10 @@ export default function Monitors() {
const load = useCallback(async () => {
try {
- const [listRes, statsRes] = await Promise.all([
- api.getMonitors({ q: q || undefined, status: filters.status || undefined, type: filters.type || undefined }),
- api.getMonitorStats().catch(() => null),
- ]);
+ const listRes = await api.getMonitors({
+ q: q || undefined, status: filters.status || undefined, type: filters.type || undefined,
+ });
setMonitors(listRes?.monitors || []);
- setStats(statsRes?.stats || null);
} catch {
// Keep the last good list on screen rather than blanking the page.
} finally {
@@ -447,34 +444,31 @@ export default function Monitors() {
rename: { filters: 'serverFilters' },
});
+ // The "⋮" rides the top bar with the page's own controls, so the view row
+ // is the view name and nothing else. No grid filter button joins it: this
+ // page has exactly ONE filter button and it is the top bar's, which opens
+ // the SERVER query drawer. Column rules come from each column's own header
+ // menu and show up in the chips.
+ const { portal: topbarChrome } = useTopbarChrome(
+ <GridToolsMenu {...chrome.toolsProps} onRefresh={load} />,
+ );
+
const hasFilters = Boolean(q || filters.status || filters.type);
const isHttpish = ['http', 'keyword'].includes(form.check_type);
return (
<div className="sk-tabgroup__inner monitors-page">
+ {topbarChrome}
{/* No KPI band: Operational / Degraded / Down are each a saved view
you can act from, so the band was three numbers you had to
- re-filter by hand. The 30-day mean is not a filter — it is a
- fleet aggregate — so it rides the view bar's meta line. */}
+ re-filter by hand. The fleet's 30-day mean went with the view
+ row's meta line — an aggregate no row on this grid can restate,
+ and now with nowhere to sit — so /monitors/stats is not fetched
+ any more either. */}
<GridViewPicker
views={chrome.views}
label="monitors"
- total={(
- <>
- {chrome.shownCount} of {monitors.length} monitor{monitors.length === 1 ? '' : 's'}
- {stats?.overall_uptime_30d != null && (
- <> &middot; {stats.overall_uptime_30d}% uptime (30d)</>
- )}
- </>
- )}
onCreate={chrome.createView}
- // The "⋮" sits on the view-name line. There is exactly ONE
- // filter button on this page and it is the top bar's, which
- // opens the SERVER query drawer; a second one here opened a
- // second drawer that narrowed the same list a weaker way, which
- // is the duplicate affordance this whole round removes. Column
- // rules come from each column's own menu and show in the chips.
- actions={<GridToolsMenu {...chrome.toolsProps} onRefresh={load} />}
/>
<GridChips {...chrome.chipProps} />
diff --git a/frontend/src/pages/QueueDetail.jsx b/frontend/src/pages/QueueDetail.jsx
index 4602a827..1c0eb7b8 100644
--- a/frontend/src/pages/QueueDetail.jsx
+++ b/frontend/src/pages/QueueDetail.jsx
@@ -383,16 +383,30 @@ const QueueDetail = () => {
<div className={`queue-detail-body ${selectedMessage ? 'has-panel' : ''}`}>
<div className="queue-detail-main">
- {/* The view name heads the message list. The queue's own
- name stays in the detail header above — a view here is
- about the messages, and is shared by every queue. */}
+ {/* The view name heads the message list, with the table's
+ own chrome on the same line. The queue's own name stays
+ in the detail header above — a view here is about the
+ messages, and is shared by every queue. */}
<GridViewPicker
views={chrome.views}
label="messages"
- total={`${chrome.shownCount} of ${messages.length} loaded`}
onCreate={chrome.createView}
+ actions={(
+ <>
+ <GridFilterButton
+ count={chrome.filterCount}
+ onClick={() => chrome.setDrawerOpen(true)}
+ />
+ <GridToolsMenu
+ {...chrome.toolsProps}
+ onRefresh={() => { loadMeta(); loadMessages(statusFilter); }}
+ />
+ </>
+ )}
/>
+ {/* The status select stays on its own line: it is a SERVER
+ filter, not table chrome — changing it refetches. */}
<div className="queue-messages-toolbar">
<div className="queue-messages-selects">
<select
@@ -404,23 +418,6 @@ const QueueDetail = () => {
{STATUS_ORDER.map(s => <option key={s} value={s}>{STATUS_LABELS[s]}</option>)}
</select>
</div>
- <div className="queue-messages-actions">
- <span className="queue-results-summary">
- <strong>{messages.length}</strong>
- <span>{messages.length === 1 ? 'message' : 'messages'}</span>
- </span>
- {/* Sort and hide live in each column's own "⋮" menu
- now. What stays here is what has no per-column
- equivalent: the multi-rule drawer and export. */}
- <GridFilterButton
- count={chrome.filterCount}
- onClick={() => chrome.setDrawerOpen(true)}
- />
- <GridToolsMenu
- {...chrome.toolsProps}
- onRefresh={() => { loadMeta(); loadMessages(statusFilter); }}
- />
- </div>
</div>
<GridChips {...chrome.chipProps} />
diff --git a/frontend/src/pages/QueueOperations.jsx b/frontend/src/pages/QueueOperations.jsx
index 71843b09..ed8fca9c 100644
--- a/frontend/src/pages/QueueOperations.jsx
+++ b/frontend/src/pages/QueueOperations.jsx
@@ -7,7 +7,6 @@ import {
Trash2,
RefreshCw,
Plus,
- Search,
Activity,
Folder,
Server,
@@ -23,7 +22,7 @@ import { Input } from '@/components/ui/input';
import { Label } from '@/components/ui/label';
import { Textarea } from '@/components/ui/textarea';
import {
- DataTable, DataTableFooter, MetricCard, Pill, SortChipBar,
+ DataTable, DataTableFooter, MetricCard, Pill, SearchField, SortChipBar,
} from '@/components/ds';
import {
useTableChrome, GridViewPicker, GridChips, GridFilterButton,
@@ -560,26 +559,36 @@ const QueueOperations = () => {
</div>
</div>
- {/* The view name is the page's heading for the list, above
- the bar that narrows it. */}
+ {/* The view name is the page's heading for the list, and
+ the table's own chrome sits on that same line. */}
<GridViewPicker
views={chrome.views}
label="queues"
- total={`${chrome.shownCount} of ${queues.length} queues`}
onCreate={chrome.createView}
+ actions={(
+ <>
+ <SearchField
+ value={searchTerm}
+ onSearch={setSearchTerm}
+ placeholder="Search queues…"
+ />
+ <GridFilterButton
+ count={chrome.filterCount}
+ onClick={() => chrome.setDrawerOpen(true)}
+ />
+ <GridToolsMenu
+ {...chrome.toolsProps}
+ onRefresh={() => { loadData(); loadQueues(selectedGroup); }}
+ />
+ </>
+ )}
/>
+ {/* The group select stays out of the chrome row: it decides
+ which group's queues are FETCHED, not how the loaded
+ rows are shown. */}
<div className="queue-command-bar">
<div className="queue-toolbar">
- <label className="search-box">
- <Search size={16} />
- <Input
- type="text"
- placeholder="Search queues by name or slug..."
- value={searchTerm}
- onChange={(e) => setSearchTerm(e.target.value)}
- />
- </label>
<select
className="queue-select"
value={selectedGroup}
@@ -588,36 +597,20 @@ const QueueOperations = () => {
<option value="">All groups</option>
{groups.map(g => <option key={g.id} value={g.slug}>{g.name}</option>)}
</select>
- {/* Sort and hide moved into each column's own "⋮"
- menu, next to the column they act on. What is
- left here is the pair that has no per-column
- equivalent: the multi-rule drawer and export. */}
- <GridFilterButton
- count={chrome.filterCount}
- onClick={() => chrome.setDrawerOpen(true)}
- />
- <GridToolsMenu
- {...chrome.toolsProps}
- onRefresh={() => { loadData(); loadQueues(selectedGroup); }}
- />
- </div>
- <div className="queue-results-summary">
- <strong>{filteredQueues.length}</strong>
- <span>{filteredQueues.length === 1 ? 'queue' : 'queues'}</span>
- {hasActiveFilters && (
- <button
- type="button"
- className="queue-clear-filters"
- onClick={() => {
- setSelectedGroup('');
- setMessageFilter('all');
- setSearchTerm('');
- }}
- >
- Clear filters
- </button>
- )}
</div>
+ {hasActiveFilters && (
+ <button
+ type="button"
+ className="queue-clear-filters"
+ onClick={() => {
+ setSelectedGroup('');
+ setMessageFilter('all');
+ setSearchTerm('');
+ }}
+ >
+ Clear filters
+ </button>
+ )}
</div>
<GridChips {...chrome.chipProps} />
diff --git a/frontend/src/pages/ServerTemplates.jsx b/frontend/src/pages/ServerTemplates.jsx
index cde42172..6f812b9d 100644
--- a/frontend/src/pages/ServerTemplates.jsx
+++ b/frontend/src/pages/ServerTemplates.jsx
@@ -1,5 +1,5 @@
import { useState, useEffect, useCallback, useMemo } from 'react';
-import { useTopbarActions } from '@/hooks/useTopbarActions';
+import { useTopbarActions, useTopbarChrome } from '@/hooks/useTopbarActions';
import { useTableSort } from '@/hooks/useTableSort';
import { useColumnVisibility } from '@/hooks/useColumnVisibility';
import api from '../services/api';
@@ -445,10 +445,27 @@ const ServerTemplates = () => {
? (compliance.compliant || 0) + (compliance.drifted || 0) + (compliance.unknown || 0)
: 0;
+ // Filter + "⋮" ride the group's top bar, so the view row is the view name
+ // alone. Gated on the tab that owns the table: the Library is a card
+ // catalogue these do not act on, and the drawer the filter button opens is
+ // rendered inside the Templates tab, so hoisting it unconditionally would
+ // leave a button whose panel does not exist.
+ const gridIsOnScreen = activeTab === 'templates' && templates.length > 0;
+ const { portal: topbarChrome } = useTopbarChrome(
+ <>
+ <GridFilterButton
+ count={chrome.filterCount}
+ onClick={() => chrome.setDrawerOpen(true)}
+ />
+ <GridToolsMenu {...chrome.toolsProps} onRefresh={loadData} />
+ </>, { enabled: gridIsOnScreen },
+ );
+
if (loading) return <PageLoader />;
return (
<div className="sk-tabgroup__inner server-templates-page">
+ {topbarChrome}
{/* Stays a band: these tiles count ASSIGNMENTS — a different entity
from the templates in the table below — and "Unknown" is the
remainder of the other two, not a predicate. Neither number is
@@ -500,30 +517,10 @@ const ServerTemplates = () => {
/>
) : (
<>
- {/* One row of chrome: the view name carries the
- count, and the filter button and "⋮" ride the
- same line rather than a second, otherwise empty
- toolbar. `shownCount` is the count AFTER the
- column rules, which are applied inside the
- table — `templates.length` here would read "4
- of 4" while the table showed 2. */}
<GridViewPicker
views={chrome.views}
label="templates"
- total={`${chrome.shownCount} of ${templates.length} template${templates.length === 1 ? '' : 's'}`}
onCreate={chrome.createView}
- actions={(
- <>
- {/* This page has no server-side filter
- drawer, so the grid one is the only
- filter affordance here. */}
- <GridFilterButton
- count={chrome.filterCount}
- onClick={() => chrome.setDrawerOpen(true)}
- />
- <GridToolsMenu {...chrome.toolsProps} onRefresh={loadData} />
- </>
- )}
/>
<GridChips {...chrome.chipProps} />
diff --git a/frontend/src/pages/Servers.jsx b/frontend/src/pages/Servers.jsx
index 4951b247..a45fde76 100644
--- a/frontend/src/pages/Servers.jsx
+++ b/frontend/src/pages/Servers.jsx
@@ -8,9 +8,9 @@ import Modal from '@/components/Modal';
import { Button } from '@/components/ui/button';
import { Input } from '@/components/ui/input';
import {
- DataTable, DataTableFooter, Drawer, Gauge, ListToolbar, Pill, SearchField,
+ DataTable, DataTableFooter, Drawer, Gauge, Pill, SearchField,
} from '@/components/ds';
-import { useTopbarActions } from '@/hooks/useTopbarActions';
+import { useTopbarActions, useTopbarChrome } from '@/hooks/useTopbarActions';
import { useTableSort } from '@/hooks/useTableSort';
import { useColumnVisibility } from '@/hooks/useColumnVisibility';
import {
@@ -320,8 +320,6 @@ const Servers = () => {
|| server.group_name?.toLowerCase().includes(q);
});
- const online = servers.filter((s) => s.status === 'online').length;
-
// The tab-group top bar owns this page's controls, search included.
useTopbarActions(() => (
<>
@@ -358,6 +356,20 @@ const Servers = () => {
applyPage: applyViewPageState,
});
+ // Filter + "⋮" ride in the top bar next to the actions and the search box,
+ // not in a toolbar under the view name. That toolbar was also repeating the
+ // row count the view row already showed, with an "N online" tacked on that
+ // no filter, sort or view ever referred to.
+ const { portal: topbarChrome } = useTopbarChrome(
+ <>
+ <GridFilterButton
+ count={chrome.filterCount}
+ onClick={() => chrome.setDrawerOpen(true)}
+ />
+ <GridToolsMenu {...chrome.toolsProps} onRefresh={loadData} />
+ </>,
+ );
+
if (loading) {
return (
<div className="sk-tabgroup__inner servers-page">
@@ -368,30 +380,12 @@ const Servers = () => {
return (
<div className="sk-tabgroup__inner servers-page">
+ {topbarChrome}
<GridViewPicker
views={chrome.views}
label="servers"
- total={`${chrome.shownCount} of ${servers.length} servers`}
onCreate={chrome.createView}
/>
- <ListToolbar
- count={(
- <>
- {filteredServers.length} of {servers.length} server{servers.length === 1 ? '' : 's'}
- <i>&middot;</i>
- <b>{online} online</b>
- </>
- )}
- tools={(
- <>
- <GridFilterButton
- count={chrome.filterCount}
- onClick={() => chrome.setDrawerOpen(true)}
- />
- <GridToolsMenu {...chrome.toolsProps} onRefresh={loadData} />
- </>
- )}
- />
<GridChips {...chrome.chipProps} />
diff --git a/frontend/src/pages/Services.jsx b/frontend/src/pages/Services.jsx
index 2ba64c90..3b40b2a5 100644
--- a/frontend/src/pages/Services.jsx
+++ b/frontend/src/pages/Services.jsx
@@ -418,65 +418,6 @@ const Services = () => {
filteredEmptyIcon={Layers}
filteredEmptyTitle="No services found"
filteredEmptyDescription="Try adjusting your search or filter"
- viewStorageKey="serverkit.services.view"
- renderCard={(app) => {
- const typeInfo = getServiceType(app.app_type);
- const primaryDomain = (app.domains?.find(d => d.is_primary) || app.domains?.[0])?.name;
- const isRunning = app.status === 'running';
- const bw = bandwidth[String(app.id)];
- return (
- <>
- <div className="services-card__top">
- <ServiceTile name={app.name} size={40} aria-hidden="true" />
- <div className="services-card__id">
- <div className="services-card__name">{app.name}</div>
- <div className="sk-cell-sub">{typeInfo.label}</div>
- </div>
- <Pill kind={STATUS_PILL[app.status] || 'gray'}>
- {getStatusConfig(app.status).label}
- </Pill>
- </div>
-
- <div className="services-card__domain">
- {primaryDomain || <span className="wp-list__dash">No domain</span>}
- </div>
-
- <div className="services-card__stats">
- <div>
- <span className="l">Project</span>
- <span className="v">{app.project_name || '—'}</span>
- </div>
- <div>
- <span className="l">Transfer</span>
- <span className="v">{bw?.month_bytes ? `${formatBytes(bw.month_bytes)}/mo` : '—'}</span>
- </div>
- <div>
- <span className="l">Last deploy</span>
- <span className="v">
- {app.last_deploy_at ? formatRelativeTime(app.last_deploy_at) : '—'}
- </span>
- </div>
- </div>
-
- <div className="services-card__foot" onClick={(e) => e.stopPropagation()}>
- {isRunning ? (
- <>
- <Button variant="ghost" size="sm" onClick={(e) => handleAction(e, app.id, 'restart')} disabled={actionLoading === `${app.id}-restart`} title="Restart">
- <RotateCw size={14} />
- </Button>
- <Button variant="ghost" size="sm" onClick={(e) => handleAction(e, app.id, 'stop')} disabled={actionLoading === `${app.id}-stop`} title="Stop">
- <Square size={14} />
- </Button>
- </>
- ) : (
- <Button variant="ghost" size="sm" onClick={(e) => handleAction(e, app.id, 'start')} disabled={actionLoading === `${app.id}-start`} title="Start">
- <Play size={14} />
- </Button>
- )}
- </div>
- </>
- );
- }}
>
<MoveToProjectDialog
open={showMoveDialog}
diff --git a/frontend/src/pages/Telemetry.jsx b/frontend/src/pages/Telemetry.jsx
index ceb0f833..8d4cf7a4 100644
--- a/frontend/src/pages/Telemetry.jsx
+++ b/frontend/src/pages/Telemetry.jsx
@@ -14,16 +14,17 @@
// The KPI band that rebuild introduced is gone again. Five of its six tiles
// were filter shortcuts wearing a number — clicking one only ever set
// `filters.severity` — so they are saved views now (see BUILTIN_VIEWS), which
-// is the same shortcut plus a name, a link and a place in the picker. "Total
-// (24h)" was the one true aggregate (a backend count over a window the table
-// never holds), so it moved to the view bar's meta line rather than dying.
+// is the same shortcut plus a name, a link and a place in the picker. The
+// sixth, "Total (24h)", was a real backend aggregate, but the view row is the
+// view name alone now and there was nowhere left to put it — so the
+// /telemetry/stats call went with it. The footer counts what is loaded.
import { useCallback, useEffect, useMemo, useState } from 'react';
import {
Activity, ChevronRight, Info, Loader2, RefreshCw, Trash2,
} from 'lucide-react';
import api from '../services/api';
import {
- DataTable, DataTableFooter, Drawer, FilterButton, FilterDrawer, ListToolbar,
+ DataTable, DataTableFooter, Drawer, FilterButton, FilterDrawer,
Pill, SearchField, countActiveFilters,
} from '@/components/ds';
import {
@@ -32,7 +33,7 @@ import {
import { Button } from '@/components/ui/button';
import { Input } from '@/components/ui/input';
import { Label } from '@/components/ui/label';
-import { useTopbarActions } from '@/hooks/useTopbarActions';
+import { useTopbarActions, useTopbarChrome } from '@/hooks/useTopbarActions';
import { useConfirm } from '@/hooks/useConfirm';
import { useTableSort } from '@/hooks/useTableSort';
import { useColumnVisibility } from '@/hooks/useColumnVisibility';
@@ -115,7 +116,6 @@ export default function Telemetry() {
const [loading, setLoading] = useState(true);
const [hasMore, setHasMore] = useState(false);
const [page, setPage] = useState(1);
- const [stats, setStats] = useState(null);
const [sources, setSources] = useState([]);
const [eventTypes, setEventTypes] = useState([]);
const [selectedEvent, setSelectedEvent] = useState(null);
@@ -139,14 +139,6 @@ export default function Telemetry() {
}
}, []);
- const loadStats = useCallback(async () => {
- try {
- setStats(await api.getTelemetryStats({ hours: 24 }));
- } catch {
- // stats are optional
- }
- }, []);
-
const loadFilterOptions = useCallback(async () => {
try {
const [sourcesData, typesData] = await Promise.all([
@@ -181,10 +173,9 @@ export default function Telemetry() {
}, [filters, q, showToast]);
useEffect(() => {
- loadStats();
loadFilterOptions();
fetchEvents(1, true);
- }, [loadStats, loadFilterOptions, fetchEvents]);
+ }, [loadFilterOptions, fetchEvents]);
const emitTestEvent = async () => {
try {
@@ -197,7 +188,6 @@ export default function Telemetry() {
});
showToast('Test event emitted', 'success');
fetchEvents(1, true);
- loadStats();
} catch (err) {
showToast(`Failed to emit test event: ${err.message}`, 'error');
}
@@ -217,7 +207,6 @@ export default function Telemetry() {
const data = await api.cleanupTelemetryEvents(90);
showToast(`Deleted ${data.deleted} old events`, 'success');
fetchEvents(1, true);
- loadStats();
} catch (err) {
showToast(`Cleanup failed: ${err.message}`, 'error');
}
@@ -365,26 +354,25 @@ export default function Telemetry() {
rename: { filters: 'serverFilters' },
});
+ // The "⋮" rides the top bar next to the page's own controls, leaving the
+ // view row as just the view name. It is NOT joined by a grid filter button:
+ // this page's one filter button is the top bar's, which opens the SERVER
+ // query drawer (eight keys, applied to the query rather than the loaded 50).
+ const { portal: topbarChrome } = useTopbarChrome(
+ <GridToolsMenu {...chrome.toolsProps} onRefresh={() => fetchEvents(1, true)} />,
+ );
+
const hasFilters = Boolean(q || activeFilterCount);
return (
<div className="sk-tabgroup__inner telemetry-page">
+ {topbarChrome}
{/* Outside the empty check below on purpose: a view that returns
- no events must still be swappable for another one. "Total (24h)"
- is the KPI band's one surviving number — a backend count over a
- window the loaded rows never model, so nothing on the grid can
- restate it. It rides the meta line beside the row count. */}
+ no events must still be swappable for another one. */}
<GridViewPicker
views={chrome.views}
label="events"
- total={`${chrome.shownCount} of ${events.length} loaded · ${stats?.total || 0} in the last 24h`}
onCreate={chrome.createView}
- // The "..." sits on the view-name line rather than in a toolbar
- // of its own -- with nothing else to put there, that toolbar was
- // an empty bar holding one icon. And there is ONE filter button
- // on this page: the top bar's, which opens the SERVER query
- // drawer (eight keys, applied to the query, not the loaded 50).
- actions={<GridToolsMenu {...chrome.toolsProps} onRefresh={() => fetchEvents(1, true)} />}
/>
<GridChips {...chrome.chipProps} />
diff --git a/frontend/src/styles/components/_datagrid.scss b/frontend/src/styles/components/_datagrid.scss
index 76f6a8e4..3d5e39b5 100644
--- a/frontend/src/styles/components/_datagrid.scss
+++ b/frontend/src/styles/components/_datagrid.scss
@@ -50,17 +50,9 @@
gap: 14px;
margin-bottom: 14px;
- &__count {
- font-family: var(--mono);
- font-size: 11.5px;
- color: var(--text-ghost);
- padding-top: 3px;
- white-space: nowrap;
- }
-
- // The table's own controls (filter, "⋮") sit on the SAME line as the view
- // name. They used to go in a ListToolbar underneath, which on a page with
- // nothing else to put there rendered a 32px-tall empty bar holding two
+ // The table's own chrome (search, filter, "⋮") sits on the SAME line as the
+ // view name. It used to go in a ListToolbar underneath, which on a page
+ // with nothing else to put there rendered a 32px-tall empty bar holding two
// right-aligned icons — one row of chrome pretending to be two.
&__actions {
display: flex;