Skip to content

ServerKit is a lightweight, modern server control panel for managing web applications, databases, and services on your VPS or dedicated server. Built with Python/Flask backend and React frontend.

feat(views): grounded presets for Monitors, Jobs and Telemetry

Juan Denisfab29ce9b972
diff --git a/frontend/src/pages/Jobs.jsx b/frontend/src/pages/Jobs.jsx
index bf03d352..3be83839 100644
--- a/frontend/src/pages/Jobs.jsx
+++ b/frontend/src/pages/Jobs.jsx
@@ -38,9 +38,49 @@ const POLL_MS = 5000;
// 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
// 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.
const BUILTIN_VIEWS = [
{ name: 'Failed', state: { filters: { status: 'failed', kind: '' } } },
{ name: 'Newest first', state: { sorts: [{ key: 'when', direction: 'desc' }] } },
+ {
+ // 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' }],
+ },
+ },
+ {
+ name: 'Backlog',
+ state: {
+ filters: { status: 'pending', kind: '' }, hiddenKeys: ['progress'],
+ sorts: [{ key: 'when', direction: 'asc' }],
+ },
+ },
+ {
+ name: 'Failures by kind',
+ state: {
+ filters: { status: 'failed', kind: '' }, hiddenKeys: ['owner'],
+ sorts: [{ key: 'kind', direction: 'asc' }, { key: 'when', direction: 'desc' }],
+ },
+ },
+ {
+ name: 'Backup runs',
+ state: {
+ filters: { status: '', kind: 'backup.policy.run' }, hiddenKeys: ['kind'],
+ sorts: [{ key: 'when', direction: 'desc' }],
+ },
+ },
+ {
+ name: 'App deploys',
+ state: {
+ filters: { status: '', kind: 'deploy.app' }, hiddenKeys: ['kind', 'owner'],
+ sorts: [{ key: 'when', direction: 'desc' }],
+ },
+ },
];
// Map a job status to a DS Pill colour.
diff --git a/frontend/src/pages/Monitors.jsx b/frontend/src/pages/Monitors.jsx
index 85963a42..2ee469f1 100644
--- a/frontend/src/pages/Monitors.jsx
+++ b/frontend/src/pages/Monitors.jsx
@@ -87,6 +87,39 @@ 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: [] } },
+ {
+ // 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'],
+ sorts: [{ key: 'uptime_30d', direction: 'asc' }, { key: 'response', direction: 'desc' }],
+ },
+ },
+ {
+ // Paused checks are silent by design; this is how you notice one has
+ // been silent for longer than anybody intended.
+ name: 'Paused — still silenced',
+ state: {
+ search: '', filters: { status: 'paused', type: '' },
+ hiddenKeys: ['last_check_at', 'next_check_at'],
+ sorts: [{ key: 'name', direction: 'asc' }],
+ },
+ },
+ {
+ name: 'Slow web checks',
+ state: {
+ search: '', filters: { status: '', type: 'http' }, hiddenKeys: ['check_type'],
+ sorts: [{ key: 'response', direction: 'desc' }],
+ },
+ },
+ {
+ name: 'In maintenance',
+ state: {
+ search: '', filters: { status: 'maintenance', type: '' }, hiddenKeys: ['next_check_at'],
+ sorts: [{ key: 'name', direction: 'asc' }],
+ },
+ },
];
export default function Monitors() {
diff --git a/frontend/src/pages/Telemetry.jsx b/frontend/src/pages/Telemetry.jsx
index 80cdd4ce..87b55231 100644
--- a/frontend/src/pages/Telemetry.jsx
+++ b/frontend/src/pages/Telemetry.jsx
@@ -62,10 +62,35 @@ const EMPTY_FILTERS = {
// 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.
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' }] },
+ },
];
export default function Telemetry() {