1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2026-12-03 17:36:05 +00:00
webvirtcloud/vmbackups/templates/vmbackups/index.html
catborise 7408a575d6 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
2026-11-22 21:03:46 +03:00

89 lines
5.9 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{% extends "base.html" %}
{% load i18n %}
{% load common_tags %}
{% load static %}
{% load bootstrap_icons %}
{% load django_bootstrap5 %}
{% load operations %}
{% block title %}{% trans "Backups" %}{% endblock %}
{% block page_heading %}{% trans "Backups" %}{% endblock page_heading %}
{% block page_heading_extra %}<a class="btn btn-outline-primary btn-sm" href="{% url 'vmbackups:policies' %}">{% bs_icon 'list-task' %} {% trans "Schedules" %}</a>
<a class="btn btn-outline-primary btn-sm" href="{% url 'vmbackups:targets' %}">{% bs_icon 'hdd-network' %} {% trans "Backup targets" %}</a>{% endblock page_heading_extra %}
{% block content %}
{% if rows or vm or target or state %}{# while there is a backup to filter #}
<form method="get" class="row g-2 mb-3" aria-label="{% trans "Filter" %}" data-filter-form>
<div class="col-12 col-md">
<label class="visually-hidden" for="filter-vm">{% trans "VM" %}</label>
<input type="search" class="form-control" id="filter-vm" name="vm" value="{{ vm }}" placeholder="{% trans "VM name" %}">
</div>
<div class="col-6 col-md-auto">
<label class="visually-hidden" for="filter-target">{% trans "Target" %}</label>
<select class="form-select" id="filter-target" name="target">
<option value="">{% trans "All targets" %}</option>
{% for t in targets %}<option value="{{ t.id }}"{% if target == t.id|stringformat:"d" %} selected{% endif %}>{{ t.name }}</option>{% endfor %}
</select>
</div>
<div class="col-6 col-md-auto">
<label class="visually-hidden" for="filter-state">{% trans "State" %}</label>
<select class="form-select" id="filter-state" name="state">
<option value="">{% trans "All states" %}</option>
<option value="ready"{% if state == "ready" %} selected{% endif %}>{% trans "Ready" %}</option>
<option value="creating"{% if state == "creating" %} selected{% endif %}>{% trans "Creating" %}</option>
<option value="failed"{% if state == "failed" %} selected{% endif %}>{% trans "Failed" %}</option>
<option value="deleting"{% if state == "deleting" %} selected{% endif %}>{% trans "Deleting" %}</option>
<option value="missing"{% if state == "missing" %} selected{% endif %}>{% trans "Missing" %}</option>
<option value="damaged"{% if state == "damaged" %} selected{% endif %}>{% trans "Damaged" %}</option>
</select>
</div>
{% if vm or target or state %}
<div class="col-12 col-md-auto">
<a class="btn btn-link" href="{% url 'vmbackups:index' %}">{% trans "Clear the filters" %}</a>
</div>
{% endif %}
</form>
{% endif %}
{% if rows %}
<div class="table-responsive">
<table class="table table-hover align-middle" id="backups">
<thead>
{# on a phone: time, VM, state and actions; the rest from wider screens #}
<tr><th>{% trans "Time" %}</th><th>{% trans "VM" %}</th>
<th class="d-none d-md-table-cell">{% trans "Consistency" %}</th>
<th class="text-end d-none d-sm-table-cell">{% trans "Size" %}</th><th>{% trans "State" %}</th><th></th></tr>
</thead>
<tbody>
{% for backup in rows %}
<tr>
{# date and time wrap apart on a phone #}
<td class="text-nowrap">{{ backup.created_at|date:"Y-m-d" }}<br class="d-sm-none"><span class="d-none d-sm-inline"> </span>{{ backup.created_at|date:"H:i" }}
<div class="small text-nowrap" title="{% trans "Target" %}"><a class="link-secondary" href="{% url 'vmbackups:target' backup.target_id %}">{{ backup.target.name }}</a></div></td>
<td style="max-width: min(12rem, 30vw);">{# a long name is cut, whole on hover #}
{% if backup.instance %}<a class="d-inline-block text-truncate mw-100 align-bottom" title="{{ backup.vm_name }}" href="{% url 'instances:instance' backup.instance.id %}">{{ backup.vm_name }}</a>
{% else %}<span class="d-inline-block text-truncate mw-100 align-bottom" title="{{ backup.vm_name }}">{{ backup.vm_name }}</span> {% if backup.tombstone %}<a class="badge text-bg-secondary" href="{% url 'admin:tombstone_list' %}">{% trans "removed" %}</a>{% else %}<span class="badge text-bg-secondary">{% trans "removed" %}</span>{% endif %}{% endif %}
<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|binary_size }}{% else %}–{% endif %}</td>
<td>{% include "vmbackups/state.html" %}</td>
<td class="text-end">{% include "vmbackups/delete_form.html" %}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% if page.has_other_pages %}
{% bootstrap_pagination page extra=page_query pages_to_show=5 extra_classes="flex-wrap" %}
{% endif %}
{% elif vm or target or state %}
<p class="text-center text-body-secondary py-4">{% trans "No backup matches the filter." %}</p>
{% else %}
<p class="text-center text-body-secondary py-4">{% trans "No backup yet. Back a VM up from its Backups tab." %}</p>
{% endif %}
{% endblock %}
{% block script %}<script src="{% static 'vmbackups/pending.js' %}"></script><script src="{% static 'js/filter_form.js' %}"></script>{% endblock %}