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>
85 lines
3.4 KiB
TypeScript
85 lines
3.4 KiB
TypeScript
import { useMemo, useState, type CSSProperties } from "react";
|
|
import { Link, NavLink, Outlet } from "react-router-dom";
|
|
import { searchSettings } from "../utils/settingsIndex";
|
|
|
|
const SUB_NAV = [
|
|
{ to: "/settings/notifications", label: "Notifications" },
|
|
{ to: "/settings/sign-in", label: "Sign-in" },
|
|
{ to: "/settings/display", label: "Display" },
|
|
{ to: "/settings/names", label: "Names" },
|
|
{ to: "/settings/tags", label: "Tags" },
|
|
{ to: "/settings/share", label: "Share links" },
|
|
{ to: "/settings/api", label: "API and webhooks" },
|
|
{ to: "/settings/data", label: "Data" },
|
|
];
|
|
|
|
/** A box that finds a setting by what it does ("quiet hours", "prometheus", "disk full") and goes to where it is set. */
|
|
function SettingsSearch() {
|
|
const [query, setQuery] = useState("");
|
|
const results = useMemo(() => searchSettings(query), [query]);
|
|
return (
|
|
<div className="mb-3 position-relative" style={{ maxWidth: 520 }}>
|
|
<input
|
|
type="search"
|
|
className="form-control"
|
|
placeholder="Find a setting…"
|
|
aria-label="Find a setting"
|
|
value={query}
|
|
onChange={(e) => setQuery(e.target.value)}
|
|
onKeyDown={(e) => e.key === "Escape" && setQuery("")}
|
|
/>
|
|
{query.trim() !== "" && (
|
|
<div className="list-group position-absolute w-100 shadow" style={{ zIndex: 20, top: "100%" }} role="listbox" aria-label="Matching settings">
|
|
{results.length === 0 ? (
|
|
<div className="list-group-item text-secondary">No setting matches that.</div>
|
|
) : (
|
|
results.map((r) => (
|
|
<Link key={r.title + r.to} to={r.to} className="list-group-item list-group-item-action" role="option" aria-selected={false} onClick={() => setQuery("")}>
|
|
<div>{r.title}</div>
|
|
<div className="small text-secondary">{r.where}</div>
|
|
</Link>
|
|
))
|
|
)}
|
|
</div>
|
|
)}
|
|
</div>
|
|
);
|
|
}
|
|
|
|
export default function Settings() {
|
|
return (
|
|
<>
|
|
<h2 className="page-title mb-3">Settings</h2>
|
|
<SettingsSearch />
|
|
<div className="row">
|
|
<div className="col-12 col-md-3 col-lg-2 mb-3 mb-md-0">
|
|
<div className="card">
|
|
{/* Tabler's default list-group-item padding (1.25rem) is sized for
|
|
standalone list cards, not a nav sidebar — at that padding the
|
|
first item's text sits ~12px below where the content column's
|
|
own heading/button row starts, even though the two boxes
|
|
themselves are top-aligned. Tightening just this list-group's
|
|
own padding (via its own CSS variable, verified pixel-for-pixel
|
|
against the real markup) brings the two back to the same
|
|
visual line instead of only the same box height. */}
|
|
<div className="list-group list-group-flush" style={{ "--tblr-list-group-item-padding-y": "0.5rem" } as CSSProperties}>
|
|
{SUB_NAV.map((item) => (
|
|
<NavLink
|
|
key={item.to}
|
|
to={item.to}
|
|
className={({ isActive }) => `list-group-item list-group-item-action ${isActive ? "active" : ""}`}
|
|
>
|
|
{item.label}
|
|
</NavLink>
|
|
))}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div className="col-12 col-md-9 col-lg-10">
|
|
<Outlet />
|
|
</div>
|
|
</div>
|
|
</>
|
|
);
|
|
}
|