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

toggle host instances button in grouped view

This commit is contained in:
Ing. Jan KRCMAR 2018-09-10 10:14:16 +02:00 committed by catborise
parent 7da5095220
commit 76f857d218

View file

@ -14,7 +14,9 @@
<tbody class="searchable"> <tbody class="searchable">
{% for host, inst in all_host_vms.items %} {% for host, inst in all_host_vms.items %}
<tr class="active" style="font-weight: bold;border-bottom: 2px solid darkgray;border-top: 2px solid darkgray;"> <tr class="active" style="font-weight: bold;border-bottom: 2px solid darkgray;border-top: 2px solid darkgray;">
<td><span class="fa fa-server"></span> </td> <td>
<span id="collapse_host_instances_{{ host.1 }}" class="glyphicon glyphicon-chevron-up" onclick="hide_host_instances('{{ host.1 }}');"></span>
</td>
<td><a href="{% url 'overview' host.0 %}">{{ host.1 }}</a></td> <td><a href="{% url 'overview' host.0 %}">{{ host.1 }}</a></td>
<td></td> <td></td>
<td> <td>
@ -32,7 +34,7 @@
</tr> </tr>
{% for vm, info in inst.items %} {% for vm, info in inst.items %}
<tr> <tr host="{{ host.1 }}">
<td style="text-align: right">{{ forloop.counter }} </td> <td style="text-align: right">{{ forloop.counter }} </td>
<td>&emsp; <a href="{% url 'instance' host.0 vm %}">{{ vm }}</a><br> <td>&emsp; <a href="{% url 'instance' host.0 vm %}">{{ vm }}</a><br>
<small><em>{{ info.title }}</em></small> <small><em>{{ info.title }}</em></small>
@ -119,4 +121,15 @@
{% endfor %} {% endfor %}
{% endfor %} {% endfor %}
</tbody> </tbody>
</table> </table>
{% block script %}
<script>
function hide_host_instances(host) {
var rows = $('table tr');
host_rows = rows.filter('[host='+host+']');
host_rows.toggle();
$('span#collapse_host_instances_'+host).toggleClass("glyphicon-chevron-down").toggleClass("glyphicon-chevron-up");
}
</script>
{% endblock %}