2015-02-27 12:25:41 +00:00
|
|
|
|
{% extends "base.html" %}
|
2015-02-27 08:53:51 +00:00
|
|
|
|
{% load i18n %}
|
2015-04-06 07:51:50 +00:00
|
|
|
|
{% load staticfiles %}
|
2015-02-27 12:25:41 +00:00
|
|
|
|
{% block title %}{% trans "Instances" %}{% endblock %}
|
2015-03-10 14:46:52 +00:00
|
|
|
|
{% block style %}
|
2015-04-06 07:51:50 +00:00
|
|
|
|
<link rel="stylesheet" href="{% static "css/sortable-theme-bootstrap.css" %}" />
|
2015-03-10 14:46:52 +00:00
|
|
|
|
{% endblock %}
|
2015-02-27 12:25:41 +00:00
|
|
|
|
{% block content %}
|
2015-03-04 15:48:22 +00:00
|
|
|
|
<!-- Page Heading -->
|
|
|
|
|
<div class="row">
|
|
|
|
|
<div class="col-lg-12">
|
2015-05-15 17:54:55 +00:00
|
|
|
|
{% if request.user.is_superuser %}
|
|
|
|
|
{% include 'create_inst_block.html' %}
|
|
|
|
|
{% endif %}
|
2015-06-16 08:53:42 +00:00
|
|
|
|
{% if all_host_vms or all_user_vms %}
|
2015-04-21 11:46:58 +00:00
|
|
|
|
<div class="pull-right search">
|
|
|
|
|
<input id="filter" class="form-control" type="text" placeholder="Search">
|
|
|
|
|
</div>
|
|
|
|
|
{% endif %}
|
2015-03-04 15:48:22 +00:00
|
|
|
|
<h1 class="page-header">{% trans "Instances" %}</h1>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<!-- /.row -->
|
2015-02-27 08:53:51 +00:00
|
|
|
|
|
2015-03-04 15:48:22 +00:00
|
|
|
|
{% include 'errors_block.html' %}
|
2015-02-27 08:53:51 +00:00
|
|
|
|
|
2015-03-04 15:48:22 +00:00
|
|
|
|
<div class="row">
|
|
|
|
|
<div class="col-lg-12">
|
|
|
|
|
<div class="table-responsive">
|
|
|
|
|
{% if request.user.is_superuser %}
|
2015-03-16 09:57:55 +00:00
|
|
|
|
{% if not all_host_vms %}
|
|
|
|
|
<div class="col-lg-12">
|
|
|
|
|
<div class="alert alert-warning alert-dismissable">
|
|
|
|
|
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
|
|
|
|
|
<i class="fa fa-exclamation-triangle"></i> <strong>{% trans "Warning:" %}</strong> {% trans "You don't have any Instace" %}
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
{% else %}
|
|
|
|
|
<table class="table table-hover table-striped sortable-theme-bootstrap" data-sortable>
|
|
|
|
|
<thead>
|
|
|
|
|
<tr>
|
|
|
|
|
<th>Name</th>
|
|
|
|
|
<th>Host</th>
|
|
|
|
|
<th>Status</th>
|
|
|
|
|
<th>VCPU</th>
|
|
|
|
|
<th>Memory</th>
|
2015-03-18 13:48:29 +00:00
|
|
|
|
<th data-sortable="false" style="width:205px;">Actions</th>
|
2015-03-16 09:57:55 +00:00
|
|
|
|
</tr>
|
|
|
|
|
</thead>
|
|
|
|
|
<tbody class="searchable">
|
|
|
|
|
{% for host, inst in all_host_vms.items %}
|
|
|
|
|
{% for vm, info in inst.items %}
|
|
|
|
|
<tr>
|
2016-02-23 14:03:33 +00:00
|
|
|
|
<td><a href="{% url 'instance' host.0 vm %}">{{ vm }}</a><br><small><em>{{ info.title }}</em></small></td>
|
2015-03-16 09:57:55 +00:00
|
|
|
|
<td><a href="{% url 'overview' host.0 %}">{{ host.1 }}</a></td>
|
|
|
|
|
<td>{% ifequal info.status 1 %}
|
2015-03-26 13:15:28 +00:00
|
|
|
|
<span class="text-success">{% trans "Active" %}</span>
|
2015-03-16 09:57:55 +00:00
|
|
|
|
{% endifequal %}
|
|
|
|
|
{% ifequal info.status 5 %}
|
2015-03-26 13:15:28 +00:00
|
|
|
|
<span class="text-danger">{% trans "Off" %}</span>
|
2015-03-16 09:57:55 +00:00
|
|
|
|
{% endifequal %}
|
|
|
|
|
{% ifequal info.status 3 %}
|
2015-03-26 13:15:28 +00:00
|
|
|
|
<span class="text-warning">{% trans "Suspend" %}</span>
|
2015-03-16 09:57:55 +00:00
|
|
|
|
{% endifequal %}
|
|
|
|
|
</td>
|
|
|
|
|
<td>{{ info.vcpu }}</td>
|
|
|
|
|
<td>{{ info.memory }} {% trans "MB" %}</td>
|
|
|
|
|
<td><form action="" method="post" role="form">{% csrf_token %}
|
|
|
|
|
<input type="hidden" name="name" value="{{ vm }}"/>
|
|
|
|
|
<input type="hidden" name="compute_id" value="{{ host.0 }}"/>
|
|
|
|
|
{% ifequal info.status 5 %}
|
2016-03-23 14:18:20 +00:00
|
|
|
|
{% if info.is_template %}
|
|
|
|
|
<button class="btn btn-sm btn-default" type="button" name="clone" title="{% trans "Clone" %}" onclick="goto_instance_clone({{ host.0 }}, '{{ vm }}');">
|
|
|
|
|
<span class="glyphicon glyphicon-duplicate"></span>
|
|
|
|
|
</button>
|
|
|
|
|
{% else %}
|
|
|
|
|
<button class="btn btn-sm btn-default" type="submit" name="poweron" title="{% trans "Power On" %}">
|
|
|
|
|
<span class="glyphicon glyphicon-play"></span>
|
|
|
|
|
</button>
|
|
|
|
|
{% endif %}
|
2015-03-16 09:57:55 +00:00
|
|
|
|
<button class="btn btn-sm btn-default disabled" title="{% trans "Suspend" %}">
|
|
|
|
|
<span class="glyphicon glyphicon-pause"></span>
|
|
|
|
|
</button>
|
2015-03-18 13:48:29 +00:00
|
|
|
|
<button class="btn btn-sm btn-default disabled" title="{% trans "Power Off" %}">
|
|
|
|
|
<span class="glyphicon glyphicon-off"></span>
|
|
|
|
|
</button>
|
|
|
|
|
<button class="btn btn-sm btn-default disabled" title="{% trans "Power Cycle" %}">
|
2015-03-27 09:53:13 +00:00
|
|
|
|
<span class="glyphicon glyphicon-refresh"></span>
|
2015-03-16 09:57:55 +00:00
|
|
|
|
</button>
|
2015-03-18 13:48:29 +00:00
|
|
|
|
<button class="btn btn-sm btn-default disabled" title="{% trans "VNC Console" %}">
|
2015-03-16 09:57:55 +00:00
|
|
|
|
<span class="glyphicon glyphicon-eye-open"></span>
|
|
|
|
|
</button>
|
|
|
|
|
{% endifequal %}
|
|
|
|
|
{% ifequal info.status 3 %}
|
2015-03-18 13:48:29 +00:00
|
|
|
|
<button class="btn btn-sm btn-default" type="submit" name="resume" title="{% trans "Resume" %}">
|
2015-03-16 09:57:55 +00:00
|
|
|
|
<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>
|
2015-03-18 13:48:29 +00:00
|
|
|
|
<button class="btn btn-sm btn-default disabled" title="{% trans "Power Off" %}">
|
|
|
|
|
<span class="glyphicon glyphicon-off"></span>
|
|
|
|
|
</button>
|
|
|
|
|
<button class="btn btn-sm btn-default disabled" title="{% trans "Power Cycle" %}">
|
2015-03-27 09:53:13 +00:00
|
|
|
|
<span class="glyphicon glyphicon-refresh"></span>
|
2015-03-16 09:57:55 +00:00
|
|
|
|
</button>
|
2015-03-18 13:48:29 +00:00
|
|
|
|
<button class="btn btn-sm btn-default disabled" title="{% trans "VNC Console" %}">
|
2015-03-16 09:57:55 +00:00
|
|
|
|
<span class="glyphicon glyphicon-eye-open"></span>
|
|
|
|
|
</button>
|
|
|
|
|
{% endifequal %}
|
|
|
|
|
{% ifequal info.status 1 %}
|
2015-03-18 13:48:29 +00:00
|
|
|
|
<button class="btn btn-sm btn-default disabled" title="{% trans "Power On" %}">
|
2015-03-16 09:57:55 +00:00
|
|
|
|
<span class="glyphicon glyphicon-play"></span>
|
|
|
|
|
</button>
|
2015-03-18 13:48:29 +00:00
|
|
|
|
<button class="btn btn-sm btn-default" type="submit" name="suspend" title="{% trans "Suspend" %}">
|
2015-03-16 09:57:55 +00:00
|
|
|
|
<span class="glyphicon glyphicon-pause"></span>
|
|
|
|
|
</button>
|
2015-03-18 13:48:29 +00:00
|
|
|
|
<button class="btn btn-sm btn-default" type="submit" name="poweroff" title="{% trans "Power Off" %}" onclick="return confirm('Are you sure?')">
|
|
|
|
|
<span class="glyphicon glyphicon-off"></span>
|
|
|
|
|
</button>
|
|
|
|
|
<button class="btn btn-sm btn-default" type="submit" name="powercycle" title="{% trans "Power Cycle" %}" onclick="return confirm('Are you sure?')">
|
2015-03-27 09:53:13 +00:00
|
|
|
|
<span class="glyphicon glyphicon-refresh"></span>
|
2015-03-16 09:57:55 +00:00
|
|
|
|
</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>
|
|
|
|
|
{% endif %}
|
|
|
|
|
{% else %}
|
|
|
|
|
{% if not all_user_vms %}
|
|
|
|
|
<div class="col-lg-12">
|
|
|
|
|
<div class="alert alert-warning alert-dismissable">
|
|
|
|
|
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
|
|
|
|
|
<i class="fa fa-exclamation-triangle"></i> <strong>{% trans "Warning:" %}</strong> {% trans "You don't have any Instace" %}
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
{% else %}
|
|
|
|
|
<table class="table table-hover table-striped sortable-theme-bootstrap" data-sortable>
|
|
|
|
|
<thead>
|
|
|
|
|
<tr>
|
|
|
|
|
<th>Name</th>
|
|
|
|
|
<th>Status</th>
|
|
|
|
|
<th>VCPU</th>
|
|
|
|
|
<th>Memory</th>
|
|
|
|
|
<th data-sortable="false" style="width: 165px;">Actions</th>
|
|
|
|
|
</tr>
|
|
|
|
|
</thead>
|
|
|
|
|
<tbody class="searchable">
|
|
|
|
|
{% for inst, vm in all_user_vms.items %}
|
2015-03-04 15:48:22 +00:00
|
|
|
|
<tr>
|
2016-03-24 13:51:29 +00:00
|
|
|
|
<td><a href="{% url 'instance' vm.compute_id vm.name %}">{{ vm.name }}</a><br><small><em>{{ vm.title }}</em></small></td>
|
2015-03-16 09:57:55 +00:00
|
|
|
|
<td>{% ifequal vm.status 1 %}
|
2015-03-26 13:15:28 +00:00
|
|
|
|
<span class="text-success">{% trans "Active" %}</span>
|
2015-03-04 15:48:22 +00:00
|
|
|
|
{% endifequal %}
|
2015-03-16 09:57:55 +00:00
|
|
|
|
{% ifequal vm.status 5 %}
|
2015-03-26 13:15:28 +00:00
|
|
|
|
<span class="text-danger">{% trans "Off" %}</span>
|
2015-03-04 15:48:22 +00:00
|
|
|
|
{% endifequal %}
|
2015-03-16 09:57:55 +00:00
|
|
|
|
{% ifequal vm.status 3 %}
|
2015-03-26 13:15:28 +00:00
|
|
|
|
<span class="text-warning">{% trans "Suspend" %}</span>
|
2015-03-04 15:48:22 +00:00
|
|
|
|
{% endifequal %}
|
|
|
|
|
</td>
|
2015-03-16 09:57:55 +00:00
|
|
|
|
<td>{{ vm.vcpu }}</td>
|
|
|
|
|
<td>{{ vm.memory }} {% trans "MB" %}</td>
|
2015-03-04 15:48:22 +00:00
|
|
|
|
<td><form action="" method="post" role="form">{% csrf_token %}
|
2015-03-16 09:57:55 +00:00
|
|
|
|
<input type="hidden" name="name" value="{{ vm.name }}"/>
|
|
|
|
|
<input type="hidden" name="compute_id" value="{{ vm.compute_id }}"/>
|
|
|
|
|
{% ifequal vm.status 5 %}
|
2016-03-23 14:18:20 +00:00
|
|
|
|
{% if inst.instance.is_template %}
|
|
|
|
|
<button class="btn btn-sm btn-default" type="button" name="clone" title="{% trans "Clone" %}" onclick="goto_instance_clone({{ vm.compute_id }}, '{{ vm.name }}');">
|
|
|
|
|
<span class="glyphicon glyphicon-duplicate"></span>
|
|
|
|
|
</button>
|
|
|
|
|
{% else %}
|
|
|
|
|
<button class="btn btn-sm btn-default" type="submit" name="poweron" title="{% trans "Power On" %}">
|
|
|
|
|
<span class="glyphicon glyphicon-play"></span>
|
|
|
|
|
</button>
|
|
|
|
|
{% endif %}
|
2015-03-18 13:48:29 +00:00
|
|
|
|
<button class="btn btn-sm btn-default disabled" title="{% trans "Power Off" %}">
|
|
|
|
|
<span class="glyphicon glyphicon-off"></span>
|
2015-03-04 15:48:22 +00:00
|
|
|
|
</button>
|
2015-03-18 13:48:29 +00:00
|
|
|
|
<button class="btn btn-sm btn-default disabled" title="{% trans "Power Cycle" %}">
|
2015-03-27 09:53:13 +00:00
|
|
|
|
<span class="glyphicon glyphicon-refresh"></span>
|
2015-03-04 15:48:22 +00:00
|
|
|
|
</button>
|
2015-03-18 13:48:29 +00:00
|
|
|
|
<button class="btn btn-sm btn-default disabled" title="{% trans "VNC Console" %}">
|
2015-03-04 15:48:22 +00:00
|
|
|
|
<span class="glyphicon glyphicon-eye-open"></span>
|
|
|
|
|
</button>
|
|
|
|
|
{% endifequal %}
|
2015-03-16 09:57:55 +00:00
|
|
|
|
{% ifequal vm.status 3 %}
|
2015-03-18 13:48:29 +00:00
|
|
|
|
<button class="btn btn-sm btn-default disabled" title="{% trans "Power On" %}">
|
2015-03-04 15:48:22 +00:00
|
|
|
|
<span class="glyphicon glyphicon-play"></span>
|
|
|
|
|
</button>
|
2015-03-18 13:48:29 +00:00
|
|
|
|
<button class="btn btn-sm btn-default disabled" title="{% trans "Power Off" %}">
|
|
|
|
|
<span class="glyphicon glyphicon-off"></span>
|
2015-03-04 15:48:22 +00:00
|
|
|
|
</button>
|
2015-03-18 13:48:29 +00:00
|
|
|
|
<button class="btn btn-sm btn-default disabled" title="{% trans "Power Cycle" %}">
|
2015-03-27 09:53:13 +00:00
|
|
|
|
<span class="glyphicon glyphicon-refresh"></span>
|
2015-03-04 15:48:22 +00:00
|
|
|
|
</button>
|
2015-03-18 13:48:29 +00:00
|
|
|
|
<button class="btn btn-sm btn-default disabled" title="{% trans "VNC Console" %}">
|
2015-03-04 15:48:22 +00:00
|
|
|
|
<span class="glyphicon glyphicon-eye-open"></span>
|
|
|
|
|
</button>
|
|
|
|
|
{% endifequal %}
|
2015-03-16 09:57:55 +00:00
|
|
|
|
{% ifequal vm.status 1 %}
|
2015-03-18 13:48:29 +00:00
|
|
|
|
<button class="btn btn-sm btn-default disabled" title="{% trans "Power On" %}">
|
2015-03-04 15:48:22 +00:00
|
|
|
|
<span class="glyphicon glyphicon-play"></span>
|
|
|
|
|
</button>
|
2015-03-18 13:48:29 +00:00
|
|
|
|
<button class="btn btn-sm btn-default" type="submit" name="poweroff" title="{% trans "Power Off" %}">
|
|
|
|
|
<span class="glyphicon glyphicon-off"></span>
|
2015-03-04 15:48:22 +00:00
|
|
|
|
</button>
|
2015-03-18 13:48:29 +00:00
|
|
|
|
<button class="btn btn-sm btn-default" type="submit" name="powercycle" title="{% trans "Power Cycle" %}" onclick="return confirm('Are you sure?')">
|
2015-03-27 09:53:13 +00:00
|
|
|
|
<span class="glyphicon glyphicon-refresh"></span>
|
2015-03-04 15:48:22 +00:00
|
|
|
|
</button>
|
2015-05-21 14:55:34 +00:00
|
|
|
|
<a href="#" class="btn btn-sm btn-default" onclick='open_console("{{ vm.compute_id }}-{{ vm.uuid }}")' title="{% trans "Console" %}">
|
2015-03-04 15:48:22 +00:00
|
|
|
|
<span class="glyphicon glyphicon-eye-open"></span>
|
|
|
|
|
</a>
|
|
|
|
|
{% endifequal %}
|
|
|
|
|
</form>
|
|
|
|
|
</td>
|
|
|
|
|
</tr>
|
|
|
|
|
{% endfor %}
|
2015-03-16 09:57:55 +00:00
|
|
|
|
</tbody>
|
|
|
|
|
</table>
|
|
|
|
|
{% endif %}
|
2015-03-04 15:48:22 +00:00
|
|
|
|
{% endif %}
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2015-02-27 12:25:41 +00:00
|
|
|
|
{% endblock %}
|
2015-03-06 13:06:29 +00:00
|
|
|
|
{% block script %}
|
2015-04-06 07:51:50 +00:00
|
|
|
|
<script src="{% static "js/sortable.min.js" %}"></script>
|
2015-03-06 13:06:29 +00:00
|
|
|
|
<script>
|
|
|
|
|
function open_console(uuid) {
|
|
|
|
|
window.open("{% url 'console' %}?token=" + uuid, "", "width=850,height=485");
|
|
|
|
|
}
|
|
|
|
|
</script>
|
2015-03-11 07:07:30 +00:00
|
|
|
|
<script>
|
|
|
|
|
$(document).ready(function () {
|
|
|
|
|
(function ($) {
|
|
|
|
|
$('#filter').keyup(function () {
|
|
|
|
|
var rex = new RegExp($(this).val(), 'i');
|
|
|
|
|
$('.searchable tr').hide();
|
|
|
|
|
$('.searchable tr').filter(function () {
|
|
|
|
|
return rex.test($(this).text());
|
|
|
|
|
}).show();
|
|
|
|
|
})
|
|
|
|
|
}(jQuery));
|
|
|
|
|
});
|
|
|
|
|
</script>
|
2016-03-23 14:18:20 +00:00
|
|
|
|
<script>
|
|
|
|
|
function goto_instance_clone(compute, instance) {
|
|
|
|
|
window.location = "/instance/" + compute + "/" + instance + "/#clone";
|
|
|
|
|
}
|
|
|
|
|
</script>
|
2015-03-11 09:39:44 +00:00
|
|
|
|
{% if request.user.is_superuser %}
|
|
|
|
|
<script>
|
|
|
|
|
function goto_compute() {
|
|
|
|
|
var compute = $("#compute_select").val();
|
2015-04-02 13:20:46 +00:00
|
|
|
|
window.location = "/compute/" + compute + "/create/";
|
2015-03-11 09:39:44 +00:00
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
{% endif %}
|
2015-05-16 10:04:36 +00:00
|
|
|
|
{% endblock %}
|