Sfoglia il codice sorgente

Fix web2 run labels and timezone

Sam Lee 3 settimane fa
parent
commit
457d4ac2cf
2 ha cambiato i file con 22 aggiunte e 3 eliminazioni
  1. 19 3
      web2/features/RunListPage.tsx
  2. 3 0
      web2/lib/flow-ledger/business.ts

+ 19 - 3
web2/features/RunListPage.tsx

@@ -19,6 +19,22 @@ function statusLabel(value?: string | null): string {
   return value ? labels[value] || "状态待确认" : "状态待确认";
 }
 
+function formatBeijingTime(value?: string | null): string {
+  if (!value) return "未记录开始时间";
+  const iso = /z$|[+-]\d{2}:\d{2}$/i.test(value) ? value : `${value}Z`;
+  const date = new Date(iso);
+  if (Number.isNaN(date.getTime())) return "开始时间待确认";
+  return `北京时间 ${new Intl.DateTimeFormat("zh-CN", {
+    timeZone: "Asia/Shanghai",
+    year: "numeric",
+    month: "2-digit",
+    day: "2-digit",
+    hour: "2-digit",
+    minute: "2-digit",
+    hour12: false
+  }).format(date)}`;
+}
+
 export function RunListPage() {
   const [runs, setRuns] = useState<RunListItem[]>([]);
   const [loading, setLoading] = useState(true);
@@ -53,13 +69,13 @@ export function RunListPage() {
         {runs.map((run) => (
           <Link className="run-row" href={`/runs/${encodeURIComponent(run.run_id)}`} key={run.run_id}>
             <div>
-              <strong>{run.demand_name || "未命名任务"}</strong>
-              <span>{run.demand_desc || "暂无任务说明"}</span>
+              <strong>{run.demand_name || run.run_id}</strong>
+              <span>{run.demand_desc || `任务编号 ${run.run_id}`}</span>
             </div>
             <div className="run-row-meta">
               <span className="chip">{platformLabel(run.platform)}</span>
               <span className="chip blue">{statusLabel(run.status)}</span>
-              <span>{run.started_at ? `开始时间 ${run.started_at}` : "未记录开始时间"}</span>
+              <span>{formatBeijingTime(run.started_at)}</span>
             </div>
           </Link>
         ))}

+ 3 - 0
web2/lib/flow-ledger/business.ts

@@ -40,6 +40,9 @@ const REASON_IMPACT: Record<string, string> = {
 };
 
 const SOURCE_LABELS: Record<string, string> = {
+  seed_term: "Pattern 种子词",
+  piaoquan_topic_point: "票圈内容点",
+  category_leaf_element: "分类叶子元素",
   pattern_itemset: "来自需求 Pattern",
   pattern_search_query: "来自需求 Pattern",
   pattern_seed_ref: "来自需求 Pattern",