diff --git a/NOTIFICATIONS.md b/NOTIFICATIONS.md
index 2815c9c..b4f447c 100644
--- a/NOTIFICATIONS.md
+++ b/NOTIFICATIONS.md
@@ -4,9 +4,16 @@ Every notification in Homelab Manager is sent through the same pipe
(`server/src/services/notify.ts`) to whichever channels are enabled under
**Settings → Notifications**: Gotify, ntfy, SMTP (email), and a generic
JSON webhook. All four fire for every notification below — there's no
-per-event channel routing, only a per-event on/off toggle (the "Notify
-on" list on that same page) and, for the daily ones, one shared
-time/timezone.
+per-event channel routing, only a per-event on/off toggle and, for the
+daily ones, one shared time/timezone.
+
+The settings page has three tabs, with one Save button for all of them (it
+shows "Unsaved changes" until you save, and the browser asks before the page
+is closed with changes unsaved): **Channels** (the four channels, each a row
+you open to fill in and send a test), **What to send** (the event toggles
+grouped by topic, each group's thresholds beside its switches) and **When**
+(the time zone, the daily reminder time, quiet hours and the weekly digest).
+The address keeps the tab, e.g. `/settings/notifications?tab=when`.
Two settings apply to *every* notification regardless of what triggered
it:
diff --git a/web/src/pages/settings/NotificationSettings.tsx b/web/src/pages/settings/NotificationSettings.tsx
index fc186a3..ffe5a75 100644
--- a/web/src/pages/settings/NotificationSettings.tsx
+++ b/web/src/pages/settings/NotificationSettings.tsx
@@ -1,4 +1,5 @@
-import { useEffect, useState } from "react";
+import { useEffect, useRef, useState, type KeyboardEvent, type ReactNode } from "react";
+import { useSearchParams } from "react-router-dom";
import {
api,
type AppSettings,
@@ -74,6 +75,14 @@ const DIGEST_DAYS: { value: number; label: string }[] = [
const DEFAULT_HEALTH_CHECKS: HealthCheckSettings = { serverOfflineMinutes: 60, diskUsagePercent: 90, domainWarnDays: 30, diskForecastDays: 14 };
type TestResult = { ok: boolean; message: string } | null;
+type EventKey = { [K in keyof NotificationEvents]: NotificationEvents[K] extends boolean ? K : never }[keyof NotificationEvents];
+
+const TABS = [
+ { id: "channels", label: "Channels" },
+ { id: "events", label: "What to send" },
+ { id: "when", label: "When" },
+] as const;
+type TabId = (typeof TABS)[number]["id"];
function TestBadge({ result }: { result: TestResult }) {
if (!result) return null;
@@ -84,12 +93,126 @@ function TestBadge({ result }: { result: TestResult }) {
);
}
+/** The host of an address, for a channel's one-line summary — never the whole address, which can carry a token. */
+function hostOf(address: string): string {
+ try {
+ return new URL(address).host;
+ } catch {
+ return address;
+ }
+}
+
+/** One channel in the list: its name, whether it is on and filled in, and (opened) its settings. */
+function ChannelRow({
+ name,
+ description,
+ enabled,
+ onToggle,
+ summary,
+ complete,
+ open,
+ onOpen,
+ children,
+}: {
+ name: string;
+ description: ReactNode;
+ enabled: boolean;
+ onToggle: (on: boolean) => void;
+ /** What it is set to send to, once filled in ("elsa.lab", "my-topic"). */
+ summary: string;
+ complete: boolean;
+ open: boolean;
+ onOpen: () => void;
+ children: ReactNode;
+}) {
+ const panelId = `channel-${name.replace(/\W+/g, "-").toLowerCase()}`;
+ return (
+
+
+
+
+
+
+ {name}{" "}
+ {enabled && complete && On}
+ {enabled && !complete && On, but not filled in}
+ {!enabled && complete && Off}
+ {!enabled && !complete && Not set up}
+
- From each agent server's own history, shown on the Alerts page and dashboard (not sent as a notification). Needs a few days of
- steady growth to say anything. 0 turns it off.
-
-
-
- Domain expiry warning
-
- setHealthChecks((h) => ({ ...h, domainWarnDays: Number(e.target.value) }))}
- />
- days before
-
- Shared by the secret, Tailscale key, Docker update, Proxmox backup, Proxmox Backup Server, and
- domain expiry reminders above.
-
-
-
- Timezone
-
-
-
- );
- })()}
-
-
-
-
-
-
-
-
Quiet hours
-
-
-
- Notifications that fire during this window are held instead of sent immediately, then delivered
- as one digest at the end time (in the timezone set above). Scheduled daily reminders already only
- fire once at a time you pick, so this mainly affects instant ones — DNS changes and integration
- failure/recovery alerts.
-
- One message a week through the channels above, in the time zone set above: what is wrong now, what was down and for how long, what happened,
- disks heading for full, things about to expire, updates waiting and maintenance coming up. A topic with nothing to say is left out, and a
- quiet week says so in one line. Quiet hours hold it like any other notification.
-
+ Shared by the secret, Tailscale key, Docker update, Proxmox backup, Proxmox Backup Server, and domain expiry reminders (switched on under What to send).
+
-
-
-
+
+
+
+
+
+
+
Quiet hours
-
Settings above are saved with the Save button; the preview and "send it now" don't depend on them.
-
- {digestPreview && (
-
-
{digestPreview.title}
-
- {digestPreview.message}
-
+
+
+ Notifications that fire during this window are held instead of sent immediately, then delivered as one digest at the end time (in the time zone
+ set here). Scheduled daily reminders already only fire once at a time you pick, so this mainly affects instant ones — DNS changes and integration
+ failure/recovery alerts.
+
+ One message a week through the channels that are on, in the time zone set here: what is wrong now, what was down and for how long, what happened,
+ disks heading for full, things about to expire, updates waiting and maintenance coming up. A topic with nothing to say is left out, and a quiet week
+ says so in one line. Quiet hours hold it like any other notification.
+