From 0e711ec058f94370d7efa7f25d0f10f1e4b9531c Mon Sep 17 00:00:00 2001 From: catborise Date: Thu, 19 Nov 2026 08:40:36 +0300 Subject: [PATCH] feat(tags): the tag filter as pills, below the state pills The tag filter was a select beside the search box. It is now a row of pills as the VM states' are, below them on the VM list and above the table on the hosts list: All tags, No tag and each tag with how many have it. The state and tag pills share one helper in table_filter.js; a badge chooses its tag's pill, the choice is remembered as before. --- computes/templates/computes/list.html | 2 +- computes/tests/test_tags.py | 4 +- instances/templates/allinstances.html | 8 +- instances/tests/js/table_filter.test.js | 73 +++++++++------- instances/tests/test_states.py | 2 +- instances/tests/test_tags.py | 12 +-- locale/tr/LC_MESSAGES/django.mo | Bin 248254 -> 248224 bytes locale/tr/LC_MESSAGES/django.po | 110 ++++++++++++------------ locale/zh/LC_MESSAGES/django.mo | Bin 232942 -> 232909 bytes locale/zh/LC_MESSAGES/django.po | 110 ++++++++++++------------ static/css/webvirtcloud.css | 12 ++- static/js/table_filter.js | 107 +++++++++++------------ templates/common/tag_filter.html | 24 ++++-- 13 files changed, 243 insertions(+), 221 deletions(-) diff --git a/computes/templates/computes/list.html b/computes/templates/computes/list.html index d032fdae..dfd05eee 100644 --- a/computes/templates/computes/list.html +++ b/computes/templates/computes/list.html @@ -11,7 +11,6 @@ {% include 'create_comp_block.html' %} {% if computes|length > 1 %}{% trans "Balance" %}{% endif %} {% include 'search_block.html' %} -
{% include 'common/tag_filter.html' %}

{% trans "Computes" %}

@@ -52,6 +51,7 @@ + {% include 'common/tag_filter.html' %} {# position-relative: the hidden status texts are positioned within it, not the page #}
diff --git a/computes/tests/test_tags.py b/computes/tests/test_tags.py index 3a134725..ecc479bb 100644 --- a/computes/tests/test_tags.py +++ b/computes/tests/test_tags.py @@ -155,7 +155,9 @@ class HostTagsTests(TestCase): response = self.client.get(reverse("computes")) self.assertContains(response, 'data-show-tags title="ssd"') # three, and "…" for the others self.assertContains(response, "rack-1") - self.assertContains(response, '', html=True) + self.assertContains(response, '', + html=True) self.assertContains(response, 'data-tag-filter="rack-1"') # a search and a tag that match no host: the page says so and clears them self.assertContains(response, 'id="no-match"') diff --git a/instances/templates/allinstances.html b/instances/templates/allinstances.html index ea1ccecc..d15db790 100644 --- a/instances/templates/allinstances.html +++ b/instances/templates/allinstances.html @@ -6,7 +6,6 @@ {% block page_heading_extra %}
- {% include 'common/tag_filter.html' %} {# the list's search and the address search, as one control #}
@@ -43,18 +42,19 @@ {% if instances %} {# the state filter: table_filter.js counts each state's VMs the search finds #} -