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
@@ -8,6 +8,7 @@ import { recordAudit } from "../services/audit.js";
|
||||
import { invalidateAlertsCache } from "../services/alerts.js";
|
||||
import { dependentsOf, impactOf, loadGraph, nodeKey, nodeTypes, wouldLoop } from "../services/dependencies.js";
|
||||
import { getSettings } from "../services/settingsStore.js";
|
||||
import { loadDependencySuggestions, loadDismissedDependencies, saveDismissedDependencies } from "../services/dependencySuggestions.js";
|
||||
import { getSourceStatus } from "../services/integrationHealthMonitor.js";
|
||||
import { serverStatus, type MapStatus } from "../services/topology.js";
|
||||
import { asyncHandler } from "../utils/asyncHandler.js";
|
||||
@@ -44,6 +45,43 @@ dependenciesRouter.get("/", asyncHandler(async (_req, res) => {
|
||||
});
|
||||
}));
|
||||
|
||||
// Dependencies worth writing, from what the app already knows (an integration reached at a server's own address). Everyone signed in can see them; operators
|
||||
// add or dismiss them, as they would any dependency.
|
||||
dependenciesRouter.get("/suggestions", asyncHandler(async (_req, res) => {
|
||||
res.json(await loadDependencySuggestions());
|
||||
}));
|
||||
|
||||
const keysSchema = z.object({ keys: z.array(z.string().min(1).max(100)).min(1).max(200) });
|
||||
|
||||
dependenciesRouter.post("/suggestions/add", requireRole("operator"), asyncHandler(async (req, res) => {
|
||||
const parsed = keysSchema.safeParse(req.body);
|
||||
if (!parsed.success) return res.status(400).json({ error: "invalid_body" });
|
||||
const { suggestions } = await loadDependencySuggestions();
|
||||
const wanted = new Set(parsed.data.keys);
|
||||
const added: { id: number; from: string; to: string }[] = [];
|
||||
for (const s of suggestions.filter((x) => wanted.has(x.key))) {
|
||||
const [row] = await db.insert(dependencies).values({ fromType: "integration", fromId: s.from.id, toType: "server", toId: s.to.id }).returning();
|
||||
await recordAudit({ actor: req.currentUser!, category: "dependency", action: "create", targetType: "dependency", targetId: row.id, detail: { from: s.from.name, to: s.to.name, fromKey: `integration:${s.from.id}`, toKey: `server:${s.to.id}`, suggested: true } });
|
||||
added.push({ id: row.id, from: s.from.name, to: s.to.name });
|
||||
}
|
||||
if (added.length > 0) invalidateAlertsCache();
|
||||
res.json({ added, ...(await loadDependencySuggestions()) });
|
||||
}));
|
||||
|
||||
dependenciesRouter.post("/suggestions/dismiss", requireRole("operator"), asyncHandler(async (req, res) => {
|
||||
const parsed = keysSchema.safeParse(req.body);
|
||||
if (!parsed.success) return res.status(400).json({ error: "invalid_body" });
|
||||
const dismissed = await loadDismissedDependencies();
|
||||
for (const k of parsed.data.keys) dismissed.add(k);
|
||||
await saveDismissedDependencies(dismissed);
|
||||
res.json(await loadDependencySuggestions());
|
||||
}));
|
||||
|
||||
dependenciesRouter.post("/suggestions/restore", requireRole("operator"), asyncHandler(async (_req, res) => {
|
||||
await saveDismissedDependencies(new Set());
|
||||
res.json(await loadDependencySuggestions());
|
||||
}));
|
||||
|
||||
// What a thing would take with it, and what it needs itself: for the maintenance and update pages, which say so before it is done.
|
||||
dependenciesRouter.get("/impact", asyncHandler(async (req, res) => {
|
||||
const type = nodeTypes.find((t) => t === req.query.type);
|
||||
|
||||
Reference in new issue
Block a user