mirvmon/templates/alerts/index.twig

60 lines
3.2 KiB
Twig
Executable File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{% extends "layout.twig" %}
{% block content %}
<div class="row">
<div class="col-12">
<div class="d-flex justify-content-between align-items-center mb-3">
<h2><i class="fas fa-bell"></i> Алерты</h2>
</div>
<div class="card">
<div class="card-body">
{% if alerts|length > 0 %}
<div class="table-responsive">
<table class="table table-striped">
<thead>
<tr>
<th>Сервер</th>
<th>Метрика</th>
<th>Значение</th>
<th>Уровень</th>
<th>Время</th>
<th>Действия</th>
</tr>
</thead>
<tbody>
{% for alert in alerts %}
<tr class="{% if alert.severity == 'critical' %}table-danger{% else %}table-warning{% endif %}">
<td>{{ alert.server_name }}</td>
<td>{{ alert.metric_name|replace({'_': ' ', 'load': 'загрузка', 'used': 'использование'})|title }}</td>
<td>{{ alert.value }}{% if alert.metric_name ends_with '_load' or alert.metric_name ends_with '_used' %}%{% endif %}</td>
<td>
{% if alert.severity == 'critical' %}
<span class="badge bg-danger"><i class="fas fa-exclamation-triangle"></i> Критично</span>
{% else %}
<span class="badge bg-warning text-dark"><i class="fas fa-exclamation-circle"></i> Предупреждение</span>
{% endif %}
</td>
<td>{{ alert.created_at|date('d.m.Y H:i:s') }}</td>
<td>
<a href="/alerts/{{ alert.id }}/resolve" class="btn btn-sm btn-outline-success" onclick="return confirm('Вы уверены, что хотите отметить этот алерт как исправленный?');">
<i class="fas fa-check"></i> <span class="d-none d-sm-inline">Исправлено</span>
</a>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% else %}
<div class="text-center py-5">
<i class="fas fa-bell fa-3x text-muted mb-3"></i>
<p class="lead">Нет активных алертов</p>
<p class="text-muted">Все серверы работают в штатном режиме</p>
</div>
{% endif %}
</div>
</div>
</div>
</div>
{% endblock %}