Skip to content

Commit ce7ffe4

Browse files
committed
add link from compliance view
Signed-off-by: tdruez <tdruez@aboutcode.org>
1 parent bce3f73 commit ce7ffe4

2 files changed

Lines changed: 5 additions & 18 deletions

File tree

product_portfolio/templates/product_portfolio/compliance/compliance_dashboard.html

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,6 @@ <h1 class="h3 mb-0">
128128
<th class="fw-medium">{% trans "Product" %}</th>
129129
<th class="fw-medium text-end">{% trans "Packages" %}</th>
130130
<th class="fw-medium text-end">{% trans "License compliance" %}</th>
131-
<th class="fw-medium text-end">{% trans "Security compliance" %}</th>
132131
<th class="fw-medium text-end">{% trans "Vulnerabilities" %}</th>
133132
<th class="fw-medium text-end">{% trans "Policy violations" %}</th>
134133
</tr>
@@ -162,19 +161,6 @@ <h1 class="h3 mb-0">
162161
<a href="{{ product_url }}#licenses" class="badge bg-success-subtle text-success-emphasis">{% trans "OK" %}</a>
163162
{% endif %}
164163
</td>
165-
<td class="text-end">
166-
{% if product.max_risk_level == "critical" %}
167-
<span class="badge bg-danger-subtle text-danger-emphasis">{% trans "Critical" %}</span>
168-
{% elif product.max_risk_level == "high" %}
169-
<span class="badge bg-warning-orange-subtle text-warning-orange">{% trans "High" %}</span>
170-
{% elif product.max_risk_level == "medium" %}
171-
<span class="badge bg-warning-subtle text-warning-emphasis">{% trans "Medium" %}</span>
172-
{% elif product.max_risk_level == "low" %}
173-
<span class="badge bg-info-subtle text-info-emphasis">{% trans "Low" %}</span>
174-
{% else %}
175-
<span class="badge bg-success-subtle text-success-emphasis">{% trans "OK" %}</span>
176-
{% endif %}
177-
</td>
178164
<td class="text-end">
179165
{% if product.risk_threshold and product.vulnerability_count %}
180166
<span class="text-body-tertiary fs-xs" data-bs-toggle="tooltip" title="{% trans 'Risk threshold' %}">
@@ -199,7 +185,9 @@ <h1 class="h3 mb-0">
199185
</td>
200186
<td class="text-end">
201187
{% if product.policy_violation_count %}
202-
<span class="badge bg-danger-subtle text-danger-emphasis">{{ product.policy_violation_count }}</span>
188+
<a href="{{ product_url }}#compliance" class="badge bg-danger-subtle text-danger-emphasis text-decoration-none">
189+
{{ product.policy_violation_count }} {% trans "rule" %}{{ product.policy_violation_count|pluralize }} {% trans "triggered" %}
190+
</a>
203191
{% else %}
204192
<span class="text-body-tertiary small">{% trans "None" %}</span>
205193
{% endif %}
@@ -208,7 +196,7 @@ <h1 class="h3 mb-0">
208196
{% endwith %}
209197
{% empty %}
210198
<tr>
211-
<td colspan="6" class="text-center text-body-tertiary py-4">
199+
<td colspan="5" class="text-center text-body-tertiary py-4">
212200
{% trans "No active products" %}
213201
</td>
214202
</tr>

product_portfolio/views.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3054,20 +3054,19 @@ class ComplianceDashboardView(LoginRequiredMixin, ExportComplianceMixin, Dataspa
30543054
"package_count": "Packages",
30553055
"license_error_count": "License errors",
30563056
"license_warning_count": "License warnings",
3057-
"max_risk_level": "Max risk level",
30583057
"risk_threshold": "Risk threshold",
30593058
"critical_count": "Critical",
30603059
"high_count": "High",
30613060
"medium_count": "Medium",
30623061
"low_count": "Low",
30633062
"vulnerability_count": "Total vulnerabilities",
3063+
"policy_violation_count": "Policy violations",
30643064
}
30653065

30663066
def get_queryset(self):
30673067
return (
30683068
get_viewable_products(self.request.user)
30693069
.with_compliance_data()
3070-
.with_max_risk_level()
30713070
.with_has_vulnerable_packages()
30723071
.with_policy_violation_count()
30733072
)

0 commit comments

Comments
 (0)