feat(dashboard): components by update impact and ecosystem as clickable charts (#957) #966

Merged
sharang merged 1 commits from feat/957-components-view into main 2026-11-10 14:52:23 +00:00
Owner

Part of #957 (the "Komponenten" view only), epic #955.

Stacked on #959 (feat/949-cve-groups): this PR's base is that branch. Retarget it to main after #959 merges.

What changed

On the SBOM page's component tab ("Pakete"), with one target picked, two horizontal bar charts open the tab. Each is a single series in one hue (#2a78d6, checked against the light and dark surfaces), so there is no legend; the title names what is plotted. "Diagramm / Tabelle" switches to plain tables with the same numbers.

  1. Welches Update entfernt die meisten CVEs: one bar per CVE group from #959 that names a fix (fix_version set and fixable > 0). Label openssl 3.0.11 → 3.0.15, value −3 CVEs. Ranked by fixable, then by the worst severity. Shows the top 10, then "Alle anzeigen (N)". Each bar is a <button> with an aria-label. A click opens #959's own group card (CveGroupCard) on the page, with the breadcrumb "Komponenten › openssl 3.0.11" and "← Zurück zum Diagramm". A decision in the card reloads the groups; once a component has no open CVE left, the view says so.
  2. Komponenten nach Ökosystem: one bar per package manager. Value 412 · 7 mit CVE, meaning components, and how many of them have a known vulnerability. A click filters the component table below to that ecosystem and puts the filter in the URL: /sbom/ecosystem/npm?target=<id>. The view then shows the breadcrumb "Komponenten › npm" and "← Zurück zum Diagramm", which clears the filter.

There is no new ranking. The update chart filters and orders #959's CveGroup values (rank_updates).

Endpoints

  • Uses GET /api/v1/targets/{id}/cve-groups (#959, via infrastructure::vex::fetch_cve_groups). When a card opens, it also loads /targets/{id}/cves and /targets/{id}/enisa, which the card needs.
  • Adds GET /api/v1/targets/{id}/sbom-ecosystems (new handlers/sbom_ecosystems.rs):
    • One $match/$group aggregation over the tenant's SBOM collection, so one row leaves Mongo per ecosystem.
    • Reply: {data: [{package_manager, components, with_cve}]}, largest first.
    • A failed aggregation answers 500, so the dashboard says "could not be loaded" instead of drawing an empty chart.
    • Uses the tenant DB and the org-role gate like every route (GET, so read-only roles may call it).
    • The type and the pure ranking live in compliance-core/src/sbom_ecosystems.rs. The rule for which managers count (is_filterable_manager: not empty, unknown or file) is now shared with /sbom/filters.
  • Adds the dashboard route /sbom/ecosystem/:ecosystem?:target (Route::SbomEcosystemPage). It is additive: it renders the existing SbomPage with a new defaulted ecosystem prop, so no existing Route::SbomPage { target } constructor changes. The sidebar keeps "Stückliste" active on it (one added match arm).

Edits outside the new files (all small)

  • components/vex_panel.rs (#959's file): fn CveGroupCard becomes pub fn CveGroupCard. Only the visibility changes.
  • pages/sbom.rs:
    • Mounts ComponentOverview at the top of the tab when a target is picked.
    • Starts pm_filter from the URL and keeps it in step on back/forward (use_reactive).
    • The package-manager <option> now gets selected:, so the dropdown shows the active filter.
    • pm_display_name becomes pub(crate).
  • app.rs (new route plus a round-trip test), sidebar.rs (one arm), routes.rs, and the mod.rs files: one line each.
  • i18n/texts.rs: a new component_overview module at the end (DE and EN). assets/main.css: co-* classes at the end. docs/guide/sbom.md: a "Charts for one target" section.

How tested

  • cargo fmt --all --check: ok.
  • RUSTFLAGS="-D warnings" cargo clippy ... -- -D warnings for compliance-agent, compliance-core, and compliance-dashboard (server and web): all clean.
  • Targeted tests, all passing:
    • core sbom_ecosystems: 3 unit tests and 1 doctest.
    • agent sbom_ecosystems: 2 tests (pipeline shape; a row read whether Mongo sums in i32 or i64).
    • agent role_gate: 9 tests.
    • dashboard: component_overview (ranking, bar width), the texts module, and the route round trip for /sbom/ecosystem/npm?target=…, plus the existing i18n, VEX panel and sidebar tests (33).
  • Not checked in a running app or browser. The view has not been seen on stage yet; please look at it there before merging.

Open points

  • Opening a package card stays on the page (breadcrumb and back) and is not in the URL. Only the ecosystem filter is in the URL.
  • Picking a package manager from the dropdown while on /sbom/ecosystem/X changes the filter but not the URL.
  • sbom-ecosystems is not in the API-key KEY_SCOPES or docs/guide/api-keys.md, the same as #959's cve-groups. Add it with pruefwerk:sbom.read if API keys should reach it.
  • Components with an empty, unknown or file package manager are left out of the ecosystem chart (the same rule as the dropdown, which cannot filter by them). The bars can therefore add up to less than the table's total.

🤖 Generated with Claude Code

Part of #957 (the "Komponenten" view only), epic #955. > **Stacked on #959** (`feat/949-cve-groups`): this PR's base is that branch. Retarget it to `main` after #959 merges. ## What changed On the SBOM page's component tab ("Pakete"), with one target picked, two horizontal bar charts open the tab. Each is a single series in one hue (`#2a78d6`, checked against the light and dark surfaces), so there is no legend; the title names what is plotted. "Diagramm / Tabelle" switches to plain tables with the same numbers. 1. **Welches Update entfernt die meisten CVEs**: one bar per CVE group from #959 that names a fix (`fix_version` set and `fixable > 0`). Label `openssl 3.0.11 → 3.0.15`, value `−3 CVEs`. Ranked by `fixable`, then by the worst severity. Shows the top 10, then "Alle anzeigen (N)". Each bar is a `<button>` with an `aria-label`. A click opens **#959's own group card** (`CveGroupCard`) on the page, with the breadcrumb "Komponenten › openssl 3.0.11" and "← Zurück zum Diagramm". A decision in the card reloads the groups; once a component has no open CVE left, the view says so. 2. **Komponenten nach Ökosystem**: one bar per package manager. Value `412 · 7 mit CVE`, meaning components, and how many of them have a known vulnerability. A click filters the component table below to that ecosystem and puts the filter in the URL: `/sbom/ecosystem/npm?target=<id>`. The view then shows the breadcrumb "Komponenten › npm" and "← Zurück zum Diagramm", which clears the filter. There is no new ranking. The update chart filters and orders #959's `CveGroup` values (`rank_updates`). ### Endpoints - **Uses** `GET /api/v1/targets/{id}/cve-groups` (#959, via `infrastructure::vex::fetch_cve_groups`). When a card opens, it also loads `/targets/{id}/cves` and `/targets/{id}/enisa`, which the card needs. - **Adds** `GET /api/v1/targets/{id}/sbom-ecosystems` (new `handlers/sbom_ecosystems.rs`): - One `$match`/`$group` aggregation over the tenant's SBOM collection, so one row leaves Mongo per ecosystem. - Reply: `{data: [{package_manager, components, with_cve}]}`, largest first. - A failed aggregation answers 500, so the dashboard says "could not be loaded" instead of drawing an empty chart. - Uses the tenant DB and the org-role gate like every route (GET, so read-only roles may call it). - The type and the pure ranking live in `compliance-core/src/sbom_ecosystems.rs`. The rule for which managers count (`is_filterable_manager`: not empty, `unknown` or `file`) is now shared with `/sbom/filters`. - **Adds the dashboard route** `/sbom/ecosystem/:ecosystem?:target` (`Route::SbomEcosystemPage`). It is additive: it renders the existing `SbomPage` with a new defaulted `ecosystem` prop, so no existing `Route::SbomPage { target }` constructor changes. The sidebar keeps "Stückliste" active on it (one added match arm). ### Edits outside the new files (all small) - `components/vex_panel.rs` (#959's file): `fn CveGroupCard` becomes `pub fn CveGroupCard`. Only the visibility changes. - `pages/sbom.rs`: - Mounts `ComponentOverview` at the top of the tab when a target is picked. - Starts `pm_filter` from the URL and keeps it in step on back/forward (`use_reactive`). - The package-manager `<option>` now gets `selected:`, so the dropdown shows the active filter. - `pm_display_name` becomes `pub(crate)`. - `app.rs` (new route plus a round-trip test), `sidebar.rs` (one arm), `routes.rs`, and the `mod.rs` files: one line each. - `i18n/texts.rs`: a new `component_overview` module at the end (DE and EN). `assets/main.css`: `co-*` classes at the end. `docs/guide/sbom.md`: a "Charts for one target" section. ## How tested - `cargo fmt --all --check`: ok. - `RUSTFLAGS="-D warnings" cargo clippy ... -- -D warnings` for compliance-agent, compliance-core, and compliance-dashboard (`server` and `web`): all clean. - Targeted tests, all passing: - core `sbom_ecosystems`: 3 unit tests and 1 doctest. - agent `sbom_ecosystems`: 2 tests (pipeline shape; a row read whether Mongo sums in i32 or i64). - agent `role_gate`: 9 tests. - dashboard: `component_overview` (ranking, bar width), the texts module, and the route round trip for `/sbom/ecosystem/npm?target=…`, plus the existing i18n, VEX panel and sidebar tests (33). - **Not checked in a running app or browser.** The view has not been seen on stage yet; please look at it there before merging. ## Open points - Opening a package card stays on the page (breadcrumb and back) and is **not in the URL**. Only the ecosystem filter is in the URL. - Picking a package manager from the dropdown while on `/sbom/ecosystem/X` changes the filter but not the URL. - `sbom-ecosystems` is **not** in the API-key `KEY_SCOPES` or `docs/guide/api-keys.md`, the same as #959's `cve-groups`. Add it with `pruefwerk:sbom.read` if API keys should reach it. - Components with an empty, `unknown` or `file` package manager are left out of the ecosystem chart (the same rule as the dropdown, which cannot filter by them). The bars can therefore add up to less than the table's total. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
sharang changed target branch from feat/949-cve-groups to main 2026-11-10 14:33:04 +00:00
sharang added 1 commit 2026-11-10 14:33:04 +00:00
feat(dashboard): components by update impact and ecosystem as clickable charts (#957)
CI / Check (push) Skipped
CI / Detect Changes (pull_request) Skipped
CI / Deploy Agent (pull_request) Skipped
CI / Deploy Dashboard (pull_request) Skipped
CI / Deploy Docs (pull_request) Skipped
CI / Deploy MCP (pull_request) Skipped
CI / Agent integration (pull_request) Successful in 4m12s
CI / Check (pull_request) Successful in 18m48s
be0eb4f12c
The SBOM page's component tab opens, for one target, with two bar charts
(one hue, no legend; "Tabelle" shows the same numbers as tables):

- "Welches Update entfernt die meisten CVEs": per CVE group of #949 with
  a fix, "openssl 3.0.11 -> 3.0.15" and "-3 CVEs", ranked by the CVEs the
  update fixes, then by the worst severity; top 10, then "Alle anzeigen".
  A bar opens that component's group card in place (breadcrumb
  "Komponenten > openssl 3.0.11", "Zurueck zum Diagramm"). The card is
  #949's own; only its visibility changes.
- "Komponenten nach Oekosystem": per package manager the components and
  how many have a known vulnerability. A bar filters the component table
  below to it and puts it in the URL: the new additive route
  /sbom/ecosystem/:ecosystem?target=<id> renders the same page. The
  package-manager select now shows the active filter.

Agent: GET /api/v1/targets/{id}/sbom-ecosystems counts the target's SBOM
components per package manager in one aggregation (tenant database, org
role gate as every route). The ranking and the filterable managers live
in compliance-core (sbom_ecosystems), shared with /sbom/filters.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
sharang merged commit 88682c6c6a into main 2026-11-10 14:52:23 +00:00
Sign in to join this conversation.