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

fix(i18n): chart series and the preset announcement in the page's language

The VM and host charts named their series in English (Usage, Usage (RSS),
Read, Write, Inbound, Outbound) and the new-VM form announced an applied
preset as "...new N GiB disk" in English on Turkish and Chinese pages.
The texts now come from the templates: the stats tab and host overview
give the series names (disk and NIC series reuse In, Out, Read, Write of
the readings line), and each preset button carries its own announcement.
"Usage" has the context "chart": zh translated it for secrets as "used by".

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-09 14:34:57 +03:00
parent 03dcb14e45
commit f6c7f8c85e
12 changed files with 41 additions and 13 deletions

View file

@ -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