Add a since-you-last-looked summary, 30-day uptime ribbons, a maintenance timeline and hover timestamps

- Dashboard card on what changed since the user pressed Got it (users.last_looked_at,
  migration 0021), folding each problem and its recovery into one line.
- Uptime ribbons on servers and integrations, built from the audit log; integrations'
  failing/working-again moments are now recorded.
- Timeline of running and scheduled maintenance windows on the Maintenance page.
- TimeAgo component: relative times with the exact time in the chosen format on hover.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
bobbanandClaude Sonnet 5.5 committed 2026-10-16 21:55:04 +02:00
1 parent 3945c60681
commit 906220040e
32 files changed
+3380 -15

No files matched your search

+26
View File
@@ -5,6 +5,7 @@ import { db } from "../db/client.js";
import { users } from "../db/schema.js";
import { requireAuth } from "../auth/middleware.js";
import { asyncHandler } from "../utils/asyncHandler.js";
import { FIRST_LOOKBACK_MS, getChangesSince } from "../services/changesSince.js";
export const meRouter = Router();
@@ -43,3 +44,28 @@ meRouter.put("/favorites", requireAuth, asyncHandler(async (req, res) => {
await db.update(users).set({ favorites: JSON.stringify(paths) }).where(eq(users.id, req.currentUser!.id));
res.json({ favorites: paths });
}));
const CHANGES_SHOWN = 8;
// What happened since this person last pressed "Got it" on the dashboard (or in the last day, the first time). Only reads.
meRouter.get("/changes", requireAuth, asyncHandler(async (req, res) => {
const user = req.currentUser!;
const now = new Date();
const stored = user.lastLookedAt ? Date.parse(user.lastLookedAt) : NaN;
const since = new Date(Number.isFinite(stored) ? stored : now.getTime() - FIRST_LOOKBACK_MS);
const report = await getChangesSince({ since, now, actorId: user.id, canSeeAudit: user.role === "admin" || user.role === "operator" });
res.json({
since: report.since,
firstTime: !Number.isFinite(stored),
events: report.events.slice(0, CHANGES_SHOWN),
moreEvents: Math.max(0, report.events.length - CHANGES_SHOWN),
changesByOthers: report.changesByOthers,
});
}));
// "Got it": the next summary starts from now. Only ever for the signed-in person.
meRouter.post("/changes/seen", requireAuth, asyncHandler(async (req, res) => {
const at = new Date().toISOString();
await db.update(users).set({ lastLookedAt: at }).where(eq(users.id, req.currentUser!.id));
res.json({ lastLookedAt: at });
}));
+11
View File
@@ -0,0 +1,11 @@
import { Router } from "express";
import { requireAuth } from "../auth/middleware.js";
import { asyncHandler } from "../utils/asyncHandler.js";
import { getUptime } from "../services/uptimeHistory.js";
export const uptimeRouter = Router();
// Anyone signed in who can see the server and integration lists can see how those have been doing.
uptimeRouter.get("/", requireAuth, asyncHandler(async (_req, res) => {
res.json(await getUptime());
}));