UniFi: servers plugged into switches; server page in sections; My work; settings search and undo

UniFi: the controller's client list is matched to servers by IP address, so a
server is connected through a switch or access point (and port). That is a
dependency made by itself, shown on the server page, the Network devices page
and the Connections map. IP Addresses can sync the devices' addresses.

A server's page is split into Overview, Health, Network, History, Tasks and
Settings, by ?view=; alerts link to the section they are about.

My work lists what has your name on it: alerts you have, maintenance you
started (extend, end with undo) and update runs you started, with a badge.

Settings has a search box (and the command palette lists every setting).
Removing a dependency, admin link, runbook, hand-made IP address, port opening
or restore test is undone from the message instead of asked about first.

Two backup tests used a fixed date and failed as days passed; they follow the
real clock now.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
bobbanandClaude Sonnet 5.5 committed 2026-10-20 19:35:45 +02:00
1 parent 396e074108
commit 5e26e77340
45 files changed
+6224 -194

No files matched your search

+82
View File
@@ -0,0 +1,82 @@
/**
* Every setting worth looking for, and where it is: used by the search box on the Settings page and by the command palette. It is kept by hand — add a line when a
* setting is added — and `words` are the other ways somebody might ask for it (what it does, what it is called elsewhere).
*/
export interface SettingsEntry {
title: string;
/** Where it is, in words: "Notifications › What to send". */
where: string;
/** The address that opens it. */
to: string;
words: string;
}
const N = "/settings/notifications";
export const SETTINGS_INDEX: SettingsEntry[] = [
// Notifications
{ title: "Gotify, ntfy, email and webhook channels", where: "Notifications › Channels", to: `${N}?tab=channels`, words: "gotify ntfy smtp email mail webhook push channel test send where notifications go" },
{ title: "Browser and phone push", where: "Notifications › Channels", to: `${N}?tab=channels`, words: "web push browser phone device subscribe pwa notify vapid" },
{ title: "Server offline after (minutes)", where: "Notifications › What to send › Servers and disks", to: `${N}?tab=events`, words: "offline stopped reporting silent agent threshold limit minutes" },
{ title: "Disk usage alert at (percent)", where: "Notifications › What to send › Servers and disks", to: `${N}?tab=events`, words: "disk full storage percent threshold space" },
{ title: "Warn when a disk will fill within (days)", where: "Notifications › What to send › Servers and disks", to: `${N}?tab=events`, words: "disk forecast fill growth trend days" },
{ title: "Warn when a server starts listening on a new port", where: "Notifications › What to send › Servers and disks", to: `${N}?tab=events`, words: "new port baseline listening tcp monitoring" },
{ title: "Call an alert flapping after (raises in an hour)", where: "Notifications › What to send › Servers and disks", to: `${N}?tab=events`, words: "flapping flap noise repeat raised cleared again hold back" },
{ title: "Alert when a network device is offline for (minutes)", where: "Notifications › What to send › Servers and disks", to: `${N}?tab=events`, words: "unifi network device switch access point gateway offline" },
{ title: "Secret, Tailscale key and domain expiry reminders", where: "Notifications › What to send › Secrets, keys and domains", to: `${N}?tab=events`, words: "expiry expire secrets certificate tailscale key domain renew warn days" },
{ title: "Backups too old, and restore tests", where: "Notifications › What to send › Backups and updates", to: `${N}?tab=events`, words: "backup stale old restore test guest proxmox updates docker image" },
{ title: "Integration, automation and ticket alerts", where: "Notifications › What to send › Integrations and automation", to: `${N}?tab=events`, words: "integration failing semaphore gitea automation failed osticket tickets uptime kuma" },
{ title: "DNS change notifications", where: "Notifications › What to send › DNS changes", to: `${N}?tab=events`, words: "dns changes record added removed" },
{ title: "Routing rules: which channel gets which alert", where: "Notifications › Who hears what", to: `${N}?tab=routing`, words: "routing rules route channel tags severity kinds mute" },
{ title: "Escalation: tell more people if nobody acts", where: "Notifications › Who hears what", to: `${N}?tab=routing`, words: "escalation escalate unacknowledged steps neglected" },
{ title: "Time zone and daily reminders", where: "Notifications › When", to: `${N}?tab=when`, words: "timezone time zone daily reminder time of day" },
{ title: "Quiet hours", where: "Notifications › When", to: `${N}?tab=when`, words: "quiet hours night hold queue do not disturb" },
{ title: "Monthly report", where: "Notifications › When", to: `${N}?tab=when`, words: "monthly report day of month send availability" },
{ title: "Weekly digest", where: "Notifications › When", to: `${N}?tab=when`, words: "weekly digest summary email day" },
{ title: "Open osTicket tickets from alerts", where: "Notifications › Alert tickets", to: `${N}?view=tickets`, words: "osticket ticket alert open api key which problems" },
// Sign-in
{ title: "Roles from groups", where: "Sign-in", to: "/settings/sign-in", words: "roles groups authentik oidc admin operator viewer claim map" },
{ title: "Profile pictures (Gravatar)", where: "Sign-in", to: "/settings/sign-in", words: "profile picture avatar gravatar photo identity provider" },
// Display
{ title: "Date and time format", where: "Display › Dates, times and tables", to: "/settings/display", words: "date time format 24 hour 12 hour locale clock" },
{ title: "Table pagination (rows per page)", where: "Display › Dates, times and tables", to: "/settings/display", words: "table rows per page pagination size" },
{ title: "Badge colours for integrations and DNS providers", where: "Display › Badge colours", to: "/settings/display?view=badges", words: "badge colour color integration dns provider" },
// Names, tags, share
{ title: "Name lists for the name generator", where: "Names", to: "/settings/names", words: "names generator themes list server names" },
{ title: "Tags and tag colours", where: "Tags", to: "/settings/tags", words: "tags colour color label add delete" },
{ title: "Share links: wall display, status page, calendar", where: "Share links", to: "/settings/share", words: "share link public wall status page calendar ics token address" },
// API and webhooks
{ title: "Metrics for Prometheus (tokens)", where: "API and webhooks", to: "/settings/api", words: "prometheus metrics token scrape grafana /metrics" },
{ title: "Event webhooks", where: "API and webhooks", to: "/settings/api", words: "webhook event alert opened resolved maintenance hmac secret home assistant" },
// Data
{ title: "Export and import configuration", where: "Data › Backup", to: "/settings/data", words: "backup export import configuration move restore database self backup" },
{ title: "Log retention and purge", where: "Data › Logs", to: "/settings/data?view=logs", words: "logs purge retention diagnostic audit delete old days" },
{ title: "DNS record cache", where: "Data › Cache", to: "/settings/data?view=cache", words: "dns cache clear zones records resync" },
];
const norm = (s: string) => s.toLowerCase().normalize("NFKD").replace(/[̀-ͯ]/g, "");
/** The settings that match every word typed, best first (a word in the title beats one only in the description). */
export function searchSettings(query: string, limit = 8): SettingsEntry[] {
const words = norm(query).split(/\s+/).filter(Boolean);
if (words.length === 0) return [];
const scored: { entry: SettingsEntry; score: number }[] = [];
for (const entry of SETTINGS_INDEX) {
const title = norm(entry.title);
const where = norm(entry.where);
const rest = norm(entry.words);
let score = 0;
let all = true;
for (const w of words) {
if (title.includes(w)) score += title.startsWith(w) || title.includes(` ${w}`) ? 4 : 3;
else if (where.includes(w)) score += 2;
else if (rest.includes(w)) score += 1;
else {
all = false;
break;
}
}
if (all) scored.push({ entry, score });
}
return scored.sort((a, b) => b.score - a.score || a.entry.title.localeCompare(b.entry.title)).slice(0, limit).map((s) => s.entry);
}
+32
View File
@@ -0,0 +1,32 @@
import { readableError } from "./errors";
import { toast } from "./toast";
/**
* "Removed — Undo": take something away at once and offer to put it back, instead of asking first. Only for things that can be put back as they were by making them
* again from what is on screen (a link, a note, a written dependency) — not for anything whose history, secret or address would not come back with it.
*
* Returns whether it was removed. `reload` is called after the removal and again after an undo, so the page shows what is true.
*/
export async function removeWithUndo(options: { remove: () => Promise<unknown>; restore: () => Promise<unknown>; message: string; reload: () => void; onError?: (message: string) => void }): Promise<boolean> {
try {
await options.remove();
} catch (err) {
(options.onError ?? toast.error)(readableError(err));
return false;
}
toast.success(options.message, {
label: "Undo",
onClick: async () => {
try {
await options.restore();
toast.info("Put back.");
} catch (err) {
toast.error(`Couldn't put it back: ${readableError(err)}`);
} finally {
options.reload();
}
},
});
options.reload();
return true;
}