+ update emblemed support in iframe and list view

This commit is contained in:
Robin
2025-10-06 12:54:41 +02:00
parent 988ab003ad
commit ca02212004
8 changed files with 416 additions and 98 deletions

11
templates/_footer.html Normal file
View File

@@ -0,0 +1,11 @@
<footer class="footer mt-auto py-3 bg-light border-top">
<div class="container text-center">
<span class="text-muted">
&copy; {{ now.year }} <a href="https://rl-dev.de" target="_blank" class="text-decoration-none">rl-dev.de</a>
</span>
<span class="mx-2 text-muted">|</span>
<a href="https://git.rl-dev.de/Robin/Uptime-Stats" target="_blank" class="text-decoration-none text-muted">
<i class="bi bi-git"></i> Source Code
</a>
</div>
</footer>

View File

@@ -0,0 +1,13 @@
<td>
{% if monitor.status_override == 'MAINTENANCE' %}
<span class="badge bg-primary">Wartung <i class="bi bi-tools"></i></span>
{% elif monitor.status_override == 'DEGRADED' %}
<span class="badge bg-warning text-dark">Probleme <i class="bi bi-exclamation-triangle"></i></span>
{% elif last_log and last_log.is_up %}
<span class="badge bg-success status-badge">Up <i class="bi bi-check-circle"></i></span>
{% elif last_log and not last_log.is_up %}
<span class="badge bg-danger status-badge">Down <i class="bi bi-x-circle"></i></span>
{% else %}
<span class="badge bg-secondary">Unbekannt <i class="bi bi-question-circle"></i></span>
{% endif %}
</td>

View File

@@ -0,0 +1,16 @@
{% extends 'admin/master.html' %}
{% block body %}
<h1>iFrame-Einbettungscode</h1>
<p>Kopieren Sie den folgenden HTML-Code, um die Status-Tabelle auf einer anderen Seite oder in Ihrem Intranet einzubetten:</p>
<div class="card">
<div class="card-body bg-light">
<pre><code>&lt;iframe src="{{ url_for('status', _external=True) }}" style="width: 100%; height: 400px; border: none;"&gt;&lt;/iframe&gt;</code></pre>
</div>
</div>
<p class="mt-4">
<a href="{{ url_for('admin.index') }}" class="btn btn-primary"><i class="bi bi-arrow-left"></i> Zurück zum Dashboard</a>
</p>
{% endblock %}

View File

