Add saved filter views, a customisable dashboard, server comparison, row keyboard navigation and share links

- Table search, status, tag and sort live in the address; Save view pins one as a favourite.
- Dashboard cards can be moved and hidden per user (users.dashboard_layout, migration 0022).
- Compare two to four servers' load, memory or disk on one chart.
- j/k move through table rows that open a detail panel.
- Share links open a read-only wall without signing in, numbers only or with names
  (share_links, migration 0023); the wall is split into a shared view over two data sources.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
bobbanandClaude Sonnet 5.5 committed 2026-10-16 22:15:29 +02:00
1 parent 906220040e
commit 44e393f172
50 files changed
+6114 -258

No files matched your search

+2
View File
@@ -5,6 +5,7 @@ import { api, type CurrentUser, type MaintenanceWindow } from "../api/client";
import { isCurrent, isGroup, visibleNav, type NavGroup } from "./nav";
import SidebarNav, { type NavBadge } from "./SidebarNav";
import { initFavorites } from "../utils/favorites";
import { initDashboardLayout } from "../utils/dashboardLayout";
import { formatRemaining } from "../utils/duration";
import { getTheme, setTheme, type Theme } from "../utils/theme";
import { DENSITIES, getDensity, setDensity, type Density } from "../utils/density";
@@ -56,6 +57,7 @@ export default function AppShell({ user, children }: { user: CurrentUser; childr
// This person's pinned pages come with the user; load them before the menu is first drawn.
useState(() => {
initFavorites(user.favorites);
initDashboardLayout(user.dashboard);
return null;
});
// The narrow, icon-only sidebar: remembered per browser (a laptop wants it, a big monitor may not), and only on wide screens.
+31 -7
View File
@@ -1,8 +1,9 @@
import { useEffect, useRef, useState, type ReactNode } from "react";
import { NavLink } from "react-router-dom";
import { NavLink, useLocation } from "react-router-dom";
import { IconStar, IconStarFilled } from "@tabler/icons-react";
import { isCurrent, isGroup, type NavEntry, type NavGroup, type NavLeaf } from "./nav";
import { toggleFavorite, useFavorites } from "../utils/favorites";
import { canonicalSearch, describeView, splitView } from "../utils/savedViews";
export interface NavBadge {
text: string;
@@ -40,6 +41,7 @@ export default function SidebarNav({
onNavigate: () => void;
}) {
const favorites = useFavorites();
const location = useLocation();
const [flyout, setFlyout] = useState<Flyout | null>(null);
const flyoutRef = useRef<HTMLDivElement>(null);
const opener = useRef<HTMLElement | null>(null);
@@ -50,7 +52,12 @@ export default function SidebarNav({
if (isGroup(entry)) entry.items.forEach((i) => leaves.set(i.to, i));
else leaves.set(entry.to, entry);
}
const pinned = favorites.map((p) => leaves.get(p)).filter((l): l is NavLeaf => !!l);
// A pinned page, or a pinned view of one ("/servers?status=offline"), which is shown under the page's name and what narrows it.
const pinned = favorites.flatMap((path) => {
const [base, search] = splitView(path);
const leaf = leaves.get(base);
return leaf ? [{ leaf, path, search }] : [];
});
// The side menu goes away when the page changes, when the strip is widened, on Escape, and on a click anywhere else.
useEffect(() => setFlyout(null), [pathname, rail]);
@@ -85,16 +92,33 @@ export default function SidebarNav({
) : null;
};
const star = (leaf: NavLeaf) => {
const on = favorites.includes(leaf.to);
const label = on ? `Remove ${leaf.label} from favourites` : `Add ${leaf.label} to favourites`;
const star = (leaf: NavLeaf, path: string = leaf.to, name: string = leaf.label) => {
const on = favorites.includes(path);
const label = on ? `Remove ${name} from favourites` : `Add ${name} to favourites`;
return (
<button type="button" className="fav-star" aria-pressed={on} aria-label={label} title={label} onClick={() => void toggleFavorite(leaf.to)}>
<button type="button" className="fav-star" aria-pressed={on} aria-label={label} title={label} onClick={() => void toggleFavorite(path)}>
{on ? <IconStarFilled size={16} /> : <IconStar size={16} />}
</button>
);
};
const viewRow = (leaf: NavLeaf, path: string, search: string) => {
const words = describeView(search);
const name = `${leaf.label}: ${words}`;
const here = location.pathname === leaf.to && canonicalSearch(location.search) === search;
return (
<li className="nav-item nav-row" key={`fav-${path}`}>
<NavLink to={path} className={() => `nav-link ${here ? "active" : ""}`} title={rail ? name : undefined} aria-current={here ? "page" : undefined} onClick={onNavigate}>
<span className="nav-link-icon d-md-none d-lg-inline-block">{leaf.icon}</span>
<span className="nav-link-title">
{leaf.label} <span className="nav-view">{words}</span>
</span>
</NavLink>
{star(leaf, path, name)}
</li>
);
};
const leafRow = (leaf: NavLeaf, key: string) => (
<li className="nav-item nav-row" key={key}>
<NavLink to={leaf.to} end={leaf.to === "/"} className="nav-link" title={rail ? leaf.label : undefined} onClick={onNavigate}>
@@ -125,7 +149,7 @@ export default function SidebarNav({
Favourites
</div>
<ul className="navbar-nav" aria-labelledby="nav-favourites-heading">
{pinned.map((leaf) => leafRow(leaf, `fav-${leaf.to}`))}
{pinned.map((p) => (p.search ? viewRow(p.leaf, p.path, p.search) : leafRow(p.leaf, `fav-${p.leaf.to}`)))}
</ul>
</li>
)}
+1
View File
@@ -22,6 +22,7 @@ export const GO_SHORTCUTS: GoShortcut[] = [
export const OTHER_SHORTCUTS: { keys: string; label: string }[] = [
{ keys: "Ctrl K", label: "Search, and run actions (silence a server, switch theme…)" },
{ keys: "/", label: "Jump to the search box of the table on this page" },
{ keys: "j / k", label: "Move down or up the rows of the table on this page (Enter opens the row)" },
{ keys: "[", label: "Narrow the sidebar to icons, or widen it again" },
{ keys: "?", label: "Show this list" },
{ keys: "Esc", label: "Close a dialog, the search or this list" },