2018-09-28 10:33:21 +00:00
|
|
|
{% extends "base.html" %}
|
|
|
|
{% load i18n %}
|
|
|
|
{% load staticfiles %}
|
|
|
|
{% block title %}{% trans "Instances" %}{% endblock %}
|
|
|
|
{% block style %}
|
|
|
|
<link rel="stylesheet" href="{% static "css/sortable-theme-bootstrap.css" %}" />
|
|
|
|
{% endblock %}
|
|
|
|
{% block content %}
|
2019-07-31 08:03:48 +00:00
|
|
|
<!-- Page Heading -->
|
|
|
|
<div class="row">
|
|
|
|
<div class="col-lg-12">
|
|
|
|
{% if request.user.is_superuser %}
|
|
|
|
{% include 'create_inst_block.html' %}
|
|
|
|
{% 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-09-28 10:33:21 +00:00
|
|
|
</div>
|
2019-07-31 08:03:48 +00:00
|
|
|
{% endif %}
|
2020-05-19 16:53:54 +00:00
|
|
|
<h2 class="page-header">{% trans "Instances" %}</h2>
|
2019-07-31 08:03:48 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<!-- /.row -->
|
2018-09-28 10:33:21 +00:00
|
|
|
|
2019-07-31 08:03:48 +00:00
|
|
|
{% include 'errors_block.html' %}
|
2018-09-28 10:33:21 +00:00
|
|
|
|
2020-01-22 11:50:12 +00:00
|
|
|
<div class="col-lg-12">
|
|
|
|
{% if request.user.is_superuser %}
|
|
|
|
{% 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 Instance" %}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
{% else %}
|
2020-06-04 12:40:57 +00:00
|
|
|
{% if view_style == "nongrouped" %}
|
2020-01-22 11:50:12 +00:00
|
|
|
{% include 'allinstances_index_nongrouped.html' %}
|
2020-06-04 12:40:57 +00:00
|
|
|
{% endif %}
|
|
|
|
{% if view_style == "grouped" %}
|
2020-01-22 11:50:12 +00:00
|
|
|
{% include 'allinstances_index_grouped.html' %}
|
2020-06-04 12:40:57 +00:00
|
|
|
{% endif %}
|
2020-01-22 11:50:12 +00:00
|
|
|
{% 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 Instance" %}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
{% else %}
|
|
|
|
<table class="table table-hover table-striped sortable-theme-bootstrap" data-sortable>
|
|
|
|
<thead>
|
|
|
|
<tr>
|
2020-05-26 10:52:52 +00:00
|
|
|
<th scope="col">{% trans 'Name' %}</th>
|
|
|
|
<th scope="col">{% trans 'Status' %}</th>
|
|
|
|
<th scope="col">{% trans 'VCPU' %}</th>
|
|
|
|
<th scope="col">{% trans 'Memory' %}</th>
|
|
|
|
<th scope="col" data-sortable="false" style="width: 165px;">{% trans 'Actions' %}</th>
|
2020-01-22 11:50:12 +00:00
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody class="searchable">
|
|
|
|
{% for inst, vm in all_user_vms.items %}
|
|
|
|
<tr>
|
2020-06-16 12:57:50 +00:00
|
|
|
<td><a href="{% url 'instances:instance' vm.compute_id vm.name %}">{{ vm.name }}</a><br><small><em>{{ vm.title }}</em></small></td>
|
2020-06-04 12:40:57 +00:00
|
|
|
<td>{% if vm.status == 1 %}
|
2020-01-22 11:50:12 +00:00
|
|
|
<span class="text-success">{% trans "Active" %}</span>
|
2020-06-04 12:40:57 +00:00
|
|
|
{% endif %}
|
|
|
|
{% if vm.status == 5 %}
|
2020-01-22 11:50:12 +00:00
|
|
|
<span class="text-danger">{% trans "Off" %}</span>
|
2020-06-04 12:40:57 +00:00
|
|
|
{% endif %}
|
|
|
|
{% if vm.status == 3 %}
|
2020-01-22 11:50:12 +00:00
|
|
|
<span class="text-warning">{% trans "Suspend" %}</span>
|
2020-06-04 12:40:57 +00:00
|
|
|
{% endif %}
|
2020-01-22 11:50:12 +00:00
|
|
|
</td>
|
|
|
|
<td>{{ vm.vcpu }}</td>
|
|
|
|
<td>{{ vm.memory }} {% trans "MB" %}</td>
|
2020-05-19 16:53:54 +00:00
|
|
|
<td>
|
|
|
|
{% include "instance_actions.html" %}
|
2020-01-22 11:50:12 +00:00
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
{% endfor %}
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
{% endif %}
|
|
|
|
{% endif %}
|
2019-07-31 08:03:48 +00:00
|
|
|
</div>
|
2018-09-28 10:33:21 +00:00
|
|
|
{% endblock %}
|
|
|
|
{% block script %}
|
|
|
|
<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);
|
|
|
|
}
|
|
|
|
(function ($) {
|
|
|
|
$('#filter').keyup(filter_table)
|
|
|
|
}(jQuery));
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
<script>
|
|
|
|
function goto_instance_clone(compute, instance) {
|
2018-10-01 08:42:01 +00:00
|
|
|
window.location = "/instances/" + compute + "/" + instance + "/#clone";
|
2018-09-28 10:33:21 +00:00
|
|
|
}
|
|
|
|
</script>
|
|
|
|
{% if request.user.is_superuser %}
|
|
|
|
<script>
|
|
|
|
function goto_compute() {
|
2019-12-13 13:47:51 +00:00
|
|
|
let compute = $("#compute_select").val();
|
|
|
|
{#window.location.href = "{% url 'create_instance' 1 %}".replace(1, compute);#}
|
|
|
|
window.location.href = "{% url 'create_instance_select_type' 1 %}".replace(1, compute);
|
2018-09-28 10:33:21 +00:00
|
|
|
}
|
|
|
|
</script>
|
|
|
|
{% endif %}
|
|
|
|
{% endblock %}
|