fix: lock pchome growth ui copy guardrails
All checks were successful
CD Pipeline / deploy (push) Successful in 1m11s

This commit is contained in:
ogt
2026-06-26 11:35:30 +08:00
parent 0808063133
commit 2144ef2102
14 changed files with 147 additions and 41 deletions

View File

@@ -289,7 +289,7 @@
<!-- Review Steps -->
<div class="card">
<div class="card-header">審查流程
<span id="pipelineId" style="font-size:11px;color:var(--muted);margin-left:auto;font-family:monospace"></span>
<span id="pipelineId" style="font-size:11px;color:var(--muted);margin-left:auto;"></span>
</div>
<div class="card-body">
<div class="pipeline" id="stepsContainer">
@@ -315,11 +315,10 @@
</div>
</div>
<!-- Commit Info -->
<div class="card">
<div class="card-header">部署證據</div>
<div class="card-header">上線證據</div>
<div class="card-body" id="commitInfo" style="font-size:13px;color:var(--muted);line-height:1.8;">
<span style="color:var(--muted)">等待下次部署觸發...</span>
<span style="color:var(--muted)">等待下次上線檢查...</span>
</div>
</div>
@@ -490,17 +489,15 @@ function renderEA(ea, autoFix) {
</div>`;
}
// ── Commit info ───────────────────────────────────────────────────
// ── 上線證據 ─────────────────────────────────────────────────────
function renderCommitInfo(state) {
const el = document.getElementById('commitInfo');
if (!state.commit_sha) return;
const files = (state.changed_files||[]).slice(0,5).map(f=>`<code>${f.split('/').pop()}</code>`).join(' ');
const more = (state.changed_files||[]).length > 5 ? `<span style="color:var(--muted)">+${state.changed_files.length-5}</span>` : '';
const changedCount = (state.changed_files||[]).length;
el.innerHTML = `
<div><b>提交</b> <code>${state.commit_sha.slice(0,8)}</code></div>
<div><b>分支</b> <code>${state.branch||'?'}</code></div>
<div><b>狀態</b> 已收到上線檢查資料</div>
<div><b>模式</b> ${DEPLOY_TYPE_LABEL[state.deploy_type] || state.deploy_type || '同步部署'}</div>
<div><b>變更</b> ${files} ${more}</div>`;
<div><b>變更</b> ${changedCount} 項待檢查</div>`;
}
// ── Status bar ────────────────────────────────────────────────────
@@ -514,7 +511,7 @@ function renderStatusBar(state) {
const msgs = {
running: `⟳ <b>流程執行中</b> — 第 ${state.current_step}/5 步`,
completed: `✅ <b>程式碼審查完成</b> — ${state.message||''}`,
error: `❌ <b>流程失敗</b> — ${escHtml(state.message||'')}`,
error: `❌ <b>流程需確認</b> — 請查看風險清單`,
skipped: `⏭ <b>已略過</b> — ${escHtml(state.message||'')}`,
};
el.innerHTML = msgs[state.status] || '';
@@ -533,10 +530,10 @@ function renderHistory(items) {
const sev = h.severity_summary || {};
return `<div class="hist-item" onclick="loadHistoryItem(${idx})" data-idx="${idx}">
<div style="display:flex;justify-content:space-between">
<span class="hist-sha">${h.commit_sha}</span>
<span class="hist-sha">上線檢查</span>
<span style="font-size:11px;color:var(--muted)">${h.created_at.slice(0,16).replace('T',' ')}</span>
</div>
<div class="hist-meta">🌿 ${h.branch}${(h.changed_files||[]).length} 檔案${h.auto_fix?' • 🔧 已自動修復':''}</div>
<div class="hist-meta">${(h.changed_files||[]).length} 項變更${h.auto_fix?' • 已完成修復流程':''}</div>
<div class="hist-sev">
${sev.critical?`<span style="background:rgba(248,81,73,.2);color:var(--red)">🔴 ${sev.critical}</span>`:''}
${sev.high?`<span style="background:rgba(210,153,34,.2);color:var(--orange)">🟠 ${sev.high}</span>`:''}
@@ -555,18 +552,16 @@ function loadHistoryItem(idx) {
el.style.borderColor = i === idx ? 'var(--blue)' : '';
});
renderSeverity(h.severity_summary);
const files = (h.changed_files||[]).slice(0,5).map(f=>`<code>${f.split('/').pop()}</code>`).join(' ');
const more = (h.changed_files||[]).length > 5 ? `<span style="color:var(--muted)">+${h.changed_files.length-5}</span>` : '';
const changedCount = (h.changed_files||[]).length;
document.getElementById('commitInfo').innerHTML = `
<div><b>提交</b> <code>${h.commit_sha}</code></div>
<div><b>分支</b> <code>${h.branch||'?'}</code></div>
<div><b>狀態</b> 已完成上線檢查</div>
<div><b>時間</b> ${h.created_at.slice(0,16).replace('T',' ')}</div>
<div><b>變更</b> ${files} ${more}</div>`;
document.getElementById('pipelineId').textContent = (h.pipeline_id||'').slice(-14);
<div><b>變更</b> ${changedCount} 項已檢查</div>`;
document.getElementById('pipelineId').textContent = '最近一次';
const sBar = document.getElementById('statusBar');
sBar.style.display = 'block';
sBar.className = 'completed';
sBar.innerHTML = `✅ <b>歷史記錄</b> — 提交 ${h.commit_sha}${h.auto_fix ? ' 🔧 已自動修復' : ''}`;
sBar.innerHTML = `✅ <b>歷史記錄</b> — 已完成上線檢查${h.auto_fix ? ',並完成修復流程' : ''}`;
renderFindings(h.findings || []);
renderArchitectureReport(h.openclaw_report || '');
renderEA(h.ea_decision || {}, h.auto_fix || false);
@@ -593,7 +588,7 @@ async function poll() {
renderArchitectureReport(state.openclaw_report);
renderEA(state.ea_decision, state.auto_fix_triggered);
renderCommitInfo(state);
document.getElementById('pipelineId').textContent = (state.pipeline_id||'').slice(-14);
document.getElementById('pipelineId').textContent = state.pipeline_id ? '執行中' : '';
// 每 3s 輪詢running/ 30sidle
const interval = state.status === 'running' ? 3000 : 30000;