From 7cf12b997ba469191e43dbbc9711dcad47f5a991 Mon Sep 17 00:00:00 2001 From: catborise Date: Sat, 24 Oct 2026 18:15:04 +0300 Subject: [PATCH] feat(tables): tables sort with tablesort, the grouped VM list within each host sortable.js 0.8.0 (abandoned since 2014) sorted only a table's first body: in the grouped VM list the first host's row moved among its VMs and the other hosts never sorted, and memory sorted as text ("1024 MB" before "512 MB"). tablesort 5.7.1 sorts each table body on its own and keeps a row marked data-sort-method="none" in place, so hosts stay in name order with their row on top and their VMs sort below it. Memory, vCPUs and volume sizes sort by their numbers (data-sort). Headers are reachable by keyboard and carry aria-sort. base.html loads tablesort for every table marked data-sortable; the per-page sortable includes and sortable-theme-bootstrap.css go, so these tables take the theme's table style like the others. The grouped list's row numbers go (meaningless once sorted). The VM owners and VM logs tables were marked sortable but never loaded the script; they stay unsorted. --- computes/templates/computes/instances.html | 16 +-- computes/templates/computes/list.html | 5 +- instances/templates/allinstances.html | 4 - .../templates/allinstances_index_grouped.html | 20 ++-- .../allinstances_index_nongrouped.html | 12 +- .../templates/instances/settings_tab.html | 2 +- instances/templates/instances/stats_tab.html | 2 +- instances/tests/test_index.py | 9 -- instances/tests/test_states.py | 4 + nwfilters/templates/nwfilter.html | 1 - nwfilters/templates/nwfilters.html | 7 +- static/css/sortable-theme-bootstrap.css | 109 ------------------ static/css/webvirtcloud.css | 21 ++++ static/js/sort_tables.js | 6 + static/js/sortable.min.js | 2 - static/js/tablesort.min.js | 6 + static/js/tablesort.number.min.js | 6 + storages/templates/storage.html | 18 ++- templates/base.html | 4 + virtsecrets/templates/secrets.html | 10 +- 20 files changed, 84 insertions(+), 180 deletions(-) delete mode 100755 static/css/sortable-theme-bootstrap.css create mode 100644 static/js/sort_tables.js delete mode 100755 static/js/sortable.min.js create mode 100644 static/js/tablesort.min.js create mode 100644 static/js/tablesort.number.min.js diff --git a/computes/templates/computes/instances.html b/computes/templates/computes/instances.html index 0a55991c..a8e5b211 100644 --- a/computes/templates/computes/instances.html +++ b/computes/templates/computes/instances.html @@ -4,9 +4,6 @@ {% load operations %} {% load bootstrap_icons %} {% block title %}{% trans "Instances" %} - {{ compute.name }}{% endblock %} -{% block style %} - -{% endblock %} {% block page_heading %}{{ compute.name }} - {% trans "Instances" %}{% endblock page_heading %} {% block page_heading_extra %} @@ -67,15 +64,15 @@ {% else %}
- +
- - - + + + @@ -99,8 +96,8 @@ - - + + @@ -116,6 +113,5 @@ {% block script %} {% job_panel_script job_resource %} - {% endblock %} \ No newline at end of file diff --git a/computes/templates/computes/list.html b/computes/templates/computes/list.html index d7af461c..a8e4fb9e 100644 --- a/computes/templates/computes/list.html +++ b/computes/templates/computes/list.html @@ -22,13 +22,13 @@ {% else %}
-
{% trans 'Name' %}
{% trans 'Description' %}
{% trans 'User' %} {% trans 'Status' %}{% trans 'VCPU' %}{% trans 'Memory' %}{% trans 'Actions' %}{% trans 'VCPU' %}{% trans 'Memory' %}{% trans 'Actions' %}
{% include 'instance_state.html' %} {{ instance.info.3 }}

{% if instance.info %}{% widthratio instance.info.1 1024 1 %} MiB{% endif %}

{{ instance.info.3 }}

{% if instance.info %}{% widthratio instance.info.1 1024 1 %} MiB{% endif %}

{% include 'instance_actions.html' %}
+
- + @@ -67,6 +67,5 @@ {% endblock content %} {% block script %} - {% endblock script %} diff --git a/instances/templates/allinstances.html b/instances/templates/allinstances.html index 835fd56f..684c4e59 100644 --- a/instances/templates/allinstances.html +++ b/instances/templates/allinstances.html @@ -2,9 +2,6 @@ {% load i18n %} {% load static %} {% block title %}{% trans "Instances" %}{% endblock %} -{% block style %} - -{% endblock %} {% block page_heading %}{% trans "Instances" %}{% endblock page_heading %} {% block page_heading_extra %} @@ -47,7 +44,6 @@ {% endblock content %} {% block script %} - {% if request.user.is_superuser %} {% job_panel_script job_resource %} - + + + + -{% endblock %} \ No newline at end of file
{% trans "Name" %} {% trans "Status" %} {% trans "Details" %}{% trans "Actions" %}{% trans "Actions" %}