1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2026-12-03 17:36:05 +00:00

fix(ui): sizes in the units the forms ask in, percentages as the language writes them

- binary_size filter (common_tags): every size on the pages is B/KiB/MiB/GiB/TiB
  with the language's decimal mark; Django's filesizeformat said GB for GiB, so a
  page showed "512,0 MB / 3,8 GB" beside "0,4 / 3,8 GiB" and a disk "20,0 GB"
  next to a GiB field
- percent filter and Intl percent in charts.js, the job panel and the new-VM
  dialog: 13% in English, %13 in Turkish (pages had "13 %", "%11" and "13%")
- the Jobs page and panel say in whole sentences that the job worker is not
  running and that jobs wait for it, instead of a sentence glued to a date
- job state badges start with a capital, as the VM state badges (CSS, so the
  label stays lowercase inside sentences)
- profile card shows the username under the name only when there is a full name
- Turkish: hostname, revert snapshot, snapshot count, API token and worker texts
This commit is contained in:
catborise 2026-11-22 18:25:15 +03:00
parent 50fa42181b
commit 7408a575d6
52 changed files with 241 additions and 127 deletions

View file

@ -1,5 +1,6 @@
{% extends "base.html" %}
{% load i18n %}
{% load common_tags %}
{% load static %}
{% load bootstrap_icons %}
{% load django_bootstrap5 %}
@ -67,7 +68,7 @@
<div class="small text-body-secondary text-truncate">{{ backup.compute_name }}{% if backup.policy %}, <a href="{% url 'vmbackups:policy' backup.policy_id %}" title="{% trans "Schedule" %}">{{ backup.policy.name }}</a>{% endif %}</div>
</td>
<td class="d-none d-md-table-cell">{% include "vmbackups/consistency.html" %}</td>
<td class="text-end text-nowrap d-none d-sm-table-cell">{% if backup.size %}{{ backup.size|filesizeformat }}{% else %}–{% endif %}</td>
<td class="text-end text-nowrap d-none d-sm-table-cell">{% if backup.size %}{{ backup.size|binary_size }}{% else %}–{% endif %}</td>
<td>{% include "vmbackups/state.html" %}</td>
<td class="text-end">{% include "vmbackups/delete_form.html" %}</td>
</tr>

View file

@ -1,4 +1,5 @@
{% load i18n %}
{% load common_tags %}
{% load operations %}
{% load bootstrap_icons %}
{% load static %}
@ -47,7 +48,7 @@
<td class="text-nowrap">{{ backup.created_at|date:"Y-m-d H:i" }}</td>
<td class="d-none d-md-table-cell">{{ backup.target.name }}</td>
<td class="d-none d-sm-table-cell">{% include "vmbackups/consistency.html" %}</td>
<td class="text-end text-nowrap d-none d-sm-table-cell">{% if backup.size %}{{ backup.size|filesizeformat }}{% else %}–{% endif %}</td>
<td class="text-end text-nowrap d-none d-sm-table-cell">{% if backup.size %}{{ backup.size|binary_size }}{% else %}–{% endif %}</td>
<td>{% include "vmbackups/state.html" with pending_deletes=backups.pending_deletes %}</td>
<td class="text-end">{% include "vmbackups/delete_form.html" with pending_deletes=backups.pending_deletes %}</td>
</tr>

View file

@ -609,7 +609,7 @@ class BackupTabTests(PageControls, TransactionTestCase):
page = lxml_html.fromstring(self.last_page)
self.assertTrue(page.xpath("//div[@id='backups']//form[contains(@action, '/backups/vm/')]"))
self.assertIn("nfs1", page.xpath("string(//select[@id='backup-target'])"))
self.assertIn("3.0", page.xpath("string(//div[@id='backups']//table)"))
self.assertIn("3\xa0GiB", page.xpath("string(//div[@id='backups']//table)"))
backup_proxy.return_value.backup_plan.side_effect = OperationError("%(vm)s has TPM state", vm="ctl-vm")
self.controls(admin)
page = lxml_html.fromstring(self.last_page)