Skip to content

Commit 832c5b2

Browse files
committed
Display the risk_threshold value when enabled #97
Including a link to see all vulnerabilities Signed-off-by: tdruez <[email protected]>
1 parent 61a47e3 commit 832c5b2

File tree

4 files changed

+20
-4
lines changed

4 files changed

+20
-4
lines changed

dje/templates/object_details_base.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ <h1 class="header-title text-break">
9191
</nav>
9292

9393
<div class="background-white">
94-
<div class="tab-content pt-4 px-0 container" style="height: 100%; min-height: 28.5em;">
94+
<div class="tab-content pt-3 px-0 container" style="height: 100%; min-height: 28.5em;">
9595
{% for tab_name, tab_context in tabsets.items %}
9696
{# IDs are prefixed with "tab_" to avoid autoscroll issue #}
9797
<div class="tab-pane{% if forloop.first %} show active{% endif %}" id="tab_{{ tab_name|slugify }}" role="tabpanel" aria-labelledby="tab_{{ tab_name|slugify }}-tab" tabindex="0">

dje/templates/tabs/pagination.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{% load humanize %}
22
<div class="row align-items-end">
3-
<div class="col mb-3">
3+
<div class="col mb-2">
44
<ul class="nav nav-pills">
55
<li class="nav-item">
66
<form id="tab-{{ tab_id }}-search-form" class="mt-md-0 me-sm-2">

product_portfolio/templates/product_portfolio/tabs/tab_vulnerabilities.html

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@
22
{% load as_icon from dje_tags %}
33

44
{% include 'tabs/pagination.html' %}
5+
6+
{% if risk_threshold %}
7+
<small class="d-inline-flex mb-3 px-2 py-1 fw-semibold text-warning-emphasis bg-warning-subtle border border-warning-subtle rounded-2">
8+
A risk threshold filter at "{{ risk_threshold }}" is currently applied.
9+
<a class="ms-1" href="?vulnerabilities-bypass_risk_threshold=Yes#vulnerabilities">Click here to see all vulnerabilities.</a>
10+
</small>
11+
{% endif %}
12+
513
<table class="table table-bordered table-md text-break">
614
{% include 'includes/object_list_table_header.html' with filter=filterset include_actions=True %}
715
<tbody>

product_portfolio/views.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -541,7 +541,11 @@ def tab_vulnerabilities(self):
541541
if not all(display_tab_contions):
542542
return
543543

544-
risk_threshold = product.get_vulnerabilities_risk_threshold()
544+
if self.request.GET.get("vulnerabilities-bypass_risk_threshold"):
545+
risk_threshold = None
546+
else:
547+
risk_threshold = product.get_vulnerabilities_risk_threshold()
548+
545549
vulnerability_count = product.get_vulnerability_qs(risk_threshold=risk_threshold).count()
546550
if not vulnerability_count:
547551
label = 'Vulnerabilities <span class="badge bg-secondary">0</span>'
@@ -1153,7 +1157,11 @@ class ProductTabVulnerabilitiesView(
11531157

11541158
def get_context_data(self, **kwargs):
11551159
product = self.object
1156-
risk_threshold = product.get_vulnerabilities_risk_threshold()
1160+
1161+
if self.request.GET.get("vulnerabilities-bypass_risk_threshold"):
1162+
risk_threshold = None
1163+
else:
1164+
risk_threshold = product.get_vulnerabilities_risk_threshold()
11571165

11581166
total_count = product.get_vulnerability_qs(risk_threshold=risk_threshold).count()
11591167
vulnerability_qs = (

0 commit comments

Comments
 (0)