@@ -1,78 +1,86 @@
{% extends 'layout.html' %}
{% block title %}Statusübersicht - Uptime Stats{% endblock %}
{% block content %}
<div class="container">
<h1 class="mb-4">Statusübersicht</h1>
{% if not monitors %}
<div class="alert alert-info text-center">
<h4>Noch keine Monitore konfiguriert.</h4>
<p>Bitte fügen Sie im <a href="{{ url_for('admin.index') }}" class="alert-link">Admin-Bereich</a> einen Monitor hinzu, um mit der Überwachung zu beginnen.</p>
</div>
{% else %}
<div class="row">
{% for monitor in monitors %}
<div class="col-lg-4 col-md-6 mb-4">
<div class="card h-100 shadow-sm">
<div class="card-body">
<h5 class="card-title d-flex justify-content-between">
{{ monitor.name }}
{# Manuelle Statusanzeige priorisieren #}
{% if monitor.status_override == 'MAINTENANCE' %}
<span class="badge bg-primary status-badge">Wartung <i class="bi bi-tools"></i></span>
{% elif monitor.status_override == 'DEGRADED' %}
<span class="badge bg-warning text-dark status-badge">Probleme <i class="bi bi-exclamation-triangle"></i></span>
{% elif monitor.status_override == 'OPERATIONAL' %}
<span class="badge bg-success status-badge">Funktionsfähig <i class="bi bi-check-circle"></i></span>
{# Automatische Statusanzeige, wenn kein manueller Status gesetzt ist #}
{% elif monitor.is_up == True %}
<span class="badge bg-success status-badge">Up <i class="bi bi-check-circle"></i></span>
{% elif monitor.is_up == False %}
<span class="badge bg-danger status-badge">Down <i class="bi bi-x-circle"></i></span>
{% else %}
<span class="badge bg-secondary status-badge">Unbekannt <i class="bi bi-question-circle"></i></span>
{% endif %}
</h5>
{# Status-Nachricht anzeigen, wenn vorhanden #}
{% if monitor.status_override_message %}
<div class="alert alert-info mt-2 p-2">
<small>{{ monitor.status_override_message }}</small>
</div>
{% endif %}
<p class="card-text">
{% if monitor.monitor_type == 'TCP' %}
<span class="text-muted text-break">{{ monitor.url }}:{{ monitor.port }}</span>
{% else %}
<a href="{{ monitor.url }}" target="_blank" class="text-muted text-break">{{ monitor.url }}</a>
{% endif %}
</p>
<div>
<span class="badge rounded-pill bg-primary">{{ monitor.monitor_type }}</span>
{% if monitor.monitor_type == 'KEYWORD' and monitor.keyword %}
<span class="badge rounded-pill bg-light text-dark">Keyword: {{ monitor.keyword }}</span>
{% endif %}
</div>
</div>
<div class="card-footer text-muted">
<small>Zuletzt geprüft:
{% if monitor.last_checked != 'Nie' %}
{{ monitor.last_checked.strftime('%d.%m.%Y %H:%M:%S UTC') }}
{% else %}
Nie
{% endif %}
</small>
</div>
</div>
<!doctype html>
<html lang="de">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Uptime Status</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css">
<style>
.status-badge.bg-danger {
animation: pulse-red 1.5s infinite;
}
@keyframes pulse-green {
0% { box-shadow: 0 0 0 0 rgba(25, 135, 84, 0.7); }
70% { box-shadow: 0 0 0 10px rgba(25, 135, 84, 0); }
100% { box-shadow: 0 0 0 0 rgba(25, 135, 84, 0); }
}
@keyframes pulse-red {
0% { box-shadow: 0 0 0 0 rgba(220, 53, 69, 0.7); }
70% { box-shadow: 0 0 0 10px rgba(220, 53, 69, 0); }
100% { box-shadow: 0 0 0 0 rgba(220, 53, 69, 0); }
}
</style>
</head>
<body class="d-flex flex-column vh-100">
<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
<div class="container">
<i class="bi bi-bar-chart-line-fill"></i> Uptime Status
</a>
<div class="ms-auto">
<a href="{{ url_for('admin.index') }}" class="btn btn-outline-light">
<i class="bi bi-person-circle"></i> Admin-Bereich
</a>
</div>
{% endfor %}
</div>
{% endif %}
</div>
{% endblock %}
</nav>
<main class="container mt-4 flex-grow-1">
<h1 class="mb-4">Statusübersicht</h1>
{% if not monitors_with_status %}
<div class="alert alert-info text-center">
<h4>Keine Monitore konfiguriert.</h4>
<p>Bitte loggen Sie sich in den <a href="{{ url_for('admin.index') }}" class="alert-link">Admin-Bereich</a> ein, um neue Monitore hinzuzufügen.</p>
</div>
{% else %}
<div class="table-responsive">
<table class="table table-bordered table-hover">
<thead class="table-light">
<tr>
<th>Dienst</th>
<th>Status</th>
<th>Letzte Prüfung</th>
</tr>
</thead>
<tbody>
{% for monitor, last_log in monitors_with_status %}
<tr>
<td>
<a href="{{ url_for('monitor_details', monitor_id=monitor.id) }}" class="text-decoration-none fw-bold">{{ monitor.name }}</a>
{% if monitor.status_override_message %}
<div class="text-muted fst-italic small">
<i class="bi bi-info-circle"></i> {{ monitor.status_override_message }}
</div>
{% endif %}
</td>
{% include '_status_badge.html' %}
<td>
{% if last_log %}
{{ last_log.timestamp.strftime('%d.%m.%Y %H:%M:%S UTC') }}
{% else %}
<span class="text-muted">Nie</span>
{% endif %}
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% endif %}
</main>
{% include '_footer.html' %}
<script src="ht
</html>

78
templates/status.html Normal file
View File

@@ -0,0 +1,78 @@
<!doctype html>
<html lang="de">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Statusübersicht</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css">
<style>
body {
background-color: transparent;
}
.status-badge.bg-success {
animation: pulse-green 2s infinite;
}
.status-badge.bg-danger {
animation: pulse-red 1.5s infinite;
}
@keyframes pulse-green {
0% { box-shadow: 0 0 0 0 rgba(25, 135, 84, 0.7); }
70% { box-shadow: 0 0 0 10px rgba(25, 135, 84, 0); }
100% { box-shadow: 0 0 0 0 rgba(25, 135, 84, 0); }
}
@keyframes pulse-red {
0% { box-shadow: 0 0 0 0 rgba(220, 53, 69, 0.7); }
70% { box-shadow: 0 0 0 10px rgba(220, 53, 69, 0); }
100% { box-shadow: 0 0 0 0 rgba(220, 53, 69, 0); }
}
</style>
</head>
<body>
<div class="container-fluid">
{% if not monitors_with_status %}
<div class="alert alert-info text-center">
<h4>Keine Monitore konfiguriert.</h4>
</div>
{% else %}
<table class="table table-striped table-hover">
<thead class="thead-dark">
<tr>
<th>Dienst</th>
<th class="text-center">Status</th>
<th>Letzte Prüfung</th>
</tr>
</thead>
<tbody>
{% for monitor, last_log in monitors_with_status %}
<tr>
<td>
<a href="{{ url_for('monitor_details', monitor_id=monitor.id, _external=True) }}" target="_blank" class="text-decoration-none fw-bold">{{ monitor.name }}</a>
{% if monitor.status_override_message %}
<div class="text-muted fst-italic small">
<i class="bi bi-info-circle"></i> {{ monitor.status_override_message }}
</div>
{% endif %}
</td>
{% with %}
{% set monitor=monitor %}
{% set last_log=last_log %}
{% include '_status_badge.html' %}
{% endwith %}
<td>
{% if last_log %}
{{ last_log.timestamp.strftime('%d.%m.%Y %H:%M:%S UTC') }}
{% else %}
Nie
{% endif %}
</td>
</tr>
{% endfor %}
</tbody>
</table>
{% endif %}
{% include '_footer.html' %}
</div>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>