| 123456789101112131415161718192021222324252627282930 |
- import type { SourceNotice } from "@/lib/types";
- const statusLabels: Record<string, string> = {
- merged: "已采用", parked: "暂存", discarded: "未采用", open: "尚未处置",
- running: "运行中", success: "已完成", completed: "已完成", partial: "部分完成",
- failed: "失败", stopped: "已停止", cancel: "已取消", cancle: "已取消", cancelled: "已取消", done: "已结束", passed: "通过",
- interrupted: "构建中断",
- hit: "查询命中", empty: "查询成功 · 无匹配", failure: "查询失败",
- "partially-passed": "部分通过", "needs-retry": "需要继续", "not-evaluated": "未整体评审", unknown: "尚无结论",
- legacy: "旧结构",
- };
- export function statusLabel(status?: string) {
- const value = (status || "unknown").toLowerCase();
- return statusLabels[value] || status || "尚无结论";
- }
- export function StatusBadge({ status }: { status?: string }) {
- const value = (status || "unknown").toLowerCase();
- return <span className={`statusBadge status-${value}`}>{statusLabel(status)}</span>;
- }
- export function SourceNoticeBadge({ notice }: { notice?: SourceNotice }) {
- // Runtime association is provenance, not a business status. Keep it in the
- // Inspector's technical record; only surface notices that change how a
- // business user should interpret the visible step.
- if (!notice || notice === "runtime-associated") return null;
- const label = notice === "process-incomplete" ? "流程未完成" : notice === "legacy-record" ? "旧版本记录" : "记录缺失";
- return <span className={`sourceBadge source-${notice}`}>{label}</span>;
- }
|