mirror of
https://github.com/MengMengCode/VoCat.git
synced 2026-08-16 21:03:44 +08:00
feat: remove legacy device stat panels from dashboard
The total/online/offline/last-refresh mini panels are superseded by the new module online-rate card. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
115598757a
commit
e2177a6e9a
@@ -28,7 +28,6 @@ export default function DashboardPage() {
|
||||
const [devicesLoading, setDevicesLoading] = useState(false);
|
||||
const [devicesError, setDevicesError] = useState<LoadError | null>(null);
|
||||
const [devicesOkAt, setDevicesOkAt] = useState<number | null>(null);
|
||||
const [lastRefresh, setLastRefresh] = useState<number | null>(null);
|
||||
const [host, setHost] = useState<DashboardHost | null>(null);
|
||||
const [upcomingTasks, setUpcomingTasks] = useState<DashboardUpcomingTask[]>([]);
|
||||
|
||||
@@ -38,9 +37,7 @@ export default function DashboardPage() {
|
||||
const list = await api<DashboardDevice[]>("/dashboard/devices");
|
||||
setDevices(list || []);
|
||||
setDevicesError(null);
|
||||
const now = Date.now();
|
||||
setDevicesOkAt(now);
|
||||
setLastRefresh(now);
|
||||
setDevicesOkAt(Date.now());
|
||||
} catch (e: any) {
|
||||
setDevicesError({ message: e?.message || t("加载失败"), status: e?.status });
|
||||
} finally {
|
||||
@@ -76,7 +73,6 @@ export default function DashboardPage() {
|
||||
|
||||
const total = devices.length;
|
||||
const online = devices.filter((d) => d?.healthy).length;
|
||||
const offline = Math.max(0, total - online);
|
||||
const openDevice = (id: string) => navigate(`/devices?device=${encodeURIComponent(id)}&tab=overview`);
|
||||
|
||||
return (
|
||||
@@ -92,12 +88,6 @@ export default function DashboardPage() {
|
||||
<UpcomingTasksCard tasks={upcomingTasks} />
|
||||
<OnlineRateCard online={online} total={total} />
|
||||
</div>
|
||||
<div className="mb-6 grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-4">
|
||||
<div className="ui-panel p-4"><div className="text-xs text-gray-400">{t("设备总数")}</div><div className="mt-1 text-2xl font-extrabold">{total}</div></div>
|
||||
<div className="ui-panel p-4"><div className="text-xs text-gray-400">{t("在线")}</div><div className="mt-1 text-2xl font-extrabold text-green-600 dark:text-green-400">{online}</div></div>
|
||||
<div className="ui-panel p-4"><div className="text-xs text-gray-400">{t("离线")}</div><div className="mt-1 text-2xl font-extrabold text-red-600 dark:text-red-400">{offline}</div></div>
|
||||
<div className="ui-panel p-4"><div className="text-xs text-gray-400">{t("最近刷新")}</div><div className="mt-2 font-mono text-sm text-gray-600 dark:text-gray-300">{lastRefresh ? new Date(lastRefresh).toLocaleTimeString() : "--:--:--"}</div></div>
|
||||
</div>
|
||||
{devicesError ? (
|
||||
<ErrorState className="mb-6" title={t("设备列表加载失败")} message={devicesError.message} statusCode={devicesError.status} requestMethod={devicesError.method} requestUrl={devicesError.url} lastSuccessAt={devicesOkAt} retryText={t("重试")} onRetry={fetchDevices} />
|
||||
) : null}
|
||||
|
||||
Reference in New Issue
Block a user