1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2026-11-11 12:46:49 +00:00

fix(templates): the list pages search their rows as text, with one script

The list pages' search (filter-table.js) read what was typed as a
regular expression: a "(" or "[" stopped it with an error. It also
needed jQuery, while the instance list had its own script for the same
search. Both are now static/js/table_filter.js: plain text in any case,
the instance list's state list and host groups where a page has them,
remembered for a day as before. A group's header row is marked as one
(data-group-header) instead of being any row without a state.
This commit is contained in:
catborise 2026-10-25 22:59:36 +03:00
parent b4c999a22f
commit e5c7dc338d
14 changed files with 58 additions and 56 deletions

View file

@ -94,7 +94,7 @@
</div>
{% endblock content %}
{% block script %}
<script src="{% static 'js/instance_filter.js' %}"></script>
<script src="{% static 'js/table_filter.js' %}"></script>
<script src="{% static 'js/find_address.js' %}"></script>
{% if request.user.is_superuser %}
<script>

View file

@ -19,7 +19,7 @@
{% for compute in computes %}
<tbody class="searchable" data-host="{{ compute.name }}">
{% if compute.instance_set.count > 0 %}
<tr class="table-secondary fw-bold border-bottom border-dark" data-sort-method="none">
<tr class="table-secondary fw-bold border-bottom border-dark" data-sort-method="none" data-group-header>
<td>
<span id="collapse_host_instances_{{ compute.id }}" onclick="hide_host_instances('{{ compute.id }}');" class="bi bi-chevron-up" ></span>
</td>
@ -96,7 +96,7 @@
{% block script %}
<script>
// a collapsed host's VM rows are hidden by its table body's class, so the
// search (instance_filter.js, the hidden attribute) can still hide them too
// search (table_filter.js, the hidden attribute) can still hide them too
function hide_all_host_instances() {
$('tbody.searchable').toggleClass('host-collapsed');
$('span[id^=collapse_host_instances_]').toggleClass("bi bi-chevron-down ").toggleClass("bi bi-chevron-up");