Speedtest Tracker, Costs, "Having trouble" on status pages, grouped Integrations and Dashboard

- Speedtest Tracker integration: charts, alerts for a slow line (median of the
  last three tests under a share of what is paid for) and for failing tests.
- Costs page (Records): things paid for by hand plus Hetzner's estimate, totals
  per currency, bills rolled forward into Coming up as Renewals.
- Status pages: a "Having trouble" state for things that answer but have an open
  alert; Speedtest reads as the internet.
- Integrations page and kind picker grouped like the sidebar (one shared types
  file); Notifications "What to send" shown one group at a time; Dashboard
  integration sections follow the menu groups, with tiles for integrations that
  have no widget.
- Docs, tests, and ROLES.md menu table brought up to date.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
bobbanandClaude Sonnet 5.5 committed 2026-10-26 23:23:46 +01:00
1 parent 78822346b1
commit f86661f6c9
49 files changed
+18156 -238

No files matched your search

+39
View File
@@ -562,6 +562,7 @@ export const integrationTypes = [
"netbox",
"n8n",
"hetzner",
"speedtest",
] as const;
export type IntegrationType = (typeof integrationTypes)[number];
@@ -1219,6 +1220,44 @@ export const nextcloudState = sqliteTable("nextcloud_state", {
updatedAt: text("updated_at").notNull(), // ISO
});
// ─── Costs ──────────────────────────────────────────────────────────────────
// Things paid for by hand (a domain, a VPN, a licence, a subscription), one row each: what it costs per month or per year, in which currency, and optionally the day it is billed on —
// an anchor from which the next renewal is worked out, not a date to keep up to date. What can be read (a Hetzner project's estimate) is not here. Read by services/costs.ts.
export const costItems = sqliteTable("cost_items", {
id: integer("id").primaryKey({ autoIncrement: true }),
name: text("name").notNull(),
amount: real("amount").notNull(), // per period, including VAT
currency: text("currency").notNull(), // three capital letters: EUR, SEK …
period: text("period").notNull(), // month | year
category: text("category").notNull().default("Other"),
renewsOn: text("renews_on"), // YYYY-MM-DD: a day it is (or will first be) billed; null: not said
note: text("note"),
createdAt: text("created_at").notNull(), // ISO
updatedAt: text("updated_at").notNull(), // ISO
});
// ─── Speedtest Tracker ──────────────────────────────────────────────────────
// The speed tests a Speedtest Tracker (an integration of type "speedtest") has made, one row for each, kept for 90 days: when, how fast down and up (bits per second) and the ping (ms).
// Stored once under Speedtest Tracker's own id and never changed. A failed or skipped test has no speeds. Read by services/speedtestSync.ts.
export const speedtestResults = sqliteTable(
"speedtest_results",
{
integrationId: integer("integration_id")
.notNull()
.references(() => integrations.id, { onDelete: "cascade" }),
resultId: integer("result_id").notNull(), // Speedtest Tracker's own id
at: text("at").notNull(), // ISO: when the test was made
status: text("status").notNull(), // completed, failed, skipped …
downloadBps: real("download_bps"),
uploadBps: real("upload_bps"),
pingMs: real("ping_ms"),
healthy: integer("healthy", { mode: "boolean" }), // Speedtest Tracker's own judgement by its thresholds; null: it did not say
},
(t) => [primaryKey({ columns: [t.integrationId, t.resultId] }), index("speedtest_results_at_idx").on(t.integrationId, t.at)],
);
// ─── Hetzner Cloud ──────────────────────────────────────────────────────────
// How a Hetzner Cloud project (an integration of type "hetzner"; a token belongs to one project) is right now, one row each, replaced at every read: its servers, volumes, snapshots and