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: "已退役" },
|
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> = {
|
const TASK_PREFIX: Record<string, string> = {
|
||||||
done: "✅",
|
done: "✅",
|
||||||
in_progress: "🔵",
|
in_progress: "🔵",
|
||||||
@ -1289,25 +1302,17 @@ function GovernancePanel({
|
|||||||
{packTemplates && (
|
{packTemplates && (
|
||||||
<div className="space-y-0.5 pt-0.5">
|
<div className="space-y-0.5 pt-0.5">
|
||||||
<p className="text-[10px] text-gray-500 font-semibold">模板分发</p>
|
<p className="text-[10px] text-gray-500 font-semibold">模板分发</p>
|
||||||
{packTemplates.map((t) => (
|
{packTemplates.map((t) => {
|
||||||
<p key={t.name} className="text-[10px] font-mono flex items-center gap-1">
|
const style =
|
||||||
<span
|
TEMPLATE_ACTION_STYLE[t.action] ?? TEMPLATE_ACTION_STYLE.failed;
|
||||||
className={
|
return (
|
||||||
t.action === "written"
|
<p key={t.name} className="text-[10px] font-mono flex items-center gap-1">
|
||||||
? "text-green-600"
|
<span className={style.color}>{style.icon}</span>
|
||||||
: t.action === "skipped"
|
<span className="text-gray-600 truncate flex-1">{t.name}</span>
|
||||||
? "text-gray-400"
|
<span className="text-gray-400">{style.label ?? t.detail}</span>
|
||||||
: "text-red-600"
|
</p>
|
||||||
}
|
);
|
||||||
>
|
})}
|
||||||
{t.action === "written" ? "✓" : t.action === "skipped" ? "○" : "✗"}
|
|
||||||
</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>
|
|
||||||
</p>
|
|
||||||
))}
|
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
{buffStatus?.status === "active" ? (
|
{buffStatus?.status === "active" ? (
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user