1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2026-11-08 19:26:48 +00:00
webvirtcloud/instances/templates/create_flavors.html
catborise c401479cf9 feat(templates): every confirmation asks in the page's own dialog
Deleting or detaching a disk, deleting a network card, forcing a VM off,
reverting or deleting a snapshot, stopping or deleting a pool, a
network, an interface, a filter or a secret, and the other actions that
ask first opened the browser's yes/no box (confirm()), and the ISO
upload told its mistakes in the browser's alert().

One dialog in the base page now asks for all of them: its title and
confirming button carry the button's own words, its body the button's
question, the confirming button red for a destructive action. Confirmed,
the button is clicked again, so its form sends what it did before. A
button inside another dialog (the flavors) hides that one while asking
and shows it again after; Cancel gives the focus back, and the
confirming button acts once. The ISO upload's mistakes show in its
dialog's error box, announced.
2026-10-31 20:44:39 +03:00

22 lines
1.1 KiB
HTML

{% load i18n %}
{% load django_bootstrap5 %}
<div id="flavors" class="modal-body">
{% if flavors %}
<ul class="list-group mb-3">
{% for flavor in flavors %}
<li class="list-group-item d-flex flex-wrap align-items-center gap-2">
<span><strong>{{ flavor.label }}</strong> · {{ flavor.vcpu }} vCPU · {{ flavor.memory }} MiB · {{ flavor.disk }} GiB</span>
<form class="ms-auto" action="{% url 'instances:flavor_delete' flavor.id %}" method="post">{% csrf_token %}
<button type="submit" class="btn btn-sm btn-secondary"
data-confirm="{% blocktrans with name=flavor.label %}Delete flavor {{ name }}? Only the size template goes; VMs made from it keep their size.{% endblocktrans %}">{% trans "Delete" %}</button>
</form>
</li>
{% endfor %}
</ul>
{% endif %}
<h3 class="h6">{% trans "Add flavor" %}</h3>
<form method="post" action="{% url 'instances:flavor_create' %}">{% csrf_token %}
{% bootstrap_form flavor_form %}
<button type="submit" class="btn btn-primary">{% trans "Add" %}</button>
</form>
</div>