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 %}
|
2018-09-28 10:33:21 +00:00
|
|
|
{% block title %}{% trans "Instances" %} - {{ compute.name }}{% endblock %}
|
2015-03-10 14:46:52 +00:00
|
|
|
{% block style %}
|
2018-07-19 06:39:41 +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 %}
|
2018-09-28 10:33:21 +00:00
|
|
|
<!-- Page Heading -->
|
2018-07-19 06:39:41 +00:00
|
|
|
<div class="row">
|
|
|
|
<div class="col-lg-12">
|
|
|
|
{% if request.user.is_superuser %}
|
2018-10-02 12:15:41 +00:00
|
|
|
<a href="{% url 'create_instance' compute.id %}" type="button" class="btn btn-success btn-header pull-right" data-toggle="modal">
|
|
|
|
<span class="glyphicon glyphicon-plus" aria-hidden="true"></span>
|
|
|
|
</a>
|
2018-07-19 06:39:41 +00:00
|
|
|
{% endif %}
|
|
|
|
{% if all_host_vms or all_user_vms %}
|
|
|
|
<div class="pull-right search">
|
|
|
|
<input id="filter" class="form-control" type="text" placeholder="Search">
|
|
|
|
</div>
|
|
|
|
{% endif %}
|
2018-09-28 10:33:21 +00:00
|
|
|
<h1 class="page-header">{{ compute.name }}</h1>
|
2018-07-19 06:39:41 +00:00
|
|
|
</div>
|
2018-07-18 12:46:11 +00:00
|
|
|
</div>
|
2018-09-28 10:33:21 +00:00
|
|
|
<div class="row">
|
|
|
|
<div class="col-lg-12">
|
2015-02-27 08:53:51 +00:00
|
|
|
|
2018-09-28 10:33:21 +00:00
|
|
|
<ol class="breadcrumb">
|
|
|
|
<li class="active">
|
|
|
|
<i class="fa fa-dashboard"></i> <a href="{% url 'overview' compute.id %}">{% trans "Overview" %}</a>
|
|
|
|
</li>
|
|
|
|
<li>
|
|
|
|
<i class="fa fa-server"></i> {% trans "Instances" %}
|
|
|
|
</li>
|
|
|
|
<li>
|
|
|
|
<i class="fa fa-hdd-o"></i> <a href="{% url 'storages' compute.id %}">{% trans "Storages" %}</a>
|
|
|
|
</li>
|
|
|
|
<li>
|
|
|
|
<i class="fa fa-sitemap"></i> <a href="{% url 'networks' compute.id %}">{% trans "Networks" %}</a>
|
|
|
|
</li>
|
|
|
|
<li>
|
|
|
|
<i class="fa fa-wifi"></i> <a href="{% url 'interfaces' compute.id %}">{% trans "Interfaces" %}</a>
|
|
|
|
</li>
|
|
|
|
<li>
|
|
|
|
<i class="fa fa-filter"></i> <a href="{% url 'nwfilters' compute.id %}">{% trans "NWFilters" %}</a>
|
|
|
|
</li>
|
|
|
|
<li>
|
|
|
|
<i class="fa fa-key"></i> <a href="{% url 'secrets' compute.id %}">{% trans "Secrets" %}</a>
|
|
|
|
</li>
|
|
|
|
</ol>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<!-- /.row -->
|
2015-02-27 08:53:51 +00:00
|
|
|
|
2018-09-28 10:33:21 +00:00
|
|
|
{% include 'errors_block.html' %}
|
|
|
|
<div class="row">
|
|
|
|
{% if not all_host_vms %}
|
2018-07-19 06:39:41 +00:00
|
|
|
<div class="col-lg-12">
|
2018-09-28 10:33:21 +00:00
|
|
|
<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 "Hypervisor doesn't have any instances" %}
|
2018-07-18 12:46:11 +00:00
|
|
|
</div>
|
2018-07-19 06:39:41 +00:00
|
|
|
</div>
|
2018-09-28 10:33:21 +00:00
|
|
|
{% else %}
|
|
|
|
<div class="col-lg-12">
|
|
|
|
<table class="table table-hover table-striped sortable-theme-bootstrap" data-sortable>
|
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
<th>Name<br>Description</th>
|
|
|
|
<th>Host<br>User</th>
|
|
|
|
<th>Status</th>
|
|
|
|
<th>VCPU</th>
|
|
|
|
<th>Memory</th>
|
|
|
|
<th data-sortable="false" style="width:205px;">Actions</th>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody class="searchable">
|
|
|
|
{% for host, inst in all_host_vms.items %}
|
|
|
|
{% for vm, info in inst.items %}
|
|
|
|
<tr>
|
|
|
|
<td><a href="{% url 'instance' host.0 vm %}">{{ vm }}</a><br><small><em>{{ info.title }}</em></small></td>
|
|
|
|
<td><a href="{% url 'overview' host.0 %}">{{ host.1 }}</a><br><small><em>{% if info.userinstances.count > 0 %}{{ info.userinstances.first_user.user.username }}{% if info.userinstances.count > 1 %} (+{{ info.userinstances.count|add:"-1" }}){% endif %}{% endif %}</em></small></td>
|
|
|
|
<td>
|
|
|
|
{% ifequal info.status 1 %}<span class="text-success">{% trans "Active" %}</span>{% endifequal %}
|
|
|
|
{% ifequal info.status 5 %}<span class="text-danger">{% trans "Off" %}</span>{% endifequal %}
|
|
|
|
{% ifequal info.status 3 %}<span class="text-warning">{% trans "Suspend" %}</span>{% endifequal %}
|
|
|
|
</td>
|
|
|
|
<td>{{ info.vcpu }}</td>
|
|
|
|
<td>{{ info.memory|filesizeformat }}</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 %}
|
|
|
|
{% 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 %}
|
|
|
|
<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 "Power Off" %}">
|
|
|
|
<span class="glyphicon glyphicon-off"></span>
|
|
|
|
</button>
|
|
|
|
<button class="btn btn-sm btn-default disabled" title="{% trans "Power Cycle" %}">
|
|
|
|
<span class="glyphicon glyphicon-refresh"></span>
|
|
|
|
</button>
|
|
|
|
<button class="btn btn-sm btn-default disabled" title="{% trans "VNC 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 "Power Off" %}">
|
|
|
|
<span class="glyphicon glyphicon-off"></span>
|
|
|
|
</button>
|
|
|
|
<button class="btn btn-sm btn-default disabled" title="{% trans "Power Cycle" %}">
|
|
|
|
<span class="glyphicon glyphicon-refresh"></span>
|
|
|
|
</button>
|
|
|
|
<button class="btn btn-sm btn-default disabled" title="{% trans "VNC Console" %}">
|
|
|
|
<span class="glyphicon glyphicon-eye-open"></span>
|
|
|
|
</button>
|
|
|
|
{% endifequal %}
|
|
|
|
{% ifequal info.status 1 %}
|
|
|
|
<button class="btn btn-sm btn-default disabled" title="{% trans "Power On" %}">
|
|
|
|
<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="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?')">
|
|
|
|
<span class="glyphicon glyphicon-refresh"></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>
|
|
|
|
</div>
|
|
|
|
{% endif %}
|
|
|
|
</div>
|
2015-02-27 12:25:41 +00:00
|
|
|
{% endblock %}
|
2015-03-06 13:06:29 +00:00
|
|
|
{% block script %}
|
2018-07-19 06:39:41 +00:00
|
|
|
<script src="{% static "js/sortable.min.js" %}"></script>
|
|
|
|
<script>
|
|
|
|
function open_console(uuid) {
|
|
|
|
window.open("{% url 'console' %}?token=" + uuid, "", "width=850,height=485");
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
<script>
|
|
|
|
function filter_table() {
|
|
|
|
var rex = new RegExp($(this).val(), 'i');
|
|
|
|
$('.searchable tr').hide();
|
|
|
|
$('.searchable tr').filter(function () {
|
|
|
|
return rex.test($(this).text());
|
|
|
|
}).show();
|
|
|
|
Cookies.set("instances_filter", $(this).val(), { expires: 1 });
|
|
|
|
}
|
|
|
|
$(document).ready(function () {
|
|
|
|
instances_filter_cookie = Cookies.get("instances_filter");
|
|
|
|
if (instances_filter_cookie) {
|
|
|
|
$('#filter').val(instances_filter_cookie);
|
|
|
|
$('#filter').each(filter_table);
|
2016-05-06 08:56:50 +00:00
|
|
|
}
|
2018-07-19 06:39:41 +00:00
|
|
|
(function ($) {
|
|
|
|
$('#filter').keyup(filter_table)
|
|
|
|
}(jQuery));
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
<script>
|
|
|
|
function goto_instance_clone(compute, instance) {
|
2018-10-01 08:44:29 +00:00
|
|
|
window.location = "/instances/" + compute + "/" + instance + "/#clone";
|
2018-07-19 06:39:41 +00:00
|
|
|
}
|
|
|
|
</script>
|
|
|
|
{% if request.user.is_superuser %}
|
2015-03-11 09:39:44 +00:00
|
|
|
<script>
|
2018-07-19 06:39:41 +00:00
|
|
|
function goto_compute() {
|
|
|
|
var compute = $("#compute_select").val();
|
2018-10-01 12:09:04 +00:00
|
|
|
window.location.href = "{% url 'create_instance' 1 %}".replace(1, compute);
|
2015-03-11 09:39:44 +00:00
|
|
|
}
|
|
|
|
</script>
|
2018-07-19 06:39:41 +00:00
|
|
|
{% endif %}
|
2018-09-28 10:33:21 +00:00
|
|
|
{% endblock %}
|