Racks, notes and to-do, OS support, suggested dependencies, Nginx Proxy Manager and Home Assistant
- Racks page and a network diagram (UniFi tree with servers, printable) - Notes on servers and devices; To do list shown in Coming up and My work - Agents report the operating system (Linux 7, Windows 6); end-of-life badge and alert - Suggested dependencies from where a service is reached - Nginx Proxy Manager integration: proxy hosts page, certificate and host alerts, suggested checks - Home Assistant integration: watch chosen entities, history chart, limit and unavailable alerts - TimeChart gets a "value" scale that fits negatives; docs updated Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
68b41b5586
commit
18ceed62e8
77 files changed
+20432
-35
No files matched your search
@@ -11,11 +11,14 @@ import { servers, updateRuns } from "../db/schema.js";
|
||||
import { getAlerts } from "./alerts.js";
|
||||
import { loadAcks } from "./alertAcks.js";
|
||||
import { describeTarget, listActiveWindows } from "./maintenance.js";
|
||||
import { openTodosFor } from "./todos.js";
|
||||
|
||||
/** An acknowledgement that runs out within this long is flagged. */
|
||||
export const ACK_ENDS_SOON_MS = 24 * 3600_000;
|
||||
/** A maintenance window that ends within this long is flagged. */
|
||||
export const WINDOW_ENDS_SOON_MS = 2 * 3600_000;
|
||||
/** A job handed to somebody is flagged from this many days before it is due (and once it is past). */
|
||||
export const TODO_DUE_SOON_DAYS = 2;
|
||||
/** A finished update run stays on the list this long, so the result is seen. */
|
||||
export const RUN_KEPT_MS = 24 * 3600_000;
|
||||
|
||||
@@ -44,6 +47,8 @@ export interface MyWork {
|
||||
}[];
|
||||
windows: { id: number; targetType: string; targetId: number; targetName: string; targetKind: string; reason: string | null; startedAt: string; endsAt: string; endsSoon: boolean }[];
|
||||
updateRuns: { id: number; serverId: number; serverName: string; templateName: string; status: string; message: string | null; startedAt: string; finishedAt: string | null; running: boolean; updatesBefore: number | null; updatesAfter: number | null; rebootRequired: boolean }[];
|
||||
/** Open jobs from the to-do list handed to this person, the soonest due first. */
|
||||
todos: { id: number; title: string; detail: string | null; dueDate: string | null; overdue: boolean; dueSoon: boolean; target: { type: string; id: number; name: string } | null }[];
|
||||
/** How many of the above want a look: acknowledgements and windows that end soon, alerts handed to them, update runs still going. */
|
||||
needsAttention: number;
|
||||
}
|
||||
@@ -111,6 +116,18 @@ export async function buildMyWork(user: MyWorkUser, now: Date = new Date()): Pro
|
||||
}
|
||||
runs.sort((a, b) => Number(b.running) - Number(a.running) || b.startedAt.localeCompare(a.startedAt));
|
||||
|
||||
const needsAttention = alerts.filter((a) => a.role === "handed" || a.endsSoon).length + windows.filter((w) => w.endsSoon).length + runs.filter((r) => r.running).length;
|
||||
return { alerts, windows, updateRuns: runs, needsAttention };
|
||||
const today = now.toISOString().slice(0, 10);
|
||||
const soon = new Date(nowMs + TODO_DUE_SOON_DAYS * 86_400_000).toISOString().slice(0, 10);
|
||||
const jobs: MyWork["todos"] = (await openTodosFor(user.id)).map((t) => ({
|
||||
id: t.id,
|
||||
title: t.title,
|
||||
detail: t.detail,
|
||||
dueDate: t.dueDate,
|
||||
overdue: t.dueDate !== null && t.dueDate < today,
|
||||
dueSoon: t.dueDate !== null && t.dueDate >= today && t.dueDate <= soon,
|
||||
target: t.target,
|
||||
}));
|
||||
|
||||
const needsAttention = alerts.filter((a) => a.role === "handed" || a.endsSoon).length + windows.filter((w) => w.endsSoon).length + runs.filter((r) => r.running).length + jobs.filter((j) => j.overdue || j.dueSoon).length;
|
||||
return { alerts, windows, updateRuns: runs, todos: jobs, needsAttention };
|
||||
}
|
||||
Reference in new issue
Block a user