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 -->
|
2019-07-31 08:03:48 +00:00
|
|
|
<div class="row">
|
|
|
|
<div class="col-lg-12">
|
|
|
|
{% if request.user.is_superuser %}
|
2020-05-19 16:53:54 +00:00
|
|
|
<a href="{% url 'create_instance_select_type' compute.id %}" type="button" class="btn btn-success btn-header float-right">
|
|
|
|
<span class="fa fa-plus" aria-hidden="true"></span>
|
|
|
|
</a>
|
2019-07-31 08:03:48 +00:00
|
|
|
{% endif %}
|
|
|
|
{% if all_host_vms or all_user_vms %}
|
2020-05-19 16:53:54 +00:00
|
|
|
<div class="float-right search">
|
2020-06-10 12:16:58 +00:00
|
|
|
<input id="filter" class="form-control" type="text" placeholder="{% trans 'Search' %}">
|
2018-07-18 12:46:11 +00:00
|
|
|
</div>
|
2019-07-31 08:03:48 +00:00
|
|
|
{% endif %}
|
2020-05-19 16:53:54 +00:00
|
|
|
<h2 class="page-header">{{ compute.name }}</h2>
|
2019-07-31 08:03:48 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="row">
|
2020-05-19 16:53:54 +00:00
|
|
|
<div class="col-lg-12">
|
|
|
|
<nav aria-label="breadcrumb">
|
|
|
|
<ol class="breadcrumb bg-light shadow-sm">
|
|
|
|
<li class="breadcrumb-item active">
|
|
|
|
<a href="{% url 'overview' compute.id %}"><i class="fa fa-dashboard"></i> {% trans "Overview" %}</a>
|
|
|
|
</li>
|
|
|
|
<li class="breadcrumb-item">
|
|
|
|
<span class="font-weight-bold"><i class="fa fa-server"></i> {% trans "Instances" %}</span>
|
|
|
|
</li>
|
|
|
|
<li class="breadcrumb-item">
|
|
|
|
<a href="{% url 'storages' compute.id %}"><i class="fa fa-hdd-o"></i> {% trans "Storages" %}</a>
|
|
|
|
</li>
|
|
|
|
<li class="breadcrumb-item">
|
|
|
|
<a href="{% url 'networks' compute.id %}"><i class="fa fa-sitemap"></i> {% trans "Networks" %}</a>
|
|
|
|
</li>
|
|
|
|
<li class="breadcrumb-item">
|
|
|
|
<a href="{% url 'interfaces' compute.id %}"><i class="fa fa-wifi"></i> {% trans "Interfaces" %}</a>
|
|
|
|
</li>
|
|
|
|
<li class="breadcrumb-item">
|
|
|
|
<a href="{% url 'nwfilters' compute.id %}"><i class="fa fa-filter"></i> {% trans "NWFilters" %}</a>
|
|
|
|
</li>
|
|
|
|
<li class="breadcrumb-item">
|
|
|
|
<a href="{% url 'secrets' compute.id %}"><i class="fa fa-key"></i> {% trans "Secrets" %}</a>
|
|
|
|
</li>
|
|
|
|
</ol>
|
|
|
|
</nav>
|
2019-07-31 08:03:48 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<!-- /.row -->
|
|
|
|
{% include 'errors_block.html' %}
|
2020-05-21 13:16:21 +00:00
|
|
|
{% include 'messages_block.html' %}
|
2019-07-31 08:03:48 +00:00
|
|
|
<div class="row">
|
|
|
|
{% if not all_host_vms %}
|
|
|
|
<div class="col-lg-12">
|
2020-05-21 13:16:21 +00:00
|
|
|
<div class="alert alert-warning alert-dismissable fade show">
|
2020-05-19 16:53:54 +00:00
|
|
|
<i class="fa fa-exclamation-triangle"></i> <strong>{% trans "Warning" %}:</strong> {% trans "Hypervisor doesn't have any Instances" %}
|
2019-07-31 08:03:48 +00:00
|
|
|
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
|
2018-09-28 10:33:21 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
2019-07-31 08:03:48 +00:00
|
|
|
{% else %}
|
|
|
|
<div class="col-lg-12">
|
2020-05-19 16:53:54 +00:00
|
|
|
<table class="table table-hover sortable-theme-bootstrap" data-sortable>
|
2019-07-31 08:03:48 +00:00
|
|
|
<thead>
|
|
|
|
<tr>
|
2020-05-26 10:52:52 +00:00
|
|
|
<th scope="col">{% trans 'Name' %}<br>{% trans 'Description' %}</th>
|
|
|
|
<th scope="col" class="d-none d-md-table-cell">{% trans 'User' %}</th>
|
|
|
|
<th scope="col">{% trans 'Status' %}</th>
|
|
|
|
<th scope="col">{% trans 'VCPU' %}</th>
|
|
|
|
<th scope="col">{% trans 'Memory' %}</th>
|
|
|
|
<th scope="col" style="width:200px;" data-sortable="false">{% trans 'Actions' %}</th>
|
2019-07-31 08:03:48 +00:00
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody class="searchable">
|
2020-05-19 16:53:54 +00:00
|
|
|
{% for host, insts in all_host_vms.items %}
|
|
|
|
{% for inst, vm in insts.items %}
|
|
|
|
<tr>
|
2020-06-16 12:57:50 +00:00
|
|
|
<td><a class="text-secondary" href="{% url 'instances:instance' host.0 inst %}">{{ inst }}</a><br><small><em>{{ vm.title }}</em></small></td>
|
2020-05-19 16:53:54 +00:00
|
|
|
<td class="d-none d-md-table-cell"><small><em>{% if vm.userinstances.count > 0 %}{{ vm.userinstances.first_user.user.username }}{% if vm.userinstances.count > 1 %} (+{{ vm.userinstances.count|add:"-1" }}){% endif %}{% endif %}</em></small></td>
|
|
|
|
<td>
|
2020-06-04 12:40:57 +00:00
|
|
|
{% if vm.status == 1 %}<span class="text-success">{% trans "Active" %}</span>{% endif %}
|
|
|
|
{% if vm.status == 5 %}<span class="text-danger">{% trans "Off" %}</span>{% endif %}
|
|
|
|
{% if vm.status == 3 %}<span class="text-warning">{% trans "Suspend" %}</span>{% endif %}
|
2020-05-19 16:53:54 +00:00
|
|
|
</td>
|
|
|
|
<td>{{ vm.vcpu }}</td>
|
|
|
|
<td>{{ vm.memory|filesizeformat }}</td>
|
|
|
|
<td class="text-nowrap">
|
|
|
|
{% include 'instance_actions.html' %}
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
{% endfor %}
|
2019-07-31 08:03:48 +00:00
|
|
|
{% 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) {
|
2019-12-13 13:47:51 +00:00
|
|
|
window.open("{% url 'console' %}?token=" + uuid, "", "width=850,height=685");
|
2018-07-19 06:39:41 +00:00
|
|
|
}
|
|
|
|
</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>
|
2018-09-28 10:33:21 +00:00
|
|
|
{% endblock %}
|