Add status pages (a share link kind) and a downloadable Grafana dashboard
- Share links can open a status page: an admin picks servers, integrations and Uptime Kuma monitors and names them; the public sees only those names, Working / Not working / Being worked on / Can't tell, an optional message and the 30-day figure (share_links.kind/ title/message and status_items, migration 0033). A status address doesn't open the wall and the other way round; Uptime Kuma is asked at most every 30 seconds - Grafana dashboard built from code (download in Settings -> API and webhooks); a test checks it only uses series /metrics serves - Tests and docs Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
2744a84719
commit
5cc51c57de
24 files changed
+4880
-35
No files matched your search
@@ -514,6 +514,10 @@ export const alertTickets = sqliteTable(
|
||||
export const shareLinkDetails = ["summary", "names"] as const;
|
||||
export type ShareLinkDetail = (typeof shareLinkDetails)[number];
|
||||
|
||||
// What a link opens: the wall display (how things are, for a TV), or a status page (is each of the things I chose working, for people at home).
|
||||
export const shareLinkKinds = ["wall", "status"] as const;
|
||||
export type ShareLinkKind = (typeof shareLinkKinds)[number];
|
||||
|
||||
// A link to the wall display that needs no sign-in, for a TV in the hall or someone who only wants to know if things are up. Only a hash
|
||||
// of the secret part of the address is kept (like an agent token), so it can't be read back out of the database or a backup.
|
||||
export const shareLinks = sqliteTable("share_links", {
|
||||
@@ -523,6 +527,10 @@ export const shareLinks = sqliteTable("share_links", {
|
||||
tokenPrefix: text("token_prefix").notNull(), // the first characters, to tell links apart in the list
|
||||
// summary = how things are, in numbers; names = also the names of what is wrong, in maintenance, and the integrations
|
||||
detail: text("detail").$type<ShareLinkDetail>().notNull().default("summary"),
|
||||
kind: text("kind").$type<ShareLinkKind>().notNull().default("wall"),
|
||||
// A status page's own heading and an optional announcement under it ("Movies are being updated tonight"). Unused by a wall.
|
||||
title: text("title"),
|
||||
message: text("message"),
|
||||
createdBy: text("created_by"),
|
||||
createdAt: text("created_at")
|
||||
.notNull()
|
||||
@@ -531,6 +539,25 @@ export const shareLinks = sqliteTable("share_links", {
|
||||
lastUsedAt: text("last_used_at"), // ISO
|
||||
});
|
||||
|
||||
// What a status page shows, in order: each with the name people will recognise, and what it points at.
|
||||
export const statusItemKinds = ["server", "integration", "monitor"] as const;
|
||||
export type StatusItemKind = (typeof statusItemKinds)[number];
|
||||
export const statusItems = sqliteTable(
|
||||
"status_items",
|
||||
{
|
||||
id: integer("id").primaryKey({ autoIncrement: true }),
|
||||
linkId: integer("link_id")
|
||||
.notNull()
|
||||
.references(() => shareLinks.id, { onDelete: "cascade" }),
|
||||
position: integer("position").notNull().default(0),
|
||||
label: text("label").notNull(),
|
||||
kind: text("kind").$type<StatusItemKind>().notNull(),
|
||||
targetId: integer("target_id").notNull(), // the server, the integration, or the Uptime Kuma a monitor belongs to — a plain reference, not a foreign key
|
||||
monitorId: text("monitor_id"), // Uptime Kuma's id for the monitor (kind = monitor)
|
||||
},
|
||||
(t) => [index("status_items_link_idx").on(t.linkId, t.position)],
|
||||
);
|
||||
|
||||
// ─── Recurring maintenance ──────────────────────────────────────────────────
|
||||
|
||||
// "Every Sunday 02:00–04:00 on these servers": a schedule kept here, turned into ordinary maintenance windows a week ahead (each marked
|
||||
|
||||
Reference in new issue
Block a user