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:
1 parent
906220040e
commit
44e393f172
50 files changed
+6114
-258
No files matched your search
+55
-1
@@ -6,8 +6,47 @@ export interface CurrentUser {
|
||||
email?: string;
|
||||
name?: string;
|
||||
role: UserRole;
|
||||
/** Pages this person pinned to the top of their menu, by path. */
|
||||
/** Pages this person pinned to the top of their menu, by path — a page alone, or with filters ("/servers?status=offline"). */
|
||||
favorites?: string[];
|
||||
/** How this person arranged the dashboard cards. */
|
||||
dashboard?: DashboardLayout;
|
||||
}
|
||||
|
||||
export type ShareLinkDetail = "summary" | "names";
|
||||
|
||||
/** A link that opens the wall display without signing in, as the settings list shows it (never the secret). */
|
||||
export interface ShareLink {
|
||||
id: number;
|
||||
label: string;
|
||||
tokenPrefix: string;
|
||||
detail: ShareLinkDetail;
|
||||
createdBy: string | null;
|
||||
createdAt: string;
|
||||
expiresAt: string | null;
|
||||
lastUsedAt: string | null;
|
||||
expired: boolean;
|
||||
}
|
||||
|
||||
/** What a share link may show: numbers, and with "names" also the names of what is wrong. Built on the server. */
|
||||
export interface PublicWall {
|
||||
detail: ShareLinkDetail;
|
||||
level: "ok" | "warning" | "critical" | "unsure";
|
||||
environment: string | null;
|
||||
servers: { online: number; offline: number };
|
||||
alerts: { critical: number; warning: number };
|
||||
maintenance: number;
|
||||
integrationsFailing: number;
|
||||
problems?: { id: string; severity: "critical" | "warning"; message: string }[];
|
||||
maintenanceWindows?: { id: number; name: string; endsAt: string }[];
|
||||
integrations?: { id: number; name: string; type: string; status: "ok" | "failing" | "unknown" }[];
|
||||
generatedAt: string;
|
||||
display: { dateFormat: string; timeFormat: string };
|
||||
}
|
||||
|
||||
/** The dashboard cards a person hid, and the order they put the rest in (a lower number comes first). */
|
||||
export interface DashboardLayout {
|
||||
hidden: string[];
|
||||
order: Record<string, number>;
|
||||
}
|
||||
|
||||
/** One thing worth a line in "Since you last looked". */
|
||||
@@ -1148,12 +1187,27 @@ async function request<T>(path: string, init?: RequestInit): Promise<T> {
|
||||
export const api = {
|
||||
me: Object.assign(() => request<{ user: CurrentUser }>("/api/me"), {
|
||||
setFavorites: (paths: string[]) => request<{ favorites: string[] }>("/api/me/favorites", { method: "PUT", body: JSON.stringify({ paths }) }),
|
||||
setDashboard: (layout: DashboardLayout) => request<{ dashboard: DashboardLayout }>("/api/me/dashboard", { method: "PUT", body: JSON.stringify(layout) }),
|
||||
changes: () => request<ChangesSummary>("/api/me/changes"),
|
||||
markChangesSeen: () => request<{ lastLookedAt: string }>("/api/me/changes/seen", { method: "POST" }),
|
||||
}),
|
||||
uptime: {
|
||||
get: () => request<UptimeReport>("/api/uptime"),
|
||||
},
|
||||
shareLinks: {
|
||||
list: () => request<{ links: ShareLink[] }>("/api/share-links"),
|
||||
create: (data: { label: string; detail: ShareLinkDetail; expiresInDays: number | null }) =>
|
||||
request<{ link: ShareLink; token: string; path: string }>("/api/share-links", { method: "POST", body: JSON.stringify(data) }),
|
||||
remove: (id: number) => request<void>(`/api/share-links/${id}`, { method: "DELETE" }),
|
||||
},
|
||||
// Opened by someone who isn't signed in: no cookies, and the status is kept so a link that has ended can say so.
|
||||
publicWall: {
|
||||
get: async (token: string): Promise<PublicWall> => {
|
||||
const res = await fetch(`/api/public/wall/${encodeURIComponent(token)}`, { credentials: "omit", cache: "no-store" });
|
||||
if (!res.ok) throw Object.assign(new Error(`Request failed (${res.status})`), { status: res.status });
|
||||
return (await res.json()) as PublicWall;
|
||||
},
|
||||
},
|
||||
search: {
|
||||
query: (q: string) => request<SearchResponse>(`/api/search?q=${encodeURIComponent(q)}`),
|
||||
},
|
||||
|
||||
Reference in new issue
Block a user