mirror of
https://gitlab.com/buildroot.org/buildroot.git
synced 2026-09-09 07:51:59 -09:00
support/scripts/pkg-stats: add unsure_cves to cve_total calculation
When I initially made the CVE cells collapsible, I neglected to
count the unsure CVEs. This patch adds unsure CVEs to the cell collapsing
calcualation to ensure that cells with lots of unsure CVEs actually get collapsed.
This patch also removes the "+ 1" from the cve_total calculation,
which fixes the cve_total being off-by-one.
I'm not sure *why* I did that in the first place.
demo:
https://sen-h.codeberg.page/pkg-stats-demos/@pages/add-unsure_cves-to-cve_total-calc.html
Signed-off-by: Sen Hastings <sen@hastings.org>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
(cherry picked from commit 87b8428c40)
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
This commit is contained in:
committed by
Peter Korsgaard
parent
993dffe44d
commit
a2c6a7a9f3
@@ -1043,7 +1043,8 @@ def dump_html_pkg(f, pkg):
|
||||
data_field_id = f'cves__{pkg_css_class}'
|
||||
div_class = ["centered cves data"]
|
||||
div_class.append(f'_{pkg_css_class}')
|
||||
if len(pkg.cves) > 10:
|
||||
cve_total = len(pkg.cves) + len(pkg.unsure_cves)
|
||||
if cve_total > 10:
|
||||
div_class.append("collapse")
|
||||
if pkg.is_status_ok("cve"):
|
||||
div_class.append("cve-ok")
|
||||
@@ -1054,8 +1055,7 @@ def dump_html_pkg(f, pkg):
|
||||
else:
|
||||
div_class.append("cve-unknown")
|
||||
f.write(f' <div id="{data_field_id}" class="{" ".join(div_class)}">\n')
|
||||
if len(pkg.cves) > 10:
|
||||
cve_total = len(pkg.cves) + 1
|
||||
if cve_total > 10:
|
||||
f.write(f' <div onclick="expandField(\'{data_field_id}\')" \
|
||||
class="see-more centered cve_ignored">see all ({cve_total}) ▾</div>\n')
|
||||
if pkg.is_status_error("cve"):
|
||||
|
||||
Reference in New Issue
Block a user