ServerKit is a lightweight, modern server control panel for managing web applications, databases, and services on your VPS or dedicated server. Built with Python/Flask backend and React frontend.
Python astracloudflarecontrol-panelcyberpaneldnsfablehosting-control-panelhosting-panelkimi-k3server-managementserverkitubuntu-web-panelwebserver
refactor(monitoring): one group for Monitors, Incidents, Events and Jobs
Juan Denisce3420f60795
diff --git a/frontend/src/App.jsx b/frontend/src/App.jsxindex ff249f8d..0e00e676 100644--- a/frontend/src/App.jsx+++ b/frontend/src/App.jsx@@ -44,7 +44,6 @@ import { MARKET_TABS } from './components/marketplace/marketTabs';import { BACKUP_TABS } from './components/backups/backupTabs';import { SECURITY_TABS } from './components/security/securityTabs';import { ORG_TABS } from './components/organization/organizationTabs';-import { JOBS_TABS } from './components/jobs/jobsTabs';import Downloads from './pages/Downloads';import SSLCertificates from './pages/SSLCertificates';import SSOCallback from './pages/SSOCallback';@@ -73,6 +72,9 @@ import Notifications from './pages/Notifications';import DeliveryLog from './pages/DeliveryLog';import Telemetry from './pages/Telemetry';import Jobs from './pages/Jobs';+import Monitors from './pages/Monitors';+import MonitorDetail from './pages/MonitorDetail';+import Incidents from './pages/Incidents';import TestSandbox from './pages/TestSandbox';import useDevMode from './hooks/useDevMode';import useExtensionRoutes from './plugins/ExtensionRoutes';@@ -137,6 +139,10 @@ const PAGE_TITLES = {'/notifications': 'Notifications','/admin/notifications': 'Notification Delivery Log','/telemetry': 'Telemetry',+ '/monitoring/monitors': 'Monitors',+ '/monitoring/monitors/:monitorId': 'Monitor',+ '/monitoring/incidents': 'Incidents',+ '/monitoring/jobs': 'Jobs','/jobs': 'Jobs','/test-sandbox': 'Test Sandbox',};@@ -428,10 +434,28 @@ function AppRoutes() {the public /status/:slug route stays core above. */}<Route element={<TabGroupLayout tabs={MONITOR_TABS} groupId="monitoring" />}><Route path="monitoring" element={<Monitoring />} />+ {/* Static segments outrank the :tab catch-all below, so these+ keep their own pages while /monitoring/rules etc. still+ land on <Monitoring/>. */}+ <Route path="monitoring/monitors" element={<Monitors />} />+ <Route path="monitoring/incidents" element={<Incidents />} />+ {/* Alerts merged into Incidents — a host threshold crossing+ and a monitor going down are the same question. */}+ <Route path="monitoring/alerts" element={<Navigate to="/monitoring/incidents" replace />} />+ <Route path="monitoring/fleet-alerts" element={<Navigate to="/monitoring/incidents" replace />} />+ {/* Jobs moved in from its own top-level page: it is the same+ class of thing as Events and read as a rival page next to+ it. Activity/Scheduled is now an in-page SegControl+ (the group's bar already owns the tab row). */}+ <Route path="monitoring/jobs" element={<Jobs />} />+ <Route path="monitoring/jobs/scheduled" element={<Jobs />} /><Route path="monitoring/:tab" element={<Monitoring />} /><Route path="telemetry" element={<Telemetry />} />{groupRoutes.monitoring}</Route>+ {/* Outside the tab group: a single monitor is a drill-down with+ its own breadcrumb top bar, like /queue/:group/:queue. */}+ <Route path="monitoring/monitors/:monitorId" element={<MonitorDetail />} /><Route path="observability" element={<Navigate to="/monitoring" replace />} />{/* Fleet Monitor folded into /monitoring: it asked the samequestions at fleet scope, so its heatmap is now the Host@@ -475,10 +499,9 @@ function AppRoutes() {<Route path="queue/:groupSlug/:queueSlug" element={<QueueDetail />} /><Route path="notifications" element={<Notifications />} /><Route path="admin/notifications" element={<DeliveryLog />} />- <Route element={<TabGroupLayout tabs={JOBS_TABS} />}>- <Route path="jobs" element={<Jobs />} />- <Route path="jobs/scheduled" element={<Jobs />} />- </Route>+ {/* Jobs is a Monitoring tab now; keep old links working. */}+ <Route path="jobs" element={<Navigate to="/monitoring/jobs" replace />} />+ <Route path="jobs/scheduled" element={<Navigate to="/monitoring/jobs/scheduled" replace />} /><Route path="settings" element={<Settings />} /><Route path="settings/:tab" element={<Settings />} />{dashboardRoutes}diff --git a/frontend/src/components/backups/BackupDetailDrawer.jsx b/frontend/src/components/backups/BackupDetailDrawer.jsxindex af34e4c0..bb3350b6 100644--- a/frontend/src/components/backups/BackupDetailDrawer.jsx+++ b/frontend/src/components/backups/BackupDetailDrawer.jsx@@ -77,7 +77,7 @@ export default function BackupDetailDrawer({ run, open, onClose, onRestore, onVe</div>{run.job_id && (- <a className="backup-detail-drawer__joblink" href="/jobs">+ <a className="backup-detail-drawer__joblink" href="/monitoring/jobs"><ExternalLink size={13} /> View job</a>)}diff --git a/frontend/src/components/backups/ProtectionPanel.jsx b/frontend/src/components/backups/ProtectionPanel.jsxindex cc659dab..0176ceea 100644--- a/frontend/src/components/backups/ProtectionPanel.jsx+++ b/frontend/src/components/backups/ProtectionPanel.jsx@@ -193,7 +193,7 @@ export default function ProtectionPanel({ targetType, targetId, targetName, showonBackupNow={handleBackupNow}onRunDrill={handleRunDrill}onViewGlobal={() => navigate('/backups')}- onViewJobs={() => navigate('/jobs')}+ onViewJobs={() => navigate('/monitoring/jobs')}busy={saving}backingUp={backingUp}drilling={drilling || !!view?.restore_proof?.is_drilling}diff --git a/frontend/src/components/dashboard/widgets/renderers.jsx b/frontend/src/components/dashboard/widgets/renderers.jsxindex 3812b0dc..480ea9f4 100644--- a/frontend/src/components/dashboard/widgets/renderers.jsx+++ b/frontend/src/components/dashboard/widgets/renderers.jsx@@ -779,7 +779,7 @@ const ACTIONS = {domains: ['Domains', Globe, '/domains'],files: ['File manager', FolderOpen, '/files'],security: ['Security', ShieldCheck, '/security'],- jobs: ['Jobs', ListChecks, '/jobs'],+ jobs: ['Jobs', ListChecks, '/monitoring/jobs'],};export const QUICK_ACTION_KEYS = Object.keys(ACTIONS);diff --git a/frontend/src/components/ds/FilterDrawer.jsx b/frontend/src/components/ds/FilterDrawer.jsxindex 76856695..c6a10831 100644--- a/frontend/src/components/ds/FilterDrawer.jsx+++ b/frontend/src/components/ds/FilterDrawer.jsx@@ -80,6 +80,12 @@ export function FilterDrawer({// legitimately not count a group whose value is just its default (a sort// order sitting on "featured" is not a filter the user applied).activeCount,+ // Optional: extra fields rendered below the chip groups, for filters that+ // aren't a pick-from-a-list (free text, date bounds). A host that passes+ // these must also pass `onClear`, otherwise "Clear all" would reset only the+ // groups and silently leave the extra fields applied.+ children,+ onClear,}) {const isOn = (group, optValue) => (group.type === 'multi'@@ -101,7 +107,7 @@ export function FilterDrawer({};const active = activeCount ?? countActiveFilters(value);- const clearAll = () => onChange(emptyFilterValue(groups));+ const clearAll = () => (onClear ? onClear() : onChange(emptyFilterValue(groups)));return (<Drawer@@ -137,6 +143,7 @@ export function FilterDrawer({</div></div>))}+ {children && <div className="sk-filter__extra">{children}</div>}<div className="sk-filter__footer"><Button variant="ghost" size="sm" onClick={clearAll} disabled={!active}>Clear alldiff --git a/frontend/src/components/jobs/jobsTabs.jsx b/frontend/src/components/jobs/jobsTabs.jsxdeleted file mode 100644index faf55387..00000000--- a/frontend/src/components/jobs/jobsTabs.jsx+++ /dev/null@@ -1,10 +0,0 @@-import { ListChecks, Clock } from 'lucide-react';--// Shared sub-nav for the Jobs page group (Activity / Scheduled). Rendered in the-// shared PageTopbar via <TabGroupLayout tabs={JOBS_TABS}> so the two surfaces act-// like real tabs (see docs/REDESIGN_MAP.md §6) instead of one long scroll. Both-// routes render <Jobs/>; the page picks the view from the pathname.-export const JOBS_TABS = [- { to: '/jobs', label: 'Activity', end: true, icon: <ListChecks size={15} /> },- { to: '/jobs/scheduled', label: 'Scheduled', icon: <Clock size={15} /> },-];diff --git a/frontend/src/components/monitoring/FleetAlertsPanel.jsx b/frontend/src/components/monitoring/FleetAlertsPanel.jsxindex f2a67ae0..642cbcaa 100644--- a/frontend/src/components/monitoring/FleetAlertsPanel.jsx+++ b/frontend/src/components/monitoring/FleetAlertsPanel.jsx@@ -15,8 +15,8 @@ const ALERT_FILTERS = [// Alerts raised by per-server thresholds across the fleet. The panel host's own// alerts are a different system (a single set of limits, delivered by the-// monitoring scheduler) and sit above this on the Alerts tab; the limits behind-// these rows are edited on the Rules tab.+// monitoring scheduler) and sit above this in the Incidents timeline; the limits+// behind these rows are edited on the Rules tab.export default function FleetAlertsPanel({ scope, refreshKey = 0 }) {const toast = useToast();const [alerts, setAlerts] = useState([]);diff --git a/frontend/src/components/monitoring/MonitoringOverview.jsx b/frontend/src/components/monitoring/MonitoringOverview.jsxindex d34b11be..9cdc3a3a 100644--- a/frontend/src/components/monitoring/MonitoringOverview.jsx+++ b/frontend/src/components/monitoring/MonitoringOverview.jsx@@ -8,6 +8,7 @@ import { formatBytes } from '@/utils/formatBytes';import { AreaChart, KpiBand, MetricCard, Pill, Sparkline } from '@/components/ds';import { Button } from '@/components/ui/button';import EmptyState from '../EmptyState';+import MonitorsSummary from './MonitorsSummary';import { HOST_SCOPE, useScopeMetrics, trendOf } from './useMonitorScope';const PERIODS = ['1h', '6h', '24h', '7d'];@@ -185,6 +186,16 @@ export default function MonitoringOverview({return (<div className="mon-overview">+ {/* Monitors first: "is the site up" is the question this page is+ for, and everything below describes the machines ServerKit runs+ on rather than the things it is watching. */}+ <MonitorsSummary refreshKey={refreshKey} />++ <div className="mon-section-head">+ <h3>Host health</h3>+ <span className="mon-section-head__meta">{scopeLabel}</span>+ </div>+{/* The shared DS tile, not a monitoring-only copy of it — samegeometry as every other KPI strip in the panel, plus thesparkline slot this page needed. */}@@ -278,8 +289,10 @@ export default function MonitoringOverview({{fleet.length > 0 && (<><div className="mon-section-head">- <h3>Host health</h3>- <span className="mon-section-head__meta">{online}/{fleet.length} online</span>+ <h3>All hosts</h3>+ <span className="mon-section-head__meta">+ {online}/{fleet.length} online · click a card to re-scope+ </span></div><div className="mon-fleet-grid">{/* Always the panel host's own numbers, never thediff --git a/frontend/src/components/monitoring/monitorTabs.jsx b/frontend/src/components/monitoring/monitorTabs.jsxindex 05729202..e85978f8 100644--- a/frontend/src/components/monitoring/monitorTabs.jsx+++ b/frontend/src/components/monitoring/monitorTabs.jsx@@ -1,23 +1,38 @@-import { Activity, Bell, Gauge, ScrollText, SlidersHorizontal, Stethoscope } from 'lucide-react';+import {+ Activity, AlertTriangle, Gauge, ListChecks, Radar, ScrollText,+ SlidersHorizontal, Stethoscope,+} from 'lucide-react';-// Shared sub-nav for the Observability page group. The Monitoring page's own+// Shared sub-nav for the Monitoring page group. The Monitoring page's own// sections live HERE, in the group's one top bar, rather than in a second tab// strip inside the page — a nav under a nav reads as two competing headers// (and is what the design mock does: its tabs sit in the top bar).//// Which host each section describes is a separate axis, carried by the top-bar-// server picker as `?server=` — so Overview/Alerts/Capacity all follow the same-// scope. Fleet Monitor used to be a page of its own under Servers; its heatmap-// is now the Host health grid on Overview, and its analytics are Capacity.+// server picker as `?server=` — so Overview/Capacity all follow the same scope.+// Fleet Monitor used to be a page of its own under Servers; its heatmap is now+// the Host health grid on Overview, and its analytics are Capacity.+//+// Monitors is the synthetic-check list (watch a URL, a service, a WordPress+// site). Incidents absorbed the old Alerts tab: a CPU threshold crossing on a+// host and a monitor going down are both "something is wrong right now", and+// splitting them was what made alerting look like it only ever described the+// panel's own machine. Host threshold alerting is unchanged, just rendered in+// the same timeline.+//+// Events is the telemetry stream and Jobs the unified job runner — both used to+// be top-level pages that read as rivals to this group.//// The Status Pages tab is contributed by the serverkit-status builtin extension// (tab-group contribution, #43) and merged in by TabGroupLayout-// groupId="monitoring".+// groupId="monitoring". TabGroupLayout overflows the tail into "⋯ More".export const MONITOR_TABS = [{ to: '/monitoring', label: 'Overview', end: true, icon: <Activity size={15} /> },- { to: '/monitoring/alerts', label: 'Alerts', icon: <Bell size={15} /> },+ { to: '/monitoring/monitors', label: 'Monitors', icon: <Radar size={15} /> },+ { to: '/monitoring/incidents', label: 'Incidents', icon: <AlertTriangle size={15} /> },{ to: '/monitoring/rules', label: 'Rules', icon: <SlidersHorizontal size={15} /> },{ to: '/monitoring/capacity', label: 'Capacity', icon: <Gauge size={15} /> },- { to: '/monitoring/doctor', label: 'Doctor', icon: <Stethoscope size={15} /> },{ to: '/telemetry', label: 'Events', icon: <ScrollText size={15} /> },+ { to: '/monitoring/jobs', label: 'Jobs', icon: <ListChecks size={15} /> },+ { to: '/monitoring/doctor', label: 'Doctor', icon: <Stethoscope size={15} /> },];diff --git a/frontend/src/components/sidebarItems.js b/frontend/src/components/sidebarItems.jsindex 6a386342..7028d16c 100644--- a/frontend/src/components/sidebarItems.js+++ b/frontend/src/components/sidebarItems.js@@ -126,11 +126,12 @@ export const SIDEBAR_ITEMS = [},{// Redesign: Monitoring uses the top-bar layout (REDESIGN_MAP §6 dec. 3).- // Its sections (Overview / Alerts / Rules / Capacity / Doctor / Events)- // share the top bar (PageTopbar MONITOR_TABS); the sidebar entry lights- // for any of them via matchPrefixes. Events absorbed the old standalone- // Telemetry. Labelled "Monitoring" to match the route and the page —- // this used to say "Observability", which named the same thing twice.+ // Its sections (Overview / Monitors / Incidents / Rules / Capacity /+ // Events / Jobs / Doctor) share the top bar (PageTopbar MONITOR_TABS);+ // the sidebar entry lights for any of them via matchPrefixes. Events+ // absorbed the old standalone Telemetry and Jobs the old top-level Jobs+ // page. Labelled "Monitoring" to match the route and the page — this+ // used to say "Observability", which named the same thing twice.id: 'monitoring',label: 'Monitoring',route: '/monitoring',@@ -175,13 +176,9 @@ export const SIDEBAR_ITEMS = [category: 'system',icon: '<path d="M4 17l6-6-6-6M12 19h8"/>'},- {- id: 'jobs',- label: 'Jobs',- route: '/jobs',- category: 'system',- icon: '<path d="m12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83Z"/><path d="m22 17.65-9.17 4.16a2 2 0 0 1-1.66 0L2 17.65"/><path d="m22 12.65-9.17 4.16a2 2 0 0 1-1.66 0L2 12.65"/>'- },+ // Jobs is a Monitoring tab now (/monitoring/jobs), not a top-level page: it+ // is the same class of thing as Events and the two read as rival pages when+ // one sat in the sidebar and the other inside the group. /jobs redirects.// GPU Monitor lives in the standalone serverkit-gpu extension (own repo,// registry-installed); its sidebar item (still gated on gpuAvailable via// requiresCondition) is contributed by the extension manifest.diff --git a/frontend/src/data/palettePages.js b/frontend/src/data/palettePages.jsindex 1054ce8a..2bbb47f6 100644--- a/frontend/src/data/palettePages.js+++ b/frontend/src/data/palettePages.js@@ -38,7 +38,9 @@ export const PALETTE_PAGES = [{ label: 'Workspaces', path: '/workspaces', navId: 'organization', keywords: 'organization team' },{ label: 'Vaults', path: '/vaults', navId: 'organization', keywords: 'secrets tokens credentials vault' },{ label: 'Queue Bus', path: '/queue', navId: 'queue', keywords: 'bus operations tasks' },- { label: 'Jobs', path: '/jobs', navId: 'jobs', keywords: 'scheduler background work' },+ { label: 'Jobs', path: '/monitoring/jobs', navId: 'monitoring', keywords: 'scheduler background work' },+ { label: 'Monitors', path: '/monitoring/monitors', navId: 'monitoring', keywords: 'uptime check probe http ping website' },+ { label: 'Incidents', path: '/monitoring/incidents', navId: 'monitoring', keywords: 'outage alert downtime postmortem' },// No navId: the inbound-webhook console is a Settings tab now, not a// sidebar page, so there's no nav item for the permission gate to consult.{ label: 'Webhooks', path: '/settings/webhooks', keywords: 'webhook receive forward delivery inbound' },diff --git a/frontend/src/pages/Jobs.jsx b/frontend/src/pages/Jobs.jsxindex 2f635e25..d0cc3aa1 100644--- a/frontend/src/pages/Jobs.jsx+++ b/frontend/src/pages/Jobs.jsx@@ -1,18 +1,21 @@// Jobs — admin view over the unified job system (job orchestration, "Phase 9").//-// Tab-group page (the Marketplace/Domains pattern): a shared PageTopbar carries-// the Activity/Scheduled sub-nav (JOBS_TABS) plus the reusable SearchField +-// FilterDrawer (status/kind) + Refresh. 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; Scheduled is its own tab so it's not-// buried below the runs. Wired to the real ApiService job methods-// (see frontend/src/services/api/jobs.js).+// A tab in the Monitoring group now, not a top-level page: it is the same class+// of thing as Events, and the two read as rival pages while one sat in the+// sidebar and the other inside the group. The group's shared PageTopbar carries+// SearchField + FilterDrawer (status/kind) + Refresh; Activity/Scheduled is an+// 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.+// Wired to the real ApiService job methods (see frontend/src/services/api/jobs.js).import { useState, useEffect, useCallback, useRef } from 'react';-import { useLocation } from 'react-router-dom';+import { useLocation, useNavigate } from 'react-router-dom';import { ListChecks, RefreshCw, RotateCcw, XCircle, Play, Clock, ChevronLeft, ChevronRight } from 'lucide-react';import api from '../services/api';import {- MetricCard, KpiBand, Pill, DataTable,+ MetricCard, KpiBand, Pill, DataTable, SegControl,SearchField, FilterDrawer, FilterButton, countActiveFilters,} from '@/components/ds';import { Button } from '@/components/ui/button';@@ -66,6 +69,9 @@ export default function Jobs() {const { isAdmin } = useAuth();const toast = useToast();const location = useLocation();+ const navigate = useNavigate();+ // The view still lives in the URL (so a link to the scheduled list keeps+ // working) — only the control that switches it moved into the page.const scheduledView = location.pathname.endsWith('/scheduled');const [jobs, setJobs] = useState([]);const [total, setTotal] = useState(0);@@ -260,6 +266,19 @@ export default function Jobs() {return (<div className="sk-tabgroup__inner jobs-page"><div className="sk-jobs">+ <div className="sk-jobs__viewswitch">+ <SegControl+ value={scheduledView ? 'scheduled' : 'activity'}+ onChange={(value) => navigate(+ value === 'scheduled' ? '/monitoring/jobs/scheduled' : '/monitoring/jobs',+ )}+ options={[+ { value: 'activity', label: 'Activity', icon: <ListChecks size={14} /> },+ { value: 'scheduled', label: 'Scheduled', icon: <Clock size={14} /> },+ ]}+ />+ </div>+{scheduledView ? (<DataTablecolumns={scheduledColumns}diff --git a/frontend/src/pages/Monitoring.jsx b/frontend/src/pages/Monitoring.jsxindex 5d1e1ff3..071a882c 100644--- a/frontend/src/pages/Monitoring.jsx+++ b/frontend/src/pages/Monitoring.jsx@@ -7,7 +7,6 @@ import EmptyState from '../components/EmptyState';import DoctorPanel from '../components/monitoring/DoctorPanel';import MonitoringOverview from '../components/monitoring/MonitoringOverview';import FleetCapacityPanel from '../components/monitoring/FleetCapacityPanel';-import FleetAlertsPanel from '../components/monitoring/FleetAlertsPanel';import FleetThresholdsPanel from '../components/monitoring/FleetThresholdsPanel';import ServerScopePicker from '../components/monitoring/ServerScopePicker';import { useMonitorScope } from '../components/monitoring/useMonitorScope';@@ -20,16 +19,19 @@ import { ProviderBrandIcon } from '../components/icons/ProviderBrands';import { useTopbarActions } from '@/hooks/useTopbarActions';import {Activity, Bell, Cpu, Gauge as GaugeIcon, HardDrive, MemoryStick,- PlayCircle, RefreshCw, Settings, Siren,+ PlayCircle, RefreshCw, Settings,} from 'lucide-react';// One section per top-bar tab. There is deliberately no second tab strip inside// the page: the group's own bar (MONITOR_TABS) carries these, the way the// design mock does — a nav under a nav reads as two competing headers.-const VALID_TABS = ['overview', 'alerts', 'rules', 'capacity', 'doctor'];+// Alerts is gone from this page: host threshold alerts now render in the+// Incidents tab alongside monitor outages (they are the same question asked of+// two different subjects). /monitoring/alerts redirects there in App.jsx.+const VALID_TABS = ['overview', 'rules', 'capacity', 'doctor'];// Old deep links from when Alert Rules and Delivery were separate inner tabs.-const TAB_ALIASES = { thresholds: 'rules', config: 'rules', fleet: 'overview', 'fleet-alerts': 'alerts' };+const TAB_ALIASES = { thresholds: 'rules', config: 'rules', fleet: 'overview' };const DEFAULT_THRESHOLDS = {cpu_percent: 80,@@ -60,34 +62,18 @@ const RULE_ICONS = {const SPEEDTEST_POLL_INTERVAL_MS = 3000;const SPEEDTEST_POLL_TIMEOUT_MS = 90000;-function formatTimestamp(timestamp) {- if (!timestamp) return 'Never';- return new Date(timestamp).toLocaleString();-}-function formatNumber(value, digits = 1) {if (typeof value !== 'number' || Number.isNaN(value)) return '-';return value.toFixed(digits);}-function getSeverityTone(severity) {- switch (severity) {- case 'critical': return 'red';- case 'warning': return 'amber';- case 'info': return 'cyan';- default: return 'gray';- }-}-const Monitoring = () => {const toast = useToast();const [status, setStatus] = useState(null);const [thresholds, setThresholds] = useState(DEFAULT_THRESHOLDS);- const [alertHistory, setAlertHistory] = useState([]);const [loading, setLoading] = useState(true);const [savingConfig, setSavingConfig] = useState(false);const [savingThresholds, setSavingThresholds] = useState(false);- const [checkingAlerts, setCheckingAlerts] = useState(false);const [error, setError] = useState(null);const [rawTab] = useTabParam('/monitoring', VALID_TABS);const activeTab = TAB_ALIASES[rawTab] || rawTab;@@ -119,18 +105,16 @@ const Monitoring = () => {try {setLoading(true);setError(null);- const [statusRes, configRes, thresholdsRes, historyRes] = await Promise.all([+ const [statusRes, configRes, thresholdsRes] = await Promise.all([api.getMonitoringStatus(),api.getMonitoringConfig(),api.getMonitoringThresholds(),- api.getAlertHistory(50),]);const nextThresholds = { ...DEFAULT_THRESHOLDS, ...(thresholdsRes.thresholds || {}) };setStatus(statusRes);setThresholds(nextThresholds);setThresholdForm(nextThresholds);- setAlertHistory(historyRes.alerts || []);setConfigForm({enabled: Boolean(configRes.enabled),check_interval: configRes.check_interval || 60,@@ -239,20 +223,6 @@ const Monitoring = () => {}};- const handleCheckAlerts = async () => {- try {- setCheckingAlerts(true);- const result = await api.checkAlerts();- const count = result.alerts?.length || 0;- toast[count > 0 ? 'warning' : 'success'](`${count} active alert${count !== 1 ? 's' : ''}`);- await loadData();- } catch (err) {- toast.error(err.message || 'Alert check failed');- } finally {- setCheckingAlerts(false);- }- };-const handleRunSpeedTest = async () => {try {setSpeedTestRunning(true);@@ -345,55 +315,6 @@ const Monitoring = () => {/>)}- {activeTab === 'alerts' && (- <div className="monitoring-stack">- <section className="monitoring-panel">- <div className="monitoring-panel__header">- <div>- <h3>This server</h3>- <span className="mon-panel-sub">- {activeAlerts.length} firing · {alertHistory.length} in history- </span>- </div>- <Button variant="outline" size="sm" onClick={handleCheckAlerts} disabled={checkingAlerts}>- <Siren size={14} />- {checkingAlerts ? 'Checking…' : 'Check now'}- </Button>- </div>- {alertHistory.length === 0 && activeAlerts.length === 0 ? (- <p className="mon-panel-hint">- Nothing has crossed a limit yet. Rules live one tab over.- </p>- ) : (- <div className="mon-alert-list">- {[...activeAlerts.map((a) => ({ ...a, firing: true })), ...alertHistory]- .map((alert, index) => (- <article key={`${alert.timestamp || 'now'}-${index}`} className="mon-alert-row">- <span className={`mon-sev mon-sev--${alert.severity}`} />- <div className="mon-alert-row__body">- <div className="mon-alert-row__title">{alert.message}</div>- <div className="mon-alert-row__sub">- {alert.type} · {formatNumber(alert.value)} / {alert.threshold}- </div>- </div>- <div className="mon-alert-row__end">- <span className={`mon-state mon-state--${alert.firing ? 'red' : getSeverityTone(alert.severity)}`}>- {alert.firing ? 'firing' : alert.severity}- </span>- <span className="mon-alert-row__time">- {alert.firing ? 'now' : formatTimestamp(alert.timestamp)}- </span>- </div>- </article>- ))}- </div>- )}- </section>-- {servers.length > 0 && <FleetAlertsPanel scope={scope} refreshKey={refreshKey} />}- </div>- )}-{activeTab === 'rules' && (<div className="monitoring-stack"><form className="monitoring-panel" onSubmit={handleSaveThresholds}>diff --git a/frontend/src/pages/StatusPages.jsx b/frontend/src/pages/StatusPages.jsxindex 6cc3eeb9..0063735a 100644--- a/frontend/src/pages/StatusPages.jsx+++ b/frontend/src/pages/StatusPages.jsx@@ -18,10 +18,12 @@ import {Copy,ExternalLink,Globe2,+ Link2,PlayCircle,Plus,RefreshCw,Trash2,+ Unlink,} from 'lucide-react';// pill → ds Pill kind · tone → .status-dot modifier · dot → .comp-dots square@@ -108,6 +110,11 @@ const StatusPages = () => {const [incidents, setIncidents] = useState([]);const [showCreatePage, setShowCreatePage] = useState(false);const [showCreateComponent, setShowCreateComponent] = useState(false);+ // Monitors are first-class now (core /api/v1/monitors) — a status page+ // publishes a subset of them rather than owning its own private probes. This+ // is the list of monitors not yet on any page.+ const [unattached, setUnattached] = useState([]);+ const [showAttach, setShowAttach] = useState(false);const [showCreateIncident, setShowCreateIncident] = useState(false);const [deleteConfirm, setDeleteConfirm] = useState(null);@@ -138,18 +145,45 @@ const StatusPages = () => {const loadPageDetails = async (page) => {if (!page) return;try {- const [cData, iData] = await Promise.all([+ const [cData, iData, mData] = await Promise.all([api.getStatusPageComponents(page.id),api.getStatusPageIncidents(page.id),+ api.getMonitors().catch(() => null),]);setSelectedPage(page);setComponents(cData.components || []);setIncidents(iData.incidents || []);+ setUnattached((mData?.monitors || []).filter((m) => m.page_id == null));} catch (err) {toast.error(err.message || 'Failed to load page details');}};+ // Publishing an existing monitor is just setting its page — no second probe,+ // no duplicated config, and the monitor keeps the history it already has.+ const handleAttachMonitor = async (monitor) => {+ try {+ await api.updateMonitor(monitor.id, { page_id: selectedPage.id });+ toast.success(`${monitor.name} added to ${selectedPage.name}`);+ setShowAttach(false);+ await loadPageDetails(selectedPage);+ } catch (err) {+ toast.error(err.message || 'Could not add the monitor');+ }+ };++ // Unpublish without destroying: deleting a component now deletes a real+ // monitor and its history, so removing it from a page needs its own action.+ const handleDetachMonitor = async (component) => {+ try {+ await api.updateMonitor(component.id, { page_id: null });+ toast.success(`${component.name} removed from this page`);+ await loadPageDetails(selectedPage);+ } catch (err) {+ toast.error(err.message || 'Could not remove the monitor');+ }+ };+const loadPages = async () => {try {setLoading(true);@@ -414,10 +448,24 @@ const StatusPages = () => {<TabsContent value="components"><div className="status-actions-bar">{isAdmin && (- <Button size="sm" onClick={() => setShowCreateComponent(true)}>- <Plus size={14} />- Add Component- </Button>+ <>+ <Button+ size="sm"+ variant="outline"+ onClick={() => setShowAttach(true)}+ disabled={unattached.length === 0}+ title={unattached.length === 0+ ? 'Every monitor is already on a page'+ : undefined}+ >+ <Link2 size={14} />+ Add existing monitor+ </Button>+ <Button size="sm" onClick={() => setShowCreateComponent(true)}>+ <Plus size={14} />+ New component+ </Button>+ </>)}</div>@@ -448,7 +496,20 @@ const StatusPages = () => {<PlayCircle size={14} />Check</Button>- <Button size="sm" variant="ghost" onClick={() => setDeleteConfirm({ type: 'component', item: component })}>+ <Button+ size="sm"+ variant="ghost"+ onClick={() => handleDetachMonitor(component)}+ title="Remove from this page — the monitor keeps running"+ >+ <Unlink size={14} />+ </Button>+ <Button+ size="sm"+ variant="ghost"+ onClick={() => setDeleteConfirm({ type: 'component', item: component })}+ title="Delete the monitor and its history"+ ><Trash2 size={14} /></Button></div>@@ -602,6 +663,41 @@ const StatusPages = () => {</div></Modal>+ <Modal+ open={showAttach}+ onClose={() => setShowAttach(false)}+ title="Add an existing monitor"+ size="md"+ className="status-modal"+ footer={<Button variant="outline" onClick={() => setShowAttach(false)}>Close</Button>}+ >+ <p className="form-help">+ These monitors are already running and are not on any status page yet.+ Adding one publishes it here — it keeps the history it has already collected.+ </p>+ <div className="status-attach-list">+ {unattached.map((monitor) => (+ <button+ key={monitor.id}+ type="button"+ className="status-attach-row"+ onClick={() => handleAttachMonitor(monitor)}+ >+ <span className="status-attach-row__body">+ <strong>{monitor.name}</strong>+ <span>{monitor.check_type.toUpperCase()} · {monitor.check_target || 'bound site'}</span>+ </span>+ <Pill kind={(STATUS_META[monitor.status] || STATUS_META.operational).pill}>+ {(STATUS_META[monitor.status] || STATUS_META.operational).label}+ </Pill>+ </button>+ ))}+ {unattached.length === 0 && (+ <p className="form-help">Every monitor is already on a page.</p>+ )}+ </div>+ </Modal>+<Modalopen={showCreateComponent}onClose={() => setShowCreateComponent(false)}diff --git a/frontend/src/pages/Telemetry.jsx b/frontend/src/pages/Telemetry.jsxindex b4525d05..666c148d 100644--- a/frontend/src/pages/Telemetry.jsx+++ b/frontend/src/pages/Telemetry.jsx@@ -1,41 +1,57 @@-import { useState, useEffect, useCallback } from 'react';-import { useSearchParams } from 'react-router-dom';+// Events — the system event stream (the "Events" tab of the Monitoring group).+//+// Rebuilt on the standard tab-group page pattern. What it used to do wrong:+// - it rendered its own <PageTopbar> while nested inside <TabGroupLayout>,+// so the page carried two stacked headers+// - its KPI row was bespoke `telemetry-stat` divs instead of KpiBand ++// MetricCard, so it matched nothing else in the panel+// - filters were an inline collapsible panel instead of the shared topbar+// SearchField + FilterDrawer that Domains / Cron / Jobs / Monitors use+//+// Every capability it had is kept: source / type / severity / resource / date+// filters, correlation drill-down, test-event emit, cleanup, and pagination.+import { useCallback, useEffect, useMemo, useState } from 'react';import {- Activity,- AlertTriangle,- ChevronDown,- ChevronRight,- ChevronUp,- Filter,- Info,- Loader2,- RefreshCw,- Search,- Trash2,- X,+ Activity, AlertTriangle, ChevronRight, Info, Loader2, RefreshCw, Trash2,XCircle,} from 'lucide-react';import api from '../services/api';-import { PageTopbar } from '@/components/ds';+import {+ DataTable, Drawer, FilterButton, FilterDrawer, KpiBand, MetricCard, Pill,+ SearchField, countActiveFilters,+} from '@/components/ds';import { Button } from '@/components/ui/button';import { Input } from '@/components/ui/input';+import { Label } from '@/components/ui/label';+import { useTopbarActions } from '@/hooks/useTopbarActions';import { useAuth } from '../contexts/AuthContext';import { useToast } from '../contexts/ToastContext';+import EmptyState from '../components/EmptyState';const SEVERITY_ORDER = ['critical', 'error', 'warning', 'info', 'debug'];const SEVERITY_CONFIG = {- critical: { icon: XCircle, color: '#fb6f6f', label: 'Critical' },- error: { icon: XCircle, color: '#ff7b7b', label: 'Error' },- warning: { icon: AlertTriangle, color: '#f5b945', label: 'Warning' },- info: { icon: Info, color: '#6d7cff', label: 'Info' },- debug: { icon: Activity, color: '#9aa1b2', label: 'Debug' },+ critical: { icon: XCircle, tone: 'red', label: 'Critical' },+ error: { icon: XCircle, tone: 'red', label: 'Error' },+ warning: { icon: AlertTriangle, tone: 'amber', label: 'Warning' },+ info: { icon: Info, tone: 'accent', label: 'Info' },+ debug: { icon: Activity, tone: 'gray', label: 'Debug' },};const PAGE_SIZE = 50;+const EMPTY_FILTERS = {+ source: '',+ event_type: '',+ severity: '',+ resource_type: '',+ resource_id: '',+ correlation_id: '',+ start_date: '',+ end_date: '',+};+export default function Telemetry() {- const [searchParams, setSearchParams] = useSearchParams();const { isAdmin } = useAuth();const { showToast } = useToast();@@ -47,30 +63,19 @@ export default function Telemetry() {const [sources, setSources] = useState([]);const [eventTypes, setEventTypes] = useState([]);const [selectedEvent, setSelectedEvent] = useState(null);- const [filtersExpanded, setFiltersExpanded] = useState(false);-- const [filters, setFilters] = useState({- source: searchParams.get('source') || '',- event_type: searchParams.get('event_type') || '',- severity: searchParams.get('severity') || '',- resource_type: searchParams.get('resource_type') || '',- resource_id: searchParams.get('resource_id') || '',- correlation_id: searchParams.get('correlation_id') || '',- q: searchParams.get('q') || '',- start_date: searchParams.get('start_date') || '',- end_date: searchParams.get('end_date') || '',- });+ const [filtersOpen, setFiltersOpen] = useState(false);+ const [filters, setFilters] = useState(EMPTY_FILTERS);+ const [q, setQ] = useState('');const loadStats = useCallback(async () => {try {- const data = await api.getTelemetryStats({ hours: 24 });- setStats(data);+ setStats(await api.getTelemetryStats({ hours: 24 }));} catch {// stats are optional}}, []);- const loadFilters = useCallback(async () => {+ const loadFilterOptions = useCallback(async () => {try {const [sourcesData, typesData] = await Promise.all([api.getTelemetrySources(),@@ -79,14 +84,14 @@ export default function Telemetry() {setSources(sourcesData.sources || []);setEventTypes(typesData.event_types || []);} catch {- // filters are optional+ // filter options are optional}}, [filters.source]);const fetchEvents = useCallback(async (nextPage = 1, replace = true) => {setLoading(true);try {- const params = { ...filters, per_page: PAGE_SIZE, page: nextPage };+ const params = { ...filters, q, per_page: PAGE_SIZE, page: nextPage };Object.keys(params).forEach((key) => {if (params[key] === '') delete params[key];});@@ -101,57 +106,13 @@ export default function Telemetry() {} finally {setLoading(false);}- }, [filters, showToast]);+ }, [filters, q, showToast]);useEffect(() => {loadStats();- loadFilters();- fetchEvents(1, true);- }, [loadStats, loadFilters, fetchEvents]);-- const applyFilters = () => {- const next = new URLSearchParams();- Object.entries(filters).forEach(([key, value]) => {- if (value) next.set(key, value);- });- setSearchParams(next);+ loadFilterOptions();fetchEvents(1, true);- };-- const clearFilters = () => {- const empty = {- source: '',- event_type: '',- severity: '',- resource_type: '',- resource_id: '',- correlation_id: '',- q: '',- start_date: '',- end_date: '',- };- setFilters(empty);- setSearchParams(new URLSearchParams());- setFiltersExpanded(false);- fetchEvents(1, true);- };-- const loadMore = () => {- if (!loading && hasMore) {- fetchEvents(page + 1, false);- }- };-- const handleFilterChange = (key, value) => {- setFilters((prev) => ({ ...prev, [key]: value }));- };-- const handleCorrelationClick = (correlationId) => {- if (!correlationId) return;- setFilters((prev) => ({ ...prev, correlation_id: correlationId }));- setSearchParams({ correlation_id: correlationId });- fetchEvents(1, true);- };+ }, [loadStats, loadFilterOptions, fetchEvents]);const emitTestEvent = async () => {try {@@ -184,282 +145,320 @@ export default function Telemetry() {}};- const activeFilterCount = Object.values(filters).filter(Boolean).length;+ const activeFilterCount = countActiveFilters(filters);- return (+ // Search + advanced filters + Refresh live in the group's shared top bar,+ // the way every other list page in the panel does it.+ useTopbarActions(() => (<>- <PageTopbar- icon={<Activity size={18} />}- title="Telemetry"- meta={stats ? `${stats.total || 0} events in last 24h` : 'System event stream'}- actions={(- <>- {isAdmin && (- <Button variant="outline" size="sm" onClick={emitTestEvent}>- <Activity size={15} /> Test event- </Button>+ <SearchField value={q} onSearch={(value) => setQ(value.trim())} placeholder="Search messages…" />+ <FilterButton count={activeFilterCount} onClick={() => setFiltersOpen(true)} />+ {isAdmin && (+ <Button variant="outline" size="sm" onClick={emitTestEvent}>+ <Activity size={14} /> Test event+ </Button>+ )}+ {isAdmin && (+ <Button variant="outline" size="sm" onClick={cleanupOldEvents}>+ <Trash2 size={14} /> Cleanup+ </Button>+ )}+ <Button variant="outline" size="sm" onClick={() => fetchEvents(1, true)} disabled={loading}>+ <RefreshCw size={14} className={loading ? 'spin' : ''} /> Refresh+ </Button>+ </>+ ), [q, activeFilterCount, isAdmin, loading, fetchEvents]);++ const setSeverityQuick = (severity) => {+ setFilters((f) => ({ ...f, severity: f.severity === severity ? '' : severity }));+ };++ const filterGroups = useMemo(() => ([+ {+ key: 'source',+ label: 'Source',+ type: 'single',+ options: sources.map((s) => ({ value: s, label: s })),+ },+ {+ key: 'event_type',+ label: 'Event type',+ type: 'single',+ options: eventTypes.map((t) => ({ value: t, label: t })),+ },+ {+ key: 'severity',+ label: 'Severity',+ type: 'single',+ options: SEVERITY_ORDER.map((s) => ({ value: s, label: SEVERITY_CONFIG[s].label })),+ },+ ]), [sources, eventTypes]);++ const columns = [+ {+ key: 'severity',+ header: 'Severity',+ render: (event) => {+ const config = SEVERITY_CONFIG[event.severity] || SEVERITY_CONFIG.info;+ return <Pill kind={config.tone}>{config.label}</Pill>;+ },+ },+ {+ key: 'message',+ header: 'Event',+ render: (event) => (+ <div className="telemetry-cell">+ <div className="telemetry-cell__message">{event.message || event.event_type}</div>+ <div className="telemetry-cell__meta">+ <span className="telemetry-cell__source">{event.source}</span>+ <span className="telemetry-cell__type">{event.event_type}</span>+ {event.resource_type && (+ <span className="telemetry-cell__badge">+ {event.resource_type}:{event.resource_id}+ </span>)}- {isAdmin && (- <Button variant="outline" size="sm" onClick={cleanupOldEvents}>- <Trash2 size={15} /> Cleanup- </Button>+ {event.actor_username && (+ <span className="telemetry-cell__badge">by {event.actor_username}</span>)}- <Button variant="outline" size="sm" onClick={() => fetchEvents(1, true)} disabled={loading}>- <RefreshCw size={15} className={loading ? 'spin' : ''} /> Refresh- </Button>- </>- )}- />-- <div className="telemetry-page">- {stats && (- <div className="telemetry-stats">- {SEVERITY_ORDER.map((severity) => (- <div key={severity} className={`telemetry-stat telemetry-stat--${severity}`}>- <span className="telemetry-stat__count">- {stats.by_severity?.[severity] || 0}- </span>- <span className="telemetry-stat__label">- {SEVERITY_CONFIG[severity]?.label}- </span>- </div>- ))}- <div className="telemetry-stat telemetry-stat--total">- <span className="telemetry-stat__count">{stats.total || 0}</span>- <span className="telemetry-stat__label">Total</span>- </div></div>- )}+ </div>+ ),+ },+ {+ key: 'correlation_id',+ header: 'Related',+ render: (event) => (event.correlation_id ? (+ <Button+ variant="ghost"+ size="sm"+ onClick={(e) => {+ e.stopPropagation();+ setFilters((f) => ({ ...f, correlation_id: event.correlation_id }));+ }}+ title="Show every event in this trace"+ >+ trace <ChevronRight size={12} />+ </Button>+ ) : <span className="telemetry-cell__muted">—</span>),+ },+ {+ key: 'timestamp',+ header: 'When',+ cellClassName: 'telemetry-cell__when',+ render: (event) => new Date(event.timestamp).toLocaleString(),+ },+ ];- <div className="telemetry-filters">- <button- type="button"- className="telemetry-filters__toggle"- onClick={() => setFiltersExpanded((v) => !v)}- >- <Filter size={15} />- Filters- {activeFilterCount > 0 && (- <span className="telemetry-filters__count">{activeFilterCount}</span>- )}- {filtersExpanded ? <ChevronUp size={15} /> : <ChevronDown size={15} />}- </button>+ const hasFilters = Boolean(q || activeFilterCount);- {filtersExpanded && (- <div className="telemetry-filters__body">- <div className="telemetry-filters__grid">- <select- value={filters.source}- onChange={(e) => handleFilterChange('source', e.target.value)}- >- <option value="">All sources</option>- {sources.map((s) => (- <option key={s} value={s}>{s}</option>- ))}- </select>- <select- value={filters.event_type}- onChange={(e) => handleFilterChange('event_type', e.target.value)}- >- <option value="">All event types</option>- {eventTypes.map((t) => (- <option key={t} value={t}>{t}</option>- ))}- </select>- <select- value={filters.severity}- onChange={(e) => handleFilterChange('severity', e.target.value)}- >- <option value="">All severities</option>- {SEVERITY_ORDER.map((s) => (- <option key={s} value={s}>{SEVERITY_CONFIG[s].label}</option>- ))}- </select>- <Input- placeholder="Resource type"- value={filters.resource_type}- onChange={(e) => handleFilterChange('resource_type', e.target.value)}- />- <Input- placeholder="Resource ID"- value={filters.resource_id}- onChange={(e) => handleFilterChange('resource_id', e.target.value)}- />- <Input- placeholder="Correlation ID"- value={filters.correlation_id}- onChange={(e) => handleFilterChange('correlation_id', e.target.value)}- />- <Input- type="datetime-local"- value={filters.start_date}- onChange={(e) => handleFilterChange('start_date', e.target.value)}- />- <Input- type="datetime-local"- value={filters.end_date}- onChange={(e) => handleFilterChange('end_date', e.target.value)}- />- </div>- <div className="telemetry-filters__search">- <Search size={15} />- <Input- placeholder="Search message..."- value={filters.q}- onChange={(e) => handleFilterChange('q', e.target.value)}- />- </div>- <div className="telemetry-filters__actions">- <Button size="sm" onClick={applyFilters}>Apply</Button>- <Button size="sm" variant="ghost" onClick={clearFilters}>- <X size={15} /> Clear- </Button>- </div>- </div>- )}+ 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)}+ />+ );+ })}+ <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>++ {filters.correlation_id && (+ <div className="telemetry-trace">+ <span>+ Showing one trace: <code>{filters.correlation_id}</code>+ </span>+ <Button+ variant="ghost"+ size="sm"+ onClick={() => setFilters((f) => ({ ...f, correlation_id: '' }))}+ >+ Clear+ </Button></div>+ )}- <div className="telemetry-list">- {events.map((event) => {- const config = SEVERITY_CONFIG[event.severity] || SEVERITY_CONFIG.info;- const Icon = config.icon;- return (- <div- key={event.id}- className={`telemetry-item telemetry-item--${event.severity}`}- onClick={() => setSelectedEvent(event)}- >- <div className="telemetry-item__severity">- <Icon size={16} color={config.color} />- </div>- <div className="telemetry-item__content">- <div className="telemetry-item__header">- <span className="telemetry-item__source">{event.source}</span>- <span className="telemetry-item__type">{event.event_type}</span>- <span className="telemetry-item__time">- {new Date(event.timestamp).toLocaleString()}- </span>- </div>- <div className="telemetry-item__message">{event.message || event.event_type}</div>- <div className="telemetry-item__meta">- {event.resource_type && (- <span className="telemetry-item__badge">- {event.resource_type}:{event.resource_id}- </span>- )}- {event.actor_username && (- <span className="telemetry-item__badge">- by {event.actor_username}- </span>- )}- {event.correlation_id && (- <button- type="button"- className="telemetry-item__correlation"- onClick={(e) => {- e.stopPropagation();- handleCorrelationClick(event.correlation_id);- }}- title="View related events"- >- related <ChevronRight size={12} />- </button>- )}- </div>- </div>- </div>- );- })}+ {events.length === 0 && !loading ? (+ <EmptyState+ icon={Info}+ title={hasFilters ? 'No events match' : 'No events recorded yet'}+ description={hasFilters+ ? 'Try a different search or clear the filters.'+ : 'System activity shows up here as it happens.'}+ action={hasFilters+ ? (+ <Button variant="outline" onClick={() => { setFilters(EMPTY_FILTERS); setQ(''); }}>+ Clear filters+ </Button>+ )+ : undefined}+ />+ ) : (+ <>+ <DataTable+ tableClassName="sk-dtable telemetry-table"+ sortable={false}+ data={events}+ keyField="id"+ loading={loading && events.length === 0}+ onRowClick={setSelectedEvent}+ rowClassName={(event) => `is-${event.severity}`}+ columns={columns}+ />- {events.length === 0 && !loading && (- <div className="telemetry-empty">- <Info size={32} />- <p>No telemetry events match your filters.</p>- </div>+ {loading && events.length > 0 && (+ <div className="telemetry-loading"><Loader2 size={20} className="spin" /></div>)}- {loading && (- <div className="telemetry-loading">- <Loader2 size={24} className="spin" />+ {hasMore && !loading && (+ <div className="telemetry-more">+ <Button variant="outline" onClick={() => fetchEvents(page + 1, false)}>+ Load more+ </Button></div>)}+ </>+ )}- {hasMore && !loading && (- <Button variant="outline" className="telemetry-load-more" onClick={loadMore}>- Load more- </Button>- )}+ <FilterDrawer+ open={filtersOpen}+ onOpenChange={setFiltersOpen}+ groups={filterGroups}+ value={filters}+ onChange={setFilters}+ onClear={() => setFilters(EMPTY_FILTERS)}+ activeCount={activeFilterCount}+ title="Filter events"+ >+ {/* Free-text and date bounds don't fit the option-list shape the+ drawer's groups use, so they ride along as extra fields. */}+ <div className="form-group">+ <Label htmlFor="tel-resource-type">Resource type</Label>+ <Input+ id="tel-resource-type"+ value={filters.resource_type}+ onChange={(e) => setFilters({ ...filters, resource_type: e.target.value })}+ placeholder="application"+ /></div>- </div>+ <div className="form-group">+ <Label htmlFor="tel-resource-id">Resource ID</Label>+ <Input+ id="tel-resource-id"+ value={filters.resource_id}+ onChange={(e) => setFilters({ ...filters, resource_id: e.target.value })}+ />+ </div>+ <div className="form-group">+ <Label htmlFor="tel-start">From</Label>+ <Input+ id="tel-start"+ type="datetime-local"+ value={filters.start_date}+ onChange={(e) => setFilters({ ...filters, start_date: e.target.value })}+ />+ </div>+ <div className="form-group">+ <Label htmlFor="tel-end">To</Label>+ <Input+ id="tel-end"+ type="datetime-local"+ value={filters.end_date}+ onChange={(e) => setFilters({ ...filters, end_date: e.target.value })}+ />+ </div>+ </FilterDrawer>- {selectedEvent && (- <div className="telemetry-drawer-backdrop" onClick={() => setSelectedEvent(null)}>- <div className="telemetry-drawer" onClick={(e) => e.stopPropagation()}>- <div className="telemetry-drawer__header">- <h3>Event Details</h3>- <Button variant="ghost" size="sm" onClick={() => setSelectedEvent(null)}>- <X size={16} />- </Button>- </div>- <div className="telemetry-drawer__body">- <div className="telemetry-detail__row">- <span>ID</span>- <code>{selectedEvent.id}</code>- </div>- <div className="telemetry-detail__row">- <span>Timestamp</span>- <span>{new Date(selectedEvent.timestamp).toLocaleString()}</span>- </div>- <div className="telemetry-detail__row">- <span>Source</span>- <span>{selectedEvent.source}</span>- </div>- <div className="telemetry-detail__row">- <span>Type</span>- <span>{selectedEvent.event_type}</span>- </div>- <div className="telemetry-detail__row">- <span>Severity</span>- <span className={`telemetry-detail__severity telemetry-detail__severity--${selectedEvent.severity}`}>- {selectedEvent.severity}- </span>- </div>- <div className="telemetry-detail__row">- <span>Message</span>- <span>{selectedEvent.message || '-'}</span>+ <Drawer+ open={Boolean(selectedEvent)}+ onOpenChange={(open) => { if (!open) setSelectedEvent(null); }}+ title={selectedEvent?.message || selectedEvent?.event_type || 'Event'}+ subtitle={selectedEvent+ ? `${selectedEvent.source} · ${new Date(selectedEvent.timestamp).toLocaleString()}`+ : ''}+ icon={<Activity size={18} />}+ >+ {selectedEvent && (+ <div className="telemetry-detail">+ <dl className="mon-inforows">+ <div><dt>ID</dt><dd><code>{selectedEvent.id}</code></dd></div>+ <div><dt>Type</dt><dd>{selectedEvent.event_type}</dd></div>+ <div>+ <dt>Severity</dt>+ <dd>+ <Pill kind={(SEVERITY_CONFIG[selectedEvent.severity] || SEVERITY_CONFIG.info).tone}>+ {selectedEvent.severity}+ </Pill>+ </dd></div>{selectedEvent.resource_type && (- <div className="telemetry-detail__row">- <span>Resource</span>- <span>{selectedEvent.resource_type}:{selectedEvent.resource_id}</span>+ <div>+ <dt>Resource</dt>+ <dd>{selectedEvent.resource_type}:{selectedEvent.resource_id}</dd></div>)}{selectedEvent.actor_username && (- <div className="telemetry-detail__row">- <span>Actor</span>- <span>{selectedEvent.actor_username}</span>- </div>+ <div><dt>Actor</dt><dd>{selectedEvent.actor_username}</dd></div>)}{selectedEvent.correlation_id && (- <div className="telemetry-detail__row">- <span>Correlation</span>- <button- type="button"- className="telemetry-item__correlation"- onClick={() => handleCorrelationClick(selectedEvent.correlation_id)}- >- {selectedEvent.correlation_id} <ChevronRight size={12} />- </button>+ <div>+ <dt>Correlation</dt>+ <dd>+ <Button+ variant="ghost"+ size="sm"+ onClick={() => {+ setFilters((f) => ({ ...f, correlation_id: selectedEvent.correlation_id }));+ setSelectedEvent(null);+ }}+ >+ {selectedEvent.correlation_id} <ChevronRight size={12} />+ </Button>+ </dd></div>)}- <div className="telemetry-detail__payload">- <span>Payload</span>- <pre>{JSON.stringify(selectedEvent.payload || {}, null, 2)}</pre>- </div>- </div>+ </dl>+ <h4 className="telemetry-detail__heading">Payload</h4>+ <pre className="telemetry-detail__payload">+ {JSON.stringify(selectedEvent.payload || {}, null, 2)}+ </pre></div>- </div>- )}- </>+ )}+ </Drawer>+ </div>);}diff --git a/frontend/src/services/api/index.js b/frontend/src/services/api/index.jsindex 8214450b..e36797dd 100644--- a/frontend/src/services/api/index.js+++ b/frontend/src/services/api/index.js@@ -46,6 +46,7 @@ import * as searchMethods from './search.js';import * as testSandboxMethods from './testSandbox.js';import * as themeMethods from './themes.js';import * as dashboardMethods from './dashboards.js';+import * as monitorMethods from './monitors.js';class ApiService extends ApiClient {constructor() {@@ -99,6 +100,7 @@ class ApiService extends ApiClient {testSandboxMethods,themeMethods,dashboardMethods,+ monitorMethods,];for (const mod of modules) {for (const [key, fn] of Object.entries(mod)) {diff --git a/frontend/src/styles/components/_design-system.scss b/frontend/src/styles/components/_design-system.scssindex 76113ccd..4e506646 100644--- a/frontend/src/styles/components/_design-system.scss+++ b/frontend/src/styles/components/_design-system.scss@@ -643,6 +643,16 @@ $sk-tones: ('accent', 'green', 'cyan', 'amber', 'red', 'violet');&__chips { display: flex; flex-wrap: wrap; gap: 7px; }+ // Host-supplied fields for filters that aren't a pick-from-a-list+ // (free text, date bounds). Sits below the chip groups.+ &__extra {+ display: flex;+ flex-direction: column;+ gap: 14px;+ padding-top: 4px;+ border-top: 1px solid var(--border-soft);+ }+&__chip {display: inline-flex;align-items: center;diff --git a/frontend/src/styles/main.scss b/frontend/src/styles/main.scssindex 749fd6b5..88c6ee05 100644--- a/frontend/src/styles/main.scss+++ b/frontend/src/styles/main.scss@@ -100,6 +100,7 @@@import 'pages/_bandwidth';@import 'pages/_domains';@import 'pages/_monitoring';+@import 'pages/_monitors';@import 'pages/_backups';@import 'pages/_deployments';@import 'pages/_deploy-console';diff --git a/frontend/src/styles/pages/_jobs.scss b/frontend/src/styles/pages/_jobs.scssindex 34a1a1ef..31b2ae3a 100644--- a/frontend/src/styles/pages/_jobs.scss+++ b/frontend/src/styles/pages/_jobs.scss@@ -11,6 +11,15 @@.sk-kpiband-wrap { margin-bottom: $space-5; }}+// ── Activity / Scheduled switch ─────────────────────────────────────────+// This used to be JOBS_TABS in a PageTopbar of its own. Jobs is a Monitoring+// group tab now, so the group's bar owns the tab row and the view switch moved+// in-page — a nav under a nav reads as two competing headers.+.sk-jobs__viewswitch {+ display: flex;+ margin-bottom: $space-4;+}+// ── Slim reset bar (search + filters live in the page top bar; shown only// while filtering) ────────────────────────────────────────────────────.sk-jobs__resultbar {diff --git a/frontend/src/styles/pages/_monitoring.scss b/frontend/src/styles/pages/_monitoring.scssindex 2390c1b3..9b3d75f2 100644--- a/frontend/src/styles/pages/_monitoring.scss+++ b/frontend/src/styles/pages/_monitoring.scss@@ -2,7 +2,14 @@// MONITORING PAGE (redesign — infra console look)// ============================================-.monitoring-page {+// Every page in the Monitoring group shares one `mon-*` vocabulary (panels,+// section heads, hints, info rows). Listing the roots here rather than copying+// the rules is what keeps Monitors / Incidents / the monitor detail page+// looking like the same product as Overview.+.monitoring-page,+.monitors-page,+.incidents-page,+.monitor-detail {// ── shared bits ─────────────────────────────────────────// Mono-uppercase eyebrow section headersdiff --git a/frontend/src/styles/pages/_telemetry.scss b/frontend/src/styles/pages/_telemetry.scssindex 2ce1819f..94221ce6 100644--- a/frontend/src/styles/pages/_telemetry.scss+++ b/frontend/src/styles/pages/_telemetry.scss@@ -1,320 +1,153 @@-.telemetry-page {- padding: $spacing-md;-}+// ============================================+// EVENTS (telemetry stream) — Monitoring group tab+// ============================================+// Rewritten alongside the page. The old rules styled a bespoke KPI strip+// (.telemetry-stat), an inline collapsible filter panel (.telemetry-filters) and+// a hand-rolled drawer — all replaced by the shared DS primitives (KpiBand /+// MetricCard, topbar SearchField + FilterDrawer, DS Drawer, DataTable), so only+// what the DS does not already cover lives here.-.telemetry-filters {- background: $bg-card;- border: 1px solid $border-default;- border-radius: $radius-md;- margin-bottom: $spacing-lg;- overflow: hidden;+.telemetry-page {- &__toggle {+ // Banner shown while the list is pinned to one correlation id.+ .telemetry-trace {display: flex;align-items: center;- gap: $spacing-sm;- width: 100%;- padding: $spacing-md;- background: transparent;- border: none;- color: $text-primary;- font-weight: 500;- cursor: pointer;-- &:hover {- background: $bg-hover;- }- }-- &__count {- display: inline-flex;- align-items: center;- justify-content: center;- min-width: 20px;- height: 20px;- padding: 0 6px;- border-radius: $radius-full;- background: $accent-primary;- color: white;- font-size: 0.75rem;- font-weight: 600;- }-- &__body {- padding: $spacing-md;- border-top: 1px solid $border-default;- }-- &__grid {- display: grid;- grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));- gap: $spacing-md;- margin-bottom: $spacing-md;+ justify-content: space-between;+ gap: 12px;+ flex-wrap: wrap;+ margin: 16px 0 12px;+ padding: 10px 14px;+ border: 1px solid var(--border-soft);+ border-left: 3px solid var(--violet);+ border-radius: 8px;+ background: var(--surface-2);+ font-size: 12.5px;+ color: var(--text-dim);- select,- input {- width: 100%;- padding: $spacing-sm;- border-radius: $radius-sm;- border: 1px solid $border-default;- background: $bg-card;- color: $text-primary;- font-size: 0.875rem;+ code {+ font-family: var(--mono);+ font-size: 11.5px;+ color: var(--violet);}}- &__search {- position: relative;- display: flex;- align-items: center;- margin-bottom: $spacing-md;-- svg {- position: absolute;- left: $spacing-sm;- color: $text-tertiary;- }-- input {- width: 100%;- padding-left: 2rem;- }- }+ .telemetry-table { margin-top: 16px; }- &__actions {- display: flex;- gap: $spacing-sm;- }-}--.telemetry-list {- display: flex;- flex-direction: column;- gap: $spacing-sm;-}--.telemetry-item {- display: flex;- align-items: flex-start;- gap: $spacing-md;- padding: $spacing-md;- background: $bg-card;- border: 1px solid $border-default;- border-radius: $radius-md;- cursor: pointer;- transition: background $transition-fast, border-color $transition-fast;-- &:hover {- background: $bg-hover;- border-color: $border-hover;- }-- &__severity {- flex-shrink: 0;- margin-top: 2px;- }-- &__content {- flex: 1;- min-width: 0;+ .telemetry-cell__message {+ font-size: 13px;+ font-weight: 500;}- &__header {+ .telemetry-cell__meta {display: flex;align-items: center;- gap: $spacing-sm;+ gap: 8px;flex-wrap: wrap;- margin-bottom: $spacing-xs;+ margin-top: 4px;+ font-family: var(--mono);+ font-size: 10.5px;+ color: var(--text-faint);}- &__source {- font-size: 0.75rem;- font-weight: 600;+ .telemetry-cell__source {+ color: var(--accent-bright);text-transform: uppercase;- letter-spacing: 0.05em;- color: $text-tertiary;- }-- &__type {- font-size: 0.75rem;- font-weight: 500;- color: $accent-primary;- background: $accent-bg-soft;- padding: 2px 8px;- border-radius: $radius-sm;+ letter-spacing: 0.03em;}- &__time {- font-size: 0.75rem;- color: $text-tertiary;- margin-left: auto;+ .telemetry-cell__badge {+ padding: 1px 6px;+ border-radius: 4px;+ border: 1px solid var(--border);+ color: var(--text-dim);}- &__message {- font-size: 0.875rem;- color: $text-primary;- margin-bottom: $spacing-xs;- word-break: break-word;+ .telemetry-cell__when {+ font-family: var(--mono);+ font-size: 11.5px;+ color: var(--text-faint);+ white-space: nowrap;}- &__meta {- display: flex;- align-items: center;- gap: $spacing-sm;- flex-wrap: wrap;- }+ .telemetry-cell__muted { color: var(--text-ghost); }- &__badge {- font-size: 0.75rem;- color: $text-tertiary;- background: $bg-hover;- padding: 2px 8px;- border-radius: $radius-sm;- }+ // Severity accent down the left edge of a row — the one visual the DataTable+ // does not provide and the whole point of skimming an event log.+ tr.is-critical,+ tr.is-error { box-shadow: inset 3px 0 0 var(--red); }+ tr.is-warning { box-shadow: inset 3px 0 0 var(--amber); }+ tr.is-debug { opacity: 0.72; }- &__correlation {- display: inline-flex;- align-items: center;- gap: 2px;- font-size: 0.75rem;- color: $accent-primary;- background: transparent;- border: none;- padding: 0;- cursor: pointer;-- &:hover {- text-decoration: underline;- }+ .telemetry-loading,+ .telemetry-more {+ display: flex;+ justify-content: center;+ padding: 18px 0;}-- &--critical { border-left: 3px solid $danger; }- &--error { border-left: 3px solid $danger-hover; }- &--warning { border-left: 3px solid $warning; }- &--info { border-left: 3px solid $info; }- &--debug { border-left: 3px solid $text-tertiary; }-}--.telemetry-empty,-.telemetry-loading {- display: flex;- flex-direction: column;- align-items: center;- justify-content: center;- padding: $spacing-xl;- color: $text-tertiary;- gap: $spacing-md;-}--.telemetry-load-more {- align-self: center;- margin-top: $spacing-md;-}--.telemetry-drawer-backdrop {- position: fixed;- inset: 0;- background: rgba(0, 0, 0, 0.5);- z-index: $z-modal;- display: flex;- justify-content: flex-end;}-.telemetry-drawer {- width: 100%;- max-width: 560px;- height: 100%;- background: $bg-card;- border-left: 1px solid $border-default;+// Event drawer body+.telemetry-detail {display: flex;flex-direction: column;- overflow: hidden;-- &__header {- display: flex;- align-items: center;- justify-content: space-between;- padding: $spacing-md;- border-bottom: 1px solid $border-default;-- h3 {- margin: 0;- font-size: 1rem;- font-weight: 600;- }- }+ gap: 16px;+ padding: 18px;- &__body {- flex: 1;- overflow-y: auto;- padding: $spacing-md;+ &__heading {+ margin: 0;+ font-family: var(--mono);+ font-size: 11px;+ text-transform: uppercase;+ letter-spacing: 0.05em;+ color: var(--text-faint);}-}-.telemetry-detail {- &__row {+ &__payload {+ margin: 0;+ max-height: 340px;+ overflow: auto;+ padding: 12px;+ border-radius: 8px;+ border: 1px solid var(--border-soft);+ background: var(--surface-2);+ font-family: var(--mono);+ font-size: 11.5px;+ line-height: 1.55;+ color: var(--text-dim);+ }++ code {+ font-family: var(--mono);+ font-size: 11.5px;+ }++ // Same definition rows the monitor surfaces use.+ .mon-inforows {+ margin: 0;display: flex;- justify-content: space-between;- align-items: flex-start;- gap: $spacing-md;- padding: $spacing-sm 0;- border-bottom: 1px solid $border-default;- font-size: 0.875rem;+ flex-direction: column;- span:first-child {- color: $text-tertiary;- flex-shrink: 0;- }+ > div {+ display: flex;+ align-items: center;+ justify-content: space-between;+ gap: 16px;+ padding: 9px 0;+ border-bottom: 1px solid var(--border-soft);- span:last-child,- code {- color: $text-primary;- word-break: break-word;- text-align: right;+ &:last-child { border-bottom: none; }}- }-- &__severity {- text-transform: uppercase;- font-size: 0.75rem;- font-weight: 600;- padding: 2px 8px;- border-radius: $radius-sm;- &--critical { background: $danger-bg; color: $danger; }- &--error { background: rgba($danger-hover, 0.15); color: $danger-hover; }- &--warning { background: $warning-bg; color: $warning; }- &--info { background: $info-bg; color: $info; }- &--debug { background: rgba($text-tertiary-raw, 0.15); color: $text-tertiary; }- }-- &__payload {- margin-top: $spacing-md;+ dt { font-size: 12.5px; color: var(--text-faint); }- span {- display: block;- font-size: 0.875rem;- color: $text-tertiary;- margin-bottom: $spacing-sm;- }-- pre {- background: $bg-tertiary;- border: 1px solid $border-default;- border-radius: $radius-md;- padding: $spacing-md;- overflow-x: auto;- font-size: 0.8125rem;- color: $text-primary;+ dd {+ margin: 0;+ font-family: var(--mono);+ font-size: 12.5px;+ color: var(--text-dim);+ text-align: right;+ word-break: break-word;}}}--.spin {- animation: spin 1s linear infinite;-}--@keyframes spin {- from { transform: rotate(0deg); }- to { transform: rotate(360deg); }-}