Skip to content

Commit 81f506b

Browse files
committed
refine tab header
Signed-off-by: tdruez <tdruez@aboutcode.org>
1 parent 364f8f8 commit 81f506b

2 files changed

Lines changed: 13 additions & 17 deletions

File tree

product_portfolio/templates/product_portfolio/tabs/tab_triage.html

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

12-
{% if page_obj.object_list %}
13-
<table class="table table-hover">
12+
<table class="table table-hover">
1413
<thead class="table-light">
1514
<tr>
1615
<th style="width: 38%">{% trans "Package" %}</th>
@@ -93,15 +92,6 @@
9392
{% endfor %}
9493
</tbody>
9594
</table>
96-
{% if page_obj.paginator.num_pages > 1 %}
97-
{% include 'pagination/object_list_pagination.html' with hx_target=tab_id_html %}
98-
{% endif %}
99-
{% else %}
100-
<div class="text-center py-5">
101-
<i class="fa-solid fa-circle-check text-success fs-2"></i>
102-
<div class="mt-2 fw-semibold">{% trans "No pending triage actions" %}</div>
103-
<div class="text-body-secondary small mt-1">
104-
{% trans "All packages are within acceptable risk parameters." %}
105-
</div>
106-
</div>
95+
{% if page_obj.paginator.num_pages > 1 %}
96+
{% include 'pagination/object_list_pagination.html' with hx_target=tab_id_html %}
10797
{% endif %}

product_portfolio/views.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -676,11 +676,17 @@ def tab_triage(self):
676676
TriageRecord.objects.filter(product_package__product=product).primary_actions().count()
677677
)
678678

679-
badge_class = "bg-primary-subtle text-primary-emphasis"
680-
if triage_count > 0:
681-
badge_class = "bg-warning-subtle text-warning-emphasis"
679+
if triage_count == 0:
680+
label = 'Triage <span class="badge bg-secondary">0</span>'
681+
return {
682+
"label": mark_safe(label),
683+
"fields": [],
684+
"disabled": True,
685+
"tooltip": "No pending triage actions for this product",
686+
}
682687

683-
label = f'Triage <span class="badge {badge_class}">{triage_count}</span>'
688+
badge = f'<span class="badge bg-primary-subtle text-primary-emphasis">{triage_count}</span>'
689+
label = f"Triage {badge}"
684690

685691
tab_view_url = product.get_url("tab_triage")
686692
if full_query_string := self.request.META["QUERY_STRING"]:

0 commit comments

Comments
 (0)