1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2026-12-03 17:36:05 +00:00

fix(ui): forms ask one thing at a time, offer the host's pools and say less twice

- A backup schedule asks Which VMs first (a compute's, chosen VMs or a
  tag's) and shows that one field only (policy_scope.js); the other two
  are not read, so a choice left in them is neither saved nor an error.
- A backup target's, a restore's and a disk restore's storage pool
  field offers the chosen compute's active file pools, the ones a
  restore copies into (a target's: directory and NFS only), from
  vmbackups.views.pools, which reads them without a refresh
  (pool_choices.js); a name can still be typed and is checked as before.
- A field's label is no longer repeated inside it as a placeholder, and
  a list's empty choice says Choose… instead of Django's dashes
  (webvirtcloud.bootstrap.FieldRenderer).
- The schedule, target, e-mail OTP and VM delete forms put Cancel and
  their main button at the right, as the other forms do.
This commit is contained in:
catborise 2026-11-22 00:09:10 +03:00
parent 7359fbb147
commit 4881c3cd3e
23 changed files with 228 additions and 69 deletions

View file

@ -53,4 +53,5 @@
{% block script %}
<script src="{% static 'js/tom-select.complete.min.js' %}"></script>
<script src="{% static 'js/searchable_select.js' %}"></script>
<script src="{% static 'vmbackups/policy_scope.js' %}"></script>
{% endblock %}

View file

@ -4,11 +4,14 @@
{% bootstrap_form_errors form type="non_fields" %}
{% bootstrap_field form.name %}
{% bootstrap_field form.target %}
<div class="row g-2">
<div class="col-md-4">{% bootstrap_field form.compute %}</div>
<div class="col-md-5">{% bootstrap_field form.instances %}</div>
<div class="col-md-3">{% bootstrap_field form.tag %}</div>
</div>
{# one of the three, as Which VMs says; policy_scope.js shows its field only #}
<fieldset class="mb-3">
<legend class="form-label fs-6">{{ form.scope.label }}</legend>
{% bootstrap_field form.scope show_label=False wrapper_class="" %}
</fieldset>
<div data-scope="compute">{% bootstrap_field form.compute %}</div>
<div data-scope="instances">{% bootstrap_field form.instances %}</div>
<div data-scope="tag">{% bootstrap_field form.tag %}</div>
<div class="row g-2">
<div class="col-sm-6">{% blocktrans asvar zone_help %}Time zone: {{ time_zone }}{% endblocktrans %}{% bootstrap_field form.time help_text=zone_help %}</div>
<div class="col-sm-6">{% bootstrap_field form.full_every %}</div>
@ -21,6 +24,8 @@
{% bootstrap_field form.frozen %}
{% bootstrap_field form.enabled %}
<p class="small text-body-secondary">{% trans "Each VM is backed up once a day, starting at the time; a VM that has not started within 6 hours waits for the next day. Older backups of each VM beyond those kept are deleted, a chain of incremental backups once all of it is beyond; backups taken by hand are not." %}</p>
<button type="submit" class="btn btn-primary">{% trans "Save" %}</button>
<a class="btn btn-outline-secondary ms-1" href="{% url 'vmbackups:policies' %}">{% trans "Cancel" %}</a>
<div class="d-flex justify-content-end gap-2">
<a class="btn btn-outline-secondary" href="{% url 'vmbackups:policies' %}">{% trans "Cancel" %}</a>
<button type="submit" class="btn btn-primary">{% trans "Save" %}</button>
</div>
</form>

View file

@ -15,4 +15,5 @@
{% block script %}
<script src="{% static 'js/tom-select.complete.min.js' %}"></script>
<script src="{% static 'js/searchable_select.js' %}"></script>
<script src="{% static 'vmbackups/policy_scope.js' %}"></script>
{% endblock %}

View file

@ -1,5 +1,6 @@
{% extends "base.html" %}
{% load i18n %}
{% load static %}
{% load bootstrap_icons %}
{% load django_bootstrap5 %}
{% load operations %}
@ -22,3 +23,4 @@
</div>
</div>
{% endblock %}
{% block script %}<script src="{% static 'vmbackups/pool_choices.js' %}"></script>{% endblock %}

View file

@ -1,5 +1,6 @@
{% extends "base.html" %}
{% load i18n %}
{% load static %}
{% load bootstrap_icons %}
{% load django_bootstrap5 %}
{% load operations %}
@ -21,3 +22,4 @@
</div>
</div>
{% endblock %}
{% block script %}<script src="{% static 'vmbackups/pool_choices.js' %}"></script>{% endblock %}

View file

@ -1,5 +1,6 @@
{% extends "base.html" %}
{% load i18n %}
{% load static %}
{% load bootstrap_icons %}
{% load django_bootstrap5 %}
{% load operations %}
@ -74,3 +75,4 @@
</form>
{% endif %}
{% endblock %}
{% block script %}<script src="{% static 'vmbackups/pool_choices.js' %}"></script>{% endblock %}

View file

@ -1,5 +1,6 @@
{% extends "base.html" %}
{% load i18n %}
{% load static %}
{% load bootstrap_icons %}
{% load django_bootstrap5 %}
@ -14,9 +15,12 @@
<form method="post">
{% csrf_token %}
{% bootstrap_form form %}
<button type="submit" class="btn btn-primary">{% bs_icon 'plus' %} {% trans "Add" %}</button>
<a class="btn btn-outline-secondary ms-1" href="{% url 'vmbackups:targets' %}">{% trans "Cancel" %}</a>
<div class="d-flex justify-content-end gap-2">
<a class="btn btn-outline-secondary" href="{% url 'vmbackups:targets' %}">{% trans "Cancel" %}</a>
<button type="submit" class="btn btn-primary">{% bs_icon 'plus' %} {% trans "Add" %}</button>
</div>
</form>
</div>
</div>
{% endblock %}
{% block script %}<script src="{% static 'vmbackups/pool_choices.js' %}"></script>{% endblock %}