diff --git a/admin/templates/admin/tag_list.html b/admin/templates/admin/tag_list.html index 0694c514..9cb9cf3c 100644 --- a/admin/templates/admin/tag_list.html +++ b/admin/templates/admin/tag_list.html @@ -1,5 +1,6 @@ {% extends "base.html" %} {% load i18n %} +{% load static %} {% load bootstrap_icons %} {% block title %}{% trans "Tags" %}{% endblock %} @@ -11,30 +12,43 @@ {% if not tags %}
{% bs_icon 'info-circle' %} {% trans "No tags yet" %}
{% else %} -
- - - - - - - - - - - {% for tag in tags %} - - - - - - - {% endfor %} - -
{% trans "Tag" %}{% trans "VMs" %}{% trans "Hosts" %}{% trans "Actions" %}
{% include 'common/tag_badge.html' with tag=tag.name %}{{ tag.vm_count }}{{ tag.host_count }} - {% trans "Rename" %} - {% trans "Delete" %} -
+
+
+ {% trans "Tags" %} {{ tags|length }} + +
+
+ + + + + + + + + + + {% for tag in tags %} + + + + + + + {% endfor %} + +
{% trans "Tag" %}{% trans "VMs" %}{% trans "Hosts" %}{% trans "Actions" %}
{% include 'common/tag_badge.html' with tag=tag.name %}{{ tag.vm_count }}{{ tag.host_count }} + {% trans "Rename" %} + {% trans "Delete" %} +
+
+
+ +
{% endif %} {% endblock content %} + +{% block script %} +{% if tags %}{% endif %} +{% endblock script %} diff --git a/admin/tests/test_tags.py b/admin/tests/test_tags.py index a52b7f0f..c722aaee 100644 --- a/admin/tests/test_tags.py +++ b/admin/tests/test_tags.py @@ -30,6 +30,14 @@ class TagAdminTests(TestCase): self.assertEqual([(t.name, t.vm_count, t.host_count) for t in response.context["tags"]], [("prod", 1, 1)]) self.assertContains(response, 'class="badge tag-badge') # as small as on the other pages + def test_the_list_is_in_name_order_and_searched(self): + Tag.objects.create(name="web") + Tag.objects.create(name="db") + response = self.client.get(reverse("admin:tag_list")) + self.assertEqual([t.name for t in response.context["tags"]], ["db", "prod", "web"]) + self.assertContains(response, 'id="filter"') + self.assertContains(response, 'data-search="web"') + def test_a_rename_keeps_the_tag_on_its_vms_hosts_and_removed_vms(self): self.client.post(reverse("admin:tag_update", args=[self.prod.pk]), {"name": "Live"}) self.prod.refresh_from_db() diff --git a/admin/views.py b/admin/views.py index 39f28b25..6e40b38f 100644 --- a/admin/views.py +++ b/admin/views.py @@ -470,7 +470,9 @@ def tombstone_delete(request, pk): @superuser_only def tag_list(request): """The tags of VMs and hosts, with how many of each have them.""" - tags = Tag.objects.annotate(vm_count=Count("instances", distinct=True), host_count=Count("computes", distinct=True)) + # in name order: a query that counts leaves the model's ordering out + tags = Tag.objects.annotate(vm_count=Count("instances", distinct=True), + host_count=Count("computes", distinct=True)).order_by("name") return render(request, "admin/tag_list.html", {"tags": list(tags)}) diff --git a/locale/tr/LC_MESSAGES/django.mo b/locale/tr/LC_MESSAGES/django.mo index 222dd900..29684acb 100644 Binary files a/locale/tr/LC_MESSAGES/django.mo and b/locale/tr/LC_MESSAGES/django.mo differ diff --git a/locale/tr/LC_MESSAGES/django.po b/locale/tr/LC_MESSAGES/django.po index 7e1ae99a..9b2c503f 100644 --- a/locale/tr/LC_MESSAGES/django.po +++ b/locale/tr/LC_MESSAGES/django.po @@ -11,7 +11,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-11-19 08:03+0000\n" +"POT-Creation-Date: 2026-11-19 10:35+0000\n" "PO-Revision-Date: 2020-11-04 12:00+0000\n" "Last-Translator: catborise , 2020\n" "Language-Team: Turkish (https://www.transifex.com/catborise/teams/110663/tr/)\n" @@ -223,7 +223,7 @@ msgid "User sections" msgstr "Kullanıcı bölümleri" #: accounts/templates/account.html:50 accounts/templates/account.html:58 -#: admin/forms.py:221 admin/templates/admin/tag_list.html:19 +#: admin/forms.py:221 admin/templates/admin/tag_list.html:25 #: computes/templates/computes/list.html:33 #: computes/templates/computes/list.html:61 computes/templates/overview.html:90 #: instances/views.py:267 vmbackups/templates/vmbackups/policies.html:17 @@ -468,7 +468,7 @@ msgstr "%(name)s API anahtarı için işlemler" #: accounts/templates/api_token_list.html:12 #: accounts/templates/ssh_key_list.html:13 #: admin/templates/admin/group_list.html:44 -#: admin/templates/admin/tag_list.html:32 +#: admin/templates/admin/tag_list.html:38 #: admin/templates/admin/tombstone_list.html:43 #: admin/templates/admin/user_list.html:74 #: admin/templates/admin/user_list.html:76 @@ -884,7 +884,7 @@ msgstr "Bu izinleri kimlerin alacağı." #: admin/templates/admin/group_form.html:60 #: admin/templates/admin/group_list.html:25 admin/templates/admin/logs.html:20 -#: admin/templates/admin/logs.html:26 +#: admin/templates/admin/logs.html:26 admin/templates/admin/tag_list.html:18 #: admin/templates/admin/tombstone_list.html:20 #: admin/templates/admin/user_list.html:20 #: instances/templates/allinstances.html:11 networks/templates/network.html:130 @@ -1029,14 +1029,14 @@ msgstr "Tamamlandı" msgid "Failed" msgstr "Başarısız" -#: admin/templates/admin/tag_list.html:5 admin/templates/admin/tag_list.html:7 -#: computes/forms.py:55 instances/templates/instances/settings_tab.html:925 -#: instances/views.py:244 templates/common/tag_filter.html:6 -#: templates/navbar.html:39 +#: admin/templates/admin/tag_list.html:6 admin/templates/admin/tag_list.html:8 +#: admin/templates/admin/tag_list.html:17 computes/forms.py:55 +#: instances/templates/instances/settings_tab.html:925 instances/views.py:244 +#: templates/common/tag_filter.html:6 templates/navbar.html:39 msgid "Tags" msgstr "Etiketler" -#: admin/templates/admin/tag_list.html:10 +#: admin/templates/admin/tag_list.html:11 msgid "" "The tags of VMs and hosts. A tag is made when it is first given, on a VM's " "Options tab or a host's form." @@ -1045,20 +1045,24 @@ msgstr "" "makinenin Seçenekler sekmesinde ya da bir sunucunun formunda verildiğinde " "oluşur." -#: admin/templates/admin/tag_list.html:12 +#: admin/templates/admin/tag_list.html:13 msgid "No tags yet" msgstr "Henüz etiket yok" #: admin/templates/admin/tag_list.html:18 +msgid "Search tags" +msgstr "Etiket ara" + +#: admin/templates/admin/tag_list.html:24 msgid "Tag" msgstr "Etiket" -#: admin/templates/admin/tag_list.html:20 +#: admin/templates/admin/tag_list.html:26 #: computes/templates/computes/list.html:26 msgid "Hosts" msgstr "Sunucular" -#: admin/templates/admin/tag_list.html:21 +#: admin/templates/admin/tag_list.html:27 #: computes/templates/computes/instances.html:58 #: computes/templates/computes/list.html:64 #: instances/templates/allinstances_index_grouped.html:18 @@ -1072,10 +1076,14 @@ msgstr "Sunucular" msgid "Actions" msgstr "Eylemler" -#: admin/templates/admin/tag_list.html:31 +#: admin/templates/admin/tag_list.html:37 msgid "Rename" msgstr "Yeniden adlandır" +#: admin/templates/admin/tag_list.html:46 +msgid "No tag matches the search." +msgstr "Aramayla eşleşen etiket yok." + #: admin/templates/admin/tombstone_list.html:6 #: admin/templates/admin/tombstone_list.html:8 #: admin/templates/admin/tombstone_list.html:19 templates/navbar.html:38 @@ -1328,12 +1336,12 @@ msgid "Its owners and tags no longer come back if its UUID shows up again." msgstr "" "UUID'si yeniden görünse bile sahipleri ve etiketleri artık geri gelmez." -#: admin/views.py:510 +#: admin/views.py:512 #, python-format msgid "Rename tag %(tag)s" msgstr "%(tag)s etiketini yeniden adlandır" -#: admin/views.py:515 +#: admin/views.py:517 #, python-format msgid "The backup schedule %(schedules)s backs up its VMs: change it first" msgid_plural "" @@ -1345,24 +1353,24 @@ msgstr[1] "" "%(schedules)s yedekleme zamanlamaları bu etiketin sanal makinelerini " "yedekliyor: önce onları değiştirin" -#: admin/views.py:533 +#: admin/views.py:535 #, python-format msgid "Tag %(tag)s deleted" msgstr "%(tag)s etiketi silindi" -#: admin/views.py:541 +#: admin/views.py:543 #, python-format msgid "It is taken off %(vms)s and %(hosts)s." msgstr "%(vms)s ve %(hosts)s üzerinden kaldırılır." -#: admin/views.py:542 +#: admin/views.py:544 #, python-format msgid "%(count)s VM" msgid_plural "%(count)s VMs" msgstr[0] "%(count)s sanal makine" msgstr[1] "%(count)s sanal makine" -#: admin/views.py:543 +#: admin/views.py:545 #, python-format msgid "%(count)s host" msgid_plural "%(count)s hosts" diff --git a/locale/zh/LC_MESSAGES/django.mo b/locale/zh/LC_MESSAGES/django.mo index 30ba1ac0..ba5ef278 100644 Binary files a/locale/zh/LC_MESSAGES/django.mo and b/locale/zh/LC_MESSAGES/django.mo differ diff --git a/locale/zh/LC_MESSAGES/django.po b/locale/zh/LC_MESSAGES/django.po index d7be661f..0d53874f 100644 --- a/locale/zh/LC_MESSAGES/django.po +++ b/locale/zh/LC_MESSAGES/django.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2026-11-19 08:03+0000\n" +"POT-Creation-Date: 2026-11-19 10:35+0000\n" "PO-Revision-Date: \n" "Last-Translator: \n" "Language-Team: \n" @@ -218,7 +218,7 @@ msgid "User sections" msgstr "用户页面导航" #: accounts/templates/account.html:50 accounts/templates/account.html:58 -#: admin/forms.py:221 admin/templates/admin/tag_list.html:19 +#: admin/forms.py:221 admin/templates/admin/tag_list.html:25 #: computes/templates/computes/list.html:33 #: computes/templates/computes/list.html:61 computes/templates/overview.html:90 #: instances/views.py:267 vmbackups/templates/vmbackups/policies.html:17 @@ -461,7 +461,7 @@ msgstr "API 令牌 %(name)s 的操作" #: accounts/templates/api_token_list.html:12 #: accounts/templates/ssh_key_list.html:13 #: admin/templates/admin/group_list.html:44 -#: admin/templates/admin/tag_list.html:32 +#: admin/templates/admin/tag_list.html:38 #: admin/templates/admin/tombstone_list.html:43 #: admin/templates/admin/user_list.html:74 #: admin/templates/admin/user_list.html:76 @@ -858,7 +858,7 @@ msgstr "获得这些权限的用户。" #: admin/templates/admin/group_form.html:60 #: admin/templates/admin/group_list.html:25 admin/templates/admin/logs.html:20 -#: admin/templates/admin/logs.html:26 +#: admin/templates/admin/logs.html:26 admin/templates/admin/tag_list.html:18 #: admin/templates/admin/tombstone_list.html:20 #: admin/templates/admin/user_list.html:20 #: instances/templates/allinstances.html:11 networks/templates/network.html:130 @@ -1001,33 +1001,37 @@ msgstr "完成" msgid "Failed" msgstr "失败" -#: admin/templates/admin/tag_list.html:5 admin/templates/admin/tag_list.html:7 -#: computes/forms.py:55 instances/templates/instances/settings_tab.html:925 -#: instances/views.py:244 templates/common/tag_filter.html:6 -#: templates/navbar.html:39 +#: admin/templates/admin/tag_list.html:6 admin/templates/admin/tag_list.html:8 +#: admin/templates/admin/tag_list.html:17 computes/forms.py:55 +#: instances/templates/instances/settings_tab.html:925 instances/views.py:244 +#: templates/common/tag_filter.html:6 templates/navbar.html:39 msgid "Tags" msgstr "标签" -#: admin/templates/admin/tag_list.html:10 +#: admin/templates/admin/tag_list.html:11 msgid "" "The tags of VMs and hosts. A tag is made when it is first given, on a VM's " "Options tab or a host's form." msgstr "虚拟机和主机的标签。标签在首次于虚拟机的“选项”选项卡或主机表单中添加时创建。" -#: admin/templates/admin/tag_list.html:12 +#: admin/templates/admin/tag_list.html:13 msgid "No tags yet" msgstr "还没有标签" #: admin/templates/admin/tag_list.html:18 +msgid "Search tags" +msgstr "搜索标签" + +#: admin/templates/admin/tag_list.html:24 msgid "Tag" msgstr "标签" -#: admin/templates/admin/tag_list.html:20 +#: admin/templates/admin/tag_list.html:26 #: computes/templates/computes/list.html:26 msgid "Hosts" msgstr "主机" -#: admin/templates/admin/tag_list.html:21 +#: admin/templates/admin/tag_list.html:27 #: computes/templates/computes/instances.html:58 #: computes/templates/computes/list.html:64 #: instances/templates/allinstances_index_grouped.html:18 @@ -1041,10 +1045,14 @@ msgstr "主机" msgid "Actions" msgstr "操作" -#: admin/templates/admin/tag_list.html:31 +#: admin/templates/admin/tag_list.html:37 msgid "Rename" msgstr "重命名" +#: admin/templates/admin/tag_list.html:46 +msgid "No tag matches the search." +msgstr "没有与搜索匹配的标签。" + #: admin/templates/admin/tombstone_list.html:6 #: admin/templates/admin/tombstone_list.html:8 #: admin/templates/admin/tombstone_list.html:19 templates/navbar.html:38 @@ -1286,35 +1294,35 @@ msgstr "已删除已移除的虚拟机 %(name)s" msgid "Its owners and tags no longer come back if its UUID shows up again." msgstr "若其 UUID 再次出现,其所有者和标签将不再恢复。" -#: admin/views.py:510 +#: admin/views.py:512 #, python-format msgid "Rename tag %(tag)s" msgstr "重命名标签 %(tag)s" -#: admin/views.py:515 +#: admin/views.py:517 #, python-format msgid "The backup schedule %(schedules)s backs up its VMs: change it first" msgid_plural "" "The backup schedules %(schedules)s back up its VMs: change them first" msgstr[0] "备份计划 %(schedules)s 正在备份该标签的虚拟机:请先修改计划" -#: admin/views.py:533 +#: admin/views.py:535 #, python-format msgid "Tag %(tag)s deleted" msgstr "标签 %(tag)s 已删除" -#: admin/views.py:541 +#: admin/views.py:543 #, python-format msgid "It is taken off %(vms)s and %(hosts)s." msgstr "它将从 %(vms)s 和 %(hosts)s 上移除。" -#: admin/views.py:542 +#: admin/views.py:544 #, python-format msgid "%(count)s VM" msgid_plural "%(count)s VMs" msgstr[0] "%(count)s 个虚拟机" -#: admin/views.py:543 +#: admin/views.py:545 #, python-format msgid "%(count)s host" msgid_plural "%(count)s hosts"