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.

refactor(list): heading view picker on Monitors, Jobs and Telemetry; KPI bands out

Juan Denis6dfe9d61ee3b
diff --git a/frontend/src/pages/Jobs.jsx b/frontend/src/pages/Jobs.jsx
index 3be83839..fb74714c 100644
--- a/frontend/src/pages/Jobs.jsx
+++ b/frontend/src/pages/Jobs.jsx
@@ -7,23 +7,26 @@
// in-page SegControl rather than its own tab strip, because the group's bar
// already owns the tab row and a nav under a nav reads as two headers.
//
-// Activity shows clickable compact KPIs, a DataTable of runs, and server-side
-// pagination over a job store that can hold six figures of scheduler-tick rows.
+// Activity shows a view bar, a DataTable of runs, and server-side pagination
+// over a job store that can hold six figures of scheduler-tick rows.
// Wired to the real ApiService job methods (see frontend/src/services/api/jobs.js).
-import { useState, useEffect, useCallback, useRef } from 'react';
+import { useState, useEffect, useCallback, useMemo, useRef } from 'react';
import { useLocation, useNavigate } from 'react-router-dom';
import { ListChecks, RefreshCw, RotateCcw, XCircle, Play, Clock } from 'lucide-react';
import api from '../services/api';
import {
- MetricCard, KpiBand, Pill, DataTable, DataTableFooter, SegControl,
- SearchField, FilterDrawer, FilterButton, ViewMenu, countActiveFilters,
+ Pill, DataTable, DataTableFooter, SegControl, ListToolbar,
+ SearchField, FilterDrawer, FilterButton, countActiveFilters,
} from '@/components/ds';
+import {
+ useTableChrome, GridViewPicker, GridChips, GridFilterButton,
+ GridToolsMenu, GridFilterDrawer,
+} from '@/components/ds/grid';
import { Button } from '@/components/ui/button';
import EmptyState from '../components/EmptyState';
import { useTopbarActions } from '@/hooks/useTopbarActions';
import { useTableSort } from '@/hooks/useTableSort';
import { useColumnVisibility } from '@/hooks/useColumnVisibility';
-import { useTableViews } from '@/hooks/useTableViews';
import { useAuth } from '../contexts/AuthContext';
import { useToast } from '../contexts/ToastContext';
import { timeAgo } from '../utils/timeAgo';
@@ -34,51 +37,100 @@ const STATUSES = ['all', 'queued', 'running', 'succeeded', 'failed', 'cancelled'
const PAGE_SIZE = 50;
const POLL_MS = 5000;
-// Built-in saved views. State shape: { filters, sorts, hiddenKeys } — `filters`
-// is the FilterDrawer's value (status/kind, '' = all), `sorts` use real column
-// keys. A Scheduled/Activity view is NOT expressible here: that switch lives in
+// Built-in saved views, in the shared envelope (see ds/grid/viewState.js):
+// { sorts, hiddenKeys, columnOrder, groupBy, columnFilters, page }.
+//
+// Two filter systems live on this page and they are NOT the same tool:
+//
+// page.serverFilters — the FilterDrawer's {status, kind} query pair ('' =
+// all), sent to GET /jobs. Narrows the whole TABLE before pagination.
+// columnFilters — the chrome's client-side {match, rules} column rules.
+// Narrows the PAGE_SIZE rows already on screen.
+//
+// They shared the name `filters` until plan 69, which is exactly how a preset
+// could blank both server filters while filtering nothing. `serverFilters` is
+// namespaced inside `page` now; useTableChrome's `rename` keeps views users
+// saved under the old top-level `filters` working.
+//
+// A Scheduled/Activity view is still NOT expressible here: that switch lives in
// the URL-driven SegControl, and the drawer's kind options come from the API.
-// `filters` here is this page's SERVER-side query pair {status, kind} ('' = all)
-// — not the per-column {match, rules} object. Writing rule objects into it would
-// blank both server filters and filter nothing.
+//
+// Every preset spells out BOTH filter sets even when empty. An absent key does
+// reset to empty, but capture() always emits both — so a preset that omits one
+// reads as permanently "Unsaved" the instant you pick it.
+const STATUS_RULE = (...value) => ({ match: 'all', rules: [{ id: 'st', field: 'status', op: 'any', value }] });
+const NO_RULES = { match: 'all', rules: [] };
+const ALL_JOBS = { status: '', kind: '' };
+
const BUILTIN_VIEWS = [
- { name: 'Failed', state: { filters: { status: 'failed', kind: '' } } },
- { name: 'Newest first', state: { sorts: [{ key: 'when', direction: 'desc' }] } },
+ {
+ name: 'Failed',
+ state: {
+ sorts: [], hiddenKeys: [], columnFilters: NO_RULES,
+ page: { serverFilters: { status: 'failed', kind: '' } },
+ },
+ },
+ {
+ name: 'Newest first',
+ state: {
+ sorts: [{ key: 'when', direction: 'desc' }], hiddenKeys: [], columnFilters: NO_RULES,
+ page: { serverFilters: ALL_JOBS },
+ },
+ },
+ {
+ // The retired "Running" KPI tile. This one is a COLUMN rule rather than
+ // a server filter: it composes with whatever kind is already selected,
+ // which is what the tile did on top of the drawer's kind. The cost is
+ // that it narrows the loaded page, not the table — see the caveat above
+ // the Status column.
+ name: 'Running',
+ state: {
+ sorts: [{ key: 'when', direction: 'desc' }], hiddenKeys: [],
+ columnFilters: STATUS_RULE('running'),
+ page: { serverFilters: ALL_JOBS },
+ },
+ },
{
// Started and never finished — oldest first, because the one that has
// been "running" longest is the one that is actually wedged.
name: 'Stuck in flight',
state: {
- filters: { status: 'running', kind: '' }, hiddenKeys: [],
- sorts: [{ key: 'when', direction: 'asc' }],
+ sorts: [{ key: 'when', direction: 'asc' }], hiddenKeys: [], columnFilters: NO_RULES,
+ page: { serverFilters: { status: 'running', kind: '' } },
},
},
{
+ // Queued work. The stored value is `pending` (Job.STATUS_PENDING) — the
+ // retired KPI tile read `by_status.pending` but its click sent
+ // `'queued'`, so the tile counted one bucket and filtered another. This
+ // view is the server-side one and it has always been right; nothing
+ // client-side is added on top of it.
name: 'Backlog',
state: {
- filters: { status: 'pending', kind: '' }, hiddenKeys: ['progress'],
- sorts: [{ key: 'when', direction: 'asc' }],
+ sorts: [{ key: 'when', direction: 'asc' }], hiddenKeys: ['progress'], columnFilters: NO_RULES,
+ page: { serverFilters: { status: 'pending', kind: '' } },
},
},
{
name: 'Failures by kind',
state: {
- filters: { status: 'failed', kind: '' }, hiddenKeys: ['owner'],
sorts: [{ key: 'kind', direction: 'asc' }, { key: 'when', direction: 'desc' }],
+ hiddenKeys: ['owner'], columnFilters: NO_RULES,
+ page: { serverFilters: { status: 'failed', kind: '' } },
},
},
{
name: 'Backup runs',
state: {
- filters: { status: '', kind: 'backup.policy.run' }, hiddenKeys: ['kind'],
- sorts: [{ key: 'when', direction: 'desc' }],
+ sorts: [{ key: 'when', direction: 'desc' }], hiddenKeys: ['kind'], columnFilters: NO_RULES,
+ page: { serverFilters: { status: '', kind: 'backup.policy.run' } },
},
},
{
name: 'App deploys',
state: {
- filters: { status: '', kind: 'deploy.app' }, hiddenKeys: ['kind', 'owner'],
- sorts: [{ key: 'when', direction: 'desc' }],
+ sorts: [{ key: 'when', direction: 'desc' }], hiddenKeys: ['kind', 'owner'], columnFilters: NO_RULES,
+ page: { serverFilters: { status: '', kind: 'deploy.app' } },
},
},
];
@@ -155,32 +207,20 @@ export default function Jobs() {
storageKey: 'serverkit-table-jobs-scheduled-cols',
});
- // Saved views: capture the FilterDrawer value plus the activity table's
- // sort/column state — never the server-side page/offset.
- const captureViewState = useCallback(() => ({
- filters,
- sorts: activitySorts,
- hiddenKeys: activityHidden,
- }), [filters, activitySorts, activityHidden]);
- const applyViewState = useCallback((state) => {
- if (state.filters !== undefined) {
- setFilters({ status: '', kind: '', ...state.filters });
+ // The page-private half of a saved view. Everything else the chrome
+ // captures (sorts, hidden columns, column order, column rules) is common to
+ // every list page and lives in the envelope, not here. The server-side
+ // page/offset is deliberately NOT captured — a view is a query, not a
+ // scroll position.
+ const viewPageState = useMemo(() => ({ serverFilters: filters }), [filters]);
+ const applyViewPageState = useCallback((saved) => {
+ if (saved.serverFilters !== undefined) {
+ setFilters({ status: '', kind: '', ...saved.serverFilters });
+ // A different query means a different result set; staying on page 4
+ // of the old one would land on an empty table.
setPage(0);
}
- if (Array.isArray(state.sorts)) setActivitySorts(state.sorts);
- if (Array.isArray(state.hiddenKeys)) setActivityHidden(state.hiddenKeys);
- }, [setActivitySorts, setActivityHidden]);
- const tableViews = useTableViews({
- page: 'jobs',
- builtinViews: BUILTIN_VIEWS,
- capture: captureViewState,
- apply: applyViewState,
- });
- // Stable primitive for the topbar publish deps: re-publish the ViewMenu
- // node when the user's views or the active view change.
- const activeViewKey = tableViews.activeView
- ? `${tableViews.activeView.builtin ? 'builtin' : 'user'}:${tableViews.activeView.name}`
- : '';
+ }, []);
const load = useCallback(async () => {
try {
@@ -219,8 +259,6 @@ export default function Jobs() {
return () => clearInterval(pollRef.current);
}, [isAdmin, load]);
- // KPI tiles are quick status filters; the drawer owns the full set.
- const setStatusQuick = (value) => { setFilters((f) => ({ ...f, status: value })); setPage(0); };
const onFiltersChange = (next) => { setFilters(next); setPage(0); };
const onSearch = (value) => { setQ(value.trim()); setPage(0); };
const resetFilters = () => { setFilters({ status: '', kind: '' }); setQ(''); setPage(0); };
@@ -228,14 +266,15 @@ export default function Jobs() {
// Search + advanced-filter trigger + Refresh sit in the shared page top bar
// (the Marketplace/Domains pattern). Search/filters only apply to the
- // Activity tab; the Scheduled tab just gets Refresh.
+ // Activity tab; the Scheduled tab just gets Refresh. The view picker is NOT
+ // here any more — it is the Activity table's own heading, because it
+ // describes that table and nothing else on the page.
useTopbarActions(() => {
if (!isAdmin) return null;
return (
<>
{!scheduledView && (
<>
- <ViewMenu views={tableViews} />
<SearchField value={q} onSearch={onSearch} placeholder="Search by kind or owner…" />
<FilterButton count={activeFilterCount} onClick={() => setFiltersOpen(true)} />
</>
@@ -245,7 +284,7 @@ export default function Jobs() {
</Button>
</>
);
- }, [isAdmin, scheduledView, q, activeFilterCount, load, tableViews.userViews, activeViewKey]);
+ }, [isAdmin, scheduledView, q, activeFilterCount, load]);
const onRetry = async (id) => {
try { await api.retryJob(id); toast.success('Job re-queued'); load(); }
@@ -264,39 +303,26 @@ export default function Jobs() {
catch { toast.error('Update failed'); }
};
- if (!isAdmin) {
- return (
- <div className="sk-tabgroup__inner jobs-page">
- <div className="sk-jobs"><EmptyState title="Admins only." /></div>
- </div>
- );
- }
-
- const byStatus = stats?.by_status || {};
- const hasFilters = Boolean(filters.status || filters.kind || q);
- const totalPages = Math.max(1, Math.ceil(total / PAGE_SIZE));
-
- const kindOptions = kinds
- .map((k) => (typeof k === 'string' ? k : k.kind || k.name))
- .filter(Boolean);
-
- const filterGroups = [
+ // Declared above the admin gate because useTableChrome is a hook and the
+ // gate returns early — the column list is what it infers filter types from.
+ const jobColumns = [
{
key: 'status',
- label: 'Status',
- type: 'single',
- options: STATUSES.filter((s) => s !== 'all').map((s) => ({ value: s, label: titleCase(s) })),
- },
- {
- key: 'kind',
- label: 'Kind',
- type: 'single',
- options: kindOptions.map((k) => ({ value: k, label: k })),
+ header: 'Status',
+ sortable: true,
+ // Typed explicitly rather than left to inference. There is no
+ // `value`/`sortValue` here, so a rule reads `row.status` — the DB
+ // string — which is what the presets commit to. Inference would
+ // agree on a full page but downgrade a 2-row page to free text,
+ // and then the Status column menu would lose its pick-list.
+ //
+ // ⚠ A column rule filters the PAGE_SIZE rows the grid holds, not
+ // the table: the job store is paginated server-side. Where a status
+ // is worth a whole-table answer (Failed, Backlog) the built-in view
+ // sends it to the API instead — see BUILTIN_VIEWS.
+ type: 'enum',
+ render: (j) => <Pill kind={statusKind(j.status)}>{j.status}</Pill>,
},
- ];
-
- const jobColumns = [
- { key: 'status', header: 'Status', sortable: true, render: (j) => <Pill kind={statusKind(j.status)}>{j.status}</Pill> },
{ key: 'kind', header: 'Kind', sortable: true, cellClassName: 'sk-jobs__kind', render: (j) => j.kind || '—' },
{ key: 'owner', header: 'Owner', sortable: true, sortValue: (j) => j.owner_type || null, cellClassName: 'sk-jobs__owner', render: ownerLabel },
{
@@ -344,6 +370,60 @@ export default function Jobs() {
},
];
+ // Shared list chrome for the ACTIVITY table only — the saved views describe
+ // its sorts, its columns and this page's server query, none of which the
+ // Scheduled table has. `rename` keeps views saved before the envelope, whose
+ // server query sat at the top level as `filters`, pointing at the right key.
+ const chrome = useTableChrome({
+ columns: jobColumns,
+ rows: jobs,
+ viewPageKey: 'jobs',
+ builtinViews: BUILTIN_VIEWS,
+ noun: 'jobs',
+ sorts: activitySorts,
+ setSorts: setActivitySorts,
+ hiddenKeys: activityHidden,
+ setHiddenKeys: setActivityHidden,
+ pageState: viewPageState,
+ applyPage: applyViewPageState,
+ rename: { filters: 'serverFilters' },
+ });
+
+ if (!isAdmin) {
+ return (
+ <div className="sk-tabgroup__inner jobs-page">
+ <div className="sk-jobs"><EmptyState title="Admins only." /></div>
+ </div>
+ );
+ }
+
+ 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))
+ .filter(Boolean);
+
+ const filterGroups = [
+ {
+ key: 'status',
+ label: 'Status',
+ type: 'single',
+ options: STATUSES.filter((s) => s !== 'all').map((s) => ({ value: s, label: titleCase(s) })),
+ },
+ {
+ key: 'kind',
+ label: 'Kind',
+ type: 'single',
+ options: kindOptions.map((k) => ({ value: k, label: k })),
+ },
+ ];
+
const scheduledColumns = [
{ key: 'name', header: 'Name', sortable: true, sortValue: (s) => s.name || s.kind || null, render: (s) => s.name || s.kind || `#${s.id}` },
{ key: 'kind', header: 'Kind', sortable: true, cellClassName: 'sk-jobs__kind', render: (s) => s.kind || '—' },
@@ -398,17 +478,48 @@ export default function Jobs() {
/>
) : (
<>
- <KpiBand>
- <MetricCard label="Total" value={stats?.total ?? total ?? 0} tone="accent" compact
- onClick={() => setStatusQuick('')} />
- <MetricCard label="Running" value={byStatus.running ?? 0} tone="cyan" compact
- onClick={() => setStatusQuick('running')} />
- <MetricCard label="Queued" value={byStatus.pending ?? byStatus.queued ?? 0} tone="amber" compact
- onClick={() => setStatusQuick('queued')} />
- <MetricCard label="Failed" value={byStatus.failed ?? 0} tone="red" compact
- onClick={() => setStatusQuick('failed')} />
- </KpiBand>
+ {/* 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. */}
+ <GridViewPicker
+ views={chrome.views}
+ label="jobs"
+ total={hasFilters
+ ? `${jobs.length} of ${total} matching · ${allJobs} jobs total`
+ : `${jobs.length} 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>
+ </>
+ )}
+ tools={(
+ <>
+ <GridFilterButton
+ count={chrome.filterCount}
+ onClick={() => chrome.setDrawerOpen(true)}
+ />
+ <GridToolsMenu {...chrome.toolsProps} onRefresh={load} />
+ </>
+ )}
+ />
+
+ <GridChips {...chrome.chipProps} />
+ {/* Clears the SERVER query (status/kind/search). The
+ column rules have their own Clear on the chip bar —
+ two filter systems, two resets. */}
{hasFilters && (
<div className="sk-jobs__resultbar">
<Button variant="ghost" size="sm" onClick={resetFilters}>
@@ -418,12 +529,12 @@ export default function Jobs() {
)}
<DataTable
- columns={jobColumns}
+ columns={chrome.columns}
data={jobs}
keyField="id"
sorts={activitySorts}
onSortsChange={setActivitySorts}
- hiddenKeys={activityHidden}
+ {...chrome.tableProps}
loading={loading && jobs.length === 0}
footer={(
<DataTableFooter
@@ -450,6 +561,11 @@ export default function Jobs() {
onChange={onFiltersChange}
title="Filter jobs"
/>
+
+ {/* The column-rule drawer. Distinct from the FilterDrawer above it:
+ that one rewrites the API query, this one narrows the rows the
+ query already returned. */}
+ <GridFilterDrawer {...chrome.drawerProps} />
</div>
);
}
diff --git a/frontend/src/pages/Monitors.jsx b/frontend/src/pages/Monitors.jsx
index 2ee469f1..4cebddb7 100644
--- a/frontend/src/pages/Monitors.jsx
+++ b/frontend/src/pages/Monitors.jsx
@@ -2,21 +2,29 @@
//
// Tab-group page (the Domains/Cron/Jobs pattern): the group's shared PageTopbar
// carries SearchField + FilterDrawer + Refresh + "Add monitor" via
-// useTopbarActions, so there is no second header inside the page. Clickable KPI
-// tiles are the quick status filter; the drawer owns type + status together.
+// useTopbarActions, so there is no second header inside the page.
+//
+// Two filter surfaces live here and they are NOT the same tool: the DS
+// FilterDrawer narrows the QUERY sent to /monitors (status + type, so it sees
+// rows this client never loaded), while the grid chrome's column rules narrow
+// the rows already on screen. A saved view carries both — the server pair under
+// `page.serverFilters`, the rules under `columnFilters`.
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
import { useNavigate } from 'react-router-dom';
import {
- Activity, AlertTriangle, ChevronRight, Globe, Pause, Play, Plus, Radar,
- RefreshCw, ShieldAlert, Zap,
+ ChevronRight, Globe, Pause, Play, Plus, Radar, RefreshCw,
} from 'lucide-react';
import api from '../services/api';
import { useToast } from '../contexts/ToastContext';
import EmptyState from '../components/EmptyState';
import {
- DataTable, DataTableFooter, Drawer, FilterButton, FilterDrawer, KpiBand,
- MetricCard, Pill, SearchField, Sparkline, ViewMenu, countActiveFilters,
+ DataTable, DataTableFooter, Drawer, FilterButton, FilterDrawer, ListToolbar,
+ Pill, SearchField, Sparkline, countActiveFilters,
} from '@/components/ds';
+import {
+ useTableChrome, GridViewPicker, GridChips, GridFilterButton,
+ GridToolsMenu, GridFilterDrawer,
+} from '@/components/ds/grid';
import { Button } from '@/components/ui/button';
import { Input } from '@/components/ui/input';
import { Label } from '@/components/ui/label';
@@ -24,7 +32,6 @@ import { Switch } from '@/components/ui/switch';
import { useTopbarActions } from '@/hooks/useTopbarActions';
import { useTableSort } from '@/hooks/useTableSort';
import { useColumnVisibility } from '@/hooks/useColumnVisibility';
-import { useTableViews } from '@/hooks/useTableViews';
import useFocusParam from '@/hooks/useFocusParam';
import { CHECK_TYPES, MONITOR_STATUS, monitorStateOf } from '../components/monitoring/monitorShared';
@@ -80,20 +87,68 @@ function formatUptime(value) {
return `${Number(value).toFixed(2)}%`;
}
-// Built-in saved views. State shape: { search, filters, sorts, hiddenKeys } —
-// `filters` values are the FilterDrawer's real group options (status values
-// from MONITOR_STATUS), `sorts` use real column keys.
+// Built-in saved views, in the shared envelope (see ds/grid/viewState.js).
+//
+// `columnFilters` are CLIENT-side rules over the rows on screen; the page's own
+// SERVER-side query pair lives in `page.serverFilters`. Both used to be called
+// `filters`, which is precisely why they cross-wired — a preset that meant
+// "ask the API for major_outage" was read as a column rule and matched nothing.
+//
+// A status rule filters on the Status column's `value`, which is the LABEL
+// monitorStateOf() renders ('Operational'), never the API code ('operational').
+const STATE = (...value) => ({ match: 'all', rules: [{ id: 'st', field: 'status', op: 'any', value }] });
+const NO_RULES = { match: 'all', rules: [] };
+// The FilterDrawer's query pair at rest — a view that sets no server filter has
+// to say so, or it inherits whatever the previous view asked the API for.
+const NO_QUERY = { status: '', type: '' };
+
const BUILTIN_VIEWS = [
- { name: 'Down', state: { search: '', filters: { status: 'major_outage', type: '' }, sorts: [], hiddenKeys: [] } },
- { name: 'Degraded', state: { search: '', filters: { status: 'degraded', type: '' }, sorts: [], hiddenKeys: [] } },
- { name: 'Slowest', state: { search: '', filters: { status: '', type: '' }, sorts: [{ key: 'response', direction: 'desc' }], hiddenKeys: [] } },
+ {
+ // Was the "Operational" KPI tile: everything answering normally, i.e.
+ // the "nothing to do here" check rather than a worklist.
+ name: 'Operational',
+ state: {
+ sorts: [], hiddenKeys: [], columnFilters: STATE('Operational'),
+ page: { search: '', serverFilters: NO_QUERY },
+ },
+ },
+ {
+ // Was the "Degraded" KPI tile. That tile counted degraded +
+ // partial_outage and monitorStateOf() labels BOTH 'Degraded', so this
+ // one label rule reproduces the tile's union exactly — which the
+ // previous server-side `status: 'degraded'` preset did not, it silently
+ // dropped every partial_outage.
+ name: 'Degraded',
+ state: {
+ sorts: [], hiddenKeys: [], columnFilters: STATE('Degraded'),
+ page: { search: '', serverFilters: NO_QUERY },
+ },
+ },
+ {
+ // Stays SERVER-side: major_outage is asked of the API, so this view is
+ // not limited to the rows the current query happened to return. It is
+ // also what the "Down" tile pointed at — there is exactly one of these.
+ name: 'Down',
+ state: {
+ sorts: [], hiddenKeys: [], columnFilters: NO_RULES,
+ page: { search: '', serverFilters: { status: 'major_outage', type: '' } },
+ },
+ },
+ {
+ name: 'Slowest',
+ state: {
+ sorts: [{ key: 'response', direction: 'desc' }], hiddenKeys: [], columnFilters: NO_RULES,
+ page: { search: '', serverFilters: NO_QUERY },
+ },
+ },
{
// Least reliable over the month, slowest first among ties — the review
// list, as opposed to "what is broken right now".
name: 'Worst uptime (30d)',
state: {
- search: '', filters: { status: '', type: '' }, hiddenKeys: ['next_check_at'],
+ hiddenKeys: ['next_check_at'], columnFilters: NO_RULES,
sorts: [{ key: 'uptime_30d', direction: 'asc' }, { key: 'response', direction: 'desc' }],
+ page: { search: '', serverFilters: NO_QUERY },
},
},
{
@@ -101,23 +156,25 @@ const BUILTIN_VIEWS = [
// been silent for longer than anybody intended.
name: 'Paused — still silenced',
state: {
- search: '', filters: { status: 'paused', type: '' },
- hiddenKeys: ['last_check_at', 'next_check_at'],
+ hiddenKeys: ['last_check_at', 'next_check_at'], columnFilters: NO_RULES,
sorts: [{ key: 'name', direction: 'asc' }],
+ page: { search: '', serverFilters: { status: 'paused', type: '' } },
},
},
{
name: 'Slow web checks',
state: {
- search: '', filters: { status: '', type: 'http' }, hiddenKeys: ['check_type'],
+ hiddenKeys: ['check_type'], columnFilters: NO_RULES,
sorts: [{ key: 'response', direction: 'desc' }],
+ page: { search: '', serverFilters: { status: '', type: 'http' } },
},
},
{
name: 'In maintenance',
state: {
- search: '', filters: { status: 'maintenance', type: '' }, hiddenKeys: ['next_check_at'],
+ hiddenKeys: ['next_check_at'], columnFilters: NO_RULES,
sorts: [{ key: 'name', direction: 'asc' }],
+ page: { search: '', serverFilters: { status: 'maintenance', type: '' } },
},
},
];
@@ -167,34 +224,20 @@ export default function Monitors() {
}, []);
const activeFilterCount = countActiveFilters(filters);
- const setStatusQuick = (value) => setFilters((f) => ({ ...f, status: f.status === value ? '' : value }));
// Table sort + column visibility, controlled so saved views can drive them.
// Same storage keys DataTable used internally, so existing choices survive.
const { sorts, setSorts } = useTableSort({ storageKey: 'serverkit-table-monitors-sort' });
const { hiddenKeys, setHiddenKeys } = useColumnVisibility({ storageKey: 'serverkit-table-monitors-cols' });
- // Saved views: capture/apply adapt the hook to this page's table state.
- const captureViewState = useCallback(() => ({
- search: q, filters, sorts, hiddenKeys,
- }), [q, filters, sorts, hiddenKeys]);
- const applyViewState = useCallback((state) => {
- if (state.search !== undefined) setQ(state.search);
- if (state.filters !== undefined) setFilters((f) => ({ ...f, ...state.filters }));
- if (Array.isArray(state.sorts)) setSorts(state.sorts);
- if (Array.isArray(state.hiddenKeys)) setHiddenKeys(state.hiddenKeys);
- }, [setSorts, setHiddenKeys]);
- const tableViews = useTableViews({
- page: 'monitors',
- builtinViews: BUILTIN_VIEWS,
- capture: captureViewState,
- apply: applyViewState,
- });
- // Stable dep for the topbar publish below — the views object itself is
- // rebuilt every render, so depending on it would re-publish in a loop.
- const activeViewKey = tableViews.activeView
- ? `${tableViews.activeView.builtin ? 'builtin' : 'user'}:${tableViews.activeView.id ?? tableViews.activeView.name}`
- : null;
+ // The page-private half of a saved view. `serverFilters` is deliberately
+ // not called `filters`: in the envelope that name always means the column
+ // rules, and this pair is the query the API is asked for instead.
+ const viewPageState = useMemo(() => ({ search: q, serverFilters: filters }), [q, filters]);
+ const applyViewPageState = useCallback((saved) => {
+ if (saved.search !== undefined) setQ(saved.search);
+ if (saved.serverFilters !== undefined) setFilters((f) => ({ ...f, ...saved.serverFilters }));
+ }, []);
const openCreate = () => { setForm(emptyForm); setFormOpen(true); };
// Quick-create deep link: /monitoring/monitors?focus=create:monitor opens the form.
@@ -203,7 +246,6 @@ export default function Monitors() {
useTopbarActions(() => (
<>
<SearchField value={q} onSearch={(value) => setQ(value.trim())} placeholder="Search monitors or targets…" />
- <ViewMenu views={tableViews} />
<FilterButton count={activeFilterCount} onClick={() => setFiltersOpen(true)} />
<Button variant="outline" size="sm" onClick={load}>
<RefreshCw size={14} /> Refresh
@@ -212,7 +254,7 @@ export default function Monitors() {
<Plus size={14} /> Add monitor
</Button>
</>
- ), [q, activeFilterCount, load, captureViewState, tableViews.userViews, activeViewKey]);
+ ), [q, activeFilterCount, load]);
const onSave = async (e) => {
e.preventDefault();
@@ -300,6 +342,14 @@ export default function Monitors() {
key: 'status',
header: 'Status',
sortable: true,
+ type: 'enum',
+ // Pinned rather than left to the sortValue fallback: the column
+ // menu, the presets and the chips all read `value`, and it has to
+ // be the LABEL the pill shows — a rule written against the API code
+ // ('operational') would quietly match nothing. The label also folds
+ // degraded + partial_outage into one bucket, which is what the
+ // reader sees and therefore what a filter should mean.
+ value: (m) => monitorStateOf(m).label,
sortValue: (m) => monitorStateOf(m).label,
render: (m) => {
const state = monitorStateOf(m);
@@ -377,33 +427,62 @@ export default function Monitors() {
},
];
+ // Shared list chrome: view picker + filter chips + column-rule drawer +
+ // tools, driven off this page's own sorts/hiddenKeys state.
+ const chrome = useTableChrome({
+ columns,
+ rows: monitors,
+ viewPageKey: 'monitors',
+ builtinViews: BUILTIN_VIEWS,
+ noun: 'monitors',
+ sorts,
+ setSorts,
+ hiddenKeys,
+ setHiddenKeys,
+ pageState: viewPageState,
+ applyPage: applyViewPageState,
+ // Views saved before the envelope existed kept the server-side query at
+ // the top level under `filters`; that name now belongs to the column
+ // rules, so those views are read into the page bag instead of being
+ // mistaken for rules and dropped.
+ rename: { filters: 'serverFilters' },
+ });
+
const hasFilters = Boolean(q || filters.status || filters.type);
const isHttpish = ['http', 'keyword'].includes(form.check_type);
return (
<div className="sk-tabgroup__inner monitors-page">
- <KpiBand>
- <MetricCard
- label="Operational" value={stats?.operational ?? 0} tone="green" compact
- icon={<Activity size={17} />}
- onClick={() => setStatusQuick('operational')}
- />
- <MetricCard
- label="Degraded" value={stats?.degraded ?? 0} tone="amber" compact
- icon={<AlertTriangle size={17} />}
- onClick={() => setStatusQuick('degraded')}
- />
- <MetricCard
- label="Down" value={stats?.down ?? 0} tone="red" compact
- icon={<ShieldAlert size={17} />}
- onClick={() => setStatusQuick('major_outage')}
- />
- <MetricCard
- label="Uptime (30d)"
- value={stats?.overall_uptime_30d != null ? `${stats.overall_uptime_30d}%` : '—'}
- tone="accent" icon={<Zap size={17} />}
- />
- </KpiBand>
+ {/* 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. */}
+ <GridViewPicker
+ views={chrome.views}
+ label="monitors"
+ total={(
+ <>
+ {monitors.length} monitor{monitors.length === 1 ? '' : 's'}
+ {stats?.overall_uptime_30d != null && (
+ <> &middot; {stats.overall_uptime_30d}% uptime (30d)</>
+ )}
+ </>
+ )}
+ onCreate={chrome.createView}
+ />
+ <ListToolbar
+ tools={(
+ <>
+ <GridFilterButton
+ count={chrome.filterCount}
+ onClick={() => chrome.setDrawerOpen(true)}
+ />
+ <GridToolsMenu {...chrome.toolsProps} onRefresh={load} />
+ </>
+ )}
+ />
+
+ <GridChips {...chrome.chipProps} />
{loading && monitors.length === 0 ? (
<EmptyState loading loadingVariant="table" title="Loading monitors" />
@@ -425,10 +504,10 @@ export default function Monitors() {
storageKey="serverkit-table-monitors"
data={monitors}
keyField="id"
- columns={columns}
+ columns={chrome.columns}
sorts={sorts}
onSortsChange={setSorts}
- hiddenKeys={hiddenKeys}
+ {...chrome.tableProps}
onRowClick={(m) => navigate(`/monitoring/monitors/${m.id}`)}
rowClassName={(m) => (m.is_paused ? 'is-disabled' : undefined)}
footer={<DataTableFooter shown={monitors.length} total={monitors.length} noun="monitor" />}
@@ -436,6 +515,9 @@ export default function Monitors() {
</div>
)}
+ {/* The SERVER-side pair: this one changes what /monitors is asked
+ for, so it reaches monitors the client never loaded. Kept
+ alongside the column-rule drawer below, not replaced by it. */}
<FilterDrawer
open={filtersOpen}
onOpenChange={setFiltersOpen}
@@ -445,6 +527,8 @@ export default function Monitors() {
title="Filter monitors"
/>
+ <GridFilterDrawer {...chrome.drawerProps} />
+
<Drawer
open={formOpen}
onOpenChange={setFormOpen}
diff --git a/frontend/src/pages/Telemetry.jsx b/frontend/src/pages/Telemetry.jsx
index 87b55231..390801d0 100644
--- a/frontend/src/pages/Telemetry.jsx
+++ b/frontend/src/pages/Telemetry.jsx
@@ -10,16 +10,26 @@
//
// Every capability it had is kept: source / type / severity / resource / date
// filters, correlation drill-down, test-event emit, cleanup, and pagination.
+//
+// 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.
import { useCallback, useEffect, useMemo, useState } from 'react';
import {
- Activity, AlertTriangle, ChevronRight, Info, Loader2, RefreshCw, Trash2,
- XCircle,
+ Activity, ChevronRight, Info, Loader2, RefreshCw, Trash2,
} from 'lucide-react';
import api from '../services/api';
import {
- DataTable, DataTableFooter, Drawer, FilterButton, FilterDrawer, KpiBand,
- MetricCard, Pill, SearchField, ViewMenu, countActiveFilters,
+ DataTable, DataTableFooter, Drawer, FilterButton, FilterDrawer, ListToolbar,
+ Pill, SearchField, countActiveFilters,
} from '@/components/ds';
+import {
+ useTableChrome, GridViewPicker, GridChips, GridFilterButton,
+ GridToolsMenu, GridFilterDrawer,
+} from '@/components/ds/grid';
import { Button } from '@/components/ui/button';
import { Input } from '@/components/ui/input';
import { Label } from '@/components/ui/label';
@@ -27,23 +37,22 @@ import { useTopbarActions } from '@/hooks/useTopbarActions';
import { useConfirm } from '@/hooks/useConfirm';
import { useTableSort } from '@/hooks/useTableSort';
import { useColumnVisibility } from '@/hooks/useColumnVisibility';
-import { useTableViews } from '@/hooks/useTableViews';
import { useAuth } from '../contexts/AuthContext';
import { useToast } from '../contexts/ToastContext';
import EmptyState from '../components/EmptyState';
const SEVERITY_ORDER = ['critical', 'error', 'warning', 'info', 'debug'];
-// `tone` is a MetricCard tone (accent|green|cyan|amber|red|violet) and `pill` is
-// a Pill kind (green|amber|red|cyan|violet|gray). They overlap but are not the
-// same set — passing one token to both silently drops the Pill's background for
-// values Pill doesn't know, which is what "accent" for info was doing.
+// `pill` is a Pill kind (green|amber|red|cyan|violet|gray) — only tokens Pill
+// knows, or the badge silently renders without its background. `label` is the
+// one spelling of a severity the whole page uses: the pill, the filter drawer's
+// option list and the built-in view names all read from here.
const SEVERITY_CONFIG = {
- critical: { icon: XCircle, tone: 'red', pill: 'red', label: 'Critical' },
- error: { icon: XCircle, tone: 'red', pill: 'red', label: 'Error' },
- warning: { icon: AlertTriangle, tone: 'amber', pill: 'amber', label: 'Warning' },
- info: { icon: Info, tone: 'cyan', pill: 'cyan', label: 'Info' },
- debug: { icon: Activity, tone: 'violet', pill: 'gray', label: 'Debug' },
+ critical: { pill: 'red', label: 'Critical' },
+ error: { pill: 'red', label: 'Error' },
+ warning: { pill: 'amber', label: 'Warning' },
+ info: { pill: 'cyan', label: 'Info' },
+ debug: { pill: 'gray', label: 'Debug' },
};
const PAGE_SIZE = 50;
@@ -59,38 +68,43 @@ const EMPTY_FILTERS = {
end_date: '',
};
-// Built-in saved views. State shape: { filters, sorts, hiddenKeys } —
-// `filters` is the FilterDrawer's value (merged over EMPTY_FILTERS on apply),
-// `sorts` use real column keys.
-// `filters` here is this page's SERVER-side query object (EMPTY_FILTERS shape:
-// source / event_type / severity / resource_type / …), sent straight to the API
-// — not the per-column {match, rules} object.
+// Built-in saved views, in the shared envelope (see ds/grid/viewState.js).
+//
+// `page.serverFilters` is this page's SERVER-side query object (EMPTY_FILTERS
+// shape: source / event_type / severity / resource_type / …), merged over
+// EMPTY_FILTERS and sent straight to the API. It is deliberately NOT
+// `columnFilters`: those are client-side column rules, which can only narrow
+// the one page of rows already loaded, while this narrows the query. That is
+// why the retired severity tiles became these presets and not column rules.
+//
+// It used to live at the TOP level of the state under the name `filters`, which
+// is the envelope's word for column rules — the collision this rename fixes.
+// Views users already saved keep working via `rename` on useTableChrome.
+const NO_RULES = { match: 'all', rules: [] };
+const NEWEST_FIRST = [{ key: 'timestamp', direction: 'desc' }];
+
+// One preset describes a COMPLETE state. `serverFilters` is spelled out even
+// when empty, so switching into a view clears the previous one's query instead
+// of silently inheriting it — same reason `columnFilters` is always explicit.
+const VIEW = (name, serverFilters, sorts = []) => ({
+ name,
+ state: { sorts, hiddenKeys: [], columnFilters: NO_RULES, page: { serverFilters } },
+});
+
+// The severity ladder is the old KPI band, in the band's own order. The three
+// that already existed keep their names verbatim — a built-in is identified by
+// name, so renaming one would orphan every shared ?view= link and anyone's
+// saved default. Info and Debug are new: their tiles had no preset before.
const BUILTIN_VIEWS = [
- { name: 'Errors', state: { filters: { severity: 'error' } } },
- { name: 'Warnings', state: { filters: { severity: 'warning' } } },
- { name: 'Newest first', state: { sorts: [{ key: 'timestamp', direction: 'desc' }] } },
- {
- name: 'Critical only',
- state: { filters: { severity: 'critical' }, sorts: [{ key: 'timestamp', direction: 'desc' }] },
- },
- {
- name: 'Deploy failures',
- state: {
- filters: { source: 'deployment', severity: 'error' },
- sorts: [{ key: 'timestamp', direction: 'desc' }],
- },
- },
- {
- name: 'Backup failures',
- state: {
- filters: { source: 'backup', severity: 'error' },
- sorts: [{ key: 'timestamp', direction: 'desc' }],
- },
- },
- {
- name: 'Audit trail',
- state: { filters: { source: 'audit' }, sorts: [{ key: 'timestamp', direction: 'desc' }] },
- },
+ VIEW('Critical only', { severity: 'critical' }, NEWEST_FIRST),
+ VIEW('Errors', { severity: 'error' }),
+ VIEW('Warnings', { severity: 'warning' }),
+ VIEW('Info', { severity: 'info' }),
+ VIEW('Debug', { severity: 'debug' }),
+ VIEW('Newest first', {}, NEWEST_FIRST),
+ VIEW('Deploy failures', { source: 'deployment', severity: 'error' }, NEWEST_FIRST),
+ VIEW('Backup failures', { source: 'backup', severity: 'error' }, NEWEST_FIRST),
+ VIEW('Audit trail', { source: 'audit' }, NEWEST_FIRST),
];
export default function Telemetry() {
@@ -115,25 +129,16 @@ export default function Telemetry() {
const { sorts, setSorts } = useTableSort({ storageKey: 'serverkit-table-telemetry-sort' });
const { hiddenKeys, setHiddenKeys } = useColumnVisibility({ storageKey: 'serverkit-table-telemetry-cols' });
- // Saved views: capture the FilterDrawer value plus sort/column state —
- // never the load-more page or the detail drawer.
- const captureViewState = useCallback(() => ({ filters, sorts, hiddenKeys }), [filters, sorts, hiddenKeys]);
- const applyViewState = useCallback((state) => {
- if (state.filters !== undefined) setFilters({ ...EMPTY_FILTERS, ...state.filters });
- if (Array.isArray(state.sorts)) setSorts(state.sorts);
- if (Array.isArray(state.hiddenKeys)) setHiddenKeys(state.hiddenKeys);
- }, [setSorts, setHiddenKeys]);
- const tableViews = useTableViews({
- page: 'telemetry',
- builtinViews: BUILTIN_VIEWS,
- capture: captureViewState,
- apply: applyViewState,
- });
- // Stable primitive for the topbar publish deps: re-publish the ViewMenu
- // node when the user's views or the active view change.
- const activeViewKey = tableViews.activeView
- ? `${tableViews.activeView.builtin ? 'builtin' : 'user'}:${tableViews.activeView.name}`
- : '';
+ // The page-private half of a saved view: the FilterDrawer's server-side
+ // query, and nothing else. The load-more page and the detail drawer are
+ // deliberately out — as is `q`, which never was captured: a view that
+ // pinned the search box would fight whatever the operator is typing.
+ const viewPageState = useMemo(() => ({ serverFilters: filters }), [filters]);
+ const applyViewPageState = useCallback((saved) => {
+ if (saved.serverFilters !== undefined) {
+ setFilters({ ...EMPTY_FILTERS, ...saved.serverFilters });
+ }
+ }, []);
const loadStats = useCallback(async () => {
try {
@@ -225,7 +230,6 @@ export default function Telemetry() {
// the way every other list page in the panel does it.
useTopbarActions(() => (
<>
- <ViewMenu views={tableViews} />
<SearchField value={q} onSearch={(value) => setQ(value.trim())} placeholder="Search messages…" />
<FilterButton count={activeFilterCount} onClick={() => setFiltersOpen(true)} />
{isAdmin && (
@@ -242,11 +246,7 @@ export default function Telemetry() {
<RefreshCw size={14} className={loading ? 'spin' : ''} /> Refresh
</Button>
</>
- ), [q, activeFilterCount, isAdmin, loading, fetchEvents, tableViews.userViews, activeViewKey]);
-
- const setSeverityQuick = (severity) => {
- setFilters((f) => ({ ...f, severity: f.severity === severity ? '' : severity }));
- };
+ ), [q, activeFilterCount, isAdmin, loading, fetchEvents]);
const filterGroups = useMemo(() => ([
{
@@ -274,10 +274,23 @@ export default function Telemetry() {
key: 'severity',
header: 'Severity',
sortable: true,
+ type: 'enum',
+ // Sorting and filtering want DIFFERENT values here, so both are
+ // spelled out. `sortValue` is the rank, because critical-before-
+ // debug is the only useful order and alphabetical is nonsense.
+ // `value` is the raw string, because that is what a rule matches —
+ // and with only `sortValue` present, `fieldValue` falls back to it,
+ // the column infers as `num`, and a rule of `severity is any of
+ // critical` compares "critical" against 0 and matches nothing.
+ value: (event) => event.severity,
sortValue: (event) => {
const rank = SEVERITY_ORDER.indexOf(event.severity);
return rank === -1 ? null : rank;
},
+ // The grid only ever holds one page of events, so the menu would
+ // otherwise list whichever severities the last 50 rows happened to
+ // contain, alphabetically. Pin the full ladder in rank order.
+ enumOrder: SEVERITY_ORDER,
render: (event) => {
const config = SEVERITY_CONFIG[event.severity] || SEVERITY_CONFIG.info;
return <Pill kind={config.pill}>{config.label}</Pill>;
@@ -333,53 +346,54 @@ export default function Telemetry() {
},
];
+ // Shared list chrome: view picker + chips + column-rule drawer + tools. It
+ // sits ALONGSIDE the server-side FilterDrawer above, not in place of it —
+ // a column rule sifts the 50 rows on screen, the drawer sifts the query.
+ const chrome = useTableChrome({
+ columns,
+ rows: events,
+ viewPageKey: 'telemetry',
+ builtinViews: BUILTIN_VIEWS,
+ noun: 'events',
+ sorts,
+ setSorts,
+ hiddenKeys,
+ setHiddenKeys,
+ pageState: viewPageState,
+ applyPage: applyViewPageState,
+ // Views saved before the envelope kept this page's server-side query at
+ // the top level as `filters`, which now means column rules.
+ rename: { filters: 'serverFilters' },
+ });
+
const hasFilters = Boolean(q || activeFilterCount);
return (
<div className="sk-tabgroup__inner telemetry-page">
- {/* Ordered by what an operator acts on. KpiBand keeps the first four
- up front; info/debug are counts you rarely chase, so they ride in
- the folded strip rather than pushing Total out of the row. */}
- <KpiBand>
- {['critical', 'error', 'warning'].map((severity) => {
- const config = SEVERITY_CONFIG[severity];
- const Icon = config.icon;
- return (
- <MetricCard
- key={severity}
- label={config.label}
- value={stats?.by_severity?.[severity] || 0}
- tone={config.tone}
- compact
- icon={<Icon size={17} />}
- onClick={() => setSeverityQuick(severity)}
+ {/* 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. */}
+ <GridViewPicker
+ views={chrome.views}
+ label="events"
+ total={`${events.length} loaded · ${stats?.total || 0} in the last 24h`}
+ onCreate={chrome.createView}
+ />
+ <ListToolbar
+ tools={(
+ <>
+ <GridFilterButton
+ count={chrome.filterCount}
+ onClick={() => chrome.setDrawerOpen(true)}
/>
- );
- })}
- <MetricCard
- label="Total (24h)"
- value={stats?.total || 0}
- tone="accent"
- compact
- icon={<Activity size={17} />}
- />
- {['info', 'debug'].map((severity) => {
- const config = SEVERITY_CONFIG[severity];
- const Icon = config.icon;
- return (
- <MetricCard
- key={severity}
- secondary
- label={config.label}
- value={stats?.by_severity?.[severity] || 0}
- tone={config.tone}
- compact
- icon={<Icon size={17} />}
- onClick={() => setSeverityQuick(severity)}
- />
- );
- })}
- </KpiBand>
+ <GridToolsMenu {...chrome.toolsProps} onRefresh={() => fetchEvents(1, true)} />
+ </>
+ )}
+ />
+
+ <GridChips {...chrome.chipProps} />
{filters.correlation_id && (
<div className="telemetry-trace">
@@ -405,7 +419,17 @@ export default function Telemetry() {
: 'System activity shows up here as it happens.'}
action={hasFilters
? (
- <Button variant="outline" onClick={() => { setFilters(EMPTY_FILTERS); setQ(''); }}>
+ <Button
+ variant="outline"
+ onClick={() => {
+ setFilters(EMPTY_FILTERS);
+ setQ('');
+ // The chips sit right above this button, so
+ // leaving the column rules armed would read
+ // as "Clear filters" doing half its job.
+ chrome.api.resetToView();
+ }}
+ >
Clear filters
</Button>
)
@@ -417,13 +441,13 @@ export default function Telemetry() {
tableClassName="sk-dtable telemetry-table"
data={events}
keyField="id"
+ columns={chrome.columns}
sorts={sorts}
onSortsChange={setSorts}
- hiddenKeys={hiddenKeys}
+ {...chrome.tableProps}
loading={loading && events.length === 0}
onRowClick={setSelectedEvent}
rowClassName={(event) => `is-${event.severity}`}
- columns={columns}
footer={(
<DataTableFooter
shown={events.length}
@@ -442,6 +466,10 @@ export default function Telemetry() {
</>
)}
+ {/* The query filter, opened from the top bar's FilterButton. It
+ narrows what the API returns, so it reaches every event on the
+ server — not just the page in memory. The column-rule drawer
+ below is the other tool, not a replacement for this one. */}
<FilterDrawer
open={filtersOpen}
onOpenChange={setFiltersOpen}
@@ -491,6 +519,8 @@ export default function Telemetry() {
</div>
</FilterDrawer>
+ <GridFilterDrawer {...chrome.drawerProps} />
+
<Drawer
open={Boolean(selectedEvent)}
onOpenChange={(open) => { if (!open) setSelectedEvent(null); }}