mirror of
https://github.com/retspen/webvirtcloud
synced 2026-11-10 12:16:49 +00:00
feat(operations): a job's error and warning show in the reader's language
A job stored its error and its result's warning as English text, much of it built with the values in it (volume paths, a disk, libvirt's error), so no catalog could translate it, and the job pages and panel showed English whatever the language. A job now stores them as messages: our English text, marked for translation, and its values; libvirt's own text is a message without values and is shown as it is. The jobs API and pages put them in the reader's language. OperationError keeps its text and values apart for the same reason, so a refusal raised while a job is submitted is shown translated too. Messages one after another still read as sentences. Errors stored before are kept as one message each, shown as they were.
This commit is contained in:
parent
0eab09e19d
commit
1e66367bb4
29 changed files with 927 additions and 333 deletions
|
|
@ -20,7 +20,7 @@
|
|||
</div>
|
||||
<div class="small text-body-secondary mt-1">{% trans "User" %}: {{ job.username }}</div>
|
||||
</div>
|
||||
{% 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 %}
|
||||
{% if job.phase or op.progress_total or job.cancellable or job.error or job.result.links or job.result.warning or job.result.left_behind or job.resolution %}
|
||||
<div class="card-body pb-0">
|
||||
{% if job.phase or job.cancellable %}
|
||||
<div class="d-flex flex-wrap align-items-center gap-2 mb-3">
|
||||
|
|
@ -45,9 +45,9 @@
|
|||
<div class="progress-bar" style="width: {{ percent }}%"></div>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if op.error %}
|
||||
{% if job.error %}
|
||||
<div class="alert alert-{{ op.state|state_color }}" role="alert">
|
||||
{% bs_icon 'exclamation-triangle' %} {{ op.error }}
|
||||
{% bs_icon 'exclamation-triangle' %} {{ job.error }}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if job.result.links %}
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@
|
|||
</div>
|
||||
{% endif %}
|
||||
{% elif op.state == "failed" or op.state == "uncertain" %}
|
||||
<div class="small text-body-secondary" title="{{ op.error }}">{{ op.error|truncatechars:80 }}</div>
|
||||
<div class="small text-body-secondary" title="{{ row.error }}">{{ row.error|truncatechars:80 }}</div>
|
||||
{% endif %}
|
||||
<div class="small text-body-secondary">{{ op.created_at|date:"Y-m-d H:i:s T" }}{% if request.user.is_superuser %}<span class="d-md-none"> · {{ row.username }}</span>{% endif %}</div>
|
||||
{# below md the hidden columns show here #}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue