mirror of
https://github.com/retspen/webvirtcloud
synced 2026-12-02 17:06:09 +00:00
- An empty list says so in gray text, as the VM list does, not in a yellow warning or a blue notice (host pools, networks, filters, secrets, interfaces, tags, removed VMs, backups, schedules, targets). - The Jobs and Backups filters show only while there is something to filter. - The Jobs, Backups and Logs filters apply once a choice changes or Enter is pressed (filter_form.js): no Filter or Search button, and Clear the filters only while one is set. - On a phone the Logs table shows the date, user, VM and message, with the result under it, and the Computes table the host and its memory.
69 lines
4.1 KiB
HTML
69 lines
4.1 KiB
HTML
{% extends "base.html" %}
|
|
{% load i18n %}
|
|
{% load static %}
|
|
{% load django_bootstrap5 %}
|
|
{% load bootstrap_icons %}
|
|
|
|
{% block title %}{% trans "Logs" %}{% endblock %}
|
|
|
|
{% block page_heading %}{% trans "Logs" %}{% endblock page_heading %}
|
|
|
|
{% block page_heading_extra %}
|
|
<a class="btn btn-outline-primary" href="{% url 'admin:logs_export' %}{% if query %}?{{ query }}{% endif %}"
|
|
title="{% trans 'Download these rows as an Excel file' %}"><span aria-hidden="true">{% bs_icon 'download' %}</span> {% trans "Excel" %}</a>
|
|
{% endblock page_heading_extra %}
|
|
|
|
{% block content %}
|
|
<div class="card mb-3">
|
|
{# the search runs on the server over every row; the download takes the same rows #}
|
|
<form method="get" class="card-header d-flex flex-wrap align-items-center gap-2" role="search" data-filter-form>
|
|
<span class="me-auto">{% trans "Logs" %} <span class="badge text-bg-light border">{{ logs.paginator.count }}</span></span>
|
|
<input name="q" value="{{ q }}" class="form-control form-control-sm w-auto" type="search" placeholder="{% trans 'Search' %}"
|
|
aria-label="{% trans 'Search the logs' %}">
|
|
<div class="form-check mb-0">
|
|
<input id="logs-failed" class="form-check-input" type="checkbox" name="failed" value="1"{% if failed %} checked{% endif %}>
|
|
<label class="form-check-label small" for="logs-failed">{% trans "Failed only" %}</label>
|
|
</div>
|
|
{% if q or failed %}<a class="btn btn-sm btn-link" href="{% url 'admin:logs' %}">{% trans "Clear the filters" %}</a>{% endif %}
|
|
</form>
|
|
{% if not logs %}
|
|
<div class="card-body text-center text-body-secondary">
|
|
{% if q or failed %}{% trans "No log rows match." %}{% else %}{% trans "There are no log rows yet." %}{% endif %}
|
|
</div>
|
|
{% else %}
|
|
<div class="table-responsive position-relative">
|
|
<table class="table table-hover align-middle mb-0">
|
|
{# on a phone: the date, who, which VM, and what, with how it ended under it #}
|
|
<thead>
|
|
<tr>
|
|
<th scope="col" class="d-none d-md-table-cell">#</th>
|
|
<th scope="col">{% blocktrans %}Date ({{ time_zone }}){% endblocktrans %}</th>
|
|
<th scope="col">{% trans "User" %}</th>
|
|
<th scope="col" class="d-none d-md-table-cell">{% trans "Host" %}</th>
|
|
<th scope="col">{% trans "Instance" %}</th>
|
|
<th scope="col">{% trans "Message" %}</th>
|
|
<th scope="col" class="d-none d-md-table-cell">{% trans "Result" %}</th>
|
|
<th scope="col" class="d-none d-md-table-cell">{% trans "IP" %}</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{% for log in logs %}
|
|
<tr>
|
|
<td class="small text-body-secondary d-none d-md-table-cell">{{ log.id }}</td>
|
|
<td class="small"><span class="text-nowrap">{{ log.date|date:"Y-m-d" }}</span> <span class="text-nowrap">{{ log.date|date:"H:i:s" }}</span></td>
|
|
<td>{{ log.user }}</td>
|
|
<td class="d-none d-md-table-cell">{{ log.host }}</td>
|
|
<td>{% if log.vm_pk %}<a href="{% url 'instances:instance' log.vm_pk %}">{{ log.instance }}</a>{% else %}{{ log.instance }}{% endif %}</td>
|
|
<td class="log-message">{{ log.message }}<div class="d-md-none">{% include "admin/log_result.html" %}</div></td>
|
|
<td class="d-none d-md-table-cell">{% include "admin/log_result.html" %}</td>
|
|
<td class="small font-monospace d-none d-md-table-cell">{{ log.ip|default:"" }}</td>
|
|
</tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
{% endif %}
|
|
</div>
|
|
{% if logs %}{% bootstrap_pagination logs extra=query pages_to_show=5 extra_classes="flex-wrap" %}{% endif %}
|
|
{% endblock %}
|
|
{% block script %}<script src="{% static 'js/filter_form.js' %}"></script>{% endblock %}
|