1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2024-12-24 23:25:24 +00:00

add instance count to host collapse

This commit is contained in:
catborise 2018-12-04 16:05:24 +03:00
parent 62908f477c
commit 04d3568d1a

View file

@ -17,7 +17,10 @@
<td> <td>
<span id="collapse_host_instances_{{ host.1 }}" class="glyphicon glyphicon-chevron-up" onclick="hide_host_instances('{{ host.1 }}');"></span> <span id="collapse_host_instances_{{ host.1 }}" class="glyphicon glyphicon-chevron-up" onclick="hide_host_instances('{{ host.1 }}');"></span>
</td> </td>
<td><a href="{% url 'overview' host.0 %}">{{ host.1 }}</a></td> <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>
<td></td> <td></td>
<td> <td>
{% ifequal host.2 1 %}<span class="label label-success">{% trans "Active" %}</span>{% endifequal %} {% ifequal host.2 1 %}<span class="label label-success">{% trans "Active" %}</span>{% endifequal %}
@ -129,13 +132,14 @@ function hide_all_host_instances() {
all_host_rows = rows.filter('[host]'); all_host_rows = rows.filter('[host]');
all_host_rows.toggle(); all_host_rows.toggle();
$('span[id^=collapse_host_instances_]').toggleClass("glyphicon-chevron-down").toggleClass("glyphicon-chevron-up"); $('span[id^=collapse_host_instances_]').toggleClass("glyphicon-chevron-down").toggleClass("glyphicon-chevron-up");
$('span[id^=inst_count_badge_]').toggleClass("hidden");
} }
function hide_host_instances(host) { function hide_host_instances(host) {
var rows = $('table tr'); var rows = $('table tr');
host_rows = rows.filter("[host='"+host+"']"); host_rows = rows.filter("[host='"+host+"']");
host_rows.toggle(); host_rows.toggle();
$("span[id='collapse_host_instances_"+host+"']").toggleClass("glyphicon-chevron-down").toggleClass("glyphicon-chevron-up"); $("span[id='collapse_host_instances_"+host+"']").toggleClass("glyphicon-chevron-down").toggleClass("glyphicon-chevron-up");
$("span[id='inst_count_badge_"+host+"']").toggleClass("hidden");
} }
</script> </script>
{% endblock %} {% endblock %}