From 839fb727f25f51a156e323bf787d16dae5e35c34 Mon Sep 17 00:00:00 2001 From: Sharang Parnerkar <30073382+mighty840@users.noreply.github.com> Date: Thu, 8 Oct 2026 23:26:27 +0200 Subject: [PATCH 1/2] fix(dashboard): the SBOM arrow on a target opens the SBOM filtered to it The arrow on the target page's SBOM card linked to the bare SBOM page, so it showed every target's components. The SBOM route now takes an optional ?target= (like the findings page) that preselects the target filter; the target page passes its id, the sidebar and overview links stay unfiltered, and the sidebar keeps SBOM highlighted for a filtered view. Co-Authored-By: Claude Opus 5.5 (1M context) Claude-Session: https://claude.ai/code/session_01EYKjxacrr6K88DruUmP48p --- compliance-dashboard/src/app.rs | 30 +++++++++++++++++-- .../src/components/sidebar.rs | 5 +++- compliance-dashboard/src/pages/overview.rs | 4 +-- compliance-dashboard/src/pages/sbom.rs | 7 +++-- compliance-dashboard/src/pages/target.rs | 2 +- 5 files changed, 39 insertions(+), 9 deletions(-) diff --git a/compliance-dashboard/src/app.rs b/compliance-dashboard/src/app.rs index 31ce1dc..d1d587a 100644 --- a/compliance-dashboard/src/app.rs +++ b/compliance-dashboard/src/app.rs @@ -23,8 +23,9 @@ pub enum Route { FindingsPage { target: String }, #[route("/findings/:id")] FindingDetailPage { id: String }, - #[route("/sbom")] - SbomPage {}, + // `?target=` opens the list filtered to one target. + #[route("/sbom?:target")] + SbomPage { target: String }, #[route("/issues")] IssuesPage {}, #[route("/graph")] @@ -74,3 +75,28 @@ pub fn App() -> Element { Router:: {} } } + +#[cfg(test)] +mod tests { + use super::Route; + use std::str::FromStr; + + #[test] + fn the_sbom_page_carries_its_target_in_the_query() { + let filtered = Route::SbomPage { + target: "665f1c2ab0c4d1e2f3a4b5c6".to_string(), + }; + assert_eq!( + filtered.to_string(), + "/sbom?target=665f1c2ab0c4d1e2f3a4b5c6" + ); + assert!(matches!( + Route::from_str("/sbom?target=665f1c2ab0c4d1e2f3a4b5c6"), + Ok(Route::SbomPage { target }) if target == "665f1c2ab0c4d1e2f3a4b5c6" + )); + assert!(matches!( + Route::from_str("/sbom"), + Ok(Route::SbomPage { target }) if target.is_empty() + )); + } +} diff --git a/compliance-dashboard/src/components/sidebar.rs b/compliance-dashboard/src/components/sidebar.rs index c21e5b2..d61e224 100644 --- a/compliance-dashboard/src/components/sidebar.rs +++ b/compliance-dashboard/src/components/sidebar.rs @@ -74,7 +74,9 @@ pub fn Sidebar() -> Element { }, NavItem { label: nav::SBOM, - route: Route::SbomPage {}, + route: Route::SbomPage { + target: String::new(), + }, icon: rsx! { Icon { icon: BsBoxSeam, width: 18, height: 18 } }, runtime_only: false, write_only: false, @@ -160,6 +162,7 @@ pub fn Sidebar() -> Element { { let is_active = match (¤t_route, &item.route) { (Route::FindingDetailPage { .. } | Route::FindingsPage { .. }, Route::FindingsPage { .. }) => true, + (Route::SbomPage { .. }, Route::SbomPage { .. }) => true, (Route::CompliancePage { .. }, Route::TargetsPage {}) => true, (Route::DastTargetsPage {}, Route::DastOverviewPage {}) => true, (Route::DastFindingsPage {}, Route::DastOverviewPage {}) => true, diff --git a/compliance-dashboard/src/pages/overview.rs b/compliance-dashboard/src/pages/overview.rs index 22f4619..5648490 100644 --- a/compliance-dashboard/src/pages/overview.rs +++ b/compliance-dashboard/src/pages/overview.rs @@ -128,12 +128,12 @@ pub fn OverviewPage() -> Element { span { class: "sev-high-text", "{s.high_findings} {overview::HIGH_LC.get(lang)}" } } } - Link { to: Route::SbomPage {}, class: "ov-figure", + Link { to: Route::SbomPage { target: String::new() }, class: "ov-figure", span { class: "ov-figure-label", {overview::COMPONENTS.get(lang)} } span { class: "ov-figure-value", "{s.total_sbom_entries}" } span { class: "ov-figure-sub", {overview::IN_SBOM.get(lang)} } } - Link { to: Route::SbomPage {}, class: "ov-figure", + Link { to: Route::SbomPage { target: String::new() }, class: "ov-figure", span { class: "ov-figure-label", {overview::KNOWN_VULNS.get(lang)} } span { class: "ov-figure-value", "{s.total_cve_alerts}" } span { class: "ov-figure-sub", {overview::IN_COMPONENTS.get(lang)} } diff --git a/compliance-dashboard/src/pages/sbom.rs b/compliance-dashboard/src/pages/sbom.rs index 87e80fe..fc96029 100644 --- a/compliance-dashboard/src/pages/sbom.rs +++ b/compliance-dashboard/src/pages/sbom.rs @@ -8,12 +8,13 @@ use crate::i18n::{use_lang, Lang}; use crate::infrastructure::sbom::*; #[component] -pub fn SbomPage() -> Element { +pub fn SbomPage(target: String) -> Element { let lang = use_lang()(); let mut toasts = use_context::(); // ── Filter signals ── let mut page = use_signal(|| 1u64); - let mut repo_filter = use_signal(String::new); + // Opened from a target (`?target=`): filtered to it. + let mut repo_filter = use_signal(|| target.clone()); let mut pm_filter = use_signal(String::new); let mut search_q = use_signal(String::new); let mut vuln_toggle = use_signal(|| Option::::None); @@ -138,7 +139,7 @@ pub fn SbomPage() -> Element { { let id = repo.get("_id").and_then(|o| o.get("$oid")).and_then(|s| s.as_str()).unwrap_or_default().to_string(); let name = repo.get("name").and_then(|n| n.as_str()).unwrap_or_default().to_string(); - rsx! { option { value: "{id}", "{name}" } } + rsx! { option { value: "{id}", selected: repo_filter() == id, "{name}" } } } } }, diff --git a/compliance-dashboard/src/pages/target.rs b/compliance-dashboard/src/pages/target.rs index e9512cc..7f73152 100644 --- a/compliance-dashboard/src/pages/target.rs +++ b/compliance-dashboard/src/pages/target.rs @@ -213,7 +213,7 @@ pub fn TargetPage(id: String) -> Element { section { class: "card target-sbom", div { class: "target-card-head", h3 { {tx::SBOM_TITLE.get(lang)} } - Link { to: Route::SbomPage {}, class: "target-card-link", + Link { to: Route::SbomPage { target: id.clone() }, class: "target-card-link", Icon { icon: BsArrowRight, width: 14, height: 14 } } } -- 2.54.1 From 425e84aee4d2fb6453173959211a4d5fcd99aabb Mon Sep 17 00:00:00 2001 From: Sharang Parnerkar <30073382+mighty840@users.noreply.github.com> Date: Thu, 8 Oct 2026 23:36:26 +0200 Subject: [PATCH 2/2] docs(sbom): the target page's SBOM arrow opens the filtered list Co-Authored-By: Claude Opus 5.5 (1M context) Claude-Session: https://claude.ai/code/session_01EYKjxacrr6K88DruUmP48p --- docs/guide/repositories.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/guide/repositories.md b/docs/guide/repositories.md index a68e06c..8c5f16e 100644 --- a/docs/guide/repositories.md +++ b/docs/guide/repositories.md @@ -188,7 +188,8 @@ Below them: - **CRA-Stand** -- the target's standing against the CRA; **Stand je Anforderung** opens the status of each requirement. -- **Stückliste** -- the number of components and of known vulnerabilities (CVE). +- **Stückliste** -- the number of components and of known vulnerabilities (CVE); + the arrow opens the **Stückliste** filtered to this target. - **Offene Befunde** -- the most severe open findings; **Alle Befunde dieses Prüfobjekts** opens the full list. - **Prüfläufe** -- the scan runs, see [Prüfungen](/guide/scanning). -- 2.54.1