Add the staff stats dashboard
Backend: GET /api/stats/ (staff only) gathers psutil CPU/memory counters, nvidia-smi GPU stats, the cached disk numbers and the running/finished download + match jobs. Root logging now also writes a rotating file (backend/logs/j621.log) so the dashboard can tail it, and psutil joins the requirements. The storage payload computation is shared with the existing storage endpoint. Frontend: a /stats route + Stats nav entry for staff, polling every 2 s — per-core CPU bars, memory and swap, GPUs (utilization, VRAM, temperature), disk with the media/temp breakdown, active jobs with progress bars, recently finished jobs with summaries, and the log tail with level colours and an auto-scroll toggle. Section 4 of the roadmap is complete.
This commit is contained in:
@@ -329,3 +329,59 @@ export interface TempUpload {
|
||||
created_at: string;
|
||||
updated_at: string;
|
||||
}
|
||||
|
||||
export interface StatJob {
|
||||
kind: "download" | "match";
|
||||
id: string;
|
||||
label: string;
|
||||
status: string;
|
||||
progress: number;
|
||||
detail: string;
|
||||
summary?: string;
|
||||
created_at: string;
|
||||
updated_at: string;
|
||||
}
|
||||
|
||||
export interface SystemStats {
|
||||
system: {
|
||||
cpu: {
|
||||
percent: number;
|
||||
per_cpu: number[];
|
||||
cores: number;
|
||||
physical_cores: number;
|
||||
load: number[];
|
||||
};
|
||||
memory: {
|
||||
total: number;
|
||||
used: number;
|
||||
available: number;
|
||||
percent: number;
|
||||
swap_total: number;
|
||||
swap_used: number;
|
||||
swap_percent: number;
|
||||
};
|
||||
uptime_seconds: number;
|
||||
};
|
||||
gpus: {
|
||||
name: string;
|
||||
utilization: number | null;
|
||||
memory_used: number | null;
|
||||
memory_total: number | null;
|
||||
temperature: number | null;
|
||||
}[];
|
||||
disk: {
|
||||
watched_folder: {
|
||||
path: string;
|
||||
total: number;
|
||||
used: number;
|
||||
free: number;
|
||||
library_size: number;
|
||||
percent_used: number;
|
||||
};
|
||||
media: { path: string; size: number };
|
||||
temp: { path: string; size: number; files: number };
|
||||
library_items: number;
|
||||
};
|
||||
jobs: { active: StatJob[]; recent: StatJob[]; active_count: number };
|
||||
log: { path: string; lines: string[]; missing: boolean };
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user