mirror of
https://github.com/retspen/webvirtcloud
synced 2026-11-09 03:36:48 +00:00
The create page's flavor dialog posted its forms the normal way, and the server sent a fresh page back: the VM's name, sizes, disk choices and MAC edits were lost, and a refused flavor left the page for a bare form. The dialog's forms are now posted from the page. The flavor views answer such a post with the presets and the dialog body, rendered from the same includes as the page, and the script swaps them in: a refused flavor shows its errors in the dialog, and the focus stays in it. A post without the script, or one whose request fails, still goes the normal way. Fixes #173 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
23 lines
1.2 KiB
HTML
23 lines
1.2 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 %}"
|
|
onclick="return confirm(this.dataset.confirm)">{% 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>
|