This commit is contained in:
2025-12-17 22:10:01 +07:00
parent f371178518
commit 967176fab8
7 changed files with 794 additions and 1 deletions

View File

@@ -0,0 +1,386 @@
<!DOCTYPE html>
<html lang="ru">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>System Status</title>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
background: linear-gradient(135deg, #0f0f23 0%, #1a1a2e 50%, #16213e 100%);
min-height: 100vh;
color: #e0e0e0;
}
.container {
max-width: 900px;
margin: 0 auto;
padding: 40px 20px;
}
header {
text-align: center;
margin-bottom: 40px;
}
h1 {
font-size: 2.5rem;
font-weight: 700;
margin-bottom: 10px;
background: linear-gradient(135deg, #00d4ff, #a855f7);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
background-clip: text;
}
.overall-status {
display: inline-flex;
align-items: center;
gap: 10px;
padding: 12px 24px;
border-radius: 50px;
font-size: 1.1rem;
font-weight: 600;
margin-bottom: 10px;
}
.overall-status.operational {
background: rgba(34, 197, 94, 0.15);
border: 1px solid rgba(34, 197, 94, 0.3);
color: #22c55e;
box-shadow: 0 0 20px rgba(34, 197, 94, 0.2);
}
.overall-status.degraded {
background: rgba(250, 204, 21, 0.15);
border: 1px solid rgba(250, 204, 21, 0.3);
color: #facc15;
box-shadow: 0 0 20px rgba(250, 204, 21, 0.2);
}
.overall-status.down {
background: rgba(239, 68, 68, 0.15);
border: 1px solid rgba(239, 68, 68, 0.3);
color: #ef4444;
box-shadow: 0 0 20px rgba(239, 68, 68, 0.2);
}
.overall-status.unknown {
background: rgba(148, 163, 184, 0.15);
border: 1px solid rgba(148, 163, 184, 0.3);
color: #94a3b8;
}
.status-dot {
width: 12px;
height: 12px;
border-radius: 50%;
animation: pulse 2s infinite;
}
.status-dot.operational { background: #22c55e; }
.status-dot.degraded { background: #facc15; }
.status-dot.down { background: #ef4444; }
.status-dot.unknown { background: #94a3b8; }
@keyframes pulse {
0%, 100% { opacity: 1; transform: scale(1); }
50% { opacity: 0.7; transform: scale(1.1); }
}
.last-update {
color: #64748b;
font-size: 0.9rem;
}
.services-grid {
display: grid;
gap: 16px;
}
.service-card {
background: rgba(30, 41, 59, 0.5);
border: 1px solid rgba(100, 116, 139, 0.2);
border-radius: 16px;
padding: 24px;
backdrop-filter: blur(10px);
transition: all 0.3s ease;
}
.service-card:hover {
border-color: rgba(0, 212, 255, 0.3);
box-shadow: 0 0 30px rgba(0, 212, 255, 0.1);
}
.service-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 16px;
}
.service-name {
font-size: 1.25rem;
font-weight: 600;
color: #f1f5f9;
}
.service-status {
display: flex;
align-items: center;
gap: 8px;
padding: 6px 14px;
border-radius: 20px;
font-size: 0.85rem;
font-weight: 500;
}
.service-status.operational {
background: rgba(34, 197, 94, 0.15);
color: #22c55e;
}
.service-status.degraded {
background: rgba(250, 204, 21, 0.15);
color: #facc15;
}
.service-status.down {
background: rgba(239, 68, 68, 0.15);
color: #ef4444;
}
.service-status.unknown {
background: rgba(148, 163, 184, 0.15);
color: #94a3b8;
}
.service-status .dot {
width: 8px;
height: 8px;
border-radius: 50%;
}
.service-status.operational .dot { background: #22c55e; }
.service-status.degraded .dot { background: #facc15; }
.service-status.down .dot { background: #ef4444; }
.service-status.unknown .dot { background: #94a3b8; }
.service-metrics {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
gap: 12px;
}
.metric {
background: rgba(15, 23, 42, 0.5);
padding: 12px;
border-radius: 10px;
}
.metric-label {
font-size: 0.75rem;
color: #64748b;
text-transform: uppercase;
letter-spacing: 0.5px;
margin-bottom: 4px;
}
.metric-value {
font-size: 1.1rem;
font-weight: 600;
color: #e2e8f0;
}
.metric-value.good { color: #22c55e; }
.metric-value.warning { color: #facc15; }
.metric-value.bad { color: #ef4444; }
.service-message {
margin-top: 12px;
padding: 10px 14px;
background: rgba(239, 68, 68, 0.1);
border-left: 3px solid #ef4444;
border-radius: 0 8px 8px 0;
font-size: 0.9rem;
color: #fca5a5;
}
.refresh-btn {
display: inline-flex;
align-items: center;
gap: 8px;
padding: 12px 24px;
background: linear-gradient(135deg, rgba(0, 212, 255, 0.2), rgba(168, 85, 247, 0.2));
border: 1px solid rgba(0, 212, 255, 0.3);
border-radius: 10px;
color: #00d4ff;
font-size: 1rem;
font-weight: 500;
cursor: pointer;
transition: all 0.3s ease;
margin-top: 30px;
}
.refresh-btn:hover {
background: linear-gradient(135deg, rgba(0, 212, 255, 0.3), rgba(168, 85, 247, 0.3));
box-shadow: 0 0 20px rgba(0, 212, 255, 0.3);
transform: translateY(-2px);
}
.refresh-btn:active {
transform: translateY(0);
}
.refresh-btn.loading svg {
animation: spin 1s linear infinite;
}
@keyframes spin {
from { transform: rotate(0deg); }
to { transform: rotate(360deg); }
}
footer {
text-align: center;
margin-top: 50px;
padding-top: 30px;
border-top: 1px solid rgba(100, 116, 139, 0.2);
color: #64748b;
font-size: 0.85rem;
}
footer a {
color: #00d4ff;
text-decoration: none;
}
footer a:hover {
text-decoration: underline;
}
</style>
</head>
<body>
<div class="container">
<header>
<h1>System Status</h1>
<div class="overall-status {{ overall_status.value }}">
<span class="status-dot {{ overall_status.value }}"></span>
{% if overall_status.value == 'operational' %}
All Systems Operational
{% elif overall_status.value == 'degraded' %}
Partial System Outage
{% elif overall_status.value == 'down' %}
Major System Outage
{% else %}
Status Unknown
{% endif %}
</div>
<p class="last-update">
{% if last_check %}
Last updated: {{ last_check.strftime('%d.%m.%Y %H:%M:%S') }}
{% else %}
Checking services...
{% endif %}
&bull; Auto-refresh every {{ check_interval }}s
</p>
</header>
<div class="services-grid">
{% for name, service in services.items() %}
<div class="service-card">
<div class="service-header">
<span class="service-name">{{ service.display_name }}</span>
<span class="service-status {{ service.status.value }}">
<span class="dot"></span>
{% if service.status.value == 'operational' %}
Operational
{% elif service.status.value == 'degraded' %}
Degraded
{% elif service.status.value == 'down' %}
Down
{% else %}
Unknown
{% endif %}
</span>
</div>
<div class="service-metrics">
<div class="metric">
<div class="metric-label">Latency</div>
<div class="metric-value {% if service.latency_ms and service.latency_ms < 200 %}good{% elif service.latency_ms and service.latency_ms < 500 %}warning{% elif service.latency_ms %}bad{% endif %}">
{% if service.latency_ms %}
{{ "%.0f"|format(service.latency_ms) }} ms
{% else %}
{% endif %}
</div>
</div>
<div class="metric">
<div class="metric-label">Uptime</div>
<div class="metric-value {% if service.uptime_percent >= 99 %}good{% elif service.uptime_percent >= 95 %}warning{% else %}bad{% endif %}">
{{ "%.1f"|format(service.uptime_percent) }}%
</div>
</div>
{% if service.version %}
<div class="metric">
<div class="metric-label">Version</div>
<div class="metric-value">{{ service.version }}</div>
</div>
{% endif %}
{% if service.last_incident %}
<div class="metric">
<div class="metric-label">Last Incident</div>
<div class="metric-value warning">{{ service.last_incident.strftime('%d.%m %H:%M') }}</div>
</div>
{% endif %}
</div>
{% if service.message %}
<div class="service-message">{{ service.message }}</div>
{% endif %}
</div>
{% endfor %}
</div>
<center>
<button class="refresh-btn" onclick="refreshStatus(this)">
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M23 4v6h-6M1 20v-6h6"/>
<path d="M3.51 9a9 9 0 0114.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0020.49 15"/>
</svg>
Refresh
</button>
</center>
<footer>
<p>Game Marathon Status Monitor</p>
</footer>
</div>
<script>
async function refreshStatus(btn) {
btn.classList.add('loading');
btn.disabled = true;
try {
await fetch('/api/refresh', { method: 'POST' });
window.location.reload();
} catch (e) {
console.error('Refresh failed:', e);
btn.classList.remove('loading');
btn.disabled = false;
}
}
// Auto-refresh page
setTimeout(() => {
window.location.reload();
}, {{ check_interval }} * 1000);
</script>
</body>
</html>