1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2026-11-11 12:46:49 +00:00

feat(operations): the job panel and job pages speak the page's language

The job panel on VM and storage pages wrote its buttons and notes in
English (Cancel, Open, Refresh, Dismiss, Finishing..., Files not
removed, Worker unavailable, Cancel failed) and its state badge as the
state's code, and the jobs API gave the phase untranslated. The panel
now takes its texts and the state labels from the page's settings, and
the API gives the phase in the viewer's language, as it gives the
label; the job pages show that phase.

A job that cannot be cancelled and ran past its time limit had
"(over its time limit)" written into its phase, which then matched no
translation. The phase stays as the job sets it, and the pages say the
job is past its limit.
This commit is contained in:
catborise 2026-11-02 23:33:34 +03:00
parent 9d57adc097
commit 0eab09e19d
13 changed files with 178 additions and 42 deletions

View file

@ -20,11 +20,11 @@
</div>
<div class="small text-body-secondary mt-1">{% trans "User" %}: {{ job.username }}</div>
</div>
{% if op.phase or op.progress_total or job.cancellable or op.error or job.result.links or job.result.warning or job.result.left_behind or job.resolution %}
{% if job.phase or op.progress_total or job.cancellable or op.error or job.result.links or job.result.warning or job.result.left_behind or job.resolution %}
<div class="card-body pb-0">
{% if op.phase or job.cancellable %}
{% if job.phase or job.cancellable %}
<div class="d-flex flex-wrap align-items-center gap-2 mb-3">
<span class="me-auto">{% if op.phase %}{% translate op.phase %}{% endif %}</span>
<span class="me-auto">{{ job.phase }}</span>
{% if job.cancellable %}
<form method="post" action="{% url 'operations:cancel' job.id %}" aria-label="{% trans 'Cancel job form' %}">
{% csrf_token %}

View file

@ -68,11 +68,11 @@
<td style="min-width: 12rem;">
<a href="{% url 'operations:job' row.id %}">{{ row.label }}</a>
{% if op.state in active_states %}
{% if op.phase or op.progress_total %}
{% if row.phase or op.progress_total %}
<div class="small text-body-secondary">
{% if op.phase %}{% translate op.phase %}{% endif %}
{{ row.phase }}
{% if op.progress_total %}
{% if op.phase %}&middot;{% endif %}
{% if row.phase %}&middot;{% endif %}
{% if op.kind in bytes_kinds %}{{ op.progress_done|default:0|filesizeformat }} / {{ op.progress_total|filesizeformat }}{% else %}{{ op.progress_done|default:0 }} / {{ op.progress_total }}{% endif %}
{% endif %}
</div>