1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2024-11-01 12:04:15 +00:00
webvirtcloud/instances/templates/allinstances_index_grouped.html

106 lines
5.4 KiB
HTML
Raw Normal View History

{% load i18n %}
2020-07-13 09:33:09 +00:00
{% load icons %}
2020-05-19 16:53:54 +00:00
<table class="table table-hover sortable-theme-bootstrap" data-sortable>
<thead>
<tr>
<th scope="col" data-sortable="false"><a class="link-primary" href="#" id="hide_all_instances" onclick="hide_all_host_instances()">#</a></th>
2020-07-13 09:33:09 +00:00
<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>
2022-06-29 13:08:07 +00:00
{% if app_settings.VM_DRBD_STATUS == 'True' %}
2022-06-15 11:51:56 +00:00
<th scope="col">{% trans "Role/Disk" %}</th>
2022-06-29 13:08:07 +00:00
{% endif %}
2020-07-13 09:33:09 +00:00
<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>
</tr>
</thead>
{% for compute in computes %}
<tbody class="searchable">
2020-07-13 09:33:09 +00:00
{% if compute.status is True and compute.instance_set.count > 0 %}
<tr class="table-secondary fw-bold border-bottom border-dark">
2020-07-13 09:33:09 +00:00
<td>
<span id="collapse_host_instances_{{ compute.id }}" class="fa fa-chevron-up" onclick="hide_host_instances('{{ compute.id }}');"></span>
</td>
<td>
<a class="link-dark" href="{% url 'overview' compute.id %}">{{ compute.name }}</a>
<span id="inst_count_badge_{{ compute.id }}" class="badge bg-secondary d-none">{{ compute.instance_set.count }}</span>
2020-07-13 09:33:09 +00:00
</td>
<td class="d-none d-sm-table-cell"></td>
<td>
<span class="text-success">{% trans "Connected" %}</span>
</td>
2022-06-29 13:08:07 +00:00
{% if app_settings.VM_DRBD_STATUS == 'True' %}
2022-06-15 11:51:56 +00:00
<td class="d-none d-sm-table-cell"></td>
2022-06-29 13:08:07 +00:00
{% endif %}
2020-07-13 09:33:09 +00:00
<td class="d-none d-sm-table-cell text-center">{{ compute.cpu_count }}</td>
<td class="d-none d-sm-table-cell text-right">{{ compute.ram_size|filesizeformat }}</td>
<td>
<div class="progress">
<div class="progress-bar bg-success" role="progressbar" style="width: {{ compute.ram_usage }}%"
aria-valuenow="{{ compute.ram_usage }}" aria-valuemin="0" aria-valuemax="100">{{ compute.ram_usage }}%
</div>
</div>
</td>
</tr>
{% for instance in compute.instance_set.all %}
<tr host="{{ compute.id }}">
<td class="text-right">{{ forloop.counter }} </td>
<td>
<a class="link-primary" href="{% url 'instances:instance' instance.id %}">{{ instance.name }}</a>
<br>
<p class="m-0 small fst-italic">{{ instance.title }}</p>
2020-07-13 09:33:09 +00:00
</td>
<td>
<em>
{% if instance.userinstance_set.all.count > 0 %}
{{ instance.userinstance_set.all.0.user }}
{% if instance.userinstance_set.all.count > 1 %}
(+{{ instance.userinstance_set.all.count|add:"-1" }})
{% endif %}
{% endif %}
</em>
</td>
<td>
{% if instance.proxy.instance.info.0 == 1 %}<span class="text-success">{% trans "Active" %}</span>{% endif %}
{% if instance.proxy.instance.info.0 == 5 %}<span class="text-danger">{% trans "Off" %}</span>{% endif %}
{% if instance.proxy.instance.info.0 == 3 %}
<span class="text-warning">{% trans "Suspended" %}</span>
{% endif %}
</td>
2022-06-29 13:08:07 +00:00
{% if app_settings.VM_DRBD_STATUS == 'True' %}
2022-06-15 11:51:56 +00:00
<td>
{% if instance.drbd == "Primary/OK" or instance.drbd == "Secondary/OK" %}<span class="text-success">{% else %}<span class="text-danger">{% endif %}{{ instance.drbd }}</span>
</td>
2022-06-29 13:08:07 +00:00
{% endif %}
2020-07-13 09:33:09 +00:00
<td>{{ instance.proxy.instance.info.3 }}</td>
<td>{{ instance.cur_memory }} MB</td>
<td class="text-nowrap">
{% include 'instance_actions.html' %}
</td>
</tr>
{% endfor %}
{% endif %}
</tbody>
{% endfor %}
</table>
2020-07-13 09:33:09 +00:00
{% block script %}
<script>
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");
$('span[id^=inst_count_badge_]').toggleClass("d-none");
}
function hide_host_instances(host) {
var rows = $('table tr');
host_rows = rows.filter("[host='"+host+"']");
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");
$("span[id='inst_count_badge_"+host+"']").toggleClass("d-none");
}
</script>
{% endblock %}