1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2024-12-24 23:25:24 +00:00

fix detach cdrom problem and cd-rom list's layout problem

This commit is contained in:
catborise 2020-06-05 09:29:26 +03:00
parent 509c57d8ab
commit 07be61a557
2 changed files with 31 additions and 32 deletions

View file

@ -738,25 +738,22 @@
<div class="clearfix"></div> <div class="clearfix"></div>
</div> </div>
<div role="tabpanel" class="tab-pane tab-pane-bordered" id="disks"> <div role="tabpanel" class="tab-pane tab-pane-bordered" id="disks">
<form action="" method="post" role="form" aria-label="Detach instance CD-ROM form">{% csrf_token %} <form action="" method="post" role="form" aria-label="Add CD-ROM form">{% csrf_token %}
<p class="font-weight-bold"> <p class="font-weight-bold">
{% trans "Instance Media" %} {% trans "Instance Media" %}
{% if status == 5 and allow_admin_or_not_template %} <button class="btn btn-success float-right"
<button type="submit" class="btn btn-danger float-right" title="{% trans "Detach CD-ROM (remove device)" %}" name="detach_cdrom" value="{{ cd.dev }}"> type="submit" name="add_cdrom" type="button"
<span class="fa fa-remove"></span>
</button>
{% endif %}
<button type="submit" name="add_cdrom" type="button" class="btn btn-success float-right"
title="{% trans 'Add CD-ROM' %}" title="{% trans 'Add CD-ROM' %}"
{% if status != 5 %} disabled {% endif %} > {% if status != 5 %} disabled {% endif %}>
<span class="fa fa-plus" aria-hidden="true"></span> <span class="fa fa-plus"></span>
</button> </button>
</p> </p>
</form> </form>
<div class="clearfix"></div>
{% for cd in media %} {% for cd in media %}
<form action="" method="post" role="form" aria-label="Mount/unmount instance CD-ROM form">{% csrf_token %} <form action="" method="post" role="form" aria-label="Mount/unmount instance CD-ROM form">{% csrf_token %}
<div class="form-group row"> <div class="form-group row">
<a class="col-sm-3 col-form-label" <a class="ml-4 col-sm-3 col-form-label"
name="details" name="details"
title="{% trans "Details" %}" title="{% trans "Details" %}"
tabindex="0" tabindex="0"
@ -768,28 +765,31 @@
{% trans "CD-ROM" %} {{ forloop.counter }} {% trans "CD-ROM" %} {{ forloop.counter }}
</a> </a>
{% if not cd.image %} {% if not cd.image %}
<div class="col-sm-6"> <div class="col-sm-6">
<div class="input-group"> <div class="input-group">
<select name="media" class="custom-select"> <select name="media" class="form-control">
{% if media_iso %} {% if media_iso %}
{% for iso in media_iso %} {% for iso in media_iso %}
<option value="{{ iso }}">{{ iso }}</option> <option value="{{ iso }}">{{ iso }}</option>
{% endfor %} {% endfor %}
{% else %} {% else %}
<option value="none">{% trans "None" %}</option> <option value="none">{% trans "None" %}</option>
{% endif %} {% endif %}
</select> </select>
<div class="input-group-append">
<div class="input-group-append"> {% if media_iso and allow_admin_or_not_template %}
{% if media_iso and allow_admin_or_not_template %} <button type="submit" class="btn btn-sm btn-success float-left" name="mount_iso" value="{{ cd.dev }}">{% trans "Mount" %}</button>
<button type="submit" class="btn btn-sm btn-success float-left" name="mount_iso" value="{{ cd.dev }}">{% trans "Mount" %}</button> {% else %}
{% else %} <button class="btn btn-sm btn-success float-left disabled">{% trans "Mount" %}</button>
<button class="btn btn-sm btn-success float-left disabled">{% trans "Mount" %}</button> {% endif %}
{% endif %} {% if status == 5 and allow_admin_or_not_template %}
<button type="submit" class="btn btn-sm btn-danger float-right" title="{% trans "Detach CD-ROM (remove device)" %}" name="detach_cdrom" value="{{ cd.dev }}">
</div> <span class="fa fa-remove"></span>
</button>
{% endif %}
</div> </div>
</div> </div>
</div>
{% else %} {% else %}
<div class="col-sm-6"> <div class="col-sm-6">
<div class="input-group"> <div class="input-group">

View file

@ -649,7 +649,6 @@ def instance(request, compute_id, vname):
if 'detach_cdrom' in request.POST and allow_admin_or_not_template: if 'detach_cdrom' in request.POST and allow_admin_or_not_template:
dev = request.POST.get('detach_cdrom', '') dev = request.POST.get('detach_cdrom', '')
path = request.POST.get('path', '')
conn.detach_disk(dev) conn.detach_disk(dev)
msg = _('Detach CD-ROM: ' + dev) msg = _('Detach CD-ROM: ' + dev)
addlogmsg(request.user.username, instance.name, msg) addlogmsg(request.user.username, instance.name, msg)