Racks, notes and to-do, OS support, suggested dependencies, Nginx Proxy Manager and Home Assistant
- Racks page and a network diagram (UniFi tree with servers, printable) - Notes on servers and devices; To do list shown in Coming up and My work - Agents report the operating system (Linux 7, Windows 6); end-of-life badge and alert - Suggested dependencies from where a service is reached - Nginx Proxy Manager integration: proxy hosts page, certificate and host alerts, suggested checks - Home Assistant integration: watch chosen entities, history chart, limit and unavailable alerts - TimeChart gets a "value" scale that fits negatives; docs updated Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
68b41b5586
commit
18ceed62e8
77 files changed
+20432
-35
No files matched your search
+159
-2
@@ -517,6 +517,8 @@ export interface HealthCheckSettings {
|
||||
flapRaises: number;
|
||||
/** Minutes a UniFi device may be offline before it is raised. */
|
||||
deviceOfflineMinutes: number;
|
||||
/** Days before an operating system's support ends that a server is flagged (0 = off). */
|
||||
osSupportWarnDays: number;
|
||||
}
|
||||
|
||||
/** The monthly report: last month's availability, incidents, updates and renewals, in one message on a day of the month. */
|
||||
@@ -780,7 +782,19 @@ export interface ServerLink {
|
||||
url: string;
|
||||
}
|
||||
|
||||
/** What a server runs and when that release stops being supported (from what its agent says). */
|
||||
export interface ServerOs {
|
||||
id: string;
|
||||
name: string | null;
|
||||
version: string | null;
|
||||
product: string;
|
||||
endsOn: string | null;
|
||||
state: "ended" | "soon" | "ok" | "unknown";
|
||||
daysLeft: number | null;
|
||||
}
|
||||
|
||||
export interface ServerDetail {
|
||||
os: ServerOs | null;
|
||||
server: ServerRecord;
|
||||
ipAddresses: string[];
|
||||
hardware: ServerHardware;
|
||||
@@ -1081,7 +1095,36 @@ export interface HeartbeatInput {
|
||||
enabled?: boolean;
|
||||
}
|
||||
|
||||
export type AgendaKind = "secret" | "certificate" | "domain" | "tailscale" | "warranty" | "support" | "maintenance" | "restore" | "updates";
|
||||
export type AgendaKind = "secret" | "certificate" | "domain" | "tailscale" | "warranty" | "support" | "maintenance" | "restore" | "updates" | "todo";
|
||||
|
||||
/** One job on the to-do list. */
|
||||
export interface TodoItem {
|
||||
id: number;
|
||||
title: string;
|
||||
detail: string | null;
|
||||
dueDate: string | null;
|
||||
assignee: { id: number | null; name: string } | null;
|
||||
target: { type: "server" | "device"; id: number; name: string } | null;
|
||||
createdBy: string | null;
|
||||
createdAt: string;
|
||||
doneAt: string | null;
|
||||
doneBy: string | null;
|
||||
}
|
||||
export interface TodoInput {
|
||||
title: string;
|
||||
detail?: string | null;
|
||||
dueDate?: string | null;
|
||||
assigneeId?: number | null;
|
||||
targetType?: "server" | "device" | null;
|
||||
targetId?: number | null;
|
||||
}
|
||||
export interface NoteItem {
|
||||
targetType: "server" | "device";
|
||||
targetId: number;
|
||||
body: string;
|
||||
updatedBy: string | null;
|
||||
updatedAt: string;
|
||||
}
|
||||
export interface AgendaItem {
|
||||
id: string;
|
||||
kind: AgendaKind;
|
||||
@@ -1172,6 +1215,18 @@ export interface DependencyNode {
|
||||
id: number;
|
||||
name: string;
|
||||
}
|
||||
/** A dependency the app offers to write, from what it already knows. */
|
||||
export interface DependencySuggestion {
|
||||
key: string;
|
||||
from: { type: "integration"; id: number; name: string };
|
||||
to: { type: "server"; id: number; name: string };
|
||||
reason: string;
|
||||
}
|
||||
export interface DependencySuggestions {
|
||||
suggestions: DependencySuggestion[];
|
||||
dismissed: DependencySuggestion[];
|
||||
}
|
||||
|
||||
export interface DependenciesResponse {
|
||||
/** "A needs B", written here. */
|
||||
dependencies: { id: number; from: { type: DependencyNodeType; id: number; name: string }; to: { type: DependencyNodeType; id: number; name: string }; createdAt: string }[];
|
||||
@@ -1185,6 +1240,8 @@ export interface MyWork {
|
||||
alerts: { alertId: string; message: string; severity: string; source: string; link: string | null; note: string; role: "handed" | "acked"; ackedBy: string; ackedAt: string; until: string | null; endsSoon: boolean }[];
|
||||
windows: { id: number; targetType: string; targetId: number; targetName: string; targetKind: string; reason: string | null; startedAt: string; endsAt: string; endsSoon: boolean }[];
|
||||
updateRuns: { id: number; serverId: number; serverName: string; templateName: string; status: string; message: string | null; startedAt: string; finishedAt: string | null; running: boolean; updatesBefore: number | null; updatesAfter: number | null; rebootRequired: boolean }[];
|
||||
/** Open jobs from the to-do list handed to this person. */
|
||||
todos: { id: number; title: string; detail: string | null; dueDate: string | null; overdue: boolean; dueSoon: boolean; target: { type: string; id: number; name: string } | null }[];
|
||||
needsAttention: number;
|
||||
}
|
||||
|
||||
@@ -1257,6 +1314,68 @@ export interface NetworkOverview {
|
||||
ssids: NetworkSegment[];
|
||||
}
|
||||
|
||||
export interface NpmHost {
|
||||
id: number;
|
||||
domains: string[];
|
||||
forwardScheme: string;
|
||||
forwardHost: string;
|
||||
forwardPort: number | null;
|
||||
enabled: boolean;
|
||||
sslForced: boolean;
|
||||
certificate: { id: number; name: string; expiresAt: string | null } | null;
|
||||
online: boolean;
|
||||
error: string | null;
|
||||
/** The server the address it forwards to belongs to, when the app knows it. */
|
||||
server: { id: number; name: string } | null;
|
||||
}
|
||||
|
||||
export interface NpmCertificate {
|
||||
id: number;
|
||||
name: string;
|
||||
provider: string;
|
||||
domains: string[];
|
||||
expiresAt: string | null;
|
||||
}
|
||||
|
||||
export interface IntegrationProblem {
|
||||
key: string;
|
||||
kind: string;
|
||||
severity: "critical" | "warning";
|
||||
message: string;
|
||||
}
|
||||
|
||||
export interface NpmOverview {
|
||||
integrations: { id: number; name: string; readAt: string; error: string | null; version: string | null; hosts: NpmHost[]; certificates: NpmCertificate[]; problems: IntegrationProblem[] }[];
|
||||
}
|
||||
|
||||
export interface HaSyncStatus {
|
||||
at: string;
|
||||
ok: boolean;
|
||||
error: string | null;
|
||||
entities: number;
|
||||
}
|
||||
|
||||
export interface HaWatchedEntity {
|
||||
entityId: string;
|
||||
name: string | null;
|
||||
above: number | null;
|
||||
below: number | null;
|
||||
entity: { friendlyName: string | null; state: string; value: number | null; unit: string | null; deviceClass: string | null; lastChanged: string | null; unavailableSince: string | null; updatedAt: string } | null;
|
||||
}
|
||||
|
||||
export interface HaOverview {
|
||||
integrations: { id: number; name: string; enabled: boolean; status: HaSyncStatus | null; fresh: boolean; watched: HaWatchedEntity[]; problems: IntegrationProblem[] }[];
|
||||
}
|
||||
|
||||
export interface HaEntityChoice {
|
||||
entityId: string;
|
||||
name: string;
|
||||
state: string;
|
||||
unit: string | null;
|
||||
deviceClass: string | null;
|
||||
watched: boolean;
|
||||
}
|
||||
|
||||
/** A piece of hardware in the inventory. */
|
||||
export interface Asset {
|
||||
id: number;
|
||||
@@ -1671,7 +1790,7 @@ export interface ManualTaskInput {
|
||||
enabled?: boolean;
|
||||
}
|
||||
|
||||
export type IntegrationType = "proxmox" | "synology" | "semaphore" | "tailscale" | "gitea" | "dockhand" | "uptimekuma" | "phpipam" | "pbs" | "osticket" | "unifi";
|
||||
export type IntegrationType = "proxmox" | "synology" | "semaphore" | "tailscale" | "gitea" | "dockhand" | "uptimekuma" | "phpipam" | "pbs" | "osticket" | "unifi" | "npm" | "homeassistant";
|
||||
|
||||
export interface IntegrationField {
|
||||
key: string;
|
||||
@@ -2268,18 +2387,56 @@ export const api = {
|
||||
myWork: {
|
||||
get: () => request<MyWork>("/api/my-work"),
|
||||
},
|
||||
todos: {
|
||||
list: () => request<{ todos: TodoItem[]; people: { id: number; name: string; role: string }[] }>("/api/todos"),
|
||||
create: (data: TodoInput) => request<{ todo: TodoItem }>("/api/todos", { method: "POST", body: JSON.stringify(data) }),
|
||||
update: (id: number, data: Partial<TodoInput> & { done?: boolean }) => request<{ todo: TodoItem }>(`/api/todos/${id}`, { method: "PATCH", body: JSON.stringify(data) }),
|
||||
remove: (id: number) => request<void>(`/api/todos/${id}`, { method: "DELETE" }),
|
||||
},
|
||||
notes: {
|
||||
get: (targetType: "server" | "device", targetId: number) => request<{ note: NoteItem | null }>(`/api/notes?targetType=${targetType}&targetId=${targetId}`),
|
||||
save: (targetType: "server" | "device", targetId: number, body: string) => request<{ note: NoteItem | null }>("/api/notes", { method: "PUT", body: JSON.stringify({ targetType, targetId, body }) }),
|
||||
},
|
||||
network: {
|
||||
overview: () => request<NetworkOverview>("/api/network"),
|
||||
sync: (integrationId?: number) => request<{ statuses: Record<number, UnifiSyncStatus> }>("/api/network/sync", { method: "POST", body: JSON.stringify(integrationId ? { integrationId } : {}) }),
|
||||
},
|
||||
npm: {
|
||||
overview: (refresh = false) => request<NpmOverview>(`/api/npm${refresh ? "?refresh=1" : ""}`),
|
||||
},
|
||||
homeAssistant: {
|
||||
overview: () => request<HaOverview>("/api/home-assistant"),
|
||||
entities: (id: number, q: string) => request<{ total: number; entities: HaEntityChoice[] }>(`/api/home-assistant/${id}/entities?q=${encodeURIComponent(q)}`),
|
||||
watch: (id: number, body: { entityId: string; name?: string | null; above?: number | null; below?: number | null }) =>
|
||||
request<{ ok: boolean; status: HaSyncStatus }>(`/api/home-assistant/${id}/watched`, { method: "PUT", body: JSON.stringify(body) }),
|
||||
unwatch: (id: number, entityId: string) => request<void>(`/api/home-assistant/${id}/watched/${encodeURIComponent(entityId)}`, { method: "DELETE" }),
|
||||
history: (id: number, entityId: string, days: number) =>
|
||||
request<{ days: number; points: { t: string; v: number }[] }>(`/api/home-assistant/${id}/history?entity=${encodeURIComponent(entityId)}&days=${days}`),
|
||||
sync: () => request<{ statuses: Record<number, HaSyncStatus> }>("/api/home-assistant/sync", { method: "POST", body: "{}" }),
|
||||
},
|
||||
dependencies: {
|
||||
list: () => request<DependenciesResponse>("/api/dependencies"),
|
||||
impact: (type: DependencyNodeType, id: number) => request<DependencyImpact>(`/api/dependencies/impact?type=${type}&id=${id}`),
|
||||
graph: () => request<DependencyGraph>("/api/dependencies/graph"),
|
||||
suggestions: () => request<DependencySuggestions>("/api/dependencies/suggestions"),
|
||||
addSuggestions: (keys: string[]) => request<DependencySuggestions & { added: { id: number; from: string; to: string }[] }>("/api/dependencies/suggestions/add", { method: "POST", body: JSON.stringify({ keys }) }),
|
||||
dismissSuggestions: (keys: string[]) => request<DependencySuggestions>("/api/dependencies/suggestions/dismiss", { method: "POST", body: JSON.stringify({ keys }) }),
|
||||
restoreSuggestions: () => request<DependencySuggestions>("/api/dependencies/suggestions/restore", { method: "POST" }),
|
||||
create: (data: { fromType: DependencyNodeType; fromId: number; toType: DependencyNodeType; toId: number }) => request<{ id: number }>("/api/dependencies", { method: "POST", body: JSON.stringify(data) }),
|
||||
remove: (id: number) => request<void>(`/api/dependencies/${id}`, { method: "DELETE" }),
|
||||
},
|
||||
inventory: {
|
||||
racks: () =>
|
||||
request<{
|
||||
racks: {
|
||||
name: string;
|
||||
units: number;
|
||||
slots: { assetId: number; name: string; kind: string; model: string | null; from: number; to: number; powerWatts: number | null; serverId: number | null; clash: boolean }[];
|
||||
unplaced: { assetId: number; name: string; kind: string }[];
|
||||
usedUnits: number;
|
||||
watts: number;
|
||||
}[];
|
||||
}>("/api/inventory/racks"),
|
||||
list: () => request<{ assets: Asset[]; config: InventoryConfig; servers: { id: number; name: string }[] }>("/api/inventory"),
|
||||
create: (data: AssetInput) => request<{ asset: Asset }>("/api/inventory", { method: "POST", body: JSON.stringify(data) }),
|
||||
update: (id: number, data: AssetInput) => request<{ asset: Asset }>(`/api/inventory/${id}`, { method: "PUT", body: JSON.stringify(data) }),
|
||||
|
||||
Reference in new issue
Block a user