1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2026-12-02 17:06:09 +00:00
webvirtcloud/instances/templates/create_inst_block.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

67 lines
4.6 KiB
HTML

{% load i18n %}
{% load common_tags %}
{% load bootstrap_icons %}
<button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#AddInstance">
<span aria-hidden="true">{% bs_icon 'plus-lg' %}</span> {% trans "New VM" %}
</button>
<div class="modal fade" id="AddInstance" tabindex="-1" aria-labelledby="AddInstanceTitle" aria-hidden="true">
<div class="modal-dialog modal-dialog-scrollable modal-lg">
<div class="modal-content">
<div class="modal-header">
<h2 class="modal-title h5" id="AddInstanceTitle">{% trans "New instance" %}</h2>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="{% trans "Close" %}"></button>
</div>
<div class="modal-body">
{% include "create_steps.html" with step=1 %}
<div class="text-body-secondary mb-3">{% trans "Choose the host the VM runs on." %}</div>
<div class="list-group">
{% for compute in reachable_computes %}
{% if compute.maintenance %}
<div class="list-group-item py-3" aria-disabled="true">
<span class="fw-semibold text-body-secondary">{{ compute.name }}</span>
<span class="badge text-bg-warning ms-2">{% trans "Maintenance" %}</span>{# requested or ready: no new VM comes either way #}
<div class="small text-body-secondary">{% trans "No new VM comes to a host in maintenance." %}</div>
</div>
{% else %}
<a class="list-group-item list-group-item-action py-3" href="{% url 'instances:create_instance_select_type' compute.id %}">
<div class="row g-2 align-items-center">
<div class="col-12 col-md-3 fw-semibold">{{ compute.name }}</div>
<div class="col-6 col-md-4">
<div class="small text-body-secondary">{% trans "CPU" %} · {{ compute.cpu_count }} vCPU</div>
<div class="cpu-usage d-flex align-items-center gap-2" data-url="{% url 'compute_graph' compute.id %}">
<div class="progress flex-grow-1" role="progressbar" aria-label="{% blocktrans with name=compute.name %}CPU usage of {{ name }}{% endblocktrans %}"
aria-valuemin="0" aria-valuemax="100">
<div class="progress-bar" style="width: 0%"></div>
</div>
<small class="cpu-usage-value"></small>
</div>
</div>
<div class="col-6 col-md-4">
<div class="small text-body-secondary">{% trans "Memory" %} · {{ compute.ram_size|binary_size }}</div>
<div class="d-flex align-items-center gap-2">
<div class="progress flex-grow-1" role="progressbar" aria-label="{% blocktrans with name=compute.name %}Memory usage of {{ name }}{% endblocktrans %}"
aria-valuenow="{{ compute.ram_usage }}" aria-valuemin="0" aria-valuemax="100">
<div class="progress-bar" style="width: {{ compute.ram_usage }}%"></div>
</div>
<small>{{ compute.ram_usage|percent }}</small>
</div>
</div>
<div class="col-md-1 d-none d-md-block text-end" aria-hidden="true">{% bs_icon 'chevron-right' %}</div>
<div class="col-12 col-md-8 offset-md-3 small text-body-secondary compute-capacity" data-url="{% url 'compute_capacity' compute.id %}"></div>
</div>
</a>
{% endif %}
{% empty %}
{% url 'computes' as computes_url %}
{% if computes %}
<p>{% blocktrans %}No compute is reachable: see the <a href="{{ computes_url }}">Computes</a> page.{% endblocktrans %}</p>
{% else %}
<p>{% blocktrans %}There is no compute yet: add the first host on the <a href="{{ computes_url }}">Computes</a> page.{% endblocktrans %}</p>
{% endif %}
{% endfor %}
</div>
</div>
</div>
</div>
</div>