Files
UHD_Media_Tool/apps/web/app/api/system.ts
T
rootandClaude Opus 5.5 4bb2583f6c feat(web): status page and home regrouped around tasks, inbox and plan (FE-1)
Status page reads /system/health and history: level banner, process table,
event-loop lag and SSE charts (monochrome recharts), database, engine,
schedules, disks with thresholds and mount roots. Home now shows in-progress
tasks, items needing attention, media overview, a plan strip with quick
toggles, recent finished/failed tasks, cache and retention, source health
with site account status, and a run-status summary.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-09-28 16:10:42 +08:00

23 lines
807 B
TypeScript

import { useQuery } from "@tanstack/react-query";
import type { SystemHealth, SystemHealthHistory } from "@umt/contracts";
import { apiData } from "~/lib/api.ts";
import { qk } from "~/lib/query-keys.ts";
// 进程与健康(W9-I):GET /system/health、/system/health/history,仅 admin。
export function useSystemHealth(refetchMs = 15_000) {
return useQuery({
queryKey: qk.sub("system", "health"),
queryFn: ({ signal }) => apiData<SystemHealth>("/system/health", { signal }),
refetchInterval: refetchMs,
});
}
export function useSystemHealthHistory(hours: number) {
return useQuery({
queryKey: qk.sub("system", "history", hours),
queryFn: ({ signal }) => apiData<SystemHealthHistory>("/system/health/history", { params: { hours }, signal }),
refetchInterval: 60_000,
});
}