1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2026-12-01 16:36:06 +00:00

fix(logs): the VM page's Logs tab shows times as the Logs page does

The Logs tab of a VM's Stats showed each row's time in UTC, formatted by
the process locale ("11/10/26 08:43:08" whatever the page's language),
while the Logs page shows the same row in the panel's time zone
("2026-11-10 11:43:08" with TIME_ZONE=Europe/Istanbul). The tab now
shows the panel's time in the Logs page's format, and its Date heading
names the zone as the Logs page's does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Kk4h2TcUiaWmU5MUszYSea
This commit is contained in:
catborise 2026-11-10 11:52:54 +03:00
parent ae3496ac50
commit a8f7c8aeaa
7 changed files with 86 additions and 75 deletions

View file

@ -1,4 +1,5 @@
{% load i18n %} {% load i18n %}
{% load tz %}
<div class="tab-pane" id="graphics" role="tabpanel" data-url="{% url 'instances:stats' instance.id %}" <div class="tab-pane" id="graphics" role="tabpanel" data-url="{% url 'instances:stats' instance.id %}"
data-average-over="{% trans "average over" %}" data-in="{% trans "In" %}" data-out="{% trans "Out" %}" data-average-over="{% trans "average over" %}" data-in="{% trans "In" %}" data-out="{% trans "Out" %}"
data-read="{% trans "Read" %}" data-write="{% trans "Write" %}" data-read="{% trans "Read" %}" data-write="{% trans "Write" %}"
@ -64,7 +65,8 @@
data-empty="{% trans "None" %}" data-failed="{% trans "The logs could not be loaded." %}"> data-empty="{% trans "None" %}" data-failed="{% trans "The logs could not be loaded." %}">
<thead> <thead>
<tr> <tr>
<th scope="col">{% trans "Date" %}</th> {% get_current_timezone as time_zone %}
<th scope="col">{% blocktrans %}Date ({{ time_zone }}){% endblocktrans %}</th>
<th scope="col">{% trans "User" %}</th> <th scope="col">{% trans "User" %}</th>
<th scope="col">{% trans "Message" %}</th> <th scope="col">{% trans "Message" %}</th>
<th scope="col">{% trans "Result" %}</th> <th scope="col">{% trans "Result" %}</th>

Binary file not shown.

View file

@ -11,7 +11,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PACKAGE VERSION\n" "Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2026-11-10 08:10+0000\n" "POT-Creation-Date: 2026-11-10 08:52+0000\n"
"PO-Revision-Date: 2020-11-04 12:00+0000\n" "PO-Revision-Date: 2020-11-04 12:00+0000\n"
"Last-Translator: catborise <muhammetalisag@gmail.com>, 2020\n" "Last-Translator: catborise <muhammetalisag@gmail.com>, 2020\n"
"Language-Team: Turkish (https://www.transifex.com/catborise/teams/110663/tr/)\n" "Language-Team: Turkish (https://www.transifex.com/catborise/teams/110663/tr/)\n"
@ -708,7 +708,7 @@ msgstr "Listelerde tüm sanal makineleri ve sunucuları salt okunur görme"
#: admin/templates/admin/user_list.html:34 #: admin/templates/admin/user_list.html:34
#: computes/templates/computes/instances.html:46 #: computes/templates/computes/instances.html:46
#: instances/templates/add_instance_owner_block.html:17 #: instances/templates/add_instance_owner_block.html:17
#: instances/templates/instances/stats_tab.html:68 #: instances/templates/instances/stats_tab.html:70
#: operations/templates/operations/job.html:21 #: operations/templates/operations/job.html:21
#: operations/templates/operations/jobs.html:27 #: operations/templates/operations/jobs.html:27
#: operations/templates/operations/jobs.html:61 #: operations/templates/operations/jobs.html:61
@ -750,14 +750,14 @@ msgstr "vCPU"
#: instances/templates/create_inst_block.html:33 #: instances/templates/create_inst_block.html:33
#: instances/templates/instance.html:66 #: instances/templates/instance.html:66
#: instances/templates/instances/resize_tab.html:17 #: instances/templates/instances/resize_tab.html:17
#: instances/templates/instances/stats_tab.html:35 #: instances/templates/instances/stats_tab.html:36
msgid "Memory" msgid "Memory"
msgstr "Bellek" msgstr "Bellek"
#: admin/forms.py:191 instances/models.py:235 #: admin/forms.py:191 instances/models.py:235
#: instances/templates/create_instance_w2.html:118 #: instances/templates/create_instance_w2.html:118
#: instances/templates/instances/settings_tab.html:25 #: instances/templates/instances/settings_tab.html:25
#: instances/templates/instances/stats_tab.html:52 #: instances/templates/instances/stats_tab.html:53
msgid "Disk" msgid "Disk"
msgstr "Disk" msgstr "Disk"
@ -885,7 +885,7 @@ msgstr "Aramayla eşleşen grup yok."
#: admin/templates/admin/logs.html:6 admin/templates/admin/logs.html:8 #: admin/templates/admin/logs.html:6 admin/templates/admin/logs.html:8
#: admin/templates/admin/logs.html:19 #: admin/templates/admin/logs.html:19
#: instances/templates/instances/stats_tab.html:19 templates/navbar.html:34 #: instances/templates/instances/stats_tab.html:20 templates/navbar.html:34
msgid "Logs" msgid "Logs"
msgstr "Loglar" msgstr "Loglar"
@ -914,6 +914,7 @@ msgid "There are no log rows yet."
msgstr "Henüz log satırı yok." msgstr "Henüz log satırı yok."
#: admin/templates/admin/logs.html:38 #: admin/templates/admin/logs.html:38
#: instances/templates/instances/stats_tab.html:69
#, python-format #, python-format
msgid "Date (%(time_zone)s)" msgid "Date (%(time_zone)s)"
msgstr "Tarih (%(time_zone)s)" msgstr "Tarih (%(time_zone)s)"
@ -923,12 +924,12 @@ msgid "Instance"
msgstr "Sanal Makine" msgstr "Sanal Makine"
#: admin/templates/admin/logs.html:42 #: admin/templates/admin/logs.html:42
#: instances/templates/instances/stats_tab.html:69 #: instances/templates/instances/stats_tab.html:71
msgid "Message" msgid "Message"
msgstr "Mesaj" msgstr "Mesaj"
#: admin/templates/admin/logs.html:43 #: admin/templates/admin/logs.html:43
#: instances/templates/instances/stats_tab.html:70 #: instances/templates/instances/stats_tab.html:72
msgid "Result" msgid "Result"
msgstr "Sonuç" msgstr "Sonuç"
@ -937,15 +938,15 @@ msgid "IP"
msgstr "IP" msgstr "IP"
#: admin/templates/admin/logs.html:56 admin/views.py:292 instances/states.py:19 #: admin/templates/admin/logs.html:56 admin/views.py:292 instances/states.py:19
#: instances/views.py:419 instances/views.py:421 logs/views.py:17 #: instances/views.py:419 instances/views.py:421 logs/views.py:18
msgid "Unknown" msgid "Unknown"
msgstr "Bilinmeyen" msgstr "Bilinmeyen"
#: admin/templates/admin/logs.html:56 admin/views.py:292 logs/views.py:17 #: admin/templates/admin/logs.html:56 admin/views.py:292 logs/views.py:18
msgid "Done" msgid "Done"
msgstr "Tamamlandı" msgstr "Tamamlandı"
#: admin/templates/admin/logs.html:56 admin/views.py:292 logs/views.py:17 #: admin/templates/admin/logs.html:56 admin/views.py:292 logs/views.py:18
#: operations/templates/operations/job.html:107 #: operations/templates/operations/job.html:107
msgid "Failed" msgid "Failed"
msgstr "Başarısız" msgstr "Başarısız"
@ -2311,12 +2312,12 @@ msgstr ""
"tamponlarını ve önbelleğini içermez." "tamponlarını ve önbelleğini içermez."
#: computes/templates/overview.html:111 #: computes/templates/overview.html:111
#: instances/templates/instances/stats_tab.html:3 #: instances/templates/instances/stats_tab.html:4
msgid "average over" msgid "average over"
msgstr "ortalama süresi" msgstr "ortalama süresi"
#: computes/templates/overview.html:111 #: computes/templates/overview.html:111
#: instances/templates/instances/stats_tab.html:5 #: instances/templates/instances/stats_tab.html:6
msgctxt "chart" msgctxt "chart"
msgid "Usage" msgid "Usage"
msgstr "Kullanım" msgstr "Kullanım"
@ -2510,7 +2511,7 @@ msgstr "Ölçekleme"
#: instances/templates/instance.html:71 #: instances/templates/instance.html:71
#: instances/templates/instances/settings_tab.html:180 #: instances/templates/instances/settings_tab.html:180
#: instances/templates/instances/settings_tab.html:398 #: instances/templates/instances/settings_tab.html:398
#: instances/templates/instances/stats_tab.html:64 #: instances/templates/instances/stats_tab.html:65
#: interfaces/templates/create_iface_block.html:94 #: interfaces/templates/create_iface_block.html:94
#: interfaces/templates/create_iface_block.html:117 #: interfaces/templates/create_iface_block.html:117
#: interfaces/templates/interface.html:97 #: interfaces/templates/interface.html:97
@ -3637,7 +3638,7 @@ msgstr "Sanal makinenin çalışacağı sunucuyu seçin."
#: instances/templates/create_inst_block.html:23 #: instances/templates/create_inst_block.html:23
#: instances/templates/instance.html:62 #: instances/templates/instance.html:62
#: instances/templates/instances/resize_tab.html:14 #: instances/templates/instances/resize_tab.html:14
#: instances/templates/instances/stats_tab.html:28 #: instances/templates/instances/stats_tab.html:29
msgid "CPU" msgid "CPU"
msgstr "CPU" msgstr "CPU"
@ -4804,7 +4805,7 @@ msgstr "Ön Yükleme"
#: instances/templates/instances/settings_tab.html:39 #: instances/templates/instances/settings_tab.html:39
#: instances/templates/instances/settings_tab.html:805 #: instances/templates/instances/settings_tab.html:805
#: instances/templates/instances/stats_tab.html:45 #: instances/templates/instances/stats_tab.html:46
#: networks/templates/network.html:6 networks/templates/network.html:8 #: networks/templates/network.html:6 networks/templates/network.html:8
#: networks/templates/network.html:48 #: networks/templates/network.html:48
msgid "Network" msgid "Network"
@ -5861,78 +5862,74 @@ msgstr ""
"Saatler %(TIME_ZONE)s saat dilimindedir. Anlık görüntüsü olan bir sanal " "Saatler %(TIME_ZONE)s saat dilimindedir. Anlık görüntüsü olan bir sanal "
"makine taşınamaz." "makine taşınamaz."
#: instances/templates/instances/stats_tab.html:3 #: instances/templates/instances/stats_tab.html:4
msgid "In" msgid "In"
msgstr "Gelen" msgstr "Gelen"
#: instances/templates/instances/stats_tab.html:3 #: instances/templates/instances/stats_tab.html:4
msgid "Out" msgid "Out"
msgstr "Giden" msgstr "Giden"
#: instances/templates/instances/stats_tab.html:4 #: instances/templates/instances/stats_tab.html:5
msgid "Read" msgid "Read"
msgstr "Okuma" msgstr "Okuma"
#: instances/templates/instances/stats_tab.html:4 #: instances/templates/instances/stats_tab.html:5
msgid "Write" msgid "Write"
msgstr "Yaz" msgstr "Yaz"
#: instances/templates/instances/stats_tab.html:5 #: instances/templates/instances/stats_tab.html:6
msgctxt "chart" msgctxt "chart"
msgid "Usage (RSS)" msgid "Usage (RSS)"
msgstr "Kullanım (RSS)" msgstr "Kullanım (RSS)"
#: instances/templates/instances/stats_tab.html:11 #: instances/templates/instances/stats_tab.html:12
msgid "Updates every 5 seconds." msgid "Updates every 5 seconds."
msgstr "Her 5 saniyede bir güncellenir." msgstr "Her 5 saniyede bir güncellenir."
#: instances/templates/instances/stats_tab.html:13 #: instances/templates/instances/stats_tab.html:14
msgid "The VM is not running: nothing is measured." msgid "The VM is not running: nothing is measured."
msgstr "Sanal makine çalışmıyor: hiçbir şey ölçülmüyor." msgstr "Sanal makine çalışmıyor: hiçbir şey ölçülmüyor."
#: instances/templates/instances/stats_tab.html:17 #: instances/templates/instances/stats_tab.html:18
msgid "Stats view" msgid "Stats view"
msgstr "İstatistik görünümü" msgstr "İstatistik görünümü"
#: instances/templates/instances/stats_tab.html:18 #: instances/templates/instances/stats_tab.html:19
msgid "Graphs" msgid "Graphs"
msgstr "Grafikler" msgstr "Grafikler"
#: instances/templates/instances/stats_tab.html:29 #: instances/templates/instances/stats_tab.html:30
msgid "of the host" msgid "of the host"
msgstr "sunucu kapasitesinin" msgstr "sunucu kapasitesinin"
#: instances/templates/instances/stats_tab.html:31 #: instances/templates/instances/stats_tab.html:32
msgid "CPU use, recent readings" msgid "CPU use, recent readings"
msgstr "CPU kullanımı, son ölçümler" msgstr "CPU kullanımı, son ölçümler"
#: instances/templates/instances/stats_tab.html:38 #: instances/templates/instances/stats_tab.html:39
msgid "Memory use, recent readings" msgid "Memory use, recent readings"
msgstr "Bellek kullanımı, son ölçümler" msgstr "Bellek kullanımı, son ölçümler"
#: instances/templates/instances/stats_tab.html:47 #: instances/templates/instances/stats_tab.html:48
#, python-format #, python-format
msgid "Network %(mac)s, recent readings" msgid "Network %(mac)s, recent readings"
msgstr "Ağ %(mac)s, son ölçümler" msgstr "Ağ %(mac)s, son ölçümler"
#: instances/templates/instances/stats_tab.html:54 #: instances/templates/instances/stats_tab.html:55
#, python-format #, python-format
msgid "Disk %(dev)s, recent readings" msgid "Disk %(dev)s, recent readings"
msgstr "Disk %(dev)s, son ölçümler" msgstr "Disk %(dev)s, son ölçümler"
#: instances/templates/instances/stats_tab.html:64 #: instances/templates/instances/stats_tab.html:65
msgid "The logs could not be loaded." msgid "The logs could not be loaded."
msgstr "Loglar yüklenemedi." msgstr "Loglar yüklenemedi."
#: instances/templates/instances/stats_tab.html:67 #: instances/templates/instances/stats_tab.html:79
msgid "Date"
msgstr "Tarih"
#: instances/templates/instances/stats_tab.html:77
msgid "The latest rows, newest first." msgid "The latest rows, newest first."
msgstr "En son satırlar, en yenisi önce." msgstr "En son satırlar, en yenisi önce."
#: instances/templates/instances/stats_tab.html:78 #: instances/templates/instances/stats_tab.html:80
msgid "All of this VM's logs" msgid "All of this VM's logs"
msgstr "Bu sanal makinenin tüm logları" msgstr "Bu sanal makinenin tüm logları"

Binary file not shown.

View file

@ -7,7 +7,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: \n" "Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2026-11-10 08:10+0000\n" "POT-Creation-Date: 2026-11-10 08:52+0000\n"
"PO-Revision-Date: \n" "PO-Revision-Date: \n"
"Last-Translator: \n" "Last-Translator: \n"
"Language-Team: \n" "Language-Team: \n"
@ -688,7 +688,7 @@ msgstr "在列表中查看所有虚拟机和主机(只读)"
#: admin/templates/admin/user_list.html:34 #: admin/templates/admin/user_list.html:34
#: computes/templates/computes/instances.html:46 #: computes/templates/computes/instances.html:46
#: instances/templates/add_instance_owner_block.html:17 #: instances/templates/add_instance_owner_block.html:17
#: instances/templates/instances/stats_tab.html:68 #: instances/templates/instances/stats_tab.html:70
#: operations/templates/operations/job.html:21 #: operations/templates/operations/job.html:21
#: operations/templates/operations/jobs.html:27 #: operations/templates/operations/jobs.html:27
#: operations/templates/operations/jobs.html:61 #: operations/templates/operations/jobs.html:61
@ -729,14 +729,14 @@ msgstr "vCPU"
#: instances/templates/create_inst_block.html:33 #: instances/templates/create_inst_block.html:33
#: instances/templates/instance.html:66 #: instances/templates/instance.html:66
#: instances/templates/instances/resize_tab.html:17 #: instances/templates/instances/resize_tab.html:17
#: instances/templates/instances/stats_tab.html:35 #: instances/templates/instances/stats_tab.html:36
msgid "Memory" msgid "Memory"
msgstr "内存" msgstr "内存"
#: admin/forms.py:191 instances/models.py:235 #: admin/forms.py:191 instances/models.py:235
#: instances/templates/create_instance_w2.html:118 #: instances/templates/create_instance_w2.html:118
#: instances/templates/instances/settings_tab.html:25 #: instances/templates/instances/settings_tab.html:25
#: instances/templates/instances/stats_tab.html:52 #: instances/templates/instances/stats_tab.html:53
msgid "Disk" msgid "Disk"
msgstr "磁盘" msgstr "磁盘"
@ -862,7 +862,7 @@ msgstr "没有与搜索匹配的用户组。"
#: admin/templates/admin/logs.html:6 admin/templates/admin/logs.html:8 #: admin/templates/admin/logs.html:6 admin/templates/admin/logs.html:8
#: admin/templates/admin/logs.html:19 #: admin/templates/admin/logs.html:19
#: instances/templates/instances/stats_tab.html:19 templates/navbar.html:34 #: instances/templates/instances/stats_tab.html:20 templates/navbar.html:34
msgid "Logs" msgid "Logs"
msgstr "日志" msgstr "日志"
@ -891,6 +891,7 @@ msgid "There are no log rows yet."
msgstr "还没有日志行。" msgstr "还没有日志行。"
#: admin/templates/admin/logs.html:38 #: admin/templates/admin/logs.html:38
#: instances/templates/instances/stats_tab.html:69
#, python-format #, python-format
msgid "Date (%(time_zone)s)" msgid "Date (%(time_zone)s)"
msgstr "日期(%(time_zone)s)" msgstr "日期(%(time_zone)s)"
@ -900,12 +901,12 @@ msgid "Instance"
msgstr "虚拟机" msgstr "虚拟机"
#: admin/templates/admin/logs.html:42 #: admin/templates/admin/logs.html:42
#: instances/templates/instances/stats_tab.html:69 #: instances/templates/instances/stats_tab.html:71
msgid "Message" msgid "Message"
msgstr "消息" msgstr "消息"
#: admin/templates/admin/logs.html:43 #: admin/templates/admin/logs.html:43
#: instances/templates/instances/stats_tab.html:70 #: instances/templates/instances/stats_tab.html:72
msgid "Result" msgid "Result"
msgstr "结果" msgstr "结果"
@ -914,15 +915,15 @@ msgid "IP"
msgstr "IP" msgstr "IP"
#: admin/templates/admin/logs.html:56 admin/views.py:292 instances/states.py:19 #: admin/templates/admin/logs.html:56 admin/views.py:292 instances/states.py:19
#: instances/views.py:419 instances/views.py:421 logs/views.py:17 #: instances/views.py:419 instances/views.py:421 logs/views.py:18
msgid "Unknown" msgid "Unknown"
msgstr "未知" msgstr "未知"
#: admin/templates/admin/logs.html:56 admin/views.py:292 logs/views.py:17 #: admin/templates/admin/logs.html:56 admin/views.py:292 logs/views.py:18
msgid "Done" msgid "Done"
msgstr "完成" msgstr "完成"
#: admin/templates/admin/logs.html:56 admin/views.py:292 logs/views.py:17 #: admin/templates/admin/logs.html:56 admin/views.py:292 logs/views.py:18
#: operations/templates/operations/job.html:107 #: operations/templates/operations/job.html:107
msgid "Failed" msgid "Failed"
msgstr "失败" msgstr "失败"
@ -2235,12 +2236,12 @@ msgid ""
msgstr "最近 10 次读数,每 5 秒一次。内存使用量不含主机的缓冲区和缓存。" msgstr "最近 10 次读数,每 5 秒一次。内存使用量不含主机的缓冲区和缓存。"
#: computes/templates/overview.html:111 #: computes/templates/overview.html:111
#: instances/templates/instances/stats_tab.html:3 #: instances/templates/instances/stats_tab.html:4
msgid "average over" msgid "average over"
msgstr "平均" msgstr "平均"
#: computes/templates/overview.html:111 #: computes/templates/overview.html:111
#: instances/templates/instances/stats_tab.html:5 #: instances/templates/instances/stats_tab.html:6
msgctxt "chart" msgctxt "chart"
msgid "Usage" msgid "Usage"
msgstr "使用量" msgstr "使用量"
@ -2425,7 +2426,7 @@ msgstr "缩放"
#: instances/templates/instance.html:71 #: instances/templates/instance.html:71
#: instances/templates/instances/settings_tab.html:180 #: instances/templates/instances/settings_tab.html:180
#: instances/templates/instances/settings_tab.html:398 #: instances/templates/instances/settings_tab.html:398
#: instances/templates/instances/stats_tab.html:64 #: instances/templates/instances/stats_tab.html:65
#: interfaces/templates/create_iface_block.html:94 #: interfaces/templates/create_iface_block.html:94
#: interfaces/templates/create_iface_block.html:117 #: interfaces/templates/create_iface_block.html:117
#: interfaces/templates/interface.html:97 #: interfaces/templates/interface.html:97
@ -3490,7 +3491,7 @@ msgstr "选择运行虚拟机的主机。"
#: instances/templates/create_inst_block.html:23 #: instances/templates/create_inst_block.html:23
#: instances/templates/instance.html:62 #: instances/templates/instance.html:62
#: instances/templates/instances/resize_tab.html:14 #: instances/templates/instances/resize_tab.html:14
#: instances/templates/instances/stats_tab.html:28 #: instances/templates/instances/stats_tab.html:29
msgid "CPU" msgid "CPU"
msgstr "CPU" msgstr "CPU"
@ -4590,7 +4591,7 @@ msgstr "启动"
#: instances/templates/instances/settings_tab.html:39 #: instances/templates/instances/settings_tab.html:39
#: instances/templates/instances/settings_tab.html:805 #: instances/templates/instances/settings_tab.html:805
#: instances/templates/instances/stats_tab.html:45 #: instances/templates/instances/stats_tab.html:46
#: networks/templates/network.html:6 networks/templates/network.html:8 #: networks/templates/network.html:6 networks/templates/network.html:8
#: networks/templates/network.html:48 #: networks/templates/network.html:48
msgid "Network" msgid "Network"
@ -5554,78 +5555,74 @@ msgstr "该虚拟机没有快照。"
msgid "Times in %(TIME_ZONE)s. A VM with snapshots cannot be migrated." msgid "Times in %(TIME_ZONE)s. A VM with snapshots cannot be migrated."
msgstr "时间以 %(TIME_ZONE)s 显示。有快照的虚拟机无法迁移。" msgstr "时间以 %(TIME_ZONE)s 显示。有快照的虚拟机无法迁移。"
#: instances/templates/instances/stats_tab.html:3 #: instances/templates/instances/stats_tab.html:4
msgid "In" msgid "In"
msgstr "入" msgstr "入"
#: instances/templates/instances/stats_tab.html:3 #: instances/templates/instances/stats_tab.html:4
msgid "Out" msgid "Out"
msgstr "出" msgstr "出"
#: instances/templates/instances/stats_tab.html:4 #: instances/templates/instances/stats_tab.html:5
msgid "Read" msgid "Read"
msgstr "读" msgstr "读"
#: instances/templates/instances/stats_tab.html:4 #: instances/templates/instances/stats_tab.html:5
msgid "Write" msgid "Write"
msgstr "写" msgstr "写"
#: instances/templates/instances/stats_tab.html:5 #: instances/templates/instances/stats_tab.html:6
msgctxt "chart" msgctxt "chart"
msgid "Usage (RSS)" msgid "Usage (RSS)"
msgstr "使用量 (RSS)" msgstr "使用量 (RSS)"
#: instances/templates/instances/stats_tab.html:11 #: instances/templates/instances/stats_tab.html:12
msgid "Updates every 5 seconds." msgid "Updates every 5 seconds."
msgstr "每 5 秒更新一次。" msgstr "每 5 秒更新一次。"
#: instances/templates/instances/stats_tab.html:13 #: instances/templates/instances/stats_tab.html:14
msgid "The VM is not running: nothing is measured." msgid "The VM is not running: nothing is measured."
msgstr "虚拟机未运行:无测量数据。" msgstr "虚拟机未运行:无测量数据。"
#: instances/templates/instances/stats_tab.html:17 #: instances/templates/instances/stats_tab.html:18
msgid "Stats view" msgid "Stats view"
msgstr "统计视图" msgstr "统计视图"
#: instances/templates/instances/stats_tab.html:18 #: instances/templates/instances/stats_tab.html:19
msgid "Graphs" msgid "Graphs"
msgstr "图表" msgstr "图表"
#: instances/templates/instances/stats_tab.html:29 #: instances/templates/instances/stats_tab.html:30
msgid "of the host" msgid "of the host"
msgstr "占主机" msgstr "占主机"
#: instances/templates/instances/stats_tab.html:31 #: instances/templates/instances/stats_tab.html:32
msgid "CPU use, recent readings" msgid "CPU use, recent readings"
msgstr "CPU 使用率,最近读数" msgstr "CPU 使用率,最近读数"
#: instances/templates/instances/stats_tab.html:38 #: instances/templates/instances/stats_tab.html:39
msgid "Memory use, recent readings" msgid "Memory use, recent readings"
msgstr "内存使用率,最近读数" msgstr "内存使用率,最近读数"
#: instances/templates/instances/stats_tab.html:47 #: instances/templates/instances/stats_tab.html:48
#, python-format #, python-format
msgid "Network %(mac)s, recent readings" msgid "Network %(mac)s, recent readings"
msgstr "网络 %(mac)s,最近读数" msgstr "网络 %(mac)s,最近读数"
#: instances/templates/instances/stats_tab.html:54 #: instances/templates/instances/stats_tab.html:55
#, python-format #, python-format
msgid "Disk %(dev)s, recent readings" msgid "Disk %(dev)s, recent readings"
msgstr "磁盘 %(dev)s,最近读数" msgstr "磁盘 %(dev)s,最近读数"
#: instances/templates/instances/stats_tab.html:64 #: instances/templates/instances/stats_tab.html:65
msgid "The logs could not be loaded." msgid "The logs could not be loaded."
msgstr "无法加载日志。" msgstr "无法加载日志。"
#: instances/templates/instances/stats_tab.html:67 #: instances/templates/instances/stats_tab.html:79
msgid "Date"
msgstr "日期"
#: instances/templates/instances/stats_tab.html:77
msgid "The latest rows, newest first." msgid "The latest rows, newest first."
msgstr "最近的记录,最新的在前。" msgstr "最近的记录,最新的在前。"
#: instances/templates/instances/stats_tab.html:78 #: instances/templates/instances/stats_tab.html:80
msgid "All of this VM's logs" msgid "All of this VM's logs"
msgstr "该虚拟机的全部日志" msgstr "该虚拟机的全部日志"

View file

@ -1,10 +1,14 @@
from datetime import datetime, timezone as dt_timezone
from django.contrib.auth import get_user_model from django.contrib.auth import get_user_model
from django.test import TestCase from django.test import TestCase, override_settings
from django.urls import reverse from django.urls import reverse
from django.utils import translation
from computes.models import Compute from computes.models import Compute
from instances.models import Instance from instances.models import Instance
from logs.audit import write from logs.audit import write
from logs.models import Logs
from logs.views import VM_LOG_ROWS from logs.views import VM_LOG_ROWS
UUID = "12345678-1234-1234-1234-123456789012" UUID = "12345678-1234-1234-1234-123456789012"
@ -41,6 +45,15 @@ class VMLogsTestCase(TestCase):
self.assertEqual(self.shown(), [("VM test-vm: power off: not running", "Failed"), self.assertEqual(self.shown(), [("VM test-vm: power off: not running", "Failed"),
("VM test-vm: power on", "Done")]) ("VM test-vm: power on", "Done")])
@override_settings(TIME_ZONE="Europe/Istanbul")
def test_a_row_shows_its_time_as_the_logs_page_does(self):
write("admin", "c1", "test-vm", "VM test-vm: power on", True, uuid=UUID)
Logs.objects.update(date=datetime(2026, 11, 10, 9, 0, tzinfo=dt_timezone.utc))
for language in ("en", "tr"):
with translation.override(language):
row = self.client.get(reverse("vm_logs", args=[self.instance.pk])).json()[0]
self.assertEqual(row["date"], "2026-11-10 12:00:00")
def test_a_vm_is_found_by_uuid_not_by_name(self): def test_a_vm_is_found_by_uuid_not_by_name(self):
other = Compute.objects.create(name="c2", hostname="192.0.2.2", type=1) other = Compute.objects.create(name="c2", hostname="192.0.2.2", type=1)
namesake = Instance.objects.create(compute=other, name="test-vm", uuid="87654321-4321-4321-4321-210987654321") namesake = Instance.objects.create(compute=other, name="test-vm", uuid="87654321-4321-4321-4321-210987654321")

View file

@ -1,5 +1,6 @@
from django.http import JsonResponse from django.http import JsonResponse
from django.shortcuts import get_object_or_404 from django.shortcuts import get_object_or_404
from django.utils import timezone
from django.utils.translation import gettext as _ from django.utils.translation import gettext as _
from admin.decorators import superuser_only from admin.decorators import superuser_only
@ -23,6 +24,7 @@ def vm_logs(request, pk):
"instance": log.instance, "instance": log.instance,
"message": log.message, "message": log.message,
"result": results[log.success], "result": results[log.success],
"date": log.date.strftime("%x %X"), # as the Logs page shows it: in the panel's time zone, which the tab's heading names
"date": timezone.localtime(log.date).strftime("%Y-%m-%d %H:%M:%S"),
}) })
return JsonResponse(logs, safe=False) return JsonResponse(logs, safe=False)