mirror of
https://github.com/retspen/webvirtcloud
synced 2026-11-09 11:46:49 +00:00
The instance list showed every user an alert for each compute that was not connected, with the compute's name and libvirt's error text. That text names the host and how it is reached (for example "ssh: connect to host 10.20.30.132 port 22: No route to host"), while the list hides host names from users who are not administrators. - Superusers and users with the global view_instances permission see each unreachable host and its error, as before. - Other users see one alert without host details, and only when a host of their own VMs is down. It explains why those VMs show as unknown. - The alerts' close button works (data-bs-dismiss was "modal"). Checked against the test setup with an unreachable compute that holds a user's VM: the user sees the VM as unknown and the alert, but no host name, address or error text; a superuser still sees them. The tests for the user fail on the previous code.
52 lines
2.1 KiB
HTML
52 lines
2.1 KiB
HTML
{% extends "base.html" %}
|
|
{% load i18n %}
|
|
{% load static %}
|
|
{% block title %}{% trans "Instances" %}{% endblock %}
|
|
{% block style %}
|
|
<link rel="stylesheet" href="{% static 'css/sortable-theme-bootstrap.css' %}" />
|
|
{% endblock %}
|
|
{% block page_heading %}{% trans "Instances" %}{% endblock page_heading %}
|
|
|
|
{% block page_heading_extra %}
|
|
{% if request.user.is_superuser %}
|
|
{% include 'create_inst_block.html' %}
|
|
{% endif %}
|
|
{% include 'search_block.html' %}
|
|
{% endblock page_heading_extra %}
|
|
|
|
{% block content %}
|
|
{% if show_hosts %}
|
|
{% for compute in computes %}
|
|
{% if compute.status is not True %}
|
|
<div class="alert alert-danger alert-dismissible fade show" role="alert">
|
|
{% trans 'Problem occurred with host' %} {{ compute.name }}: {{ compute.connection_error }}
|
|
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
|
|
</div>
|
|
{% endif %}
|
|
{% endfor %}
|
|
{% elif own_hosts_down %}
|
|
<div class="alert alert-warning alert-dismissible fade show" role="alert">
|
|
{% trans 'A host of some of your virtual machines cannot be reached right now.' %}
|
|
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
|
|
</div>
|
|
{% endif %}
|
|
<div class="col-lg-12">
|
|
{% if app_settings.VIEW_INSTANCES_LIST_STYLE == 'grouped' and request.user.is_superuser %}
|
|
{% include 'allinstances_index_grouped.html' %}
|
|
{% else %}
|
|
{% include 'allinstances_index_nongrouped.html' %}
|
|
{% endif %}
|
|
</div>
|
|
{% endblock content %}
|
|
{% block script %}
|
|
<script src="{% static 'js/sortable.min.js' %}"></script>
|
|
<script src="{% static 'js/filter-table.js' %}"></script>
|
|
{% if request.user.is_superuser %}
|
|
<script>
|
|
function goto_compute(compute) {
|
|
//let compute = $("#compute_select").val();
|
|
window.location.href = "{% url 'instances:create_instance_select_type' 1 %}".replace(1, compute);
|
|
}
|
|
</script>
|
|
{% endif %}
|
|
{% endblock script %}
|