fix(onboarding): 模板分发报告识别 appended/updated 五态,不再误显 ✗
noteapp 实测追加管理块成功但 UI 渲染成红叉——前端映射只认旧三态, 新增 action 落入 failed 默认分支。改映射表覆盖五态, updated/appended 展示后端 detail(含版本信息)。 Rules-Applied: R12
This commit is contained in:
parent
965d095820
commit
c4a6600134
@ -53,6 +53,19 @@ const STATUS_CONFIG: Record<string, { color: string; bg: string; label: string }
|
||||
abandoned: { color: "#52525B", bg: "#FAFAFA", label: "已退役" },
|
||||
};
|
||||
|
||||
// 接入包模板分发五态(对应 onboarding.rs TemplateResult.action)
|
||||
// label 为 null 时展示后端 detail(updated/appended/failed 的 detail 含版本信息)
|
||||
const TEMPLATE_ACTION_STYLE: Record<
|
||||
string,
|
||||
{ icon: string; color: string; label: string | null }
|
||||
> = {
|
||||
written: { icon: "✓", color: "text-green-600", label: "已写入" },
|
||||
updated: { icon: "↑", color: "text-blue-600", label: null },
|
||||
appended: { icon: "+", color: "text-blue-600", label: null },
|
||||
skipped: { icon: "○", color: "text-gray-400", label: "已存在" },
|
||||
failed: { icon: "✗", color: "text-red-600", label: null },
|
||||
};
|
||||
|
||||
const TASK_PREFIX: Record<string, string> = {
|
||||
done: "✅",
|
||||
in_progress: "🔵",
|
||||
@ -1289,25 +1302,17 @@ function GovernancePanel({
|
||||
{packTemplates && (
|
||||
<div className="space-y-0.5 pt-0.5">
|
||||
<p className="text-[10px] text-gray-500 font-semibold">模板分发</p>
|
||||
{packTemplates.map((t) => (
|
||||
{packTemplates.map((t) => {
|
||||
const style =
|
||||
TEMPLATE_ACTION_STYLE[t.action] ?? TEMPLATE_ACTION_STYLE.failed;
|
||||
return (
|
||||
<p key={t.name} className="text-[10px] font-mono flex items-center gap-1">
|
||||
<span
|
||||
className={
|
||||
t.action === "written"
|
||||
? "text-green-600"
|
||||
: t.action === "skipped"
|
||||
? "text-gray-400"
|
||||
: "text-red-600"
|
||||
}
|
||||
>
|
||||
{t.action === "written" ? "✓" : t.action === "skipped" ? "○" : "✗"}
|
||||
</span>
|
||||
<span className={style.color}>{style.icon}</span>
|
||||
<span className="text-gray-600 truncate flex-1">{t.name}</span>
|
||||
<span className="text-gray-400">
|
||||
{t.action === "written" ? "已写入" : t.action === "skipped" ? "已存在" : t.detail}
|
||||
</span>
|
||||
<span className="text-gray-400">{style.label ?? t.detail}</span>
|
||||
</p>
|
||||
))}
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
)}
|
||||
{buffStatus?.status === "active" ? (
|
||||
|
||||
Loading…
Reference in New Issue
Block a user