2018-07-30 10:33:09 +00:00
|
|
|
{% load i18n %}
|
2020-05-19 16:53:54 +00:00
|
|
|
<table class="table table-hover sortable-theme-bootstrap" data-sortable>
|
2018-07-30 10:33:09 +00:00
|
|
|
<thead>
|
2020-05-19 16:53:54 +00:00
|
|
|
<tr style="border: 2px solid transparent; ">
|
2020-05-26 10:52:52 +00:00
|
|
|
<th scope="col" data-sortable="false"><a class="text-secondary" href="#" id="hide_all_instances" onclick="hide_all_host_instances()">#</a></th>
|
|
|
|
<th scope="col">{% trans "Name" %}<br>{% trans "Description" %}</th>
|
|
|
|
<th scope="col" class="d-none d-sm-table-cell">{% trans "User"%}</th>
|
|
|
|
<th scope="col">{% trans "Status" %}</th>
|
|
|
|
<th scope="col" class="d-none d-sm-table-cell">{% trans "VCPU" %}</th>
|
|
|
|
<th scope="col" class="d-none d-sm-table-cell">{% trans "Memory" %}</th>
|
|
|
|
<th scope="col" style="width:200px;" data-sortable="false">{% trans "Actions" %} & {% trans "Mem Usage" %}</th>
|
2018-07-30 10:33:09 +00:00
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody class="searchable">
|
2020-05-19 16:53:54 +00:00
|
|
|
{% for host, insts in all_host_vms.items %}
|
2020-05-21 22:13:39 +00:00
|
|
|
<tr class="font-weight-bold active" style="border-bottom: 2px solid darkgray;border-top: 2px solid darkgray;">
|
2018-09-10 08:14:16 +00:00
|
|
|
<td>
|
2020-05-19 16:53:54 +00:00
|
|
|
<span id="collapse_host_instances_{{ host.1 }}" class="fa fa-chevron-up" onclick="hide_host_instances('{{ host.1 }}');"></span>
|
2018-09-10 08:14:16 +00:00
|
|
|
</td>
|
2018-12-04 13:05:24 +00:00
|
|
|
<td>
|
2020-05-19 16:53:54 +00:00
|
|
|
<a class="text-secondary" href="{% url 'overview' host.0 %}">{{ host.1 }}</a>
|
|
|
|
<span id="inst_count_badge_{{ host.1 }}" class="badge badge-secondary d-none">{{ insts.items|length }}</span>
|
2018-12-04 13:05:24 +00:00
|
|
|
</td>
|
2020-05-19 16:53:54 +00:00
|
|
|
<td class="d-none d-sm-table-cell"></td>
|
2018-07-30 10:33:09 +00:00
|
|
|
<td>
|
2020-05-21 22:13:39 +00:00
|
|
|
{% ifequal host.2 1 %}<span class="text-success">{% trans "Active" %}</span>{% endifequal %}
|
|
|
|
{% ifequal host.2 2 %}<span class="text-warning">{% trans "Not Active" %}</span>{% endifequal %}
|
|
|
|
{% ifequal host.2 3 %}<span class="text-danger">{% trans "Connection Failed" %}</span>{% endifequal %}
|
2018-07-30 10:33:09 +00:00
|
|
|
</td>
|
2020-05-19 16:53:54 +00:00
|
|
|
<td class="d-none d-sm-table-cell text-center">{{ host.3 }}</td>
|
|
|
|
<td class="d-none d-sm-table-cell text-right">{{ host.4|filesizeformat }}</td>
|
|
|
|
<td>
|
|
|
|
<div class="progress">
|
|
|
|
<div class="progress-bar bg-success" role="progressbar" style="width: {{ host.5 }}%"
|
|
|
|
aria-valuenow="{{ host.5 }}" aria-valuemin="0" aria-valuemax="100">{{ host.5 }}%
|
|
|
|
</div>
|
2018-07-30 10:33:09 +00:00
|
|
|
</div>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
|
2020-05-19 16:53:54 +00:00
|
|
|
{% for inst, vm in insts.items %}
|
2018-09-10 08:14:16 +00:00
|
|
|
<tr host="{{ host.1 }}">
|
2020-05-19 16:53:54 +00:00
|
|
|
<td class="text-right">{{ forloop.counter }} </td>
|
|
|
|
<td> 
|
|
|
|
<a class="text-secondary" href="{% url 'instance' host.0 inst %}">{{ inst }}</a><br>
|
|
|
|
<small><em>{{ vm.title }}</em></small>
|
2018-07-30 10:33:09 +00:00
|
|
|
</td>
|
2020-05-19 16:53:54 +00:00
|
|
|
<td class="d-none d-sm-table-cell">
|
|
|
|
<span class="font-small font-italic">
|
|
|
|
{% if vm.userinstances.count > 0 %} {{ vm.userinstances.first_user.user.username }}
|
|
|
|
{% if vm.userinstances.count > 1 %} (+{{ vm.userinstances.count|add:"-1" }}){% endif %}
|
|
|
|
{% endif %}
|
|
|
|
</span>
|
2018-07-30 10:33:09 +00:00
|
|
|
</td>
|
|
|
|
<td>
|
2020-05-19 16:53:54 +00:00
|
|
|
{% ifequal vm.status 1 %}<span class="text-success">{% trans "Active" %}</span>{% endifequal %}
|
|
|
|
{% ifequal vm.status 5 %}<span class="text-danger">{% trans "Off" %}</span>{% endifequal %}
|
|
|
|
{% ifequal vm.status 3 %}<span class="text-warning">{% trans "Suspend" %}</span>{% endifequal %}
|
2018-07-30 10:33:09 +00:00
|
|
|
</td>
|
2020-05-19 16:53:54 +00:00
|
|
|
<td class="d-none d-sm-table-cell text-center">{{ vm.vcpu }}</td>
|
|
|
|
<td class="d-none d-sm-table-cell text-right">{{ vm.memory |filesizeformat }}</td>
|
|
|
|
<td class="text-nowrap">
|
|
|
|
{% include 'instance_actions.html' %}
|
2018-07-30 10:33:09 +00:00
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
{% endfor %}
|
|
|
|
{% endfor %}
|
|
|
|
</tbody>
|
2018-09-10 08:14:16 +00:00
|
|
|
</table>
|
|
|
|
{% block script %}
|
|
|
|
<script>
|
2018-11-07 11:29:36 +00:00
|
|
|
function hide_all_host_instances() {
|
|
|
|
var rows = $('table tr');
|
|
|
|
all_host_rows = rows.filter('[host]');
|
|
|
|
all_host_rows.toggle();
|
2020-05-19 16:53:54 +00:00
|
|
|
$('span[id^=collapse_host_instances_]').toggleClass("fa-chevron-down").toggleClass("fa-chevron-up");
|
2020-05-21 22:13:39 +00:00
|
|
|
$('span[id^=inst_count_badge_]').toggleClass("d-none");
|
2018-11-07 11:29:36 +00:00
|
|
|
}
|
2018-09-10 08:14:16 +00:00
|
|
|
function hide_host_instances(host) {
|
|
|
|
var rows = $('table tr');
|
2018-11-25 09:27:30 +00:00
|
|
|
host_rows = rows.filter("[host='"+host+"']");
|
2018-09-10 08:14:16 +00:00
|
|
|
host_rows.toggle();
|
2020-05-19 16:53:54 +00:00
|
|
|
$("span[id='collapse_host_instances_"+host+"']").toggleClass("fa-chevron-down").toggleClass("fa-chevron-up");
|
2020-05-21 22:13:39 +00:00
|
|
|
$("span[id='inst_count_badge_"+host+"']").toggleClass("d-none");
|
2018-09-10 08:14:16 +00:00
|
|
|
}
|
|
|
|
</script>
|
|
|
|
{% endblock %}
|