feat: audit log, device tags, maintenance windows (v0.11.3 Beta)

- Audit log: middleware captures all write operations, paginated admin UI in Settings
- Device tags: full CRUD, device assignment, filter bar and chips on Devices page
- Maintenance windows: alert suppression during planned downtime, Settings management UI

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2GT-Rich
2026-05-16 15:33:15 -07:00
co-authored by Claude Sonnet 4.6
parent 6a4ab1fc5f
commit 49ab1b002e
16 changed files with 801 additions and 10 deletions
+17 -1
View File
@@ -67,7 +67,23 @@ router.get('/', async (_req: Request, res: Response) => {
rack_name, rack_slot, created_at
FROM devices ORDER BY name ASC`
);
res.json(devices);
// Attach tags to each device
const tagRows = await query<{ device_id: number; id: number; name: string; color: string }>(
`SELECT dt.device_id, t.id, t.name, t.color
FROM device_tags dt JOIN tags t ON t.id = dt.tag_id`
);
const tagsByDevice: Record<number, { id: number; name: string; color: string }[]> = {};
for (const t of tagRows) {
if (!tagsByDevice[t.device_id]) tagsByDevice[t.device_id] = [];
tagsByDevice[t.device_id].push({ id: t.id, name: t.name, color: t.color });
}
const result = (devices as { id: number }[]).map((d) => ({
...d,
tags: tagsByDevice[d.id] ?? [],
}));
res.json(result);
});
// ─── Routers overview (router-type devices with route counts) ─────────────────