Skip to content

Commit 427d965

Browse files
committed
refine default ordering
Signed-off-by: tdruez <tdruez@aboutcode.org>
1 parent 81f506b commit 427d965

2 files changed

Lines changed: 23 additions & 28 deletions

File tree

product_portfolio/templates/product_portfolio/tabs/tab_triage.html

Lines changed: 22 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
{% endif %}
1010
</div>
1111

12-
<table class="table table-hover">
13-
<thead class="table-light">
12+
<table class="table table-bordered table-md text-break">
13+
<thead>
1414
<tr>
1515
<th style="width: 38%">{% trans "Package" %}</th>
1616
<th style="width: 22%">{% trans "Recommended action" %}</th>
@@ -20,14 +20,15 @@
2020
</thead>
2121
<tbody>
2222
{% for record in page_obj.object_list %}
23-
<tr class="align-top">
24-
<td class="py-3">
25-
<a class="fw-semibold text-decoration-none"
26-
href="{{ record.product_package.package.get_absolute_url }}#vulnerabilities"
27-
target="_blank">
28-
{{ record.product_package.package }}
29-
</a>
30-
<div class="d-flex flex-wrap gap-2 mt-2">
23+
<tr>
24+
<td>
25+
<strong>
26+
<a href="{{ record.product_package.package.get_absolute_url }}#vulnerabilities"
27+
target="_blank">
28+
{{ record.product_package.package }}
29+
</a>
30+
</strong>
31+
<div class="d-flex flex-wrap gap-2 mt-1">
3132
{% with score=record.product_package.weighted_risk_score %}
3233
{% if score %}
3334
<span class="badge {% if score >= 8.0 %}bg-danger-subtle text-danger-emphasis{% elif score >= 6.0 %}bg-warning-subtle text-warning-emphasis{% elif score >= 3.0 %}bg-info-subtle text-info-emphasis{% else %}bg-secondary-subtle text-secondary-emphasis{% endif %}">
@@ -36,29 +37,23 @@
3637
{% endif %}
3738
{% endwith %}
3839
{% if record.product_package.is_deployed %}
39-
<span class="badge bg-body-tertiary text-body-secondary border">
40-
{% trans "Deployed" %}
41-
</span>
40+
<span class="badge text-bg-light border">{% trans "Deployed" %}</span>
4241
{% endif %}
4342
{% if record.product_package.purpose %}
44-
<span class="badge bg-body-tertiary text-body-secondary border">
45-
{{ record.product_package.purpose.label }}
46-
</span>
43+
<span class="badge text-bg-light border">{{ record.product_package.purpose.label }}</span>
4744
{% endif %}
4845
</div>
4946
</td>
50-
<td class="py-3">
51-
<div>
52-
<span class="badge {{ record.action_badge_class }} px-2 py-1">
53-
<i class="fas {{ record.action_icon }} me-1"></i>{{ record.action_label }}
54-
</span>
55-
</div>
56-
<div class="small text-body-secondary mt-2">
47+
<td>
48+
<span class="badge {{ record.action_badge_class }}">
49+
<i class="fas {{ record.action_icon }} me-1"></i>{{ record.action_label }}
50+
</span>
51+
<div class="small text-body-secondary mt-1">
5752
<i class="fas fa-layer-group fa-xs me-1"></i>{{ record.ruleset.name }}
5853
</div>
5954
</td>
60-
<td class="py-3">
61-
<div class="d-flex flex-wrap align-items-center gap-1">
55+
<td>
56+
<div class="d-flex flex-wrap gap-1">
6257
{% if record.critical_count %}
6358
<span class="badge bg-danger-subtle text-danger-emphasis">
6459
{{ record.critical_count }} {% trans "critical" %}
@@ -76,7 +71,7 @@
7671
{% endif %}
7772
</div>
7873
{% if record.vulnerability_count %}
79-
<div class="mt-2">
74+
<div class="mt-1">
8075
<a href="{{ record.product_package.package.get_absolute_url }}#vulnerabilities"
8176
target="_blank"
8277
class="small text-body-secondary text-decoration-none">
@@ -85,7 +80,7 @@
8580
</div>
8681
{% endif %}
8782
</td>
88-
<td class="py-3 small text-body-secondary text-nowrap">
83+
<td class="small text-body-secondary text-nowrap">
8984
{{ record.detected_date|date:"N j, Y" }}
9085
</td>
9186
</tr>

product_portfolio/views.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1420,7 +1420,7 @@ def get_context_data(self, **kwargs):
14201420
distinct=True,
14211421
),
14221422
)
1423-
.order_by("-product_package__weighted_risk_score")
1423+
.order_by(F("product_package__weighted_risk_score").desc(nulls_last=True))
14241424
)
14251425
total_count = triage_qs.count()
14261426

0 commit comments

Comments
 (0)