feat(server): scheduled jobs on the server and a Scheduled tab in the admin panel

Owner review 2, R10: nothing may run out of sight, so every timer the server
ran becomes a system schedule the admin panel shows and manages, and
administrators create their own.

- SchedulerHost runs the shared Scheduler on the job engine (started after
  JobEngineHost, stopped before it); ServerScheduleHost gives it the
  container's time zone (UTC with a warning when TZ is unknown), the archive
  refreshed from archive.json at every run (what ArchivePolling did), the
  clean-up steps and the system schedules: archive-scan every 10 minutes
  (no catch-up, also run once at start like the polling), upload-cleanup
  every 30 minutes, index-backup at 03:00 (SQLite only), housekeeping (job
  history) at 04:00 and audit-cleanup at 04:30.
- ArchivePolling and DatabaseBackupService are gone; UploadMaintenance only
  recovers commits at start, its sweep is the "uploads" clean-up step.
- /api/v1/schedules (ManageArchive, audited): list with actions and time
  zone, create, PUT/PATCH, delete (409 schedule_system), run now (409
  schedule_pending), reset (409 schedule_no_defaults), runs paged by cursor;
  invalid fields are 400 invalid_schedule naming the field.
- CHRONOS_AUDIT_RETENTION_DAYS (AuditRetentionDays, default 365) seeds the
  audit clean-up; set by the environment it is applied at every start and
  locked. Job history leaves Settings: it is the housekeeping schedule's age
  limit, and the setting is what a reset restores.
- Admin panel: Jobs has Queue and Scheduled tabs; schedules with when (in
  the panel's language and the server's zone), next run, last result, a
  switch, Run now, Edit, Delete or Reset, their runs linking to the jobs, and
  a side panel for the action, recurrence and parameters; job rows a
  schedule queued carry a Scheduled pill. Strings in en and it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 808ce94ae29e3bf4522cb4d40dfd76d4f8529c64)
This commit is contained in:
Alby96 committed 2026-10-27 02:25:01 +01:00
1 parent e5508e7e69
commit 75daab7275
66 files changed
+1985 -290

No files matched your search

+20
View File
@@ -223,9 +223,24 @@ svg.chart .label { fill: var(--text-muted); }
.table.nodes.fit-1 .col-owner, .table.nodes.fit-1 .col-heartbeat { display: none; }
.table.audit.fit-1 { grid-template-columns: max-content minmax(70px, .8fr) minmax(90px, max-content) minmax(100px, 2fr); }
.table.audit.fit-1 .col-from { display: none; }
/* Scheduled jobs (owner review 2, R10): name, action, when, next run, last result, switch, actions. */
.table.schedules { grid-template-columns: minmax(130px, 1.3fr) minmax(80px, max-content) minmax(110px, 1fr) max-content minmax(90px, max-content) max-content max-content; }
.table.schedules.fit-1 { grid-template-columns: minmax(130px, 1.3fr) minmax(110px, 1fr) max-content minmax(90px, max-content) max-content max-content; }
.table.schedules.fit-1 .col-action { display: none; }
.table.schedules.fit-2 { grid-template-columns: minmax(120px, 1.3fr) minmax(100px, 1fr) max-content max-content max-content; }
.table.schedules.fit-2 .col-last { display: none; }
.table-foot { display: flex; align-items: center; gap: 16px; padding: 10px 18px; font-size: 12px; }
.table-foot a { white-space: nowrap; }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; }
/* A name with a pill after it (a system schedule, a job a schedule queued). */
.name-cell { display: flex; align-items: center; gap: 8px; min-width: 0; }
.pill { flex: none; display: inline-flex; align-items: center; height: 20px; padding: 0 8px; border: 1px solid var(--stroke); border-radius: 12px; font-size: 11px; color: var(--text-muted); white-space: nowrap; text-decoration: none; }
a.pill:hover { border-color: var(--accent); color: var(--accent); }
/* The runs of a schedule, under its row: kind, state, time and a link to the job. */
.runs { display: grid; grid-template-columns: minmax(0, max-content) max-content max-content max-content; gap: 6px 18px; align-items: center; padding: 10px 18px; background: var(--bg); border-top: 1px solid var(--stroke); }
.runs .run { display: contents; }
.runs .more { grid-column: 1 / -1; justify-self: start; }
.table .row.log-row .empty { background: var(--bg); border-top: 1px solid var(--stroke); }
.person { display: flex; align-items: center; gap: 10px; min-width: 0; }
.stack { display: flex; flex-direction: column; min-width: 0; }
.stack small { font-size: 11px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@@ -253,6 +268,11 @@ pre.log.tall { max-height: 60vh; border-top: 0; }
.form legend { color: var(--text-muted); margin-bottom: 8px; padding: 0; }
.form h2 { font-size: 16px; }
.inline { display: flex; align-items: center; gap: 8px; }
.form-group { display: grid; gap: 12px; }
.form-group:empty { display: none; }
.days { display: flex; flex-wrap: wrap; gap: 8px 14px; }
/* Each tab of a page draws into its own body; its children lay out as the page's own. */
.tab-body { display: contents; }
.buttons { display: flex; gap: 8px; justify-content: flex-end; }
.error { color: var(--error); min-height: 18px; }
.settings { display: grid; gap: 20px; }