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]>
This commit is contained in:
1 parent
d8b9bd9662
commit
4bb2583f6c
5 files changed
+1012
-182
No files matched your search
@@ -1,7 +1,8 @@
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import type { Dashboard } from "@umt/contracts";
|
||||
import { cursorPage, type Dashboard, SiteListItem } from "@umt/contracts";
|
||||
import { apiData } from "~/lib/api.ts";
|
||||
import { qk } from "~/lib/query-keys.ts";
|
||||
import { apiParsed } from "./parse.ts";
|
||||
|
||||
/** 首页聚合;SSE 事件触发 invalidate,另有 60 秒兜底轮询 */
|
||||
export function useDashboard() {
|
||||
@@ -11,3 +12,15 @@ export function useDashboard() {
|
||||
refetchInterval: 60_000,
|
||||
});
|
||||
}
|
||||
|
||||
const SitePage = cursorPage(SiteListItem);
|
||||
|
||||
/** 首页"来源健康":站点 + 整体账号状态(GET /sites?include=accounts) */
|
||||
export function useSitesWithAccounts() {
|
||||
return useQuery({
|
||||
queryKey: [...qk.dashboard, "sites-accounts"],
|
||||
queryFn: ({ signal }) =>
|
||||
apiParsed(SitePage, "/api/v1/sites", { params: { limit: 200, include: "accounts" }, signal }),
|
||||
refetchInterval: 60_000,
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
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,
|
||||
});
|
||||
}
|
||||
Reference in new issue
Block a user