2018-07-30 10:33:09 +00:00
{% load i18n %}
< table class = "table table-hover table-striped sortable-theme-bootstrap" >
< thead >
< tr >
2018-11-07 11:29:36 +00:00
< th > < a href = "#" id = "hide_all_instances" onclick = "hide_all_host_instances()" > #< / a > < / th >
2019-07-31 08:03:48 +00:00
< th > {% trans "Name" %}< br > {% trans "Description" %}< / th >
2018-08-02 07:22:36 +00:00
< th > {% trans "User"%}< / th >
< th > {% trans "Status" %}< / th >
< th > {% trans "VCPU" %}< / th >
< th > {% trans "Memory" %}< / th >
2018-11-14 11:04:37 +00:00
< th style = "width:205px;" > {% trans "Actions & Mem Usage" %}< / th >
2018-07-30 10:33:09 +00:00
< / tr >
< / thead >
< tbody class = "searchable" >
{% for host, inst in all_host_vms.items %}
2018-08-02 07:22:36 +00:00
< tr class = "active" style = "font-weight: bold;border-bottom: 2px solid darkgray;border-top: 2px solid darkgray;" >
2018-09-10 08:14:16 +00:00
< td >
< span id = "collapse_host_instances_{{ host.1 }}" class = "glyphicon glyphicon-chevron-up" onclick = "hide_host_instances('{{ host.1 }}');" > < / span >
< / td >
2018-12-04 13:05:24 +00:00
< td >
< a href = "{% url 'overview' host.0 %}" > {{ host.1 }}< / a >
< span id = "inst_count_badge_{{ host.1 }}" class = "badge hidden" > {{ inst.items|length }}< / span >
< / td >
2018-07-30 10:33:09 +00:00
< td > < / td >
< td >
{% ifequal host.2 1 %}< span class = "label label-success" > {% trans "Active" %}< / span > {% endifequal %}
{% ifequal host.2 2 %}< span class = "label label-danger" > {% trans "Not Active" %}< / span > {% endifequal %}
{% ifequal host.2 3 %}< span class = "label label-danger" > {% trans "Connection Failed" %}< / span > {% endifequal %}
< / td >
< td style = "text-align:center;" > {{ host.3 }}< / td >
< td style = "text-align:right;" > {{ host.4|filesizeformat }}< / td >
< td style = "text-align:left;" >
2018-08-02 07:22:36 +00:00
< div class = "progress-bar progress-bar-success" role = "progressbar" style = "width: {{ host.5 }}%"
2018-07-30 10:33:09 +00:00
aria-valuenow="{{ host.5 }}" aria-valuemin="0" aria-valuemax="100">{{ host.5 }}%
< / div >
< / td >
< / tr >
{% for vm, info in inst.items %}
2018-09-10 08:14:16 +00:00
< tr host = "{{ host.1 }}" >
2018-07-30 10:33:09 +00:00
< td style = "text-align: right" > {{ forloop.counter }} < / td >
< td >   < a href = "{% url 'instance' host.0 vm %}" > {{ vm }}< / a > < br >
< small > < em > {{ info.title }}< / em > < / small >
< / td >
< td >
< 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 style = "text-align:center;" > {{ info.vcpu }}< / td >
< td style = "text-align:right;" > {{ 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 %}
2019-07-31 06:59:44 +00:00
< button class = "btn btn-sm btn-default disabled" title = "{% trans " Suspend " % } " disabled >
2018-07-30 10:33:09 +00:00
< span class = "glyphicon glyphicon-pause" > < / span >
< / button >
2019-07-31 06:59:44 +00:00
< button class = "btn btn-sm btn-default disabled" title = "{% trans " Power Off " % } " disabled >
2018-07-30 10:33:09 +00:00
< span class = "glyphicon glyphicon-off" > < / span >
< / button >
2019-07-31 06:59:44 +00:00
< button class = "btn btn-sm btn-default disabled" title = "{% trans " Power Cycle " % } " disabled >
2018-07-30 10:33:09 +00:00
< span class = "glyphicon glyphicon-refresh" > < / span >
< / button >
2019-07-31 06:59:44 +00:00
< button class = "btn btn-sm btn-default disabled" title = "{% trans " VNC Console " % } " disabled >
2018-07-30 10:33:09 +00:00
< 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 >
2019-07-31 06:59:44 +00:00
< button class = "btn btn-sm btn-default disabled" title = "{% trans " Suspend " % } " disabled >
2018-07-30 10:33:09 +00:00
< span class = "glyphicon glyphicon-pause" > < / span >
< / button >
2019-07-31 06:59:44 +00:00
< button class = "btn btn-sm btn-default" type = "submit" name = "powerforce" title = "{% trans " Force Off " % } " onclick = "return confirm('Are you sure to force it down?')" >
2018-07-30 10:33:09 +00:00
< span class = "glyphicon glyphicon-off" > < / span >
< / button >
2019-07-31 06:59:44 +00:00
< button class = "btn btn-sm btn-default disabled" title = "{% trans " Power Cycle " % } " disabled >
2018-07-30 10:33:09 +00:00
< span class = "glyphicon glyphicon-refresh" > < / span >
< / button >
2019-07-31 06:59:44 +00:00
< button class = "btn btn-sm btn-default disabled" title = "{% trans " VNC Console " % } " disabled >
2018-07-30 10:33:09 +00:00
< span class = "glyphicon glyphicon-eye-open" > < / span >
< / button >
{% endifequal %}
{% ifequal info.status 1 %}
2019-07-31 06:59:44 +00:00
< button class = "btn btn-sm btn-default disabled" title = "{% trans " Power On " % } " disabled >
2018-07-30 10:33:09 +00:00
< 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 >
2019-07-31 06:59:44 +00:00
< button class = "btn btn-sm btn-default" type = "button" onclick = 'open_console("{{ host.0 }}-{{ info.uuid }}")' title = "{% trans " Console " % } " >
2018-07-30 10:33:09 +00:00
< span class = "glyphicon glyphicon-eye-open" > < / span >
2019-07-31 06:59:44 +00:00
< / button >
2018-07-30 10:33:09 +00:00
{% endifequal %}
< / form >
< / 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();
2018-11-14 11:39:18 +00:00
$('span[id^=collapse_host_instances_]').toggleClass("glyphicon-chevron-down").toggleClass("glyphicon-chevron-up");
2018-12-04 13:05:24 +00:00
$('span[id^=inst_count_badge_]').toggleClass("hidden");
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();
2018-11-25 10:41:49 +00:00
$("span[id='collapse_host_instances_"+host+"']").toggleClass("glyphicon-chevron-down").toggleClass("glyphicon-chevron-up");
2018-12-04 13:05:24 +00:00
$("span[id='inst_count_badge_"+host+"']").toggleClass("hidden");
2018-09-10 08:14:16 +00:00
}
< / script >
{% endblock %}