Skip to content

Commit 3abc0c7

Browse files
committed
Display a grey badge when the vulnerability count is 0 #286
Signed-off-by: tdruez <[email protected]>
1 parent fecc9a6 commit 3abc0c7

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

product_portfolio/views.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -567,9 +567,13 @@ def tab_vulnerabilities(self):
567567
"tooltip": "No vulnerabilities found in this Product",
568568
}
569569

570+
badge_class = "text-bg-secondary"
571+
if vulnerability_count > 0:
572+
badge_class = "badge-vulnerability"
573+
570574
label = (
571575
f"Vulnerabilities"
572-
f'<span class="badge badge-vulnerability ps-1 ms-1">'
576+
f'<span class="badge {badge_class} ps-1 ms-1">'
573577
f' <i class="fas fa-archive" style="height: auto"></i>{vulnerable_package_count}'
574578
f' <i class="fas fa-bug" style="height: auto"></i>{vulnerability_count}'
575579
f"</span>"

vulnerabilities/templates/vulnerabilities/includes/exploitability.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{% if instance.exploitability %}
22
<span class="badge
33
{% if instance.exploitability == 0.5 %}bg-secondary
4-
{% elif instance.exploitability == 1.0 %}bg-warning
4+
{% elif instance.exploitability == 1.0 %}text-bg-warning
55
{% elif instance.exploitability == 2.0 %}bg-danger
66
{% else %}bg-secondary
77
{% endif %}

vulnerabilities/templates/vulnerabilities/includes/risk_score_badge.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<span class="badge
33
{% if risk_score >= 8.0 %}bg-danger
44
{% elif risk_score >= 6.0 %}bg-warning-orange
5-
{% elif risk_score >= 3.0 %}bg-warning
5+
{% elif risk_score >= 3.0 %}text-bg-warning
66
{% else %}bg-secondary
77
{% endif %}
88
">

0 commit comments

Comments
 (0)