From ad0fde910614110b571549941073aee289b7f34b Mon Sep 17 00:00:00 2001 From: Sharang Parnerkar Date: Tue, 10 Nov 2026 17:45:09 +0000 Subject: [PATCH] feat(dashboard): licences by group as a clickable chart (#957) (#967) Co-Authored-By: Claude Opus 5.5 --- compliance-core/src/models/license.rs | 181 ++++++++++++++++++ compliance-dashboard/assets/main.css | 146 ++++++++++++++ .../src/components/licence_overview.rs | 157 +++++++++++++++ compliance-dashboard/src/components/mod.rs | 1 + compliance-dashboard/src/i18n/texts.rs | 128 +++++++++++++ compliance-dashboard/src/pages/sbom.rs | 90 ++++++--- 6 files changed, 679 insertions(+), 24 deletions(-) create mode 100644 compliance-dashboard/src/components/licence_overview.rs diff --git a/compliance-core/src/models/license.rs b/compliance-core/src/models/license.rs index 8a8de4d..d483a9e 100644 --- a/compliance-core/src/models/license.rs +++ b/compliance-core/src/models/license.rs @@ -351,6 +351,93 @@ pub fn apply(entries: &mut [SbomEntry], conclusions: &[LicenseConclusion]) { } } +/// The four groups the licence chart of a target shows (#957), coarser than +/// [`LicenseCategory`]. Declared in chart order, from least to most to +/// look at; the order is also the index into [`LicenseGroupCounts`]. +#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] +pub enum LicenseGroup { + /// Public domain, permissive and own code. + Permissive, + /// LGPL, MPL, EPL, CDDL and the like. + WeakCopyleft, + /// GPL, and network copyleft (AGPL). + StrongCopyleft, + /// No licence, one SPDX cannot read, or a proprietary one: a person has + /// to look at it. + Unknown, +} + +impl LicenseGroup { + /// Every group, in chart order. + pub const ALL: [Self; 4] = [ + Self::Permissive, + Self::WeakCopyleft, + Self::StrongCopyleft, + Self::Unknown, + ]; +} + +impl LicenseCategory { + /// The chart group of this category. A proprietary licence is neither + /// open source nor copyleft, so it is grouped with the unknown ones: its + /// terms are a contract a person has to read. + pub fn group(self) -> LicenseGroup { + match self { + Self::PublicDomain | Self::Permissive | Self::OwnCode => LicenseGroup::Permissive, + Self::WeakCopyleft => LicenseGroup::WeakCopyleft, + Self::StrongCopyleft | Self::NetworkCopyleft => LicenseGroup::StrongCopyleft, + Self::Proprietary | Self::Unclear => LicenseGroup::Unknown, + } + } +} + +/// How many components fall into each [`LicenseGroup`]. +/// +/// # Examples +/// +/// ``` +/// use compliance_core::models::license::{LicenseGroup, LicenseGroupCounts}; +/// use compliance_core::models::LicenseCategory; +/// +/// let counts: LicenseGroupCounts = [ +/// (LicenseCategory::Permissive, 3), +/// (LicenseCategory::PublicDomain, 1), +/// (LicenseCategory::NetworkCopyleft, 2), +/// ] +/// .into_iter() +/// .collect(); +/// assert_eq!(counts.get(LicenseGroup::Permissive), 4); +/// assert_eq!(counts.get(LicenseGroup::StrongCopyleft), 2); +/// assert_eq!(counts.total(), 6); +/// ``` +#[derive(Debug, Clone, Copy, Default, PartialEq, Eq)] +pub struct LicenseGroupCounts([u64; 4]); + +impl LicenseGroupCounts { + /// The components in `group`. + pub fn get(self, group: LicenseGroup) -> u64 { + // A field-less enum casts to its position (`Permissive` is 0). + self.0[group as usize] + } + + /// The components in every group. + pub fn total(self) -> u64 { + self.0.iter().sum() + } +} + +/// Counts from `(category, components)` pairs, such as the rows of the +/// licence summary. +impl FromIterator<(LicenseCategory, u64)> for LicenseGroupCounts { + fn from_iter>(rows: I) -> Self { + let mut counts = Self::default(); + for (category, count) in rows { + counts.0[category.group() as usize] += count; + } + counts + } +} + #[cfg(test)] mod tests { use super::*; @@ -481,4 +568,98 @@ mod tests { assert!(LicenseCategory::WeakCopyleft.is_copyleft()); assert!(!LicenseCategory::Proprietary.is_copyleft()); } + + #[test] + fn every_category_falls_into_one_chart_group() { + use LicenseCategory as C; + use LicenseGroup as G; + for (category, group) in [ + (C::PublicDomain, G::Permissive), + (C::Permissive, G::Permissive), + (C::OwnCode, G::Permissive), + (C::WeakCopyleft, G::WeakCopyleft), + (C::StrongCopyleft, G::StrongCopyleft), + (C::NetworkCopyleft, G::StrongCopyleft), + (C::Proprietary, G::Unknown), + (C::Unclear, G::Unknown), + ] { + assert_eq!(category.group(), group, "{category:?}"); + } + // Every group is reached, and copyleft groups hold only copyleft. + for group in LicenseGroup::ALL { + let members: Vec<_> = LicenseCategory::ALL + .into_iter() + .filter(|c| c.group() == group) + .collect(); + assert!(!members.is_empty(), "{group:?} is empty"); + let copyleft = matches!(group, G::WeakCopyleft | G::StrongCopyleft); + assert!(members.iter().all(|c| c.is_copyleft() == copyleft)); + } + } + + #[test] + fn licence_expressions_fall_into_the_group_of_their_category() { + use crate::spdx_license::category; + use LicenseGroup as G; + for (license, group) in [ + ("MIT", G::Permissive), + ("Apache-2.0", G::Permissive), + ("BSD-3-Clause", G::Permissive), + ("CC0-1.0", G::Permissive), + ("The Apache Software License, Version 2.0", G::Permissive), + ("LGPL-2.1-or-later", G::WeakCopyleft), + ("MPL-2.0", G::WeakCopyleft), + ("EPL-2.0", G::WeakCopyleft), + ("CDDL-1.0", G::WeakCopyleft), + ("GPL-3.0-only", G::StrongCopyleft), + ("GPL-2.0+", G::StrongCopyleft), + ("AGPL-3.0-or-later", G::StrongCopyleft), + // `OR`: the most permissive choice counts. + ("MIT OR GPL-3.0-only", G::Permissive), + ("(LGPL-2.1-only OR GPL-2.0-only)", G::WeakCopyleft), + // `AND`: the most restrictive term counts. + ("MIT AND GPL-2.0-only", G::StrongCopyleft), + ("Apache-2.0 AND MPL-2.0", G::WeakCopyleft), + // An exception after `WITH` keeps the licence's category (the + // licence policy, #570, reads it the same way). + ( + "GPL-2.0-only WITH Classpath-exception-2.0", + G::StrongCopyleft, + ), + ("Apache-2.0 WITH LLVM-exception", G::Permissive), + // Nothing a person could rely on. + ("", G::Unknown), + ("NOASSERTION", G::Unknown), + ("NONE", G::Unknown), + ("LicenseRef-Pump-EULA", G::Unknown), + ("Custom Pump License", G::Unknown), + ("MIT AND LicenseRef-Pump-EULA", G::Unknown), + ] { + assert_eq!(category(license).group(), group, "{license}"); + } + } + + #[test] + fn group_counts_add_up_the_rows_of_each_group() { + use LicenseCategory as C; + let counts: LicenseGroupCounts = [ + (C::Permissive, 10), + (C::OwnCode, 2), + (C::WeakCopyleft, 3), + (C::StrongCopyleft, 40), + (C::NetworkCopyleft, 9), + (C::Unclear, 5), + (C::Proprietary, 1), + ] + .into_iter() + .collect(); + assert_eq!(counts.get(LicenseGroup::Permissive), 12); + assert_eq!(counts.get(LicenseGroup::WeakCopyleft), 3); + assert_eq!(counts.get(LicenseGroup::StrongCopyleft), 49); + assert_eq!(counts.get(LicenseGroup::Unknown), 6); + assert_eq!(counts.total(), 70); + let empty: LicenseGroupCounts = std::iter::empty().collect(); + assert_eq!(empty, LicenseGroupCounts::default()); + assert_eq!(empty.total(), 0); + } } diff --git a/compliance-dashboard/assets/main.css b/compliance-dashboard/assets/main.css index c0bcf8e..6e2a811 100644 --- a/compliance-dashboard/assets/main.css +++ b/compliance-dashboard/assets/main.css @@ -7542,3 +7542,149 @@ input[type="file"] { margin-top: 4px; } } + +/* Licences by group (#957): one bar of four groups, a card per group. The + group colours are fixed; #1baf7a is below 3:1 contrast, so every card + carries its number as text. */ +.lo-permissive { --lo-color: #2a78d6; } +.lo-weak { --lo-color: #1baf7a; } +.lo-strong { --lo-color: #eb6834; } +.lo-unknown { --lo-color: #9EA3BD; } + +.lo-card { margin-bottom: 16px; } + +.lo-head { + display: flex; + align-items: center; + justify-content: space-between; + gap: 12px; +} + +.lo-title { margin: 0; } + +.lo-toggle[aria-pressed="true"] { + background: var(--accent-muted); + color: var(--accent); +} + +.lo-hint { + margin: 4px 0 12px; + font-size: 13px; + color: var(--text-tertiary); +} + +.lo-bar { + display: flex; + gap: 2px; + height: 28px; + border-radius: var(--radius-sm); + overflow: hidden; +} + +.lo-seg { + min-width: 6px; + padding: 0; + border: none; + background: var(--lo-color); + cursor: pointer; +} + +.lo-seg:hover { filter: brightness(1.08); } + +.lo-seg:focus-visible, +.lo-group:focus-visible, +.lo-table-link:focus-visible, +.lo-crumb-link:focus-visible { + outline: 2px solid var(--accent); + outline-offset: 2px; +} + +.lo-groups { + display: grid; + grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); + gap: 10px; + margin-top: 14px; +} + +.lo-group { + display: flex; + flex-direction: column; + gap: 4px; + padding: 12px 14px; + text-align: left; + color: var(--text-primary); + background: var(--bg-card); + border: 1px solid var(--border); + border-radius: var(--radius); + cursor: pointer; +} + +.lo-group:hover { + background: var(--bg-card-hover); + border-color: var(--border-bright); +} + +.lo-group-name { + display: flex; + align-items: center; + gap: 8px; + font-size: 13px; + font-weight: 600; +} + +.lo-swatch { + width: 12px; + height: 12px; + flex-shrink: 0; + border-radius: 3px; + background: var(--lo-color); +} + +.lo-group-count { + font-size: 13px; + color: var(--text-secondary); +} + +.lo-group-count strong { + font-family: var(--font-mono); + font-size: 20px; + color: var(--text-primary); +} + +.lo-group-note { + font-size: 12px; + color: var(--text-tertiary); +} + +.lo-num { font-family: var(--font-mono); } + +.lo-table-link, +.lo-crumb-link { + padding: 0; + border: none; + background: none; + color: var(--accent); + font: inherit; + cursor: pointer; +} + +.lo-table-link:hover, +.lo-crumb-link:hover { text-decoration: underline; } + +.lo-crumbs { + display: flex; + flex-wrap: wrap; + align-items: center; + gap: 8px; + margin-bottom: 16px; + font-size: 14px; +} + +.lo-crumb-sep { color: var(--text-faint); } + +.lo-crumb-current { + font-weight: 600; + color: var(--text-primary); +} + +.lo-back { margin-left: auto; } diff --git a/compliance-dashboard/src/components/licence_overview.rs b/compliance-dashboard/src/components/licence_overview.rs new file mode 100644 index 0000000..17e8361 --- /dev/null +++ b/compliance-dashboard/src/components/licence_overview.rs @@ -0,0 +1,157 @@ +//! The licences view of one target (#957): its components as one bar split +//! into four licence groups, with a card per group below it. A click on a +//! segment or a card narrows the licence table of the tab to that group; a +//! breadcrumb leads back to the chart. A "Tabelle" toggle shows the same +//! numbers as a plain table. + +use dioxus::prelude::*; + +use compliance_core::models::license::{LicenseGroup, LicenseGroupCounts}; + +use crate::i18n::texts::licence_overview as tx; +use crate::i18n::{format_count, use_lang}; + +/// The class that gives a group its colour (`--lo-color`). +fn group_class(group: LicenseGroup) -> &'static str { + match group { + LicenseGroup::Permissive => "lo-permissive", + LicenseGroup::WeakCopyleft => "lo-weak", + LicenseGroup::StrongCopyleft => "lo-strong", + LicenseGroup::Unknown => "lo-unknown", + } +} + +/// The chart of `counts`, or, once a group is `selected`, the breadcrumb of +/// that group with the way back. Nothing while there are no components. +/// +/// # Arguments +/// +/// * `counts` - the target's components per licence group +/// * `selected` - the group the licence table is narrowed to; written on a +/// click, cleared by the way back +#[component] +pub fn LicenceOverview( + counts: LicenseGroupCounts, + mut selected: Signal>, +) -> Element { + let lang = use_lang()(); + let mut as_table = use_signal(|| false); + + if let Some(group) = selected() { + return rsx! { + nav { class: "lo-crumbs", "aria-label": tx::BREADCRUMB.get(lang), + button { + class: "lo-crumb-link", + onclick: move |_| selected.set(None), + {tx::BREADCRUMB_ROOT.get(lang)} + } + span { class: "lo-crumb-sep", "aria-hidden": "true", "›" } + span { class: "lo-crumb-current", "aria-current": "page", + {tx::group(group).get(lang)} + } + button { + class: "btn btn-sm btn-ghost lo-back", + onclick: move |_| selected.set(None), + {tx::BACK.get(lang)} + } + } + }; + } + + if counts.total() == 0 { + return rsx! {}; + } + + rsx! { + div { class: "card lo-card", + div { class: "lo-head", + h3 { class: "lo-title", {tx::TITLE.get(lang)} } + // A toggle: the label stays, the pressed state changes. + button { + class: "btn btn-sm btn-ghost lo-toggle", + "aria-pressed": "{as_table()}", + onclick: move |_| as_table.toggle(), + {tx::TABLE.get(lang)} + } + } + p { class: "lo-hint", {tx::HINT.get(lang)} } + if as_table() { + div { class: "table-wrapper", + table { + thead { + tr { + th { {tx::GROUP.get(lang)} } + th { {tx::COMPONENTS.get(lang)} } + th { {tx::NOTE.get(lang)} } + } + } + tbody { + for group in LicenseGroup::ALL { + tr { key: "{group_class(group)}", + td { + button { + class: "lo-table-link", + onclick: move |_| selected.set(Some(group)), + {tx::group(group).get(lang)} + } + } + td { class: "lo-num", {format_count(counts.get(group), lang)} } + td { {tx::note(group).get(lang)} } + } + } + } + } + } + } else { + div { class: "lo-bar", role: "group", "aria-label": tx::TITLE.get(lang), + // An empty group has no segment; its card still says 0. + for group in LicenseGroup::ALL.into_iter().filter(|g| counts.get(*g) > 0) { + button { + key: "{group_class(group)}", + class: "lo-seg {group_class(group)}", + style: "flex-grow: {counts.get(group)};", + title: tx::segment_label(group, counts.get(group), lang), + "aria-label": tx::segment_label(group, counts.get(group), lang), + onclick: move |_| selected.set(Some(group)), + } + } + } + div { class: "lo-groups", + for group in LicenseGroup::ALL { + button { + key: "{group_class(group)}", + class: "lo-group {group_class(group)}", + onclick: move |_| selected.set(Some(group)), + span { class: "lo-group-name", + span { class: "lo-swatch", "aria-hidden": "true" } + {tx::group(group).get(lang)} + } + span { class: "lo-group-count", + strong { {format_count(counts.get(group), lang)} } + " " + {tx::COMPONENTS.get(lang)} + } + span { class: "lo-group-note", {tx::note(group).get(lang)} } + } + } + } + } + } + } +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn every_group_has_a_colour_class_of_its_own() { + let classes: std::collections::HashSet<_> = + LicenseGroup::ALL.into_iter().map(group_class).collect(); + assert_eq!(classes.len(), LicenseGroup::ALL.len()); + let css = include_str!("../../assets/main.css"); + for class in classes { + assert!(css.contains(&format!(".{class} {{ --lo-color:")), "{class}"); + } + } +} diff --git a/compliance-dashboard/src/components/mod.rs b/compliance-dashboard/src/components/mod.rs index 234813c..8d87bcf 100644 --- a/compliance-dashboard/src/components/mod.rs +++ b/compliance-dashboard/src/components/mod.rs @@ -17,6 +17,7 @@ pub mod finding_groups; pub mod help_chat; pub mod lang_toggle; pub mod layer_pins; +pub mod licence_overview; pub mod license_editor; pub mod license_review; pub mod manual_findings; diff --git a/compliance-dashboard/src/i18n/texts.rs b/compliance-dashboard/src/i18n/texts.rs index afdf3a0..387d80b 100644 --- a/compliance-dashboard/src/i18n/texts.rs +++ b/compliance-dashboard/src/i18n/texts.rs @@ -6440,3 +6440,131 @@ pub mod inbox { } } } + +/// The licences of one target as a chart of four groups (#957). +pub mod licence_overview { + use super::super::{format_count, Lang}; + use super::Text; + use compliance_core::models::license::LicenseGroup; + + pub const TITLE: Text = Text { + de: "Lizenzen nach Gruppe", + en: "Licences by group", + }; + pub const HINT: Text = Text { + de: "Ein Klick auf einen Abschnitt oder eine Gruppe zeigt ihre Lizenzen.", + en: "Click a segment or a group to see its licences.", + }; + pub const TABLE: Text = Text { + de: "Tabelle", + en: "Table", + }; + pub const GROUP: Text = Text { + de: "Gruppe", + en: "Group", + }; + pub const COMPONENTS: Text = Text { + de: "Komponenten", + en: "Components", + }; + pub const NOTE: Text = Text { + de: "Hinweis", + en: "Note", + }; + pub const BREADCRUMB: Text = Text { + de: "Pfad", + en: "Breadcrumb", + }; + pub const BREADCRUMB_ROOT: Text = Text { + de: "Lizenzen", + en: "Licences", + }; + pub const BACK: Text = Text { + de: "← Zurück zum Diagramm", + en: "← Back to the chart", + }; + + /// The name of a group. + pub fn group(group: LicenseGroup) -> Text { + match group { + LicenseGroup::Permissive => Text { + de: "Permissiv", + en: "Permissive", + }, + LicenseGroup::WeakCopyleft => Text { + de: "Schwaches Copyleft", + en: "Weak copyleft", + }, + LicenseGroup::StrongCopyleft => Text { + de: "Starkes Copyleft", + en: "Strong copyleft", + }, + LicenseGroup::Unknown => Text { + de: "Unbekannt", + en: "Unknown", + }, + } + } + + /// What a group holds, or what it asks for, in a few words. + pub fn note(group: LicenseGroup) -> Text { + match group { + LicenseGroup::Permissive => Text { + de: "MIT, Apache-2.0, BSD", + en: "MIT, Apache-2.0, BSD", + }, + LicenseGroup::WeakCopyleft => Text { + de: "LGPL, MPL, EPL: Änderungen offenlegen", + en: "LGPL, MPL, EPL: disclose changes", + }, + LicenseGroup::StrongCopyleft => Text { + de: "GPL, AGPL: Weitergabe prüfen", + en: "GPL, AGPL: check before shipping", + }, + LicenseGroup::Unknown => Text { + de: "keine Lizenz erkannt oder proprietär", + en: "no licence detected, or proprietary", + }, + } + } + + /// What a screen reader says for a segment: "Starkes Copyleft: 49". + pub fn segment_label(group: LicenseGroup, components: u64, lang: Lang) -> String { + format!( + "{}: {}", + self::group(group).get(lang), + format_count(components, lang) + ) + } + + #[cfg(test)] + mod tests { + use super::*; + + #[test] + fn a_segment_says_its_group_and_count() { + assert_eq!( + segment_label(LicenseGroup::StrongCopyleft, 49, Lang::De), + "Starkes Copyleft: 49" + ); + assert_eq!( + segment_label(LicenseGroup::Unknown, 1_200, Lang::En), + "Unknown: 1,200" + ); + } + + #[test] + fn every_group_has_its_own_name_and_a_note() { + for lang in [Lang::De, Lang::En] { + let names: std::collections::HashSet<_> = LicenseGroup::ALL + .into_iter() + .map(|g| group(g).get(lang)) + .collect(); + assert_eq!(names.len(), LicenseGroup::ALL.len()); + assert!(LicenseGroup::ALL + .into_iter() + .all(|g| !note(g).get(lang).is_empty())); + } + } + } +} diff --git a/compliance-dashboard/src/pages/sbom.rs b/compliance-dashboard/src/pages/sbom.rs index e3f3e9a..693ffb5 100644 --- a/compliance-dashboard/src/pages/sbom.rs +++ b/compliance-dashboard/src/pages/sbom.rs @@ -120,6 +120,18 @@ pub fn SbomPage(target: String, #[props(default)] ecosystem: String) -> Element } }); + // ── Licence group the licence table is narrowed to, from its chart (#957) ── + let mut licence_group = + use_signal(|| Option::::None); + // Another target starts at the chart again. + use_effect(move || { + repo_filter.read(); + // `peek` reads without subscribing: only the target re-runs this. + if licence_group.peek().is_some() { + licence_group.set(None); + } + }); + // ── License summary ── let mut license_data = use_resource(move || { let repo = repo_filter(); @@ -611,30 +623,50 @@ pub fn SbomPage(target: String, #[props(default)] ecosystem: String) -> Element // ═══════════════ LICENSE COMPLIANCE TAB ═══════════════ if active_tab() == "licenses" { + // The chart of one target's licence groups (#957); a click on it + // narrows the licence table below to that group. { - let repo = repo_filter(); - let repo_name = match &*repos.read() { - Some(Some(resp)) => resp - .data - .iter() - .find(|r| { - r.get("_id").and_then(|o| o.get("$oid")).and_then(|s| s.as_str()) - == Some(repo.as_str()) - }) - .and_then(|r| r.get("name").and_then(|n| n.as_str())) - .unwrap_or_default() - .to_string(), - _ => String::new(), + let counts = match &*license_data.read() { + Some(Some(resp)) if !repo_filter().is_empty() => { + Some(resp.data.iter().map(|l| (l.category, l.count)).collect()) + } + _ => None, }; rsx! { - LicenseCheckPanel { - key: "{repo}", - repo: repo.clone(), - repo_name, - on_changed: move |_| { - license_data.restart(); - sbom.restart(); - }, + if let Some(counts) = counts { + crate::components::licence_overview::LicenceOverview { + counts, + selected: licence_group, + } + } + } + } + if licence_group().is_none() { + { + let repo = repo_filter(); + let repo_name = match &*repos.read() { + Some(Some(resp)) => resp + .data + .iter() + .find(|r| { + r.get("_id").and_then(|o| o.get("$oid")).and_then(|s| s.as_str()) + == Some(repo.as_str()) + }) + .and_then(|r| r.get("name").and_then(|n| n.as_str())) + .unwrap_or_default() + .to_string(), + _ => String::new(), + }; + rsx! { + LicenseCheckPanel { + key: "{repo}", + repo: repo.clone(), + repo_name, + on_changed: move |_| { + license_data.restart(); + sbom.restart(); + }, + } } } } @@ -645,9 +677,17 @@ pub fn SbomPage(target: String, #[props(default)] ecosystem: String) -> Element let copyleft_items: Vec<_> = resp.data.iter().filter(|l| l.category.is_copyleft()).collect(); let open = resp.data.iter().find(|l| l.license == "Unknown").map_or(0, |l| l.count); let confirmed: u64 = resp.data.iter().map(|l| l.confirmed).sum(); + // Behind a click on the chart only the table, narrowed + // to the group clicked. + let narrowed = licence_group(); + let shown: Vec<_> = resp + .data + .iter() + .filter(|l| narrowed.is_none_or(|g| l.category.group() == g)) + .collect(); rsx! { - if open > 0 || confirmed > 0 { + if narrowed.is_none() && (open > 0 || confirmed > 0) { div { class: "card license-open-card", if open > 0 { strong { {lx::OPEN_COUNT.get(lang).replace("{n}", &open.to_string())} } @@ -668,7 +708,7 @@ pub fn SbomPage(target: String, #[props(default)] ecosystem: String) -> Element } } } - if has_copyleft { + if narrowed.is_none() && has_copyleft { div { class: "license-copyleft-warning", strong { {tx::COPYLEFT_TITLE.get(lang)} } p { {tx::COPYLEFT_BODY.get(lang)} } @@ -684,6 +724,7 @@ pub fn SbomPage(target: String, #[props(default)] ecosystem: String) -> Element } } + if narrowed.is_none() { div { class: "card", h3 { style: "margin-bottom: 16px;", {tx::LICENSE_DISTRIBUTION.get(lang)} } if total_pkgs > 0 { @@ -711,6 +752,7 @@ pub fn SbomPage(target: String, #[props(default)] ecosystem: String) -> Element p { {tx::NO_LICENSE_DATA.get(lang)} } } } + } div { class: "card", h3 { style: "margin-bottom: 16px;", {tx::ALL_LICENSES_TITLE.get(lang)} } @@ -725,7 +767,7 @@ pub fn SbomPage(target: String, #[props(default)] ecosystem: String) -> Element } } tbody { - for item in &resp.data { + for item in &shown { tr { td { span {