52 lines
1.1 KiB
HTML
52 lines
1.1 KiB
HTML
{% extends "admin/base_site.html" %}
|
|
{% block content %}
|
|
|
|
<form action="{% url 'admin:createvm' %}" method="post">
|
|
{% csrf_token %}
|
|
<select id="vm_template" name="vm_template">
|
|
<option value="select">Select a template</option>
|
|
<option value="1">disk = 10GB, vcpu=1, ram=2GB</option>
|
|
<option value="2">disk = 20GB, vcpu=2, ram=4GB</option>
|
|
</select>
|
|
<input type="submit" name="create_vm" value="Create VM" />
|
|
</form>
|
|
{% if vms %}
|
|
<section>
|
|
<table class="table table-striped">
|
|
<thead>
|
|
<tr>
|
|
<th>ID</th>
|
|
<th>Name</th>
|
|
<th>Memory</th>
|
|
<th>Status</th>
|
|
<th>User Name</th>
|
|
<th>Actions</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{% for vm in vms %}
|
|
<tr>
|
|
<td>{{vm.id}}</td>
|
|
<td>{{vm.name}}</td>
|
|
<td>{{vm.template.memory}}</td>
|
|
<td>{{vm.str_state}}</td>
|
|
<td>{{vm.uname}}</td>
|
|
<td>
|
|
{% if vm.str_state == 'ACTIVE' %}
|
|
<a href="{% url 'admin:stopvm' vm.id %}">Stop VM</a>
|
|
{% elif vm.str_state == 'STOPPED' %}
|
|
<a href="{% url 'admin:startvm' vm.id %}">Start VM</a>
|
|
{% endif %}
|
|
<a href="{% url 'admin:deletevm' vm.id %}">Delete VM</a>
|
|
|
|
|
|
</td>
|
|
</tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
</section>
|
|
{% else %}
|
|
<h4>You do not have any VM.</h4>
|
|
{% endif %}
|
|
{% endblock %}
|