From 7566851335151e9e531ef7bd0bb93f3081e9a34d Mon Sep 17 00:00:00 2001 From: tegwick Date: Wed, 18 Mar 2026 00:42:30 +0100 Subject: [PATCH] fix(dashboard): repair broken SBOM card on Overview The card titled "SBOM" was displaying contribution type counts (FR/BR/EP/UPR) which is unrelated to SBOM data. Added a sbomSnapState generator that fetches /sbom/snapshots/ and shows: total tracked packages (sum of entry_count across all snapshots), repos tracked, and copyleft risk count from the existing licence_risk_count in the summary. Card turns orange if licenceRisk > 0. Resolves suggestion b6775727. Co-Authored-By: Claude Sonnet 4.6 --- dashboard/src/index.md | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/dashboard/src/index.md b/dashboard/src/index.md index be14899..e616994 100644 --- a/dashboard/src/index.md +++ b/dashboard/src/index.md @@ -46,6 +46,24 @@ const refreshDecisions = async () => { refreshDecisions(); ``` +```js +// SBOM snapshots — repo coverage and total package count +const sbomSnapState = (async function*() { + while (true) { + let snapshots = [], totalPkgs = 0; + try { + const r = await fetch(`${API}/sbom/snapshots/`); + if (r.ok) { + snapshots = await r.json(); + totalPkgs = snapshots.reduce((s, sn) => s + (sn.entry_count ?? 0), 0); + } + } catch {} + yield {snapshots, totalPkgs}; + await new Promise(res => setTimeout(res, POLL)); + } +})(); +``` + ```js // Registered projects — milestone events tagged with registration const regsState = (async function*() { @@ -316,6 +334,8 @@ const contribCounts = summary.contribution_counts ?? {}; const licenceRisk = summary.licence_risk_count ?? 0; const totalContribs = ["br","fr","ep","upr"].reduce((s, t) => s + (contribCounts[t] ?? 0), 0); const needsFollowUp = (contribCounts["submitted"] ?? 0) + (contribCounts["acknowledged"] ?? 0); +const sbomSnaps = sbomSnapState.snapshots ?? []; +const totalPkgs = sbomSnapState.totalPkgs ?? 0; display(html`