feat: audit log / history timeline on instance detail page
All checks were successful
CI / test (pull_request) Successful in 13s
CI / build-dev (pull_request) Has been skipped

Adds an instance_history table that records every field change:
- createInstance logs a 'created' event
- updateInstance diffs old vs new and logs one row per changed field
  (name, state, stack, vmid, tailscale_ip, all service flags)
- History is stored under the new vmid when vmid changes

New endpoint: GET /api/instances/:vmid/history

The 'timestamps' section on the detail page is replaced with a
grid timeline showing timestamp | field | old → new for each event.
State changes are colour-coded (deployed=green, testing=amber,
degraded=red). Boolean service flags display as on/off.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-28 14:35:35 -04:00
parent b48d5fb836
commit cb01573cdf
8 changed files with 168 additions and 10 deletions

View File

@@ -628,6 +628,30 @@ select:focus { border-color: var(--accent); }
.confirm-actions { display: flex; justify-content: flex-end; gap: 10px; }
/* ── HISTORY TIMELINE ── */
.tl-item {
display: grid;
grid-template-columns: 160px 140px 1fr;
gap: 0 12px;
padding: 7px 0;
border-bottom: 1px solid var(--border);
font-size: 12px;
align-items: baseline;
}
.tl-item:last-child { border-bottom: none; }
.tl-time { color: var(--text3); font-size: 11px; white-space: nowrap; }
.tl-field { color: var(--text2); }
.tl-change { display: flex; align-items: baseline; gap: 6px; }
.tl-old { color: var(--text3); text-decoration: line-through; }
.tl-arrow { color: var(--text3); }
.tl-new { color: var(--text); }
.tl-deployed { color: var(--accent); }
.tl-testing { color: var(--amber); }
.tl-degraded { color: var(--red); }
.tl-created .tl-field { color: var(--accent); }
.tl-created .tl-change { color: var(--text3); }
.tl-empty { color: var(--text3); font-size: 12px; padding: 8px 0; }
/* ── SETTINGS MODAL ── */
#settings-modal .modal-body { padding-top: 0; }
.settings-section { padding: 16px 0; border-bottom: 1px solid var(--border); }