1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2024-11-01 12:04:15 +00:00
webvirtcloud/templates/instances.html

205 lines
13 KiB
HTML
Raw Normal View History

2015-02-27 12:25:41 +00:00
{% extends "base.html" %}
2015-02-27 08:53:51 +00:00
{% load i18n %}
2015-02-27 12:25:41 +00:00
{% block title %}{% trans "Instances" %}{% endblock %}
{% block content %}
2015-02-27 08:53:51 +00:00
<div class="container-fluid">
<div class="row">
{% include 'sidebar.html' %}
<div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main">
2015-03-03 09:34:09 +00:00
{% include 'create_inst_block.html' %}
<h1 class="page-header">Instances</h1>
2015-02-27 08:53:51 +00:00
2015-03-03 09:34:09 +00:00
{% include 'errors_block.html' %}
2015-03-02 15:31:25 +00:00
{% if request.user.is_superuser %}
2015-03-04 13:43:29 +00:00
<table class="table table-responsive table-hover">
2015-02-27 08:53:51 +00:00
<thead>
2015-03-04 13:43:29 +00:00
<tr>
2015-02-27 08:53:51 +00:00
<th>Name</th>
<th>Host</th>
2015-03-04 13:43:29 +00:00
<th>Status</th>
2015-03-02 15:31:25 +00:00
<th>VCPU</th>
<th>Memory</th>
2015-03-03 09:34:09 +00:00
<th>Actions</th>
2015-02-27 08:53:51 +00:00
</tr>
</thead>
<tbody>
{% for host, inst in all_host_vms.items %}
{% for vm, info in inst.items %}
<tr>
2015-03-04 13:43:29 +00:00
<td><a href="{% url 'instance' host.0 vm %}">{{ vm }}</a></td>
<td><a href="{% url 'overview' host.0 %}">{{ host.1 }}</a></td>
2015-02-27 08:53:51 +00:00
<td>{% ifequal info.status 1 %}
2015-03-04 13:43:29 +00:00
{% trans "Active" %}
2015-02-27 08:53:51 +00:00
{% endifequal %}
{% ifequal info.status 5 %}
2015-03-04 13:43:29 +00:00
{% trans "Off" %}
2015-02-27 08:53:51 +00:00
{% endifequal %}
{% ifequal info.status 3 %}
2015-03-04 13:43:29 +00:00
{% trans "Suspend" %}
2015-02-27 08:53:51 +00:00
{% endifequal %}
</td>
2015-03-04 13:43:29 +00:00
<td>{{ info.vcpu }}</td>
<td>{{ info.memory }} {% trans "MB" %}</td>
2015-02-27 08:53:51 +00:00
<td><form action="" method="post" role="form">{% csrf_token %}
<input type="hidden" name="name" value="{{ info.name }}"/>
<input type="hidden" name="compute" value="{{ host.0 }}"/>
{% ifequal info.status 5 %}
<button class="btn btn-sm btn-default" type="submit" name="start" title="Start">
<span class="glyphicon glyphicon-play"></span>
</button>
<button class="btn btn-sm btn-default disabled" title="{% trans "Suspend" %}">
<span class="glyphicon glyphicon-pause"></span>
</button>
<button class="btn btn-sm btn-default disabled" title="{% trans "Destroy" %}">
<span class="glyphicon glyphicon-stop"></span>
</button>
<button class="btn btn-sm btn-default disabled" title="{% trans "Console" %}">
<span class="glyphicon glyphicon-eye-open"></span>
</button>
{% endifequal %}
{% ifequal info.status 3 %}
<button class="btn btn-sm btn-default" type="submit" name="resume"
title="{% trans "Resume" %}">
<span class="glyphicon glyphicon-play"></span>
</button>
<button class="btn btn-sm btn-default disabled" title="{% trans "Suspend" %}">
<span class="glyphicon glyphicon-pause"></span>
</button>
<button class="btn btn-sm btn-default disabled" title="{% trans "Destroy" %}">
<span class="glyphicon glyphicon-stop"></span>
</button>
<button class="btn btn-sm btn-default disabled" title="{% trans "Console" %}">
<span class="glyphicon glyphicon-eye-open"></span>
</button>
{% endifequal %}
{% ifequal info.status 1 %}
<button class="btn btn-sm btn-default disabled" title="{% trans "Start" %}">
<span class="glyphicon glyphicon-play"></span>
</button>
<button class="btn btn-sm btn-default" type="submit" name="suspend"
title="{% trans "Suspend" %}">
<span class="glyphicon glyphicon-pause"></span>
</button>
<button class="btn btn-sm btn-default" type="submit" name="destroy"
title="{% trans "Destroy" %}" onclick="return confirm('Are you sure?')">
<span class="glyphicon glyphicon-stop"></span>
</button>
<a href="#" class="btn btn-sm btn-default"
onclick='open_console("{{ host.0 }}-{{ info.uuid }}")' title="{% trans "Console" %}">
<span class="glyphicon glyphicon-eye-open"></span>
</a>
{% endifequal %}
</form>
</td>
</tr>
{% endfor %}
{% endfor %}
</tbody>
</table>
2015-03-02 15:31:25 +00:00
{% else %}
2015-03-04 13:43:29 +00:00
<table class="table table-responsive table-hover">
2015-03-02 15:31:25 +00:00
<thead>
2015-03-04 13:43:29 +00:00
<tr>
2015-03-02 15:31:25 +00:00
<th>Name</th>
2015-03-04 13:43:29 +00:00
<th>Status</th>
2015-03-02 15:31:25 +00:00
<th>VCPU</th>
<th>Memory</th>
2015-03-03 09:34:09 +00:00
<th>Actions</th>
2015-03-02 15:31:25 +00:00
</tr>
</thead>
<tbody>
2015-03-04 13:43:29 +00:00
2015-03-02 15:31:25 +00:00
{% for host, vm in all_user_vms.items %}
<tr>
2015-03-04 13:43:29 +00:00
<td><a href="{% url 'instance' host.0 vm.name %}">{{ vm.name }}</a></td>
2015-03-02 15:31:25 +00:00
<td>{% ifequal vm.status 1 %}
2015-03-04 13:43:29 +00:00
{% trans "Active" %}
2015-03-02 15:31:25 +00:00
{% endifequal %}
{% ifequal vm.status 5 %}
2015-03-04 13:43:29 +00:00
{% trans "Off" %}
2015-03-02 15:31:25 +00:00
{% endifequal %}
{% ifequal vm.status 3 %}
2015-03-04 13:43:29 +00:00
{% trans "Suspend" %}
2015-03-02 15:31:25 +00:00
{% endifequal %}
</td>
2015-03-04 13:43:29 +00:00
<td>{{ vm.vcpu }}</td>
<td>{{ vm.memory }} {% trans "MB" %}</td>
2015-03-02 15:31:25 +00:00
<td><form action="" method="post" role="form">{% csrf_token %}
<input type="hidden" name="name" value="{{ vm.name }}"/>
<input type="hidden" name="compute" value="{{ host.0 }}"/>
{% ifequal vm.status 5 %}
<button class="btn btn-sm btn-default" type="submit" name="start" title="Start">
<span class="glyphicon glyphicon-play"></span>
</button>
<button class="btn btn-sm btn-default disabled" title="{% trans "Suspend" %}">
<span class="glyphicon glyphicon-pause"></span>
</button>
<button class="btn btn-sm btn-default disabled" title="{% trans "Destroy" %}">
<span class="glyphicon glyphicon-stop"></span>
</button>
<button class="btn btn-sm btn-default disabled" title="{% trans "Console" %}">
<span class="glyphicon glyphicon-eye-open"></span>
</button>
{% endifequal %}
{% ifequal vm.status 3 %}
<button class="btn btn-sm btn-default" type="submit" name="resume"
title="{% trans "Resume" %}">
<span class="glyphicon glyphicon-play"></span>
</button>
<button class="btn btn-sm btn-default disabled" title="{% trans "Suspend" %}">
<span class="glyphicon glyphicon-pause"></span>
</button>
<button class="btn btn-sm btn-default disabled" title="{% trans "Destroy" %}">
<span class="glyphicon glyphicon-stop"></span>
</button>
<button class="btn btn-sm btn-default disabled" title="{% trans "Console" %}">
<span class="glyphicon glyphicon-eye-open"></span>
</button>
{% endifequal %}
{% ifequal vm.status 1 %}
<button class="btn btn-sm btn-default disabled" title="{% trans "Start" %}">
<span class="glyphicon glyphicon-play"></span>
</button>
<button class="btn btn-sm btn-default" type="submit" name="suspend"
title="{% trans "Suspend" %}">
<span class="glyphicon glyphicon-pause"></span>
</button>
<button class="btn btn-sm btn-default" type="submit" name="destroy"
title="{% trans "Destroy" %}" onclick="return confirm('Are you sure?')">
<span class="glyphicon glyphicon-stop"></span>
</button>
<a href="#" class="btn btn-sm btn-default"
onclick='open_console("{{ host.0 }}-{{ vm.uuid }}")' title="{% trans "Console" %}">
<span class="glyphicon glyphicon-eye-open"></span>
</a>
{% endifequal %}
</form>
</td>
</tr>
2015-03-04 13:43:29 +00:00
2015-03-02 15:31:25 +00:00
{% endfor %}
2015-03-04 13:43:29 +00:00
2015-03-02 15:31:25 +00:00
</tbody>
</table>
2015-03-04 13:43:29 +00:00
{% endif %}
2015-02-27 12:25:41 +00:00
2015-02-27 08:53:51 +00:00
</div>
</div>
</div>
2015-02-27 12:25:41 +00:00
{% endblock %}
2015-02-27 12:44:44 +00:00
{% block javascript %}
<script type="application/javascript">
function open_console(uuid) {
window.open("/{% url 'console' %}/?token=" + uuid, "", "width=850,height=485");
}
</script>
{% endblock %}