diff --git a/admin/forms.py b/admin/forms.py index a504f485..55b6401d 100644 --- a/admin/forms.py +++ b/admin/forms.py @@ -12,6 +12,7 @@ from django.utils.translation import gettext_lazy as _ from accounts.forms import UniqueEmailMixin from accounts.models import UserAttributes, UserInstance from appsettings.settings import app_settings +from computes.models import Tag from instances.models import Instance from .models import Permission @@ -49,6 +50,15 @@ def permission_rows(field): return rows +class TagForm(forms.ModelForm): + class Meta: + model = Tag + fields = ["name"] + + def clean_name(self): + return self.cleaned_data["name"].strip().lower() + + class GroupForm(forms.ModelForm): permissions = forms.ModelMultipleChoiceField( widget=forms.CheckboxSelectMultiple, diff --git a/admin/templates/admin/tag_list.html b/admin/templates/admin/tag_list.html new file mode 100644 index 00000000..5dba6c76 --- /dev/null +++ b/admin/templates/admin/tag_list.html @@ -0,0 +1,40 @@ +{% extends "base.html" %} +{% load i18n %} +{% load bootstrap_icons %} + +{% block title %}{% trans "Tags" %}{% endblock %} + +{% block page_heading %}{% trans "Tags" %}{% endblock page_heading %} + +{% block content %} +

{% trans "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." %}

+{% 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" %}
{% bs_icon 'tag' %} {{ tag }}{{ tag.vm_count }}{{ tag.host_count }} + {% trans "Rename" %} + {% trans "Delete" %} +
+
+{% endif %} +{% endblock content %} diff --git a/admin/tests/test_tags.py b/admin/tests/test_tags.py new file mode 100644 index 00000000..c360a05a --- /dev/null +++ b/admin/tests/test_tags.py @@ -0,0 +1,69 @@ +"""Superusers rename and delete the tags of VMs and hosts.""" + +from django.contrib.auth.models import User +from django.test import TestCase +from django.urls import reverse + +from computes.models import Compute, Tag +from instances.models import Instance, InstanceTombstone +from logs.models import Logs + + +class TagAdminTests(TestCase): + def setUp(self): + self.client.force_login(User.objects.create_superuser("tg-admin", "tg@example.com", "pw")) + self.prod = Tag.objects.create(name="prod") + compute = Compute.objects.create(name="tg", hostname="192.0.2.7", login="u", password="p", type=1) + compute.tags.add(self.prod) + Instance.objects.create(compute=compute, name="vm", uuid="12345678-0000-0000-0000-00000000dd01").tags.add(self.prod) + self.tombstone = InstanceTombstone.objects.create(uuid="12345678-0000-0000-0000-00000000dd02", name="gone", + tags=["prod", "db"]) + + def messages(self): + return list(Logs.objects.filter(message__startswith="Tag").order_by("id").values_list("message", flat=True)) + + def test_the_list_counts_each_tag_s_vms_and_hosts(self): + response = self.client.get(reverse("admin:tag_list")) + self.assertEqual([(t.name, t.vm_count, t.host_count) for t in response.context["tags"]], [("prod", 1, 1)]) + + 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() + self.assertEqual(self.prod.name, "live") + self.assertEqual(self.prod.instances.count(), 1) + self.tombstone.refresh_from_db() + self.assertEqual(self.tombstone.tags, ["live", "db"]) + self.assertEqual(self.messages(), ["Tag prod: rename to live"]) + + def test_a_name_taken_or_bad_is_refused(self): + Tag.objects.create(name="db") + for name in ("DB", "two words"): + with self.subTest(name): + response = self.client.post(reverse("admin:tag_update", args=[self.prod.pk]), {"name": name}) + self.assertEqual(response.status_code, 200) + self.assertTrue(response.context["form"].errors) + self.prod.refresh_from_db() + self.assertEqual(self.prod.name, "prod") + + def test_a_delete_takes_it_off_everything(self): + self.assertContains(self.client.get(reverse("admin:tag_delete", args=[self.prod.pk])), "1 VM and 1 host") + self.client.post(reverse("admin:tag_delete", args=[self.prod.pk])) + self.assertFalse(Tag.objects.exists()) + self.assertFalse(Instance.objects.get(name="vm").tags.exists()) + self.assertEqual(self.messages(), ["Tag prod: delete"]) + + def test_a_deleted_name_made_again_is_not_given_to_a_vm_that_returns(self): + self.client.post(reverse("admin:tag_delete", args=[self.prod.pk])) + self.tombstone.refresh_from_db() + self.assertEqual(self.tombstone.tags, ["db"]) + + def test_the_same_name_is_no_rename(self): + self.client.post(reverse("admin:tag_update", args=[self.prod.pk]), {"name": "PROD"}) + self.assertEqual(self.messages(), []) + + def test_only_superusers(self): + self.client.force_login(User.objects.create_user("tg-user", password="pw")) + for url in (reverse("admin:tag_list"), reverse("admin:tag_update", args=[self.prod.pk]), + reverse("admin:tag_delete", args=[self.prod.pk])): + self.assertEqual(self.client.post(url, {"name": "x"}).status_code, 403) + self.assertEqual(Tag.objects.get().name, "prod") diff --git a/admin/urls.py b/admin/urls.py index c0ce1fe1..2af4cd73 100644 --- a/admin/urls.py +++ b/admin/urls.py @@ -18,4 +18,7 @@ urlpatterns = [ path("logs/export.xlsx", views.logs_export, name="logs_export"), path("removed-vms/", views.tombstone_list, name="tombstone_list"), path("removed-vms//delete/", views.tombstone_delete, name="tombstone_delete"), + path("tags/", views.tag_list, name="tag_list"), + path("tags//update/", views.tag_update, name="tag_update"), + path("tags//delete/", views.tag_delete, name="tag_delete"), ] diff --git a/admin/views.py b/admin/views.py index 5fd8c619..0e4c8b0b 100644 --- a/admin/views.py +++ b/admin/views.py @@ -16,8 +16,10 @@ from django.shortcuts import get_object_or_404, redirect, render from django.utils import timezone from django.utils.http import url_has_allowed_host_and_scheme, urlencode from django.utils.translation import gettext_lazy as _ +from django.utils.translation import ngettext from django.views.decorators.http import require_POST from django.views.decorators.debug import sensitive_post_parameters +from computes.models import Tag from instances.models import InstanceTombstone from instances.report import workbook from logs.audit import audit, changed_fields, snapshot @@ -463,3 +465,57 @@ def tombstone_delete(request, pk): "consequence": _("Its owners no longer get the VM back if its UUID shows up again.")}, ) + + +@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)) + return render(request, "admin/tag_list.html", {"tags": list(tags)}) + + +def _retag_removed_vms(old, new): + """The removed VMs' kept tag old named new, or dropped with None: a name + made again later must not go to them. Under the ownership lock (computes.utils.forget).""" + for tombstone in InstanceTombstone.objects.all(): + if old in tombstone.tags: + if new: + tombstone.tags = [new if name == old else name for name in tombstone.tags] + else: + tombstone.tags = [name for name in tombstone.tags if name != old] + tombstone.save(update_fields=["tags"]) + + +@superuser_only +def tag_update(request, pk): + tag = get_object_or_404(Tag, pk=pk) + old = tag.name + form = forms.TagForm(request.POST or None, instance=tag) + if request.method == "POST" and form.is_valid(): + if form.cleaned_data["name"] != old: + with audit(request, None, f"Tag {old}", f"rename to {form.cleaned_data['name']}"), transaction.atomic(): + lock_ownership() + current = Tag.objects.values_list("name", flat=True).get(pk=pk) # another rename may have come first + form.save() + _retag_removed_vms(current, tag.name) + return redirect("admin:tag_list") + return render(request, "common/form.html", {"form": form, "title": _("Rename tag %(tag)s") % {"tag": old}}) + + +@superuser_only +def tag_delete(request, pk): + tag = get_object_or_404(Tag, pk=pk) + if request.method == "POST": + with audit(request, None, f"Tag {tag.name}", "delete"), transaction.atomic(): + lock_ownership() + tag.delete() + _retag_removed_vms(tag.name, None) + messages.success(request, _("Tag %(tag)s deleted") % {"tag": tag.name}) + return redirect("admin:tag_list") + vms, hosts = tag.instances.count(), tag.computes.count() + return render(request, "common/confirm_delete.html", { + "object": tag, + "consequence": _("It is taken off %(vms)s and %(hosts)s.") % { + "vms": ngettext("%(count)s VM", "%(count)s VMs", vms) % {"count": vms}, + "hosts": ngettext("%(count)s host", "%(count)s hosts", hosts) % {"count": hosts}}, + }) diff --git a/computes/api/serializers.py b/computes/api/serializers.py index 6cdd04f9..5cb7fe9e 100644 --- a/computes/api/serializers.py +++ b/computes/api/serializers.py @@ -2,11 +2,24 @@ from copy import copy from computes.models import Compute from computes.validators import validate_gstfsd_key +from drf_spectacular.utils import OpenApiParameter from rest_framework import serializers from vrtManager.connection import CONN_SOCKET, CONN_SSH, CONN_TCP, CONN_TLS +# a VM's or host's tags, by name: set on the web pages only +TAGS = {"many": True, "read_only": True, "slug_field": "name"} +TAG_PARAMETER = OpenApiParameter("tag", str, description="Only those with this tag") + + +def with_tag(queryset, request): + """queryset's VMs or hosts with the ?tag= of request, all without one; their tags read at once.""" + tag = request.query_params.get("tag") + return (queryset.filter(tags__name=tag) if tag else queryset).prefetch_related("tags") + + class ComputeSerializer(serializers.ModelSerializer): + tags = serializers.SlugRelatedField(**TAGS) password = serializers.CharField( style={"input_type": "password"}, write_only=True, @@ -48,4 +61,5 @@ class ComputeSerializer(serializers.ModelSerializer): class Meta: model = Compute - fields = ["id", "name", "hostname", "login", "password", "type", "details", "migration_address", "gstfsd_key"] + fields = ["id", "name", "hostname", "login", "password", "type", "details", "migration_address", "gstfsd_key", + "tags"] diff --git a/computes/api/viewsets.py b/computes/api/viewsets.py index 8e90e07a..55b015ff 100644 --- a/computes/api/viewsets.py +++ b/computes/api/viewsets.py @@ -9,7 +9,7 @@ from rest_framework import viewsets from rest_framework.response import Response from vrtManager.create import wvmCreate -from .serializers import ComputeSerializer +from .serializers import TAG_PARAMETER, ComputeSerializer, with_tag class ComputeViewSet(viewsets.ModelViewSet): @@ -22,6 +22,14 @@ class ComputeViewSet(viewsets.ModelViewSet): serializer_class = ComputeSerializer permission_classes = [IsSuperUser] + def get_queryset(self): + queryset = super().get_queryset() + return with_tag(queryset, self.request) if self.action == "list" else queryset + + @extend_schema(parameters=[TAG_PARAMETER]) + def list(self, request, *args, **kwargs): + return super().list(request, *args, **kwargs) + # checked and saved under hosts_lock, as on the web (Compute.clean) def create(self, request, *args, **kwargs): with hosts_lock(): diff --git a/instances/api/serializers.py b/instances/api/serializers.py index a5f538e3..7b505a97 100644 --- a/instances/api/serializers.py +++ b/instances/api/serializers.py @@ -1,3 +1,4 @@ +from computes.api.serializers import TAGS from computes.models import Compute from django.conf import settings from instances.models import Flavor, Instance @@ -7,9 +8,11 @@ from rest_framework import serializers class InstanceSerializer(serializers.ModelSerializer): + tags = serializers.SlugRelatedField(**TAGS) + class Meta: model = Instance - fields = ["id", "compute", "name", "uuid", "is_template", "created", "drbd"] + fields = ["id", "compute", "name", "uuid", "is_template", "created", "drbd", "tags"] # what a VM's device dicts tell of the host: its files and pools @@ -18,6 +21,7 @@ HOST_KEYS = {"image", "storage", "path", "backing_file", "loader"} class InstanceDetailsSerializer(serializers.ModelSerializer): networks = serializers.SerializerMethodField() + tags = serializers.SlugRelatedField(**TAGS) def get_networks(self, instance) -> list[dict]: """Each NIC with its addresses (None: none known), which the VM page @@ -58,6 +62,7 @@ class InstanceDetailsSerializer(serializers.ModelSerializer): "status", "uuid", "name", + "tags", "title", "description", "is_template", diff --git a/instances/api/viewsets.py b/instances/api/viewsets.py index ac46a1d9..41d3a569 100644 --- a/instances/api/viewsets.py +++ b/instances/api/viewsets.py @@ -1,5 +1,6 @@ from admin.permissions import IsSuperUser from computes import utils +from computes.api.serializers import TAG_PARAMETER, with_tag from computes.models import Compute from django.contrib.messages import get_messages from django.http import Http404 @@ -57,6 +58,7 @@ class InstancesViewSet(viewsets.ViewSet): serializer_class = InstanceSerializer lookup_value_converter = "int" + @extend_schema(parameters=[TAG_PARAMETER]) def list(self, request): # as the VM list: the hosts read first (all at once, one that does not answer # left as last read), so that VMs added, renamed or removed outside are seen @@ -74,7 +76,7 @@ class InstancesViewSet(viewsets.ViewSet): userinstance__user=request.user ).prefetch_related("userinstance_set") serializer = InstanceSerializer( - queryset, many=True, context={"request": request} + with_tag(queryset, request), many=True, context={"request": request} ) return Response(serializer.data) @@ -95,6 +97,7 @@ class InstanceViewSet(viewsets.ViewSet): serializer_class = InstanceSerializer lookup_value_converter = "int" + @extend_schema(parameters=[TAG_PARAMETER]) def list(self, request, compute_pk=None): compute = get_object_or_404(Compute, pk=compute_pk) @@ -119,7 +122,7 @@ class InstanceViewSet(viewsets.ViewSet): compute=compute, userinstance__user=request.user ).prefetch_related("userinstance_set") serializer = InstanceSerializer( - queryset, many=True, context={"request": request} + with_tag(queryset, request), many=True, context={"request": request} ) return Response(serializer.data) diff --git a/instances/tests/test_tags.py b/instances/tests/test_tags.py index 64c62279..315a2467 100644 --- a/instances/tests/test_tags.py +++ b/instances/tests/test_tags.py @@ -89,3 +89,40 @@ class VmListTagFilterTests(TestCase): def test_no_tags_no_tag_list(self): Tag.objects.all().delete() self.assertEqual(self.page(self.admin).xpath("//select[@id='tag-filter']"), []) + + +class TagsApiTests(TestCase): + def setUp(self): + User = get_user_model() + self.client.force_login(User.objects.create_superuser("ta-admin", "ta@example.com", "pw")) + self.compute = Compute.objects.create(name="ta", hostname="192.0.2.8", login="u", password="p", type=1) + Compute.objects.create(name="ta2", hostname="192.0.2.9", login="u", password="p", type=1) + prod = Tag.objects.create(name="prod") + self.compute.tags.add(prod) + self.vm = Instance.objects.create(compute=self.compute, name="web", uuid="12345678-0000-0000-0000-00000000ee01") + self.vm.tags.add(prod, Tag.objects.create(name="web")) + Instance.objects.create(compute=self.compute, name="db", uuid="12345678-0000-0000-0000-00000000ee02") + + def get(self, url): + with patch("instances.api.viewsets.host_domain_states"), \ + patch("instances.api.viewsets.utils.refresh_instance_database"): + return self.client.get(url).json() + + def test_the_vm_lists_give_the_tags_and_filter_by_one(self): + for url in ("/api/v1/instances/", f"/api/v1/computes/{self.compute.id}/instances/"): + with self.subTest(url): + self.assertEqual(sorted((vm["name"], vm["tags"]) for vm in self.get(url)), + [("db", []), ("web", ["prod", "web"])]) + self.assertEqual([vm["name"] for vm in self.get(url + "?tag=prod")], ["web"]) + + def test_the_hosts_give_the_tags_and_filter_by_one(self): + self.assertEqual([(c["name"], c["tags"]) for c in self.client.get("/api/v1/computes/").json()], + [("ta", ["prod"]), ("ta2", [])]) + self.assertEqual([c["name"] for c in self.client.get("/api/v1/computes/?tag=prod").json()], ["ta"]) + + def test_a_tag_asked_of_one_host_is_no_filter(self): + self.assertEqual(self.client.get(f"/api/v1/computes/{self.compute.id}/?tag=other").status_code, 200) + + def test_the_tags_are_not_set_through_the_api(self): + self.client.patch(f"/api/v1/computes/{self.compute.id}/", {"tags": []}, content_type="application/json") + self.assertTrue(self.compute.tags.exists()) diff --git a/locale/tr/LC_MESSAGES/django.mo b/locale/tr/LC_MESSAGES/django.mo index 89fba0df..3eb3b69b 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 e8d8d995..55887e29 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-18 17:32+0000\n" +"POT-Creation-Date: 2026-11-18 17:53+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" @@ -153,7 +153,7 @@ msgstr "en fazla disk boyutu (GiB)" msgid "max backup size (GiB)" msgstr "en fazla yedek boyutu (GiB)" -#: accounts/models.py:88 admin/forms.py:23 +#: accounts/models.py:88 admin/forms.py:24 msgid "Can change password" msgstr "Parola değiştirebilir" @@ -171,13 +171,13 @@ msgid "User Profile" msgstr "Kullanıcı Profili" #: accounts/templates/account.html:17 accounts/templates/profile.html:18 -#: admin/forms.py:92 admin/templates/admin/user_list.html:24 +#: admin/forms.py:102 admin/templates/admin/user_list.html:24 #: admin/templates/admin/user_list.html:30 msgid "Superuser" msgstr "Süperkullanıcı" #: accounts/templates/account.html:19 accounts/templates/profile.html:20 -#: admin/forms.py:92 admin/templates/admin/user_list.html:24 +#: admin/forms.py:102 admin/templates/admin/user_list.html:24 #: admin/templates/admin/user_list.html:32 msgid "Template editor" msgstr "Şablon düzenleyici" @@ -223,7 +223,8 @@ msgid "User sections" msgstr "Kullanıcı bölümleri" #: accounts/templates/account.html:50 accounts/templates/account.html:58 -#: admin/forms.py:210 computes/templates/computes/list.html:34 +#: admin/forms.py:220 admin/templates/admin/tag_list.html:19 +#: computes/templates/computes/list.html:34 #: computes/templates/computes/list.html:61 computes/templates/overview.html:90 #: instances/views.py:265 vmbackups/templates/vmbackups/policies.html:17 msgid "VMs" @@ -467,6 +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/tombstone_list.html:43 #: admin/templates/admin/user_list.html:74 #: admin/templates/admin/user_list.html:76 @@ -516,7 +518,7 @@ msgid "Signing in..." msgstr "Oturum açılıyor..." #: accounts/templates/profile.html:6 accounts/templates/profile.html:8 -#: templates/navbar.html:53 +#: templates/navbar.html:54 msgid "Profile" msgstr "Profil" @@ -692,27 +694,27 @@ msgid "OTP of %(user)s was reset: a new QR code can be mailed." msgstr "" "%(user)s kullanıcısının OTP'si sıfırlandı: yeni bir QR kodu gönderilebilir." -#: admin/forms.py:22 +#: admin/forms.py:23 msgid "Can back up instances" msgstr "Sanal makineleri yedekleyebilir" -#: admin/forms.py:24 +#: admin/forms.py:25 msgid "Can clone instances" msgstr "Sanal makineleri klonlayabilir" -#: admin/forms.py:25 instances/models.py:438 +#: admin/forms.py:26 instances/models.py:438 msgid "Can access console without password" msgstr "Parolasız konsol erişimi yapabilir" -#: admin/forms.py:26 +#: admin/forms.py:27 msgid "Can snapshot instances" msgstr "Sanal makinelerin anlık görüntüsünü alabilir" -#: admin/forms.py:27 +#: admin/forms.py:28 msgid "Can view instances" msgstr "Sanal makineleri görebilir" -#: admin/forms.py:32 +#: admin/forms.py:33 msgid "" "Back up the VMs they may change into targets open to VM owners, restore those" " backups over the VM or as a new VM, and delete the backups they took, within" @@ -722,11 +724,11 @@ msgstr "" " yedekleri VM'in üzerine ya da yeni bir VM olarak geri yükleme ve kendi " "aldığı yedekleri silme; kotaları içinde" -#: admin/forms.py:34 +#: admin/forms.py:35 msgid "Change their own password on their profile page" msgstr "Profil sayfasında kendi parolasını değiştirme" -#: admin/forms.py:35 +#: admin/forms.py:36 msgid "" "Clone the VMs they may change and the templates they may view, within their " "quota" @@ -734,21 +736,21 @@ msgstr "" "Kotası dahilinde, değiştirebildiği sanal makineleri ve görebildiği şablonları" " klonlama" -#: admin/forms.py:36 +#: admin/forms.py:37 msgid "Open a console without the VM's console password" msgstr "Sanal makinenin konsol parolası olmadan konsol aç" -#: admin/forms.py:37 +#: admin/forms.py:38 msgid "Take, revert and delete snapshots of the VMs they may change" msgstr "" "Değiştirebildiği sanal makinelerin anlık görüntülerini alma, geri yükleme ve " "silme" -#: admin/forms.py:38 +#: admin/forms.py:39 msgid "See every VM and host in the lists, read-only" msgstr "Listelerde tüm sanal makineleri ve sunucuları salt okunur görme" -#: admin/forms.py:92 admin/templates/admin/logs.html:39 +#: admin/forms.py:102 admin/templates/admin/logs.html:39 #: admin/templates/admin/user_list.html:24 #: admin/templates/admin/user_list.html:34 #: computes/templates/computes/instances.html:54 @@ -760,24 +762,24 @@ msgstr "Listelerde tüm sanal makineleri ve sunucuları salt okunur görme" msgid "User" msgstr "Kullanıcı" -#: admin/forms.py:99 admin/templates/admin/group_form.html:31 +#: admin/forms.py:109 admin/templates/admin/group_form.html:31 msgid "Permissions" msgstr "İzinler" -#: admin/forms.py:106 admin/templates/admin/group_list.html:6 +#: admin/forms.py:116 admin/templates/admin/group_list.html:6 #: admin/templates/admin/group_list.html:8 #: admin/templates/admin/group_list.html:24 #: admin/templates/admin/user_form.html:124 templates/navbar.html:36 msgid "Groups" msgstr "Gruplar" -#: admin/forms.py:160 +#: admin/forms.py:170 #, python-format msgid "NEW_USER_DEFAULT_INSTANCES: %(name)s is not exactly one VM" msgstr "" "NEW_USER_DEFAULT_INSTANCES: %(name)s tam olarak tek bir sanal makine değil" -#: admin/forms.py:163 +#: admin/forms.py:173 #, python-format msgid "" "NEW_USER_DEFAULT_INSTANCES: %(name)s has an owner, and only one is allowed" @@ -785,7 +787,7 @@ msgstr "" "NEW_USER_DEFAULT_INSTANCES: %(name)s sanal makinesinin bir sahibi var ve " "yalnızca bir sahibe izin veriliyor" -#: admin/forms.py:211 computes/templates/computes/list.html:62 +#: admin/forms.py:221 computes/templates/computes/list.html:62 #: computes/templates/overview.html:102 instances/forms.py:15 #: instances/templates/allinstances_index_grouped.html:16 #: instances/templates/allinstances_index_nongrouped.html:14 @@ -795,7 +797,7 @@ msgstr "" msgid "vCPUs" msgstr "vCPU" -#: admin/forms.py:212 computes/templates/computes/balance.html:62 +#: admin/forms.py:222 computes/templates/computes/balance.html:62 #: computes/templates/computes/bulk_migrate.html:67 #: computes/templates/computes/instances.html:57 #: computes/templates/computes/list.html:63 @@ -809,7 +811,7 @@ msgstr "vCPU" msgid "Memory" msgstr "Bellek" -#: admin/forms.py:213 instances/models.py:241 +#: admin/forms.py:223 instances/models.py:241 #: instances/templates/create_instance_w2.html:118 #: instances/templates/instances/settings_tab.html:25 #: instances/templates/instances/stats_tab.html:53 vmbackups/forms.py:57 @@ -817,7 +819,7 @@ msgstr "Bellek" msgid "Disk" msgstr "Disk" -#: admin/forms.py:214 instances/templates/instance.html:113 +#: admin/forms.py:224 instances/templates/instance.html:113 #: templates/navbar.html:21 vmbackups/templates/vmbackups/index.html:8 #: vmbackups/templates/vmbackups/index.html:10 #: vmbackups/templates/vmbackups/policies.html:8 @@ -829,27 +831,27 @@ msgstr "Disk" msgid "Backups" msgstr "Yedekler" -#: admin/forms.py:224 +#: admin/forms.py:234 msgid "No limit" msgstr "Sınır yok" -#: admin/forms.py:240 +#: admin/forms.py:250 msgid "Enter a limit or choose No limit." msgstr "Bir sınır girin ya da Sınır yok'u seçin." -#: admin/forms.py:252 +#: admin/forms.py:262 msgid "The user must change it at their next login" msgstr "Kullanıcı bir sonraki girişinde onu değiştirmek zorundadır" -#: admin/forms.py:258 +#: admin/forms.py:268 msgid "With a password" msgstr "Parolayla" -#: admin/forms.py:258 +#: admin/forms.py:268 msgid "Without a password" msgstr "Parolasız" -#: admin/forms.py:264 +#: admin/forms.py:274 msgid "A user without a password cannot be made to change it" msgstr "Parolası olmayan bir kullanıcıya parola değiştirme zorunluluğu konamaz" @@ -1006,16 +1008,16 @@ msgstr "Sonuç" msgid "IP" msgstr "IP" -#: admin/templates/admin/logs.html:56 admin/views.py:395 instances/states.py:19 +#: admin/templates/admin/logs.html:56 admin/views.py:397 instances/states.py:19 #: instances/views.py:489 logs/views.py:18 msgid "Unknown" msgstr "Bilinmeyen" -#: admin/templates/admin/logs.html:56 admin/views.py:395 logs/views.py:18 +#: admin/templates/admin/logs.html:56 admin/views.py:397 logs/views.py:18 msgid "Done" msgstr "Tamamlandı" -#: admin/templates/admin/logs.html:56 admin/views.py:395 logs/views.py:18 +#: admin/templates/admin/logs.html:56 admin/views.py:397 logs/views.py:18 #: operations/templates/operations/job.html:110 #: vmbackups/templates/vmbackups/index.html:34 #: vmbackups/templates/vmbackups/policy.html:39 @@ -1023,6 +1025,52 @@ 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:48 instances/templates/instances/settings_tab.html:925 +#: templates/navbar.html:39 +msgid "Tags" +msgstr "Etiketler" + +#: admin/templates/admin/tag_list.html:10 +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 "" +"Sanal makinelerin ve sunucuların etiketleri. Bir etiket, ilk kez bir sanal " +"makinenin Seçenekler sekmesinde ya da bir sunucunun formunda verildiğinde " +"oluşur." + +#: admin/templates/admin/tag_list.html:12 +msgid "No tags yet" +msgstr "Henüz etiket yok" + +#: admin/templates/admin/tag_list.html:18 templates/common/tag_filter.html:3 +msgid "Tag" +msgstr "Etiket" + +#: admin/templates/admin/tag_list.html:20 +#: computes/templates/computes/list.html:27 +msgid "Hosts" +msgstr "Sunucular" + +#: admin/templates/admin/tag_list.html:21 +#: computes/templates/computes/instances.html:58 +#: computes/templates/computes/list.html:64 +#: instances/templates/allinstances_index_grouped.html:18 +#: instances/templates/allinstances_index_nongrouped.html:16 +#: instances/templates/instances/settings_tab.html:450 +#: instances/templates/instances/settings_tab.html:485 +#: networks/templates/network.html:146 networks/templates/network.html:204 +#: networks/templates/network.html:286 nwfilters/templates/nwfilter.html:56 +#: nwfilters/templates/nwfilter.html:100 nwfilters/templates/nwfilters.html:35 +#: storages/templates/storage.html:126 virtsecrets/templates/secrets.html:33 +msgid "Actions" +msgstr "Eylemler" + +#: admin/templates/admin/tag_list.html:31 +msgid "Rename" +msgstr "Yeniden adlandır" + #: 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 @@ -1155,7 +1203,7 @@ msgstr "Kullanıcı oluştur" msgid "New user" msgstr "Yeni kullanıcı" -#: admin/templates/admin/user_list.html:19 admin/views.py:179 +#: admin/templates/admin/user_list.html:19 admin/views.py:181 #: instances/templates/instances/settings_tab.html:79 templates/navbar.html:35 msgid "Users" msgstr "Kullanıcılar" @@ -1214,7 +1262,7 @@ msgstr "Burada belirlenen parolayla oturum açar." msgid "Signs in another way, such as LDAP. The current password is removed." msgstr "LDAP gibi başka bir yolla oturum açar. Mevcut parola kaldırılır." -#: admin/views.py:42 +#: admin/views.py:44 #, python-format msgid "" "%(name)s was changed meanwhile: here it is as it is now; make your change " @@ -1222,59 +1270,88 @@ msgid "" msgstr "" "%(name)s bu arada değişti: güncel hâli aşağıda; değişikliğinizi yeniden yapın" -#: admin/views.py:75 +#: admin/views.py:77 msgid "Create Group" msgstr "Grup Oluştur" -#: admin/views.py:117 +#: admin/views.py:119 msgid "Update Group" msgstr "Grubu Güncelle" -#: admin/views.py:133 +#: admin/views.py:135 msgid "Its members stay but lose the permissions it gave them." msgstr "Üyeleri kalır ancak grubun onlara verdiği izinleri kaybeder." -#: admin/views.py:139 +#: admin/views.py:141 msgid "You cannot block, delete or demote your own account" msgstr "Kendi hesabınızı engelleyemez, silemez veya yetkisini düşüremezsiniz" -#: admin/views.py:140 +#: admin/views.py:142 msgid "This would leave no active superuser" msgstr "Bu işlem hiç etkin süper kullanıcı bırakmaz" -#: admin/views.py:214 +#: admin/views.py:216 msgid "Create User" msgstr "Kullanıcı Oluştur" -#: admin/views.py:287 +#: admin/views.py:289 msgid "Update User" msgstr "Kullanıcı Güncelle" -#: admin/views.py:311 +#: admin/views.py:313 #, python-format msgid "Password changed for %(user)s" msgstr "%(user)s parolası değiştirildi" -#: admin/views.py:338 +#: admin/views.py:340 msgid "Their access to VMs, SSH keys and settings go; the VMs themselves stay." msgstr "" "Sanal makinelere erişimi, SSH anahtarları ve ayarları silinir; sanal " "makinelerin kendisi kalır." -#: admin/views.py:444 +#: admin/views.py:446 msgid "deleted user" msgstr "silinmiş kullanıcı" -#: admin/views.py:456 +#: admin/views.py:458 #, python-format msgid "Removed VM %(name)s deleted" msgstr "Kaldırılan sanal makine %(name)s silindi" -#: admin/views.py:463 +#: admin/views.py:465 msgid "Its owners no longer get the VM back if its UUID shows up again." msgstr "" "UUID'si yeniden görünse bile sahipleri sanal makineyi artık geri almaz." +#: admin/views.py:502 +#, python-format +msgid "Rename tag %(tag)s" +msgstr "%(tag)s etiketini yeniden adlandır" + +#: admin/views.py:513 +#, python-format +msgid "Tag %(tag)s deleted" +msgstr "%(tag)s etiketi silindi" + +#: admin/views.py:518 +#, 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:519 +#, 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:520 +#, python-format +msgid "%(count)s host" +msgid_plural "%(count)s hosts" +msgstr[0] "%(count)s sunucu" +msgstr[1] "%(count)s sunucu" + #: appsettings/migrations/0002_auto_20200527_1603.py:11 msgid "Theme" msgstr "Tema" @@ -1817,7 +1894,7 @@ msgstr "Ayar grupları" msgid "Appearance" msgstr "Görünüm" -#: appsettings/templates/appsettings.html:35 templates/navbar.html:51 +#: appsettings/templates/appsettings.html:35 templates/navbar.html:52 msgid "Language" msgstr "Dil" @@ -1938,10 +2015,6 @@ msgstr "Kayıtlı, korumak için boş bırakın" msgid "Add tag %(tag)s" msgstr "Etiket ekle: %(tag)s" -#: computes/forms.py:48 instances/templates/instances/settings_tab.html:925 -msgid "Tags" -msgstr "Etiketler" - #: computes/forms.py:57 msgid "A tag has at most 32 characters" msgstr "Bir etiket en fazla 32 karakterdir" @@ -2618,27 +2691,10 @@ msgstr "Hipervizör üzerinde hiç sanal makine yok" msgid "VCPU" msgstr "VCPU" -#: computes/templates/computes/instances.html:58 -#: computes/templates/computes/list.html:64 -#: instances/templates/allinstances_index_grouped.html:18 -#: instances/templates/allinstances_index_nongrouped.html:16 -#: instances/templates/instances/settings_tab.html:450 -#: instances/templates/instances/settings_tab.html:485 -#: networks/templates/network.html:146 networks/templates/network.html:204 -#: networks/templates/network.html:286 nwfilters/templates/nwfilter.html:56 -#: nwfilters/templates/nwfilter.html:100 nwfilters/templates/nwfilters.html:35 -#: storages/templates/storage.html:126 virtsecrets/templates/secrets.html:33 -msgid "Actions" -msgstr "Eylemler" - #: computes/templates/computes/list.html:20 msgid "You don't have any computes" msgstr "Hiç sunucunuz yok" -#: computes/templates/computes/list.html:27 -msgid "Hosts" -msgstr "Sunucular" - #: computes/templates/computes/list.html:29 msgid "connected" msgstr "bağlı" @@ -3237,7 +3293,7 @@ msgstr "" "'%(type)s' konsol tipi desteklenmiyor. Lütfen sanal makinenin grafik tipini " "VNC olarak değiştirin." -#: instances/api/viewsets.py:157 instances/api/viewsets.py:175 +#: instances/api/viewsets.py:160 instances/api/viewsets.py:178 #: instances/views.py:863 instances/views.py:885 instances/views.py:1875 msgid "Templates cannot be started." msgstr "Şablon makineler başlatılamaz." @@ -4613,7 +4669,7 @@ msgstr "Boyutlandır" msgid "Snapshot" msgstr "Anlık Görüntü" -#: instances/templates/instance.html:103 templates/navbar.html:40 +#: instances/templates/instance.html:103 templates/navbar.html:41 msgid "Settings" msgstr "Ayarlar" @@ -9593,10 +9649,6 @@ msgstr "" msgid "Delete %(object)s?" msgstr "%(object)s silinsin mi?" -#: templates/common/tag_filter.html:3 -msgid "Tag" -msgstr "Etiket" - #: templates/common/tag_filter.html:4 msgid "All tags" msgstr "Tüm etiketler" @@ -9617,11 +9669,11 @@ msgstr "Ana sayfa" msgid "Administration" msgstr "Yönetim" -#: templates/navbar.html:39 +#: templates/navbar.html:40 msgid "VM report (.xlsx)" msgstr "Sanal makine raporu (.xlsx)" -#: templates/navbar.html:57 +#: templates/navbar.html:58 msgid "Log Out" msgstr "Oturumu Kapat" diff --git a/locale/zh/LC_MESSAGES/django.mo b/locale/zh/LC_MESSAGES/django.mo index 9a91916f..e228e7e5 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 e5fedb81..f84aca22 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-18 17:32+0000\n" +"POT-Creation-Date: 2026-11-18 17:53+0000\n" "PO-Revision-Date: \n" "Last-Translator: \n" "Language-Team: \n" @@ -150,7 +150,7 @@ msgstr "最大磁盘大小(GiB)" msgid "max backup size (GiB)" msgstr "最大备份大小 (GiB)" -#: accounts/models.py:88 admin/forms.py:23 +#: accounts/models.py:88 admin/forms.py:24 msgid "Can change password" msgstr "可修改密码" @@ -168,13 +168,13 @@ msgid "User Profile" msgstr "用户资料" #: accounts/templates/account.html:17 accounts/templates/profile.html:18 -#: admin/forms.py:92 admin/templates/admin/user_list.html:24 +#: admin/forms.py:102 admin/templates/admin/user_list.html:24 #: admin/templates/admin/user_list.html:30 msgid "Superuser" msgstr "超级用户" #: accounts/templates/account.html:19 accounts/templates/profile.html:20 -#: admin/forms.py:92 admin/templates/admin/user_list.html:24 +#: admin/forms.py:102 admin/templates/admin/user_list.html:24 #: admin/templates/admin/user_list.html:32 msgid "Template editor" msgstr "模板编辑者" @@ -218,7 +218,8 @@ msgid "User sections" msgstr "用户页面导航" #: accounts/templates/account.html:50 accounts/templates/account.html:58 -#: admin/forms.py:210 computes/templates/computes/list.html:34 +#: admin/forms.py:220 admin/templates/admin/tag_list.html:19 +#: computes/templates/computes/list.html:34 #: computes/templates/computes/list.html:61 computes/templates/overview.html:90 #: instances/views.py:265 vmbackups/templates/vmbackups/policies.html:17 msgid "VMs" @@ -460,6 +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/tombstone_list.html:43 #: admin/templates/admin/user_list.html:74 #: admin/templates/admin/user_list.html:76 @@ -509,7 +511,7 @@ msgid "Signing in..." msgstr "正在登录…" #: accounts/templates/profile.html:6 accounts/templates/profile.html:8 -#: templates/navbar.html:53 +#: templates/navbar.html:54 msgid "Profile" msgstr "个人资料" @@ -676,56 +678,56 @@ msgstr "未设置用户邮箱,无法发送二维码" msgid "OTP of %(user)s was reset: a new QR code can be mailed." msgstr "%(user)s 的 OTP 已重置:可以邮寄新的二维码。" -#: admin/forms.py:22 +#: admin/forms.py:23 msgid "Can back up instances" msgstr "可以备份虚拟机" -#: admin/forms.py:24 +#: admin/forms.py:25 msgid "Can clone instances" msgstr "可克隆虚拟机" -#: admin/forms.py:25 instances/models.py:438 +#: admin/forms.py:26 instances/models.py:438 msgid "Can access console without password" msgstr "可无密码访问控制台" -#: admin/forms.py:26 +#: admin/forms.py:27 msgid "Can snapshot instances" msgstr "可为虚拟机创建快照" -#: admin/forms.py:27 +#: admin/forms.py:28 msgid "Can view instances" msgstr "可查看虚拟机" -#: admin/forms.py:32 +#: admin/forms.py:33 msgid "" "Back up the VMs they may change into targets open to VM owners, restore those" " backups over the VM or as a new VM, and delete the backups they took, within" " their quotas" msgstr "将其可修改的虚拟机备份到向虚拟机所有者开放的目标,将这些备份恢复到虚拟机上或恢复为新虚拟机,并删除自己创建的备份;均在其配额之内" -#: admin/forms.py:34 +#: admin/forms.py:35 msgid "Change their own password on their profile page" msgstr "在个人资料页修改自己的密码" -#: admin/forms.py:35 +#: admin/forms.py:36 msgid "" "Clone the VMs they may change and the templates they may view, within their " "quota" msgstr "在配额范围内克隆其可修改的虚拟机和可查看的模板" -#: admin/forms.py:36 +#: admin/forms.py:37 msgid "Open a console without the VM's console password" msgstr "无需虚拟机的控制台密码即可打开控制台" -#: admin/forms.py:37 +#: admin/forms.py:38 msgid "Take, revert and delete snapshots of the VMs they may change" msgstr "为其可修改的虚拟机创建、恢复和删除快照" -#: admin/forms.py:38 +#: admin/forms.py:39 msgid "See every VM and host in the lists, read-only" msgstr "在列表中查看所有虚拟机和主机(只读)" -#: admin/forms.py:92 admin/templates/admin/logs.html:39 +#: admin/forms.py:102 admin/templates/admin/logs.html:39 #: admin/templates/admin/user_list.html:24 #: admin/templates/admin/user_list.html:34 #: computes/templates/computes/instances.html:54 @@ -737,29 +739,29 @@ msgstr "在列表中查看所有虚拟机和主机(只读)" msgid "User" msgstr "用户" -#: admin/forms.py:99 admin/templates/admin/group_form.html:31 +#: admin/forms.py:109 admin/templates/admin/group_form.html:31 msgid "Permissions" msgstr "权限" -#: admin/forms.py:106 admin/templates/admin/group_list.html:6 +#: admin/forms.py:116 admin/templates/admin/group_list.html:6 #: admin/templates/admin/group_list.html:8 #: admin/templates/admin/group_list.html:24 #: admin/templates/admin/user_form.html:124 templates/navbar.html:36 msgid "Groups" msgstr "用户组" -#: admin/forms.py:160 +#: admin/forms.py:170 #, python-format msgid "NEW_USER_DEFAULT_INSTANCES: %(name)s is not exactly one VM" msgstr "NEW_USER_DEFAULT_INSTANCES:%(name)s 不是唯一的一台虚拟机" -#: admin/forms.py:163 +#: admin/forms.py:173 #, python-format msgid "" "NEW_USER_DEFAULT_INSTANCES: %(name)s has an owner, and only one is allowed" msgstr "NEW_USER_DEFAULT_INSTANCES:%(name)s 已有所有者,且只允许一个所有者" -#: admin/forms.py:211 computes/templates/computes/list.html:62 +#: admin/forms.py:221 computes/templates/computes/list.html:62 #: computes/templates/overview.html:102 instances/forms.py:15 #: instances/templates/allinstances_index_grouped.html:16 #: instances/templates/allinstances_index_nongrouped.html:14 @@ -769,7 +771,7 @@ msgstr "NEW_USER_DEFAULT_INSTANCES:%(name)s 已有所有者,且只允许一 msgid "vCPUs" msgstr "vCPU" -#: admin/forms.py:212 computes/templates/computes/balance.html:62 +#: admin/forms.py:222 computes/templates/computes/balance.html:62 #: computes/templates/computes/bulk_migrate.html:67 #: computes/templates/computes/instances.html:57 #: computes/templates/computes/list.html:63 @@ -783,7 +785,7 @@ msgstr "vCPU" msgid "Memory" msgstr "内存" -#: admin/forms.py:213 instances/models.py:241 +#: admin/forms.py:223 instances/models.py:241 #: instances/templates/create_instance_w2.html:118 #: instances/templates/instances/settings_tab.html:25 #: instances/templates/instances/stats_tab.html:53 vmbackups/forms.py:57 @@ -791,7 +793,7 @@ msgstr "内存" msgid "Disk" msgstr "磁盘" -#: admin/forms.py:214 instances/templates/instance.html:113 +#: admin/forms.py:224 instances/templates/instance.html:113 #: templates/navbar.html:21 vmbackups/templates/vmbackups/index.html:8 #: vmbackups/templates/vmbackups/index.html:10 #: vmbackups/templates/vmbackups/policies.html:8 @@ -803,27 +805,27 @@ msgstr "磁盘" msgid "Backups" msgstr "备份" -#: admin/forms.py:224 +#: admin/forms.py:234 msgid "No limit" msgstr "不限" -#: admin/forms.py:240 +#: admin/forms.py:250 msgid "Enter a limit or choose No limit." msgstr "请输入限制值,或选择“不限”。" -#: admin/forms.py:252 +#: admin/forms.py:262 msgid "The user must change it at their next login" msgstr "用户必须在下次登录时修改密码" -#: admin/forms.py:258 +#: admin/forms.py:268 msgid "With a password" msgstr "使用密码" -#: admin/forms.py:258 +#: admin/forms.py:268 msgid "Without a password" msgstr "不使用密码" -#: admin/forms.py:264 +#: admin/forms.py:274 msgid "A user without a password cannot be made to change it" msgstr "没有密码的用户无法被要求修改密码" @@ -978,16 +980,16 @@ msgstr "结果" msgid "IP" msgstr "IP" -#: admin/templates/admin/logs.html:56 admin/views.py:395 instances/states.py:19 +#: admin/templates/admin/logs.html:56 admin/views.py:397 instances/states.py:19 #: instances/views.py:489 logs/views.py:18 msgid "Unknown" msgstr "未知" -#: admin/templates/admin/logs.html:56 admin/views.py:395 logs/views.py:18 +#: admin/templates/admin/logs.html:56 admin/views.py:397 logs/views.py:18 msgid "Done" msgstr "完成" -#: admin/templates/admin/logs.html:56 admin/views.py:395 logs/views.py:18 +#: admin/templates/admin/logs.html:56 admin/views.py:397 logs/views.py:18 #: operations/templates/operations/job.html:110 #: vmbackups/templates/vmbackups/index.html:34 #: vmbackups/templates/vmbackups/policy.html:39 @@ -995,6 +997,49 @@ msgstr "完成" msgid "Failed" msgstr "失败" +#: admin/templates/admin/tag_list.html:5 admin/templates/admin/tag_list.html:7 +#: computes/forms.py:48 instances/templates/instances/settings_tab.html:925 +#: templates/navbar.html:39 +msgid "Tags" +msgstr "标签" + +#: admin/templates/admin/tag_list.html:10 +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 +msgid "No tags yet" +msgstr "还没有标签" + +#: admin/templates/admin/tag_list.html:18 templates/common/tag_filter.html:3 +msgid "Tag" +msgstr "标签" + +#: admin/templates/admin/tag_list.html:20 +#: computes/templates/computes/list.html:27 +msgid "Hosts" +msgstr "主机" + +#: admin/templates/admin/tag_list.html:21 +#: computes/templates/computes/instances.html:58 +#: computes/templates/computes/list.html:64 +#: instances/templates/allinstances_index_grouped.html:18 +#: instances/templates/allinstances_index_nongrouped.html:16 +#: instances/templates/instances/settings_tab.html:450 +#: instances/templates/instances/settings_tab.html:485 +#: networks/templates/network.html:146 networks/templates/network.html:204 +#: networks/templates/network.html:286 nwfilters/templates/nwfilter.html:56 +#: nwfilters/templates/nwfilter.html:100 nwfilters/templates/nwfilters.html:35 +#: storages/templates/storage.html:126 virtsecrets/templates/secrets.html:33 +msgid "Actions" +msgstr "操作" + +#: admin/templates/admin/tag_list.html:31 +msgid "Rename" +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 @@ -1121,7 +1166,7 @@ msgstr "创建用户" msgid "New user" msgstr "新建用户" -#: admin/templates/admin/user_list.html:19 admin/views.py:179 +#: admin/templates/admin/user_list.html:19 admin/views.py:181 #: instances/templates/instances/settings_tab.html:79 templates/navbar.html:35 msgid "Users" msgstr "用户" @@ -1179,63 +1224,90 @@ msgstr "使用此处设置的密码登录。" msgid "Signs in another way, such as LDAP. The current password is removed." msgstr "通过其他方式(如 LDAP)登录。当前密码将被移除。" -#: admin/views.py:42 +#: admin/views.py:44 #, python-format msgid "" "%(name)s was changed meanwhile: here it is as it is now; make your change " "again" msgstr "%(name)s 在此期间已更改:以下是其当前状态;请重新进行更改" -#: admin/views.py:75 +#: admin/views.py:77 msgid "Create Group" msgstr "创建用户组" -#: admin/views.py:117 +#: admin/views.py:119 msgid "Update Group" msgstr "更新用户组" -#: admin/views.py:133 +#: admin/views.py:135 msgid "Its members stay but lose the permissions it gave them." msgstr "其成员仍保留,但会失去该用户组授予的权限。" -#: admin/views.py:139 +#: admin/views.py:141 msgid "You cannot block, delete or demote your own account" msgstr "不能禁用、删除或降级你自己的账户" -#: admin/views.py:140 +#: admin/views.py:142 msgid "This would leave no active superuser" msgstr "这将导致没有可用的超级用户" -#: admin/views.py:214 +#: admin/views.py:216 msgid "Create User" msgstr "创建用户" -#: admin/views.py:287 +#: admin/views.py:289 msgid "Update User" msgstr "更新用户" -#: admin/views.py:311 +#: admin/views.py:313 #, python-format msgid "Password changed for %(user)s" msgstr "已为 %(user)s 修改密码" -#: admin/views.py:338 +#: admin/views.py:340 msgid "Their access to VMs, SSH keys and settings go; the VMs themselves stay." msgstr "其对虚拟机、SSH 密钥和设置的访问将被移除;虚拟机本身保留。" -#: admin/views.py:444 +#: admin/views.py:446 msgid "deleted user" msgstr "已删除的用户" -#: admin/views.py:456 +#: admin/views.py:458 #, python-format msgid "Removed VM %(name)s deleted" msgstr "已删除已移除的虚拟机 %(name)s" -#: admin/views.py:463 +#: admin/views.py:465 msgid "Its owners no longer get the VM back if its UUID shows up again." msgstr "若其 UUID 再次出现,其所有者将不再恢复对该虚拟机的所有权。" +#: admin/views.py:502 +#, python-format +msgid "Rename tag %(tag)s" +msgstr "重命名标签 %(tag)s" + +#: admin/views.py:513 +#, python-format +msgid "Tag %(tag)s deleted" +msgstr "标签 %(tag)s 已删除" + +#: admin/views.py:518 +#, python-format +msgid "It is taken off %(vms)s and %(hosts)s." +msgstr "它将从 %(vms)s 和 %(hosts)s 上移除。" + +#: admin/views.py:519 +#, python-format +msgid "%(count)s VM" +msgid_plural "%(count)s VMs" +msgstr[0] "%(count)s 个虚拟机" + +#: admin/views.py:520 +#, python-format +msgid "%(count)s host" +msgid_plural "%(count)s hosts" +msgstr[0] "%(count)s 台主机" + #: appsettings/migrations/0002_auto_20200527_1603.py:11 msgid "Theme" msgstr "主题" @@ -1752,7 +1824,7 @@ msgstr "设置分组" msgid "Appearance" msgstr "外观" -#: appsettings/templates/appsettings.html:35 templates/navbar.html:51 +#: appsettings/templates/appsettings.html:35 templates/navbar.html:52 msgid "Language" msgstr "语言" @@ -1872,10 +1944,6 @@ msgstr "已保存,留空则保持不变" msgid "Add tag %(tag)s" msgstr "添加标签:%(tag)s" -#: computes/forms.py:48 instances/templates/instances/settings_tab.html:925 -msgid "Tags" -msgstr "标签" - #: computes/forms.py:57 msgid "A tag has at most 32 characters" msgstr "标签最多 32 个字符" @@ -2505,27 +2573,10 @@ msgstr "虚拟机管理程序中没有任何虚拟机" msgid "VCPU" msgstr "VCPU" -#: computes/templates/computes/instances.html:58 -#: computes/templates/computes/list.html:64 -#: instances/templates/allinstances_index_grouped.html:18 -#: instances/templates/allinstances_index_nongrouped.html:16 -#: instances/templates/instances/settings_tab.html:450 -#: instances/templates/instances/settings_tab.html:485 -#: networks/templates/network.html:146 networks/templates/network.html:204 -#: networks/templates/network.html:286 nwfilters/templates/nwfilter.html:56 -#: nwfilters/templates/nwfilter.html:100 nwfilters/templates/nwfilters.html:35 -#: storages/templates/storage.html:126 virtsecrets/templates/secrets.html:33 -msgid "Actions" -msgstr "操作" - #: computes/templates/computes/list.html:20 msgid "You don't have any computes" msgstr "您还没有任何计算节点" -#: computes/templates/computes/list.html:27 -msgid "Hosts" -msgstr "主机" - #: computes/templates/computes/list.html:29 msgid "connected" msgstr "已连接" @@ -3083,7 +3134,7 @@ msgid "" "VNC." msgstr "不支持控制台类型 '%(type)s'。请将虚拟机图形切换为 VNC。" -#: instances/api/viewsets.py:157 instances/api/viewsets.py:175 +#: instances/api/viewsets.py:160 instances/api/viewsets.py:178 #: instances/views.py:863 instances/views.py:885 instances/views.py:1875 msgid "Templates cannot be started." msgstr "模板无法启动。" @@ -4393,7 +4444,7 @@ msgstr "调整大小" msgid "Snapshot" msgstr "快照" -#: instances/templates/instance.html:103 templates/navbar.html:40 +#: instances/templates/instance.html:103 templates/navbar.html:41 msgid "Settings" msgstr "设置" @@ -9036,10 +9087,6 @@ msgstr "请重新加载页面重试。如果问题持续出现,请将时间告 msgid "Delete %(object)s?" msgstr "删除 %(object)s?" -#: templates/common/tag_filter.html:3 -msgid "Tag" -msgstr "标签" - #: templates/common/tag_filter.html:4 msgid "All tags" msgstr "所有标签" @@ -9060,11 +9107,11 @@ msgstr "首页" msgid "Administration" msgstr "管理" -#: templates/navbar.html:39 +#: templates/navbar.html:40 msgid "VM report (.xlsx)" msgstr "虚拟机报告 (.xlsx)" -#: templates/navbar.html:57 +#: templates/navbar.html:58 msgid "Log Out" msgstr "退出登录" diff --git a/templates/navbar.html b/templates/navbar.html index 06ac505d..96f5779f 100644 --- a/templates/navbar.html +++ b/templates/navbar.html @@ -36,6 +36,7 @@ {% bs_icon 'people-fill' %} {% trans "Groups" %} {% bs_icon 'card-list' %} {% trans "Logs" %} {% bs_icon 'trash' %} {% trans "Removed VMs" %} + {% bs_icon 'tag' %} {% trans "Tags" %} {% bs_icon 'download' %} {% trans "VM report (.xlsx)" %} {% bs_icon 'gear-wide-connected' %} {% trans "Settings" %}