1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2026-12-02 17:06:09 +00:00

fix(appsettings): the console and NIC settings say what they do

The four console settings (scale, view-only, resize session, clip
viewport) said "The console starts ...", but they set how a VNC console
starts; a serial console has none of them, and typed into a view-only
one. The NIC model setting said "default" was libvirt's choice, while
a new VM with "default" gets a VirtIO card. Their descriptions now say
so (migration 0025).
This commit is contained in:
catborise 2026-11-13 12:39:41 +03:00
parent 5a52bcf43e
commit f47b79b0ed
6 changed files with 74 additions and 1 deletions

View file

@ -0,0 +1,29 @@
from django.db import migrations
from django.utils.translation import gettext_noop as _
# what these settings do: the console ones apply to a VNC console only (a
# serial console has none of them), and a new VM's NIC model "default" is VirtIO
DESCRIPTIONS = {
"CONSOLE_SCALE": _("The VNC console starts scaled to its window"),
"CONSOLE_VIEW_ONLY": _("The VNC console starts view-only: no keyboard or mouse input"),
"CONSOLE_RESIZE_SESSION": _("The VNC console starts asking the guest to fit its screen to the window"),
"CONSOLE_CLIP_VIEWPORT": _("The VNC console starts clipped to its window, without scaling"),
"INSTANCE_NIC_DEFAULT_TYPE": _("Network card model chosen first for a new VM (default: VirtIO)"),
}
def describe(apps, schema_editor):
AppSettings = apps.get_model("appsettings", "AppSettings")
for setting in AppSettings.objects.using(schema_editor.connection.alias).filter(key__in=DESCRIPTIONS):
setting.description = DESCRIPTIONS[setting.key]
setting.save()
class Migration(migrations.Migration):
dependencies = [
("appsettings", "0024_log_retention_setting"),
]
operations = [
migrations.RunPython(describe, migrations.RunPython.noop),
]

View file

@ -71,13 +71,15 @@ class ChoicesFixTestCase(TestCase):
descriptions = importlib.import_module("appsettings.migrations.0021_setting_descriptions")
vnc_and_nic = importlib.import_module("appsettings.migrations.0025_vnc_console_and_nic_descriptions")
class DescriptionsTestCase(TestCase):
def test_every_setting_says_what_it_does_within_its_column(self):
limit = AppSettings._meta.get_field("description").max_length
removed = {"VIEW_INSTANCE_DETAIL_BOTTOM_BAR"} # by 0023
for key, text in descriptions.DESCRIPTIONS.items():
# as the last migration that describes a setting says
for key, text in {**descriptions.DESCRIPTIONS, **vnc_and_nic.DESCRIPTIONS}.items():
with self.subTest(key=key):
self.assertLessEqual(len(text), limit)
if key not in removed:

Binary file not shown.

View file

@ -1681,6 +1681,28 @@ msgstr "Log saklama süresi (gün)"
msgid "Days the Logs page keeps its rows (1-3650)"
msgstr "Logs sayfasının satırları sakladığı gün sayısı (1-3650)"
#: appsettings/migrations/0025_vnc_console_and_nic_descriptions.py:7
msgid "The VNC console starts scaled to its window"
msgstr "VNC konsolu, penceresine ölçeklenmiş olarak açılır"
#: appsettings/migrations/0025_vnc_console_and_nic_descriptions.py:8
msgid "The VNC console starts view-only: no keyboard or mouse input"
msgstr ""
"VNC konsolu yalnızca görüntüleme modunda açılır: klavye ve fare girdisi yok"
#: appsettings/migrations/0025_vnc_console_and_nic_descriptions.py:9
msgid "The VNC console starts asking the guest to fit its screen to the window"
msgstr "VNC konsolu, konuktan ekranını pencereye uydurmasını isteyerek açılır"
#: appsettings/migrations/0025_vnc_console_and_nic_descriptions.py:10
msgid "The VNC console starts clipped to its window, without scaling"
msgstr "VNC konsolu, ölçeklenmeden penceresine kırpılmış olarak açılır"
#: appsettings/migrations/0025_vnc_console_and_nic_descriptions.py:11
msgid "Network card model chosen first for a new VM (default: VirtIO)"
msgstr ""
"Yeni bir sanal makine için önce seçilen ağ kartı modeli (default: VirtIO)"
#: appsettings/models.py:10
msgid "key"
msgstr "anahtar"

Binary file not shown.

View file

@ -1624,6 +1624,26 @@ msgstr "日志保留天数"
msgid "Days the Logs page keeps its rows (1-3650)"
msgstr "日志页面保留记录的天数(1-3650)"
#: appsettings/migrations/0025_vnc_console_and_nic_descriptions.py:7
msgid "The VNC console starts scaled to its window"
msgstr "VNC 控制台启动时缩放到窗口大小"
#: appsettings/migrations/0025_vnc_console_and_nic_descriptions.py:8
msgid "The VNC console starts view-only: no keyboard or mouse input"
msgstr "VNC 控制台启动时为只读:不接受键盘和鼠标输入"
#: appsettings/migrations/0025_vnc_console_and_nic_descriptions.py:9
msgid "The VNC console starts asking the guest to fit its screen to the window"
msgstr "VNC 控制台启动时请求客户机将屏幕调整为窗口大小"
#: appsettings/migrations/0025_vnc_console_and_nic_descriptions.py:10
msgid "The VNC console starts clipped to its window, without scaling"
msgstr "VNC 控制台启动时裁剪到窗口大小,不缩放"
#: appsettings/migrations/0025_vnc_console_and_nic_descriptions.py:11
msgid "Network card model chosen first for a new VM (default: VirtIO)"
msgstr "新建虚拟机默认选择的网卡型号(默认:VirtIO)"
#: appsettings/models.py:10
msgid "key"
msgstr "键"