1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2026-11-11 12:46:49 +00:00

fix(templates): the fields of the create modals are named by their labels

An accessibility scan with every modal opened found 49 fields without a
name: the labels of the instance create forms (custom, template and each
flavor's modal), the interface, network, secret and storage pool modals
did not point at their fields. Each label now has a for= and its field an
id, prefixed per form (and per flavor), so a click on the label focuses
the field too. The "Advanced" collapse buttons and the memory and
processing bars are named.

The VCPU config select had id="vcpu_mode" in each of these forms, nine
times on the create page; the unique-ID test did not see it as the test
driver reports no CPU modes. The id goes (nothing used it), and the test
now renders that branch.
This commit is contained in:
catborise 2026-10-19 16:50:58 +03:00
parent 66151d42b1
commit ca74c02c4f
8 changed files with 185 additions and 184 deletions

View file

@ -47,22 +47,22 @@
<form method="post" action="" role="form" aria-label="Create storage with pool dir path form">{% csrf_token %}
<div class="modal-body">
<div class="row">
<label class="col-sm-3 col-form-label">{% trans "Type" %}</label>
<label for="stg_dir_stg_type" class="col-sm-3 col-form-label">{% trans "Type" %}</label>
<div class="col-sm-6">
<input type="text" class="form-control" name="stg_type" value="dir" disabled>
<input id="stg_dir_stg_type" type="text" class="form-control" name="stg_type" value="dir" disabled>
<input type="hidden" name="stg_type" value="dir">
</div>
</div>
<div class="row">
<label class="col-sm-3 col-form-label">{% trans "Name" %}</label>
<label for="stg_dir_name" class="col-sm-3 col-form-label">{% trans "Name" %}</label>
<div class="col-sm-6">
<input type="text" class="form-control" name="name" placeholder="{% trans "default" %}" maxlength="20" required pattern="[a-zA-Z0-9\.\-_]+">
<input id="stg_dir_name" type="text" class="form-control" name="name" placeholder="{% trans "default" %}" maxlength="20" required pattern="[a-zA-Z0-9\.\-_]+">
</div>
</div>
<div class="row">
<label class="col-sm-3 col-form-label">{% trans "Path" %}</label>
<label for="stg_dir_target" class="col-sm-3 col-form-label">{% trans "Path" %}</label>
<div class="col-sm-6">
<input type="text" name="target" class="form-control" value="/var/lib/libvirt/images" required>
<input id="stg_dir_target" type="text" name="target" class="form-control" value="/var/lib/libvirt/images" required>
</div>
</div>
</div>
@ -76,22 +76,22 @@
<form method="post" action="" role="form" aria-label="Create storage pool with LVM pool">{% csrf_token %}
<div class="modal-body">
<div class="row">
<label class="col-sm-3 col-form-label">{% trans "Type" %}</label>
<label for="stg_logical_stg_type" class="col-sm-3 col-form-label">{% trans "Type" %}</label>
<div class="col-sm-6">
<input type="text" class="form-control" name="stg_type" value="logical" disabled>
<input id="stg_logical_stg_type" type="text" class="form-control" name="stg_type" value="logical" disabled>
<input type="hidden" name="stg_type" value="logical">
</div>
</div>
<div class="row">
<label class="col-sm-3 col-form-label">{% trans "Name" %}</label>
<label for="stg_logical_name" class="col-sm-3 col-form-label">{% trans "Name" %}</label>
<div class="col-sm-6">
<input type="text" class="form-control" name="name" placeholder="{% trans "default" %}" maxlength="20" required pattern="[a-zA-Z0-9\.\-_]+">
<input id="stg_logical_name" type="text" class="form-control" name="name" placeholder="{% trans "default" %}" maxlength="20" required pattern="[a-zA-Z0-9\.\-_]+">
</div>
</div>
<div class="row">
<label class="col-sm-3 col-form-label">{% trans "Device" %}</label>
<label for="stg_logical_source" class="col-sm-3 col-form-label">{% trans "Device" %}</label>
<div class="col-sm-6">
<input type="text" class="form-control" name="source" value="/dev/sdb" required>
<input id="stg_logical_source" type="text" class="form-control" name="source" value="/dev/sdb" required>
</div>
</div>
</div>
@ -105,40 +105,40 @@
<form method="post" action="" role="form" aria-label="Create storage pool with ceph form">{% csrf_token %}
<div class="modal-body">
<div class="row">
<label class="col-sm-3 col-form-label">{% trans "Type" %}</label>
<label for="stg_rbd_stg_type" class="col-sm-3 col-form-label">{% trans "Type" %}</label>
<div class="col-sm-6">
<input type="text" class="form-control" name="stg_type" value="rbd" disabled>
<input id="stg_rbd_stg_type" type="text" class="form-control" name="stg_type" value="rbd" disabled>
<input type="hidden" name="stg_type" value="rbd">
</div>
</div>
<div class="row">
<label class="col-sm-3 col-form-label">{% trans "Name" %}</label>
<label for="stg_rbd_name" class="col-sm-3 col-form-label">{% trans "Name" %}</label>
<div class="col-sm-6">
<input type="text" class="form-control" name="name" placeholder="rbdpool" maxlength="20" required pattern="[a-zA-Z0-9\.\-_]+">
<input id="stg_rbd_name" type="text" class="form-control" name="name" placeholder="rbdpool" maxlength="20" required pattern="[a-zA-Z0-9\.\-_]+">
</div>
</div>
<div class="row">
<label class="col-sm-3 col-form-label">{% trans "Ceph User" %}</label>
<label for="stg_rbd_ceph_user" class="col-sm-3 col-form-label">{% trans "Ceph User" %}</label>
<div class="col-sm-6">
<input type="text" class="form-control" name="ceph_user" placeholder="libvirt" maxlength="20" required pattern="[a-zA-Z0-9\.\-_]+">
<input id="stg_rbd_ceph_user" type="text" class="form-control" name="ceph_user" placeholder="libvirt" maxlength="20" required pattern="[a-zA-Z0-9\.\-_]+">
</div>
</div>
<div class="row">
<label class="col-sm-3 col-form-label">{% trans "Ceph Pool" %}</label>
<label for="stg_rbd_ceph_pool" class="col-sm-3 col-form-label">{% trans "Ceph Pool" %}</label>
<div class="col-sm-6">
<input type="text" class="form-control" name="ceph_pool" placeholder="libvirt-pool" maxlength="20" required pattern="[a-zA-Z0-9\.\-_]+">
<input id="stg_rbd_ceph_pool" type="text" class="form-control" name="ceph_pool" placeholder="libvirt-pool" maxlength="20" required pattern="[a-zA-Z0-9\.\-_]+">
</div>
</div>
<div class="row">
<label class="col-sm-3 col-form-label">{% trans "Ceph Host" %}</label>
<label for="stg_rbd_ceph_host" class="col-sm-3 col-form-label">{% trans "Ceph Host" %}</label>
<div class="col-sm-6">
<input type="text" class="form-control" name="ceph_host" placeholder="mon0.ceph.host" maxlength="20" required pattern="[a-zA-Z0-9\.\-_]+">
<input id="stg_rbd_ceph_host" type="text" class="form-control" name="ceph_host" placeholder="mon0.ceph.host" maxlength="20" required pattern="[a-zA-Z0-9\.\-_]+">
</div>
</div>
<div class="row">
<label class="col-sm-3 col-form-label">{% trans "Secrets" %}</label>
<label for="stg_rbd_secret" class="col-sm-3 col-form-label">{% trans "Secrets" %}</label>
<div class="col-sm-6">
<select name="secret" class="form-control">
<select id="stg_rbd_secret" name="secret" class="form-control">
{% if secrets %}
{% for secret in secrets %}
<option value="{{ secret }}">{{ secret }}</option>
@ -170,32 +170,32 @@
<form method="post" action="" role="form" aria-label="Create storage pool with net filesystem form">{% csrf_token %}
<div class="modal-body">
<div class="row">
<label class="col-sm-3 col-form-label">{% trans "Type" %}</label>
<label for="stg_netfs_stg_type" class="col-sm-3 col-form-label">{% trans "Type" %}</label>
<div class="col-sm-6">
<input type="text" class="form-control" name="stg_type" value="netfs" disabled>
<input id="stg_netfs_stg_type" type="text" class="form-control" name="stg_type" value="netfs" disabled>
<input type="hidden" name="stg_type" value="netfs">
</div>
</div>
<div class="row">
<label class="col-sm-3 col-form-label">{% trans "Name" %}</label>
<label for="stg_netfs_name" class="col-sm-3 col-form-label">{% trans "Name" %}</label>
<div class="col-sm-6">
<input type="text" class="form-control" name="name" placeholder="netfspool" maxlength="20" required pattern="[a-zA-Z0-9\.\-_]+">
<input id="stg_netfs_name" type="text" class="form-control" name="name" placeholder="netfspool" maxlength="20" required pattern="[a-zA-Z0-9\.\-_]+">
</div>
</div>
<div class="row">
<label class="col-sm-3 col-form-label">{% trans "Hostname" %}</label>
<label for="stg_netfs_netfs_host" class="col-sm-3 col-form-label">{% trans "Hostname" %}</label>
<div class="col-sm-6">
<input type="text" class="form-control" name="netfs_host" placeholder="nfs.example.com" maxlength="20" required pattern="[a-zA-Z0-9\.\-_]+">
<input id="stg_netfs_netfs_host" type="text" class="form-control" name="netfs_host" placeholder="nfs.example.com" maxlength="20" required pattern="[a-zA-Z0-9\.\-_]+">
</div>
</div>
<div class="row">
<label class="col-sm-3 col-form-label">{% trans "Remote Path" %}</label>
<label for="stg_netfs_source" class="col-sm-3 col-form-label">{% trans "Remote Path" %}</label>
<div class="col-sm-6">
<input type="text" class="form-control" name="source" placeholder="/srv/storage/" maxlength="100" required>
<input id="stg_netfs_source" type="text" class="form-control" name="source" placeholder="/srv/storage/" maxlength="100" required>
</div>
</div>
<div class="row">
<label class="col-sm-3 col-form-label">{% trans "Format" %}</label>
<label for="source_format" class="col-sm-3 col-form-label">{% trans "Format" %}</label>
<div class="col-sm-6">
<select name="source_format" class="form-control" id="source_format">
<option value="auto">{% trans "auto" %}</option>
@ -206,9 +206,9 @@
</div>
</div>
<div class="row">
<label class="col-sm-3 col-form-label">{% trans "Local Path" %}</label>
<label for="stg_netfs_target" class="col-sm-3 col-form-label">{% trans "Local Path" %}</label>
<div class="col-sm-6">
<input type="text" class="form-control" name="target" placeholder="/srv/storage/" maxlength="100" required>
<input id="stg_netfs_target" type="text" class="form-control" name="target" placeholder="/srv/storage/" maxlength="100" required>
</div>
</div>
</div>
@ -226,17 +226,17 @@
<form method="post" action="" role="form" aria-label="Create iso pool form">{% csrf_token %}
<div class="modal-body">
<div class="row">
<label class="col-sm-3 col-form-label">{% trans "Name" %}</label>
<label for="stg_iso_name" class="col-sm-3 col-form-label">{% trans "Name" %}</label>
<div class="col-sm-6">
<input type="text" class="form-control" name="name" value="iso" disabled>
<input id="stg_iso_name" type="text" class="form-control" name="name" value="iso" disabled>
<input type="hidden" name="name" value="iso">
<input type="hidden" name="stg_type" value="dir">
</div>
</div>
<div class="row">
<label class="col-sm-3 col-form-label">{% trans "Path" %}</label>
<label for="stg_iso_target" class="col-sm-3 col-form-label">{% trans "Path" %}</label>
<div class="col-sm-6">
<input type="text" class="form-control" name="target" value="/var/lib/libvirt/iso" required>
<input id="stg_iso_target" type="text" class="form-control" name="target" value="/var/lib/libvirt/iso" required>
</div>
</div>
</div>