Skip to content

Commit c781cd2

Browse files
committed
运维卡片补全active与fallback字段:10秒可判读
1 parent 7d591c9 commit c781cd2

2 files changed

Lines changed: 25 additions & 4 deletions

File tree

‎frontend/components/ops/system/SystemPageClient.tsx‎

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -482,11 +482,11 @@ export function SystemPageClient() {
482482
<thead className="bg-slate-50 text-slate-500">
483483
<tr>
484484
<th className="px-3 py-2">城市</th>
485-
<th className="px-3 py-2">来源/站点</th>
485+
<th className="px-3 py-2">Active/Primary</th>
486486
<th className="px-3 py-2">状态</th>
487487
<th className="px-3 py-2">延迟</th>
488488
<th className="px-3 py-2">Fallback</th>
489-
<th className="px-3 py-2">最近错误</th>
489+
<th className="px-3 py-2">失败/错误</th>
490490
</tr>
491491
</thead>
492492
<tbody>
@@ -497,15 +497,29 @@ export function SystemPageClient() {
497497
<tr key={c.city} className="border-t border-slate-100">
498498
<td className="px-3 py-2 font-mono font-bold text-slate-800">{c.city}</td>
499499
<td className="px-3 py-2 text-slate-600">
500-
{[c.source, c.station].filter(Boolean).join(" / ") || "—"}
500+
<div className="font-semibold text-slate-800">
501+
{[c.active_source || c.source, c.station].filter(Boolean).join(" / ") || "—"}
502+
</div>
503+
<div className="text-[11px] text-slate-500">
504+
primary: {c.primary_source || "—"}
505+
{c.fallback_since ? ` · since ${String(c.fallback_since).slice(11, 16)}` : ""}
506+
</div>
507+
{c.fallback_reason ? (
508+
<div className="text-[11px] text-amber-600">{c.fallback_reason}</div>
509+
) : null}
501510
</td>
502511
<td className={`px-3 py-2 font-bold ${sourceStatusTone(c.status)}`}>{c.status}</td>
503512
<td className="px-3 py-2 font-mono text-slate-600">
504513
{c.age_seconds == null ? "—" : `${Math.floor(Number(c.age_seconds) / 60)}m`}
505514
</td>
506515
<td className="px-3 py-2 text-slate-600">{c.fallback_in_use ? "是" : "否"}</td>
507516
<td className="px-3 py-2 text-slate-500" title={c.last_error || ""}>
508-
{(c.last_error || (c.quality_flags || []).join(",") || "—").slice(0, 80)}
517+
<div>×{c.consecutive_failures ?? 0}</div>
518+
<div className="text-[11px]">
519+
ok: {c.last_success_at ? String(c.last_success_at).slice(11, 16) : "—"}
520+
{" / "}err: {c.last_error_at ? String(c.last_error_at).slice(11, 16) : "—"}
521+
</div>
522+
<div className="text-[11px]">{(c.last_error || "").slice(0, 60) || "—"}</div>
509523
</td>
510524
</tr>
511525
))}

‎frontend/types/ops.ts‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,13 @@ export type DataQualityCity = {
9393
age_seconds?: number | null;
9494
status?: string;
9595
fallback_in_use?: boolean;
96+
fallback_reason?: string | null;
97+
fallback_since?: string | null;
98+
primary_source?: string | null;
99+
active_source?: string | null;
100+
primary_last_success_at?: string | null;
101+
last_success_at?: string | null;
102+
last_error_at?: string | null;
96103
consecutive_failures?: number;
97104
request_latency_ms?: number | null;
98105
last_error?: string | null;

0 commit comments

Comments
 (0)