mirror of
https://github.com/retspen/webvirtcloud
synced 2024-12-25 15:45:23 +00:00
Changed instance info in template and deleting process
This commit is contained in:
parent
d73e8c72e7
commit
b819b91d19
2 changed files with 58 additions and 52 deletions
|
@ -4,39 +4,43 @@
|
|||
{% block content %}
|
||||
<!-- Page Heading -->
|
||||
<div class="row">
|
||||
<h2 class="page-header">{{ vname }}</h2>
|
||||
</div>
|
||||
<!--
|
||||
<div class="row">
|
||||
<div class="col-sm-1 pull-right">
|
||||
<table>
|
||||
<tr>
|
||||
<td><h3>{{ vname }}</h3></td>
|
||||
<td>
|
||||
{% ifequal status 5 %}
|
||||
<span class="text-danger">{% trans "Off" %}</span>
|
||||
<span class="label label-danger">{% trans "Off" %}</span>
|
||||
{% endifequal %}
|
||||
{% ifequal status 1 %}
|
||||
<span class="text-success">{% trans "Active" %}</span>
|
||||
<span class="label label-success">{% trans "Active" %}</span>
|
||||
{% endifequal %}
|
||||
{% ifequal status 3 %}
|
||||
<span class="text-warning">{% trans "Suspend" %}</span>
|
||||
<span class="label label-warning">{% trans "Suspend" %}</span>
|
||||
{% endifequal %}
|
||||
</div>
|
||||
<div class="col-sm-1 pull-right">
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<table width="65%">
|
||||
<tr>
|
||||
<td>
|
||||
{% if cur_vcpu %}
|
||||
{{ cur_vcpu }} {% trans "Vcpu" %}
|
||||
<h4>{{ cur_vcpu }} {% trans "Vcpu" %}</h4>
|
||||
{% else %}
|
||||
{{ vcpu }} {% trans "Vcpu" %}
|
||||
<h4>{{ vcpu }} {% trans "Vcpu" %}</h4>
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="col-sm-2 pull-right">
|
||||
{{ cur_memory }} {% trans "MB" %} {% trans "Ram" %}
|
||||
</div>
|
||||
<div class="col-sm-2 pull-right">
|
||||
</td>
|
||||
<td>
|
||||
<h4>{{ cur_memory }} {% trans "MB" %} {% trans "Ram" %}</h4>
|
||||
</td>
|
||||
{% for disk in disks %}
|
||||
{{ disk.size|filesizeformat }} {% trans "Disk" %}
|
||||
<td>
|
||||
<h4>{{ disk.size|filesizeformat }} {% trans "Disk" %}</h4>
|
||||
</td>
|
||||
{% endfor %}
|
||||
</tr>
|
||||
</table>
|
||||
<hr>
|
||||
</div>
|
||||
</div>
|
||||
-->
|
||||
<!-- /.row -->
|
||||
|
||||
{% include 'errors_block.html' %}
|
||||
{% include 'messages_block.html' %}
|
||||
|
@ -1083,7 +1087,7 @@
|
|||
window.location.reload()
|
||||
}
|
||||
})
|
||||
}, 2000);
|
||||
}, 5000);
|
||||
</script>
|
||||
<script>
|
||||
var hash = location.hash;
|
||||
|
|
|
@ -243,15 +243,14 @@ def instance(request, compute_id, vname):
|
|||
if 'delete' in request.POST:
|
||||
if conn.get_status() == 1:
|
||||
conn.force_shutdown()
|
||||
try:
|
||||
if request.POST.get('delete_disk', ''):
|
||||
conn.delete_disk()
|
||||
conn.delete()
|
||||
|
||||
instance = Instance.objects.get(compute_id=compute_id, name=vname)
|
||||
instance_name = instance.name
|
||||
instance.delete()
|
||||
if request.POST.get('delete_disk', ''):
|
||||
conn.delete_disk()
|
||||
finally:
|
||||
msg = _("Destroy")
|
||||
addlogmsg(request.user.username, instance_name, msg)
|
||||
|
||||
if not request.user.is_superuser:
|
||||
del_userinstance = UserInstance.objects.get(id=userinstace.id)
|
||||
del_userinstance.delete()
|
||||
|
@ -261,7 +260,10 @@ def instance(request, compute_id, vname):
|
|||
del_userinstance.delete()
|
||||
except UserInstance.DoesNotExist:
|
||||
pass
|
||||
conn.delete()
|
||||
|
||||
msg = _("Destroy")
|
||||
addlogmsg(request.user.username, instance_name, msg)
|
||||
|
||||
return HttpResponseRedirect(reverse('instances'))
|
||||
|
||||
if 'rootpasswd' in request.POST:
|
||||
|
|
Loading…
Reference in a new issue