Remove task pulse from overview
This commit is contained in:
@@ -69,6 +69,7 @@ describe("first-party console pages", () => {
|
|||||||
expect(html).toContain("资源负载");
|
expect(html).toContain("资源负载");
|
||||||
expect(html).toContain("游戏类型分布");
|
expect(html).toContain("游戏类型分布");
|
||||||
expect(html).toContain("最近运营信号");
|
expect(html).toContain("最近运营信号");
|
||||||
|
expect(html).not.toContain("任务脉冲");
|
||||||
expect(html).not.toContain("sk-");
|
expect(html).not.toContain("sk-");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -7,8 +7,7 @@ import {
|
|||||||
Info,
|
Info,
|
||||||
MoonStar,
|
MoonStar,
|
||||||
RotateCw,
|
RotateCw,
|
||||||
Sparkles,
|
Sparkles
|
||||||
Workflow
|
|
||||||
} from "lucide-react";
|
} from "lucide-react";
|
||||||
import { useCallback, useEffect, useMemo, useState } from "react";
|
import { useCallback, useEffect, useMemo, useState } from "react";
|
||||||
|
|
||||||
@@ -120,7 +119,6 @@ export function HomePage({ session, onNavigate, initialState }: HomePageProps) {
|
|||||||
}, [core]);
|
}, [core]);
|
||||||
|
|
||||||
const overviewSignals = useMemo<PlatformOverviewSignal[]>(() => buildOverviewSignals(core, providers), [core, providers]);
|
const overviewSignals = useMemo<PlatformOverviewSignal[]>(() => buildOverviewSignals(core, providers), [core, providers]);
|
||||||
const jobs = core.status === "ready" ? jobBuckets(core.data.jobs) : null;
|
|
||||||
const onlineCount = core.status === "ready" ? core.data.instances.filter((item) => serverIsOnline(item.state)).length : 0;
|
const onlineCount = core.status === "ready" ? core.data.instances.filter((item) => serverIsOnline(item.state)).length : 0;
|
||||||
const offlineCount = core.status === "ready" ? core.data.instances.length - onlineCount : 0;
|
const offlineCount = core.status === "ready" ? core.data.instances.length - onlineCount : 0;
|
||||||
const activeProviders = providers.status === "ready" ? providers.data.filter((item) => item.status === "active").length : 0;
|
const activeProviders = providers.status === "ready" ? providers.data.filter((item) => item.status === "active").length : 0;
|
||||||
@@ -198,44 +196,6 @@ export function HomePage({ session, onNavigate, initialState }: HomePageProps) {
|
|||||||
</section>
|
</section>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<section className="operations-command-grid" aria-label="平台运营模块">
|
|
||||||
<article className="console-panel console-module" aria-label="任务脉冲">
|
|
||||||
<div className="panel-header">
|
|
||||||
<h2><Workflow size={16} /> 任务脉冲</h2>
|
|
||||||
<span className="page-status">{moduleFreshnessLabel(core.status === "ready" ? core.refreshedAt : core.refreshedAt)}</span>
|
|
||||||
</div>
|
|
||||||
{core.status === "loading" && <LoadingState label="正在汇总任务…" compact />}
|
|
||||||
{core.status === "error" && <ErrorState title="任务状态不可用" reason={core.reason} diagnosticId={core.diagnosticId} onRetry={() => void refreshCore()} compact />}
|
|
||||||
{core.status === "ready" && jobs && (
|
|
||||||
<>
|
|
||||||
<dl className="console-stat-strip">
|
|
||||||
<div><dt>执行中</dt><dd>{jobs.active.length}</dd></div>
|
|
||||||
<div><dt>等待重试</dt><dd>{jobs.retrying.length}</dd></div>
|
|
||||||
<div><dt>近期失败</dt><dd>{jobs.failed.length}</dd></div>
|
|
||||||
</dl>
|
|
||||||
{jobs.active.length === 0 && jobs.failed.length === 0 ? (
|
|
||||||
<p className="console-empty-note">当前没有执行中或失败任务。</p>
|
|
||||||
) : (
|
|
||||||
<div className="console-row-list">
|
|
||||||
{[...jobs.active.slice(0, 3), ...jobs.failed.slice(0, 2)].map((job) => (
|
|
||||||
<button
|
|
||||||
key={job.id}
|
|
||||||
type="button"
|
|
||||||
className={cx("console-row console-row-button", job.state === "failed" && "console-row-danger")}
|
|
||||||
onClick={() => onNavigate(job.serverInstanceId ? "serverDetail" : "maintenance", job.serverInstanceId ? { serverId: job.serverInstanceId } : undefined)}
|
|
||||||
>
|
|
||||||
<span><strong>{jobCapabilityLabel(job.capability)}</strong><small>{job.serverInstanceId ? `服务器 ${job.serverInstanceId}` : "平台任务"}</small></span>
|
|
||||||
<span>{job.state === "retrying" ? `重试 ${job.attempt}/${job.retryPolicy.maxAttempts}` : jobStateLabel(job.state)}</span>
|
|
||||||
<span>{Math.round(job.progress.percent)}%</span>
|
|
||||||
</button>
|
|
||||||
))}
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
</>
|
|
||||||
)}
|
|
||||||
</article>
|
|
||||||
|
|
||||||
</section>
|
|
||||||
<section className="overview-two-col">
|
<section className="overview-two-col">
|
||||||
<article className="console-panel" aria-label="resource usage">
|
<article className="console-panel" aria-label="resource usage">
|
||||||
<div className="panel-header">
|
<div className="panel-header">
|
||||||
@@ -340,8 +300,3 @@ function refreshedNow(): string {
|
|||||||
function errorMessage(error: unknown, fallback: string): string {
|
function errorMessage(error: unknown, fallback: string): string {
|
||||||
return error instanceof Error ? error.message : fallback;
|
return error instanceof Error ? error.message : fallback;
|
||||||
}
|
}
|
||||||
|
|
||||||
function jobStateLabel(state: JobResponse["state"]): string {
|
|
||||||
const labels: Record<JobResponse["state"], string> = { queued: "排队", accepted: "已领取", running: "执行中", retrying: "等待重试", succeeded: "完成", failed: "失败", cancelled: "已取消" };
|
|
||||||
return labels[state];
|
|
||||||
}
|
|
||||||
|
|||||||
Reference in New Issue
Block a user