From 2d80f21a4ab9536e1ef63cc3a674f2e827eb7ab3 Mon Sep 17 00:00:00 2001 From: catborise Date: Tue, 27 Oct 2026 22:20:50 +0300 Subject: [PATCH] fix(instances): the VM list searches its VMs, collapses its hosts together and says when it is empty - The search read a row's whole text, so a word on a button or in a state label matched every row. VM rows now carry data-search (the name, title and owners, and the host in the flat list), and table_filter.js searches that text when a row has it; the state has its own filter. - Nothing matching left an empty table. table_filter.js shows the page's #no-match while no row does; the VM list's says so and offers "Clear the filters". A user with no VMs at all is told so instead of an empty table. - The grouped list's "#" toggled each host on its own: a host collapsed by hand opened while the others closed. It now collapses every host, or opens them all once all are collapsed. - One alert names every host the panel cannot reach, with why, in place of one dismissible alert per host; users who see no hosts keep their own message. - A host's VM list showed a VM's maximum memory, the Instances page its current memory: both show the current memory now. - The owners' users are prefetched with the VMs; the flat list's Bootstrap 4 font-italic is fst-italic. --- computes/templates/computes/instances.html | 2 +- instances/templates/allinstances.html | 29 ++++++++++++------ .../templates/allinstances_index_grouped.html | 22 +++++++++----- .../allinstances_index_nongrouped.html | 5 ++-- instances/tests/js/table_filter.test.js | 27 +++++++++++++---- instances/tests/test_list_rpc.py | 7 +++-- instances/tests/test_states.py | 22 ++++++++++++++ instances/views.py | 7 +++-- static/js/table_filter.js | 30 +++++++++++++++---- 9 files changed, 114 insertions(+), 37 deletions(-) diff --git a/computes/templates/computes/instances.html b/computes/templates/computes/instances.html index c61739cc..dfceb80b 100644 --- a/computes/templates/computes/instances.html +++ b/computes/templates/computes/instances.html @@ -72,7 +72,7 @@ {% include 'instance_state.html' %} {{ instance.info.3 }} -

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

+

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

{% include 'instance_actions.html' %} diff --git a/instances/templates/allinstances.html b/instances/templates/allinstances.html index 0b8ebe41..e3d5e000 100644 --- a/instances/templates/allinstances.html +++ b/instances/templates/allinstances.html @@ -26,14 +26,18 @@ {% block content %} {% if show_hosts %} - {% for compute in computes %} - {% if compute.status is not True %} - - {% endif %} - {% endfor %} + {% if unreachable_computes %} + {# one alert for every host the panel cannot reach, each with why #} + + {% endif %} {% elif own_hosts_down %} {% endif %}
- {% if app_settings.VIEW_INSTANCES_LIST_STYLE == 'grouped' and request.user.is_superuser %} + {% if not instances.exists %} +

{% trans "There are no VMs here yet." %}

+ {% elif app_settings.VIEW_INSTANCES_LIST_STYLE == 'grouped' and request.user.is_superuser %} {% include 'allinstances_index_grouped.html' %} {% else %} {% include 'allinstances_index_nongrouped.html' %} {% endif %} + {# table_filter.js shows it while no row matches #} +