1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2026-11-10 04:06:47 +00:00
webvirtcloud/instances/templates/instances/edit_instance_volume.html
catborise 0f778fe9f0 feat(instances): a VM's disks as cards, its CD-ROM drives above them
Settings > Disk was a bold title with an unlabelled "+", a CD-ROM row
in an input group, and a table whose actions were four alike icons.
The owner chose this layout from three rendered options:

- Removable media: each CD-ROM drive a card with its device, bus and
  image, the ISO select and Mount (or Unmount), and Detach; "Add
  CD-ROM" by the heading.
- Disks: a card each; one disk spans the row, two or more sit side by
  side from md, and the device details are capped at 32rem so values
  stay near their labels. The capacity large,
  the used size, the pool and the source path, the device's settings
  under "Device details" (they were in a popover), and labelled Edit,
  Move, Detach and Delete (danger) in its footer; "Add disk" by the
  heading.
- While the VM runs, "Add CD-ROM" adds the drive on the SCSI bus, and
  a SCSI drive can be detached: IDE and SATA drives cannot be plugged
  into or out of a running VM, SCSI ones can. Adding a drive was
  disabled while the VM ran. One line says so, and why detaching other
  drives and detaching or deleting disks waits for a shutdown, instead
  of each button alone being greyed.

The forms, their fields and actions are unchanged. The edit dialog of each
disk is titled with its device, and its fields' ids carry the disk's
number: the dialogs of two disks had the same ids, and the title was not
the dialog's label.
2026-10-30 11:19:55 +03:00

117 lines
7.9 KiB
HTML

{% load i18n %}
{% load bootstrap_icons %}
{% if request.user.is_superuser %}
<button href="#editvol{{ id }}" type="button" class="btn btn-sm btn-secondary" data-bs-toggle="modal">{% trans "Edit" %}</button>
<!-- Modal pool -->
<div class="modal fade" id="editvol{{ id }}" tabindex="-1" role="dialog" aria-labelledby="editInstanceVolumeLabel{{ id }}" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="editInstanceVolumeLabel{{ id }}">{% blocktrans with dev=disk.dev %}Edit {{ dev }}{% endblocktrans %}</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<ul class="nav nav-tabs mb-3" role="tablist" aria-label="Disk options">
<li class="nav-item" role="presentation">
<button class="nav-link active" data-bs-toggle="tab" data-bs-target="#VirtualDisk{{ id }}" type="button" role="tab" aria-controls="VirtualDisk{{ id }}" aria-selected="true">
{% trans 'Virtual Disk' %}
</button>
</li>
<li class="nav-item" role="presentation">
<button class="nav-link" data-bs-toggle="tab" data-bs-target="#PerformanceVolume{{ id }}" type="button" role="tab" aria-controls="PerformanceVolume{{ id }}" aria-selected="false">
{% trans 'Performance' %}
</button>
</li>
<li class="nav-item" role="presentation">
<button class="nav-link" data-bs-toggle="tab" data-bs-target="#AdvancedVolume{{ id }}" type="button" role="tab" aria-controls="AdvancedVolume{{ id }}" aria-selected="false">
{% trans 'Advanced' %}
</button>
</li>
</ul>
<div class="tab-content">
<div class="tab-pane active" role="tabpanel" id="VirtualDisk{{ id }}">
<div class="mb-3">
<label class="form-label" for="vol_path{{ id }}">{% trans 'Volume Path' %}</label>
<input class="form-control" id="vol_path{{ id }}" name="vol_path" value="{{ disk.path }}"/>
</div>
<div class="mb-3 form-check form-switch">
<label class="form-check-label">{% trans 'Readonly' %}</label>
<input class="form-check-input" type="checkbox" name="vol_readonly" value="True" {% if disk.readonly %}checked{% endif %}/>
</div>
<div class="mb-3 form-check form-switch">
<label class="form-check-label">{% trans 'Shareable' %}</label>
<input class="form-check-input" type="checkbox" name="vol_shareable" value="True" {% if disk.shareable %}checked{% endif %}/>
</div>
</div>
<div class="tab-pane" role="tabpanel" id="PerformanceVolume{{ id }}">
<div class="mb-3">
<label class="form-label" for="vol_cache{{ id }}">{% trans 'Cache mode' %}</label>
<select class="form-select" id="vol_cache{{ id }}" name="vol_cache">
{% for key, val in instance.cache_modes %}
<option value="{{ key }}" {% if key == disk.cache %}selected{% endif %}>{{ val }}</option>
{% endfor %}
</select>
</div>
<div class="mb-3">
<label class="form-label" for="vol_io_mode{{ id }}">{% trans 'IO mode' %}</label>
<select class="form-select" id="vol_io_mode{{ id }}" name="vol_io_mode">
{% for key, val in instance.io_modes %}
<option value="{{ key }}" {% if key == disk.io %}selected{% endif %}>{{ val }}</option>
{% endfor %}
</select>
</div>
<div class="mb-3">
<label class="form-label" for="vol_discard_mode{{ id }}">{% trans 'Discard mode' %}</label>
<select class="form-select" id="vol_discard_mode{{ id }}" name="vol_discard_mode">
{% for key, val in instance.discard_modes %}
<option value="{{ key }}" {% if key == disk.discard %}selected{% endif %}>{{ val }}</option>
{% endfor %}
</select>
</div>
<div class="mb-3">
<label class="form-label" for="vol_detect_zeroes{{ id }}">{% trans 'Detect zeroes' %}</label>
<select class="form-select" id="vol_detect_zeroes{{ id }}" name="vol_detect_zeroes">
{% for key, val in instance.detect_zeroes_modes %}
<option value="{{ key }}" {% if key == disk.detect_zeroes %}selected{% endif %}>{{ val }}</option>
{% endfor %}
</select>
</div>
<input class="form-control" name="vol_bus_old" value="{{ disk.bus }}" hidden/>
</div>
<div class="tab-pane" role="tabpanel" id="AdvancedVolume{{ id }}">
<div class="mb-3">
<label class="form-label" for="vol_bus{{ id }}">{% trans 'Bus' %}</label>
<select class="form-select" id="vol_bus{{ id }}" name="vol_bus" {% if instance.status != 5 %} disabled {% endif %}>
{% for bus in bus_host %}
<option value="{{ bus }}" {% if bus == disk.bus %}selected{% endif %}>{{ bus }}</option>
{% endfor %}
</select>
</div>
<div class="mb-3">
<label class="form-label" for="vol_serial{{ id }}">{% trans 'Serial Number' %}</label>
<input class="form-control" id="vol_serial{{ id }}" name="vol_serial" type="text" value="{{ disk.serial }}"/>
</div>
<div class="mb-3">
<label class="form-label" for="vol_format{{ id }}">{% trans 'Storage Format' %}</label>
<input class="form-control" id="vol_format{{ id }}" name="vol_format" type="text" value="{{ disk.format }}"/>
</div>
</div>
</div><!-- /.tab-content -->
</div> <!-- /.modal-body -->
<div class="clearfix"></div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">{% trans "Close" %}</button>
<button type="submit" class="btn btn-primary" name="edit_volume">{% trans "Save" %}</button>
</div><!-- /.modal-footer -->
</div> <!-- /.modal-content -->
</div> <!-- /.modal-dialog -->
</div> <!-- /.modal -->
{% endif %}