diff --git a/computes/templates/overview.html b/computes/templates/overview.html index f532dec7..4a271ee4 100644 --- a/computes/templates/overview.html +++ b/computes/templates/overview.html @@ -108,7 +108,7 @@
{% trans "The last 10 readings, one every 5 seconds. Memory in use leaves out the host's buffers and cache." %} - {% trans "Waiting for the first reading." %}
diff --git a/instances/templates/create_presets.html b/instances/templates/create_presets.html index 25f27520..bf4a8025 100644 --- a/instances/templates/create_presets.html +++ b/instances/templates/create_presets.html @@ -4,7 +4,8 @@
{% for flavor in flavors %} {% endfor %} diff --git a/instances/templates/instances/stats_tab.html b/instances/templates/instances/stats_tab.html index 809e1325..f57ed468 100644 --- a/instances/templates/instances/stats_tab.html +++ b/instances/templates/instances/stats_tab.html @@ -1,7 +1,8 @@ {% load i18n %}
+ data-read="{% trans "Read" %}" data-write="{% trans "Write" %}" + data-usage="{% trans "Usage" context "chart" %}" data-usage-rss="{% trans "Usage (RSS)" context "chart" %}">
diff --git a/instances/tests/test_create_form_input.py b/instances/tests/test_create_form_input.py index 71646d65..578c8342 100644 --- a/instances/tests/test_create_form_input.py +++ b/instances/tests/test_create_form_input.py @@ -204,6 +204,8 @@ class FlavorPresetTests(TestCase): [preset] = page.xpath(f"//button[contains(@class, 'preset')][@data-label='{self.flavor.label}']") self.assertEqual((preset.get("data-vcpu"), preset.get("data-memory"), preset.get("data-disk")), ("1", "512", "10")) self.assertEqual((preset.get("type"), preset.get("aria-pressed")), ("button", "false")) + # what a screen reader hears when it is applied (create_instance.js), in the page's language + self.assertEqual(preset.get("data-status"), "wvc-test: 1 vCPU, 512 MiB, new 10 GiB disk") def test_the_flavor_dialog_sits_outside_the_form(self): _, response = render_create_page(self) diff --git a/instances/tests/test_create_page_js.py b/instances/tests/test_create_page_js.py index bed58b32..8261cf47 100644 --- a/instances/tests/test_create_page_js.py +++ b/instances/tests/test_create_page_js.py @@ -197,7 +197,8 @@ const fieldsets = ["new", "existing", "template"].map(s => Object.assign(new El( all[".disk-source"] = fieldsets; const presets = [["small", "2", "2048", "40"], ["large", "4", "8192", "80"]].map(function ([label, vcpu, memory, disk]) { const button = new El(); - Object.assign(button.dataset, {label, vcpu, memory, disk}); + // status: the text the page has for it, in its language (create_presets.html) + Object.assign(button.dataset, {label, vcpu, memory, disk, status: label + " in the page's language"}); button.classes.add("text-body"); return button; }); @@ -235,7 +236,7 @@ console.log(JSON.stringify({applied, cleared: pressed()}));""") self.assertTrue(applied["radio"]) self.assertEqual(applied["sources"][0], ["source-new", False, False]) self.assertEqual(applied["pressed"], [["false", "text-body"], ["true", "btn-primary"]]) - self.assertEqual(applied["status"], "large: 4 vCPU, 8192 MiB, new 80 GiB disk") + self.assertEqual(applied["status"], "large in the page's language") self.assertEqual(out["cleared"], [["false", "text-body"], ["false", "text-body"]]) diff --git a/locale/tr/LC_MESSAGES/django.mo b/locale/tr/LC_MESSAGES/django.mo index f548c02c..d60afdc1 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 30404194..1963eea2 100644 --- a/locale/tr/LC_MESSAGES/django.po +++ b/locale/tr/LC_MESSAGES/django.po @@ -10005,3 +10005,15 @@ msgstr "Tüm arabirimler" #, python-format msgid "The VM's CPU topology has %(count)s vCPUs: change it in the XML editor to set another maximum" msgstr "VM'nin CPU topolojisi %(count)s vCPU içeriyor: başka bir en fazla değer için onu XML düzenleyicide değiştirin" + +msgctxt "chart" +msgid "Usage" +msgstr "Kullanım" + +msgctxt "chart" +msgid "Usage (RSS)" +msgstr "Kullanım (RSS)" + +#, python-format +msgid "%(label)s: %(vcpu)s vCPU, %(memory)s MiB, new %(disk)s GiB disk" +msgstr "%(label)s: %(vcpu)s vCPU, %(memory)s MiB, yeni %(disk)s GiB disk" diff --git a/locale/zh/LC_MESSAGES/django.mo b/locale/zh/LC_MESSAGES/django.mo index f7034050..f230ee94 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 0aa71ae7..3ddbd856 100644 --- a/locale/zh/LC_MESSAGES/django.po +++ b/locale/zh/LC_MESSAGES/django.po @@ -9424,3 +9424,15 @@ msgstr "所有接口" #, python-format msgid "The VM's CPU topology has %(count)s vCPUs: change it in the XML editor to set another maximum" msgstr "该虚拟机的 CPU 拓扑为 %(count)s 个 vCPU:要设置其他最大值,请在 XML 编辑器中修改拓扑" + +msgctxt "chart" +msgid "Usage" +msgstr "使用量" + +msgctxt "chart" +msgid "Usage (RSS)" +msgstr "使用量 (RSS)" + +#, python-format +msgid "%(label)s: %(vcpu)s vCPU, %(memory)s MiB, new %(disk)s GiB disk" +msgstr "%(label)s:%(vcpu)s 个 vCPU,%(memory)s MiB,新建 %(disk)s GiB 磁盘" diff --git a/static/js/create_instance.js b/static/js/create_instance.js index cabdae4e..b472e5eb 100644 --- a/static/js/create_instance.js +++ b/static/js/create_instance.js @@ -52,8 +52,7 @@ function apply_preset(button) { clear_presets(); button.setAttribute("aria-pressed", "true"); button.classList.replace("text-body", "btn-primary"); - document.querySelector("#preset-status").textContent = - `${button.dataset.label}: ${button.dataset.vcpu} vCPU, ${button.dataset.memory} MiB, new ${button.dataset.disk} GiB disk`; + document.querySelector("#preset-status").textContent = button.dataset.status; } function clear_presets() { diff --git a/static/js/host_graphs.js b/static/js/host_graphs.js index c21690d4..16e8e3ef 100644 --- a/static/js/host_graphs.js +++ b/static/js/host_graphs.js @@ -2,14 +2,14 @@ var state = document.getElementById("graph_state"); // the seconds each CPU point averages var cpuWindows = []; -var cpuChart = lineChart(document.getElementById("cpuChart"), "%", ["Usage"], { +var cpuChart = lineChart(document.getElementById("cpuChart"), "%", [state.dataset.usage], { max: 100, tooltip: function (context, text) { var span = cpuWindows[context.dataIndex]; return span ? text + ' (' + state.dataset.averageOver + ' ' + span + ' s)' : text; }, }); -var memChart = lineChart(document.getElementById("memChart"), "GB", ["Usage"]); +var memChart = lineChart(document.getElementById("memChart"), "GB", [state.dataset.usage]); var cpuNow = document.getElementById("cpu_now"); var memNow = document.getElementById("mem_now"); var lastUpdate = "–"; diff --git a/static/js/instance_stats.js b/static/js/instance_stats.js index 6e6a2dc8..b9915bd9 100644 --- a/static/js/instance_stats.js +++ b/static/js/instance_stats.js @@ -21,23 +21,23 @@ stats_poll.start(); return; } - var cpuChart = lineChart(document.getElementById("cpuChart"), "%", ["Usage"], { + var cpuChart = lineChart(document.getElementById("cpuChart"), "%", [pane.dataset.usage], { max: 100, tooltip: function (context, text) { var span = cpuWindows[context.dataIndex]; return span ? text + ' (' + pane.dataset.averageOver + ' ' + span + ' s)' : text; }, }); - var memChart = lineChart(document.getElementById("memChart"), "MiB", ["Usage (RSS)"]); + var memChart = lineChart(document.getElementById("memChart"), "MiB", [pane.dataset.usageRss]); var diskChart = {}; pane.querySelectorAll("canvas[data-disk]").forEach(function (canvas) { - diskChart[canvas.dataset.disk] = lineChart(canvas, "MB/s", ["Read", "Write"]); + diskChart[canvas.dataset.disk] = lineChart(canvas, "MB/s", [pane.dataset.read, pane.dataset.write]); }); // two NICs with one MAC (a misconfiguration) share the first one's chart var netChart = {}; pane.querySelectorAll("canvas[data-mac]").forEach(function (canvas) { var mac = canvas.dataset.mac; - netChart[mac] = netChart[mac] || lineChart(canvas, "Mbit/s", ["Inbound", "Outbound"]); + netChart[mac] = netChart[mac] || lineChart(canvas, "Mbit/s", [pane.dataset.in, pane.dataset.out]); }); // the first point at once, then every 5 s like the host graph