Dependency map, impact preview in maintenance, and a calmer Alerts page
- Map: a Dependencies view showing what would go down with a picked box and what it relies on - Maintenance: lists what depends on a target and can silence those too (same time, audited); the recurring form and update drawer show the same note - Alerts: a headline on where things stand, held-back alerts nested under their cause, severity edge on rows; caused-by now carries the explaining alert's id Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
ec9c2f73f0
commit
9caa414829
19 files changed
+944
-40
No files matched your search
@@ -9,6 +9,7 @@ import { invalidateAlertsCache } from "../services/alerts.js";
|
||||
import { requireAuth, requireRole } from "../auth/middleware.js";
|
||||
import { recordAudit } from "../services/audit.js";
|
||||
import { describeTarget, listActiveWindows, listUpcomingWindows, startOrExtendWindow } from "../services/maintenance.js";
|
||||
import { impactOf } from "../services/dependencies.js";
|
||||
import { KumaSyncError, syncKumaMaintenance } from "../services/kumaMaintenanceSync.js";
|
||||
import { loadIntegrationConfig } from "../integrations/loadIntegration.js";
|
||||
import { createUptimeKumaAdapter } from "../integrations/uptimekuma/adapter.js";
|
||||
@@ -56,6 +57,8 @@ const startSchema = z.object({
|
||||
// Required and capped: an open-ended window is the way this feature could quietly hide a real outage.
|
||||
minutes: z.number().int().min(5).max(7 * 24 * 60),
|
||||
reason: z.string().max(200).optional(),
|
||||
// Also put what depends on the target under maintenance, for the same time: it will look down while the target is.
|
||||
withDependents: z.boolean().optional(),
|
||||
});
|
||||
|
||||
maintenanceRouter.post("/", requireRole("operator"), asyncHandler(async (req, res) => {
|
||||
@@ -63,7 +66,7 @@ maintenanceRouter.post("/", requireRole("operator"), asyncHandler(async (req, re
|
||||
if (!parsed.success) {
|
||||
return res.status(400).json({ error: "invalid_body", details: parsed.error.flatten() });
|
||||
}
|
||||
const { targetType, targetId, minutes, reason } = parsed.data;
|
||||
const { targetType, targetId, minutes, reason, withDependents } = parsed.data;
|
||||
|
||||
const actor = req.currentUser!;
|
||||
const createdBy = actor.name ?? actor.email ?? actor.oidcSub;
|
||||
@@ -73,6 +76,19 @@ maintenanceRouter.post("/", requireRole("operator"), asyncHandler(async (req, re
|
||||
return res.status(404).json({ error: "not_found", message: "That target doesn't exist." });
|
||||
}
|
||||
|
||||
// What depends on it goes down with it, so it is silenced for the same time (and says why).
|
||||
const alsoSilenced: { type: "server" | "integration"; id: number; name: string }[] = [];
|
||||
if (withDependents && (targetType === "server" || targetType === "integration")) {
|
||||
const impact = await impactOf(targetType, targetId);
|
||||
for (const d of impact?.dependents ?? []) {
|
||||
const also = await startOrExtendWindow(d.type, d.id, minutes, `Depends on ${result.target.name}${reason ? ` — ${reason}` : ""}`.slice(0, 200), createdBy);
|
||||
if (also) {
|
||||
alsoSilenced.push({ type: d.type, id: d.id, name: also.target.name });
|
||||
await recordAudit({ actor, category: "maintenance", action: also.extended ? "extend" : "start", targetType: d.type, targetId: d.id, detail: { name: also.target.name, minutes, reason: `depends on ${result.target.name}`, dependsOn: result.target.name } });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
await recordAudit({
|
||||
actor,
|
||||
category: "maintenance",
|
||||
@@ -83,7 +99,7 @@ maintenanceRouter.post("/", requireRole("operator"), asyncHandler(async (req, re
|
||||
});
|
||||
|
||||
invalidateAlertsCache();
|
||||
res.status(201).json({ window: { ...result.window, targetName: result.target.name, targetKind: result.target.kind } });
|
||||
res.status(201).json({ window: { ...result.window, targetName: result.target.name, targetKind: result.target.kind }, alsoSilenced });
|
||||
}));
|
||||
|
||||
const importUptimeKumaSchema = z.object({
|
||||
|
||||
Reference in new issue
Block a user