From c7539e379d2718d76b1e7836f405047ee2703c3c Mon Sep 17 00:00:00 2001 From: oliver Date: Fri, 18 Sep 2026 10:50:29 +0800 Subject: [PATCH] Exclude added from fail counts and tighten the sheet nav header. Derive fail from missing+mismatch only, recompute pass rate accordingly, and put check-item count on one row aligned with fail/success/%. Co-authored-by: Cursor --- web/src/index.css | 70 +++++++++++++++++------- web/src/pages/network/BizComparePage.tsx | 47 +++++++++------- 2 files changed, 78 insertions(+), 39 deletions(-) diff --git a/web/src/index.css b/web/src/index.css index 3e50eda..2d6023c 100644 --- a/web/src/index.css +++ b/web/src/index.css @@ -10242,9 +10242,25 @@ html.login-page--paused .login-page__flare { } .bs-cmp-nav__head { - padding: 10px 12px 8px; + display: grid; + grid-template-columns: 8px minmax(0, 1fr) auto; + align-items: center; + gap: 0 8px; + padding: 8px 10px; border-bottom: 1px solid var(--bs-cmp-border); flex: 0 0 auto; + min-height: 36px; +} + +.bs-cmp-nav__dot--spacer { + visibility: hidden; +} + +.bs-cmp-nav__head-main { + display: inline-flex; + align-items: center; + gap: 6px; + min-width: 0; } .bs-cmp-nav__title { @@ -10252,43 +10268,58 @@ html.login-page--paused .login-page__flare { font-weight: 700; letter-spacing: 0.02em; color: #f1f5f9; + white-space: nowrap; +} + +.bs-cmp-nav__count { + display: inline-flex; + align-items: center; + justify-content: center; + min-width: 1.35rem; + height: 1.2rem; + padding: 0 5px; + border-radius: 999px; + font-size: 10px; + font-weight: 700; + font-variant-numeric: tabular-nums; + line-height: 1; + color: #93c5fd; + background: rgba(59, 130, 246, 0.18); + border: 1px solid rgba(96, 165, 250, 0.35); } .bs-cmp-nav__hint { - margin-top: 2px; - font-size: 11px; - color: var(--bs-cmp-muted); - line-height: 1.35; -} - -.bs-cmp-nav__legend { - display: grid; - grid-template-columns: repeat(3, minmax(1.6em, auto)); - gap: 4px 6px; - justify-items: end; - margin-top: 6px; - margin-left: auto; - width: fit-content; - font-size: 10px; - font-weight: 700; + display: none; } +.bs-cmp-nav__legend, .bs-cmp-nav__stats { display: inline-grid; - grid-template-columns: repeat(3, minmax(1.6em, auto)); - gap: 2px 6px; + grid-template-columns: 2.6em 2.6em 2.8em; + gap: 2px; justify-items: end; align-items: center; flex: 0 0 auto; font-variant-numeric: tabular-nums; } +.bs-cmp-nav__legend { + margin: 0; + font-size: 10px; + font-weight: 700; +} + .bs-cmp-nav__num { font-size: 11px; font-weight: 700; line-height: 1; color: #475569; opacity: 0.55; + white-space: nowrap; +} + +.bs-cmp-nav__legend .bs-cmp-nav__num { + font-size: 10px; } .bs-cmp-nav__num--fail.is-hot { @@ -10304,7 +10335,6 @@ html.login-page--paused .login-page__flare { .bs-cmp-nav__num--rate { color: #93c5fd; opacity: 0.95; - min-width: 2.6em; } .bs-cmp-nav__list { diff --git a/web/src/pages/network/BizComparePage.tsx b/web/src/pages/network/BizComparePage.tsx index 70830fe..6817461 100644 --- a/web/src/pages/network/BizComparePage.tsx +++ b/web/src/pages/network/BizComparePage.tsx @@ -814,12 +814,18 @@ export function BizComparePage() { diff_count?: number; removed?: number; changed?: number; - }) => - Number( - c.fail_count ?? - c.diff_count ?? - Number(c.removed || 0) + Number(c.changed || 0), - ); + added?: number; + }) => { + // Always derive from removed+changed so "新增" never counts as fail + // (legacy diff_count used to include added). + if (c.removed !== undefined || c.changed !== undefined) { + return Number(c.removed || 0) + Number(c.changed || 0); + } + if (c.fail_count !== undefined) return Number(c.fail_count || 0); + const legacy = Number(c.diff_count || 0); + const added = Number(c.added || 0); + return Math.max(0, legacy - added); + }; const sheetSuccessOf = (c: { success_count?: number; unchanged?: number }) => Number(c.success_count ?? c.unchanged ?? 0); @@ -832,8 +838,9 @@ export function BizComparePage() { changed?: number; success_count?: number; unchanged?: number; + added?: number; }) => { - if (c.pass_rate !== undefined && c.pass_rate !== null) return Number(c.pass_rate); + // Always recompute from fail/success so added never skews pass rate const fail = sheetFailOf(c); const ok = sheetSuccessOf(c); const judged = fail + ok; @@ -865,7 +872,6 @@ export function BizComparePage() { return String(a.metric_id).localeCompare(String(b.metric_id)); }); }, [summary.sheet_cards]); - const sheetFailCount = sheetCards.filter((c) => sheetFailOf(c) > 0).length; const activeSheetCard = sheetCards.find((c) => c.metric_id === resultSheetId) || sheetCards[0]; const activeFail = sheetFailOf(activeSheetCard || {}); const activeSuccess = sheetSuccessOf(activeSheetCard || {}); @@ -2275,16 +2281,19 @@ export function BizComparePage() {