1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2026-12-03 17:36:05 +00:00
webvirtcloud/computes/templates/computes/list.html
catborise f3a84bba53 feat(computes): the host overview shows its VMs, capacity and load, also when it cannot be reached
A host the panel could not reach made its overview the 500 page,
without the host's sections, and the Computes list gave such a host an
Overview button that led nowhere. The page now keeps the host's name,
sections, "Edit connection" and "Remove from panel" (the existing
confirmation), and says "Not connected" with the reason and a "Try
again". Details that cannot be read are said in an alert; the VMs,
capacity and load still show, as they are read on their own.

A reachable host's page leads with what it runs and what it gave:
- its VMs by state (running, shut off, paused, other), linked to
  Instances;
- the vCPUs, memory and storage pools given, as on the Computes list,
  which now shares those parts (computes/capacity_*.html) and their
  preparation (views.shown_capacity) with it;
- CPU and memory in use, side by side, with the current reading in
  words, a note on what the charts hold and when they were last
  updated, or since when not; memory in GB like the rest of the page;
- Hardware and Software and connection: logical CPUs and clock from
  virNodeGetInfo, but physical cores, sockets and NUMA nodes counted
  from the CPUs of the capabilities' NUMA cells, as virNodeGetInfo
  makes a topology up for hosts it cannot describe (asymmetric NUMA);
  the hypervisor's own name and version, libvirt, emulator, the guest
  architectures as text instead of menus of dead links. A host without
  sysinfo shows no processor instead of failing.
Empty notes no longer show "None"; labels stack over their values on a
phone instead of running into them.

Pools that cannot be read no longer drop a host's vCPUs and memory from
its capacity: the storage part says so. get_capacity also counts the
VMs by state.
2026-10-27 14:51:18 +03:00

90 lines
5 KiB
HTML

{% extends "base.html" %}
{% load i18n %}
{% load static %}
{% load common_tags %}
{% load bootstrap_icons %}
{% block title %}{% trans "Computes" %}{% endblock %}
{% block content %}
<div class="row">
<div class="col-lg-12">
{% include 'create_comp_block.html' %}
{% include 'search_block.html' %}
<h3 class="page-header">{% trans "Computes" %}</h3>
</div>
</div>
<div class="row">
{% if not computes %}
<div class="col-lg-12">
<div class="alert alert-warning shadow-sm">
{% bs_icon 'exclamation-triangle'%} <strong>{% trans "Warning" %}:</strong> {% trans "You don't have any computes" %}
</div>
</div>
{% else %}
<div class="col-lg-12">
{# position-relative: the hidden status texts are positioned within it, not the page #}
<div class="table-responsive position-relative">
<table class="table align-middle compute-list" data-sortable>
<thead>
<tr>
<th scope="col">{% trans "Host" %}</th>
<th scope="col" data-sort-method="number">{% trans "vCPUs" %}</th>
<th scope="col" data-sort-method="number">{% trans "Memory" %}</th>
<th scope="col" data-sort-method="none">{% trans "Storage" %}</th>
<th scope="col" data-sort-method="none"><span class="visually-hidden">{% trans "Actions" %}</span></th>
</tr>
</thead>
<tbody class="searchable">
{% for compute in computes %}
{% with given=compute.shown_capacity %}
<tr>
<td>
<div class="d-flex align-items-baseline gap-2">
{% if compute.status is True %}
<span class="compute-dot bg-success" title="{% trans "Connected" %}"></span>
<span class="visually-hidden">{% trans "Connected" %}</span>
{% else %}
<span class="compute-dot bg-danger" title="{% trans "Not Connected" %}"></span>
<span class="visually-hidden">{% trans "Not Connected" %}</span>
{% endif %}
<span class="fw-semibold">{{ compute.name }}</span>
</div>
<div class="small text-body-secondary ms-3">{{ compute.hostname }}{% if compute.details %}<br>{{ compute.details }}{% endif %}</div>
{% if compute.status is not True %}
<div class="small text-danger ms-3">{{ compute.connection_error }}</div>
{% endif %}
</td>
{% if given %}
<td data-sort="{{ given.ratio|stringformat:".2f" }}">
{% include "computes/capacity_vcpus.html" %}
</td>
<td data-sort="{{ given.memory_percent }}" class="compute-memory">
{% include "computes/capacity_memory.html" %}
</td>
<td class="compute-storage">
{% include "computes/capacity_storage.html" %}
</td>
{% else %}
<td colspan="3" class="small text-body-secondary">{% if compute.status is True %}{% trans "The capacity could not be read." %}{% else %}{% trans "No capacity while the host cannot be reached." %}{% endif %}</td>
{% endif %}
<td class="text-end">
<div class="btn-group">
{# a host the panel cannot reach opens too: its page says why #}
<a class="btn {% if compute.status is True %}btn-success{% else %}btn-light{% endif %}" title="{% trans "Overview" %}" href="{% url 'overview' compute.id %}">{% bs_icon 'eye-fill' %}</a>
<a class="btn btn-primary" title="{%trans "Edit" %}" href="{% url 'compute_update' compute.id %}">{% bs_icon 'pencil-fill' %}</a>
<a class="btn btn-danger" title="{%trans "Delete" %}" href="{% url 'compute_delete' compute.id %}">{% bs_icon 'x-circle-fill' %}</a>
</div>
</td>
</tr>
{% endwith %}
{% endfor %}
</tbody>
</table>
</div>
</div>
{% endif %}
</div>
{% endblock content %}
{% block script %}
<script src="{% static 'js/table_filter.js' %}"></script>
{% endblock script %}