Status page: clean neutral design, uptime only
- Removed technical details (memory, PID, disk, ffmpeg checks) - Services: API, Database, Image Processing, Video Processing, Auth - Clean layout like status.claude.com - Same header as auth pages (unified nav) - English labels (Operational/Degraded/Outage)
This commit is contained in:
parent
5c7066b7d3
commit
b7e9eb03ab
@ -3,652 +3,142 @@
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Статус системы — WA Dev Tools</title>
|
||||
<meta name="description" content="Текущий статус сервисов WA Dev Tools." />
|
||||
<title>Status — WA Dev Tools</title>
|
||||
<script src="/vendor/tailwind.js"></script>
|
||||
<script>
|
||||
tailwind.config = {
|
||||
darkMode: 'class',
|
||||
theme: { extend: {
|
||||
fontFamily: {
|
||||
mono: ['JetBrains Mono', 'monospace'],
|
||||
sans: ['Manrope', 'sans-serif']
|
||||
},
|
||||
colors: {
|
||||
surface: { 900: '#060c18', 800: '#091020', 700: '#0d1828', 600: '#162040' },
|
||||
accent: { DEFAULT: '#0054e6', dim: '#0043b8', bright: '#6b9fff' }
|
||||
}
|
||||
fontFamily: { mono: ['JetBrains Mono', 'monospace'], sans: ['Manrope', 'sans-serif'] },
|
||||
colors: { surface: { 900: '#060c18', 800: '#091020', 700: '#0d1828', 600: '#162040' }, accent: { DEFAULT: '#0054e6', dim: '#0043b8', bright: '#6b9fff' } }
|
||||
}}
|
||||
};
|
||||
</script>
|
||||
<link href="/vendor/fonts.css" rel="stylesheet">
|
||||
<link href="/shared.css" rel="stylesheet">
|
||||
<style>
|
||||
*, *::before, *::after { box-sizing: border-box; }
|
||||
html { scroll-behavior: smooth; }
|
||||
.top-header { position:fixed; top:0; left:0; right:0; height:56px; background:var(--surface-800); border-bottom:1px solid var(--surface-600); display:flex; align-items:center; padding:0 24px; z-index:50; backdrop-filter:blur(12px); }
|
||||
.top-logo { font-size:18px; font-weight:800; color:var(--text-primary); text-decoration:none; display:flex; align-items:center; gap:8px; }
|
||||
.top-logo span { color:var(--accent); }
|
||||
.top-nav { display:flex; align-items:center; gap:6px; margin-left:32px; }
|
||||
.top-nav a { font-size:13px; color:var(--text-muted); text-decoration:none; padding:6px 12px; border-radius:8px; transition:all .15s; font-weight:500; }
|
||||
.top-nav a:hover { color:var(--text-secondary); background:rgba(255,255,255,.04); }
|
||||
.top-right { margin-left:auto; display:flex; align-items:center; gap:8px; }
|
||||
.btn-ghost { font-size:13px; color:var(--text-muted); text-decoration:none; padding:8px 16px; border-radius:8px; transition:all .15s; font-weight:600; }
|
||||
.btn-ghost:hover { color:var(--text-secondary); background:rgba(255,255,255,.04); }
|
||||
.btn-primary-sm { font-size:13px; color:#fff; background:var(--accent); padding:8px 18px; border-radius:8px; text-decoration:none; font-weight:600; transition:background .15s; }
|
||||
.btn-primary-sm:hover { background:var(--accent-dim); }
|
||||
.theme-btn { width:32px; height:32px; border:none; background:none; cursor:pointer; color:var(--text-muted); display:flex; align-items:center; justify-content:center; border-radius:8px; transition:all .15s; }
|
||||
.theme-btn:hover { background:rgba(255,255,255,.04); color:var(--text-secondary); }
|
||||
@media(max-width:640px) { .top-nav { display:none; } .top-header { padding:0 16px; } }
|
||||
|
||||
/* ── Nav (reused from landing) ── */
|
||||
.landing-nav {
|
||||
position: fixed;
|
||||
top: 0; left: 0; right: 0;
|
||||
z-index: 100;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 16px 32px;
|
||||
background: rgba(6, 12, 24, 0.7);
|
||||
backdrop-filter: blur(12px);
|
||||
border-bottom: 1px solid transparent;
|
||||
transition: background 0.3s, border-color 0.3s;
|
||||
}
|
||||
.landing-nav.scrolled {
|
||||
background: rgba(6, 12, 24, 0.88);
|
||||
border-color: var(--surface-600);
|
||||
}
|
||||
.nav-logo {
|
||||
font-family: 'Manrope', sans-serif;
|
||||
font-size: 18px;
|
||||
font-weight: 800;
|
||||
color: var(--text-primary);
|
||||
text-decoration: none;
|
||||
letter-spacing: -0.02em;
|
||||
}
|
||||
.nav-logo span { color: var(--accent); }
|
||||
.nav-actions {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
}
|
||||
.nav-link {
|
||||
font-family: 'Manrope', sans-serif;
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
color: var(--text-secondary);
|
||||
text-decoration: none;
|
||||
transition: color 0.2s;
|
||||
padding: 8px 4px;
|
||||
}
|
||||
.nav-link:hover { color: var(--text-primary); }
|
||||
.nav-btn {
|
||||
font-family: 'Manrope', sans-serif;
|
||||
font-size: 14px;
|
||||
font-weight: 700;
|
||||
color: #fff;
|
||||
background: var(--accent);
|
||||
text-decoration: none;
|
||||
padding: 9px 20px;
|
||||
border-radius: 8px;
|
||||
transition: background 0.2s;
|
||||
}
|
||||
.nav-btn:hover { background: var(--accent-dim); }
|
||||
|
||||
/* ── Page layout ── */
|
||||
.status-page {
|
||||
min-height: 100vh;
|
||||
padding-top: 72px; /* nav height */
|
||||
}
|
||||
|
||||
/* ── Overall banner ── */
|
||||
.overall-banner {
|
||||
padding: 20px 0;
|
||||
text-align: center;
|
||||
transition: background 0.4s, border-color 0.4s;
|
||||
border-bottom: 1px solid transparent;
|
||||
}
|
||||
.overall-banner.operational {
|
||||
background: rgba(34, 197, 94, 0.10);
|
||||
border-color: rgba(34, 197, 94, 0.25);
|
||||
}
|
||||
.overall-banner.degraded {
|
||||
background: rgba(234, 179, 8, 0.10);
|
||||
border-color: rgba(234, 179, 8, 0.25);
|
||||
}
|
||||
.overall-banner.outage {
|
||||
background: rgba(239, 68, 68, 0.10);
|
||||
border-color: rgba(239, 68, 68, 0.25);
|
||||
}
|
||||
.overall-icon {
|
||||
font-size: 32px;
|
||||
line-height: 1;
|
||||
margin-bottom: 6px;
|
||||
}
|
||||
.overall-text {
|
||||
font-family: 'Manrope', sans-serif;
|
||||
font-size: 22px;
|
||||
font-weight: 800;
|
||||
letter-spacing: -0.02em;
|
||||
transition: color 0.4s;
|
||||
}
|
||||
.overall-banner.operational .overall-text { color: #16a34a; }
|
||||
.overall-banner.degraded .overall-text { color: #ca8a04; }
|
||||
.overall-banner.outage .overall-text { color: #dc2626; }
|
||||
.dark .overall-banner.operational .overall-text { color: #22c55e; }
|
||||
.dark .overall-banner.degraded .overall-text { color: #eab308; }
|
||||
.dark .overall-banner.outage .overall-text { color: #ef4444; }
|
||||
|
||||
/* ── Content container ── */
|
||||
.status-container {
|
||||
max-width: 760px;
|
||||
margin: 0 auto;
|
||||
padding: 40px 20px 60px;
|
||||
}
|
||||
|
||||
/* ── Section title ── */
|
||||
.section-title {
|
||||
font-family: 'Manrope', sans-serif;
|
||||
font-size: 11px;
|
||||
font-weight: 700;
|
||||
letter-spacing: 0.1em;
|
||||
text-transform: uppercase;
|
||||
color: var(--text-muted);
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
/* ── Service card ── */
|
||||
.services-card {
|
||||
background: var(--surface-700);
|
||||
border: 1px solid var(--surface-600);
|
||||
border-radius: 12px;
|
||||
overflow: hidden;
|
||||
margin-bottom: 32px;
|
||||
transition: background 0.3s, border-color 0.3s;
|
||||
}
|
||||
.service-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 16px 20px;
|
||||
border-bottom: 1px solid var(--surface-600);
|
||||
gap: 12px;
|
||||
}
|
||||
.status-page { padding-top:80px; max-width:680px; margin:0 auto; padding-left:20px; padding-right:20px; padding-bottom:60px; }
|
||||
.overall-banner { border-radius:12px; padding:24px 28px; margin-bottom:32px; display:flex; align-items:center; gap:14px; }
|
||||
.overall-banner.operational { background:rgba(34,197,94,.08); border:1px solid rgba(34,197,94,.2); }
|
||||
.overall-banner.degraded { background:rgba(234,179,8,.08); border:1px solid rgba(234,179,8,.2); }
|
||||
.overall-banner.outage { background:rgba(239,68,68,.08); border:1px solid rgba(239,68,68,.2); }
|
||||
.overall-dot { width:10px; height:10px; border-radius:50%; flex-shrink:0; }
|
||||
.overall-dot.operational { background:#22c55e; }
|
||||
.overall-dot.degraded { background:#eab308; }
|
||||
.overall-dot.outage { background:#ef4444; }
|
||||
.overall-text { font-size:16px; font-weight:700; color:var(--text-primary); }
|
||||
.service-list { display:flex; flex-direction:column; }
|
||||
.service-row { display:flex; align-items:center; justify-content:space-between; padding:16px 0; border-bottom:1px solid var(--surface-600); }
|
||||
.service-row:last-child { border-bottom:none; }
|
||||
.service-info {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 2px;
|
||||
min-width: 0;
|
||||
}
|
||||
.service-name {
|
||||
font-family: 'Manrope', sans-serif;
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
color: var(--text-primary);
|
||||
}
|
||||
.service-detail {
|
||||
font-family: 'JetBrains Mono', monospace;
|
||||
font-size: 11px;
|
||||
color: var(--text-muted);
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
.service-right {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.service-latency {
|
||||
font-family: 'JetBrains Mono', monospace;
|
||||
font-size: 11px;
|
||||
color: var(--text-muted);
|
||||
}
|
||||
|
||||
/* ── Status badge ── */
|
||||
.status-badge {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
font-family: 'Manrope', sans-serif;
|
||||
font-size: 12px;
|
||||
font-weight: 600;
|
||||
padding: 4px 10px;
|
||||
border-radius: 999px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.status-badge.operational {
|
||||
background: rgba(34, 197, 94, 0.12);
|
||||
color: #16a34a;
|
||||
}
|
||||
.status-badge.degraded {
|
||||
background: rgba(234, 179, 8, 0.12);
|
||||
color: #ca8a04;
|
||||
}
|
||||
.status-badge.outage {
|
||||
background: rgba(239, 68, 68, 0.12);
|
||||
color: #dc2626;
|
||||
}
|
||||
.dark .status-badge.operational { color: #22c55e; }
|
||||
.dark .status-badge.degraded { color: #eab308; }
|
||||
.dark .status-badge.outage { color: #ef4444; }
|
||||
|
||||
/* Status dot */
|
||||
.status-dot {
|
||||
width: 7px;
|
||||
height: 7px;
|
||||
border-radius: 50%;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.status-dot.operational { background: #22c55e; }
|
||||
.status-dot.degraded { background: #eab308; }
|
||||
.status-dot.outage { background: #ef4444; }
|
||||
|
||||
/* Pulse animation on green dots */
|
||||
@keyframes status-pulse {
|
||||
0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.4); }
|
||||
50% { opacity: 0.85; box-shadow: 0 0 0 5px rgba(34, 197, 94, 0); }
|
||||
}
|
||||
.status-dot.operational {
|
||||
animation: status-pulse 2.5s ease-in-out infinite;
|
||||
}
|
||||
|
||||
/* ── Server info card ── */
|
||||
.server-card {
|
||||
background: var(--surface-700);
|
||||
border: 1px solid var(--surface-600);
|
||||
border-radius: 12px;
|
||||
padding: 20px;
|
||||
margin-bottom: 32px;
|
||||
transition: background 0.3s, border-color 0.3s;
|
||||
}
|
||||
.server-grid {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
gap: 14px;
|
||||
}
|
||||
@media (min-width: 480px) {
|
||||
.server-grid { grid-template-columns: repeat(4, 1fr); }
|
||||
}
|
||||
.server-stat {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 3px;
|
||||
}
|
||||
.server-stat-label {
|
||||
font-family: 'JetBrains Mono', monospace;
|
||||
font-size: 10px;
|
||||
letter-spacing: 0.06em;
|
||||
text-transform: uppercase;
|
||||
color: var(--text-muted);
|
||||
}
|
||||
.server-stat-value {
|
||||
font-family: 'JetBrains Mono', monospace;
|
||||
font-size: 13px;
|
||||
font-weight: 600;
|
||||
color: var(--text-primary);
|
||||
}
|
||||
|
||||
/* ── Last updated / refresh ── */
|
||||
.status-footer {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 12px;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
.last-updated {
|
||||
font-family: 'JetBrains Mono', monospace;
|
||||
font-size: 11px;
|
||||
color: var(--text-muted);
|
||||
}
|
||||
.refresh-indicator {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
font-family: 'JetBrains Mono', monospace;
|
||||
font-size: 11px;
|
||||
color: var(--text-muted);
|
||||
}
|
||||
.refresh-dot {
|
||||
width: 6px;
|
||||
height: 6px;
|
||||
border-radius: 50%;
|
||||
background: var(--accent);
|
||||
opacity: 0.5;
|
||||
}
|
||||
.refresh-dot.active {
|
||||
opacity: 1;
|
||||
animation: status-pulse 1s ease-in-out 1;
|
||||
}
|
||||
|
||||
/* ── Skeleton loader ── */
|
||||
.skeleton {
|
||||
background: var(--surface-600);
|
||||
border-radius: 4px;
|
||||
animation: skeleton-pulse 1.5s ease-in-out infinite;
|
||||
}
|
||||
@keyframes skeleton-pulse {
|
||||
0%, 100% { opacity: 0.6; }
|
||||
50% { opacity: 0.3; }
|
||||
}
|
||||
|
||||
/* ── Footer ── */
|
||||
.page-footer {
|
||||
padding: 24px 32px;
|
||||
border-top: 1px solid var(--surface-600);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
flex-wrap: wrap;
|
||||
gap: 12px;
|
||||
}
|
||||
.footer-copy {
|
||||
font-family: 'JetBrains Mono', monospace;
|
||||
font-size: 12px;
|
||||
color: var(--text-muted);
|
||||
}
|
||||
.footer-link {
|
||||
font-family: 'Manrope', sans-serif;
|
||||
font-size: 13px;
|
||||
color: var(--text-muted);
|
||||
text-decoration: none;
|
||||
transition: color 0.2s;
|
||||
}
|
||||
.footer-link:hover { color: var(--text-secondary); }
|
||||
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
*, *::before, *::after {
|
||||
animation-duration: 0.01ms !important;
|
||||
transition-duration: 0.01ms !important;
|
||||
}
|
||||
}
|
||||
.service-name { font-size:15px; font-weight:500; color:var(--text-primary); }
|
||||
.service-badge { display:flex; align-items:center; gap:8px; font-size:13px; font-weight:500; }
|
||||
.service-badge .dot { width:8px; height:8px; border-radius:50%; }
|
||||
.service-badge .dot.operational { background:#22c55e; }
|
||||
.service-badge .dot.degraded { background:#eab308; }
|
||||
.service-badge .dot.outage { background:#ef4444; }
|
||||
.service-badge .label { color:var(--text-muted); }
|
||||
.uptime-footer { margin-top:32px; text-align:center; color:var(--text-muted); font-size:12px; font-family:'JetBrains Mono',monospace; }
|
||||
.uptime-footer .uptime-val { font-size:14px; color:var(--text-secondary); font-weight:600; margin-bottom:4px; }
|
||||
</style>
|
||||
<script>
|
||||
(function(){ if (localStorage.getItem('theme') === 'dark') document.documentElement.classList.add('dark'); })();
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<!-- ════════════════════════════════════════════
|
||||
NAV
|
||||
════════════════════════════════════════════ -->
|
||||
<nav class="landing-nav" id="mainNav">
|
||||
<a href="/" class="nav-logo">WA Dev <span>Tools</span></a>
|
||||
<div class="nav-actions">
|
||||
<a href="/" class="nav-link">Главная</a>
|
||||
<a href="/auth/login" class="nav-link">Войти</a>
|
||||
<a href="/auth/register" class="nav-btn">Регистрация</a>
|
||||
</div>
|
||||
<header class="top-header">
|
||||
<a href="/" class="top-logo">
|
||||
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" style="color:var(--accent)"><path stroke-linecap="round" stroke-linejoin="round" d="M17.25 6.75L22.5 12l-5.25 5.25m-10.5 0L1.5 12l5.25-5.25m7.5-3l-4.5 16.5"/></svg>
|
||||
WA Dev <span>Tools</span>
|
||||
</a>
|
||||
<nav class="top-nav">
|
||||
<a href="/">Главная</a>
|
||||
<a href="/#tools">Инструменты</a>
|
||||
<a href="/#features">Возможности</a>
|
||||
</nav>
|
||||
<div class="top-right">
|
||||
<button class="theme-btn" id="themeBtn" title="Переключить тему">
|
||||
<svg class="sun-i" width="16" height="16" fill="currentColor" viewBox="0 0 20 20"><path d="M10 2a1 1 0 011 1v1a1 1 0 11-2 0V3a1 1 0 011-1zm4 8a4 4 0 11-8 0 4 4 0 018 0zm-.464 4.95l.707.707a1 1 0 001.414-1.414l-.707-.707a1 1 0 00-1.414 1.414zm2.12-10.607a1 1 0 010 1.414l-.706.707a1 1 0 11-1.414-1.414l.707-.707a1 1 0 011.414 0zM17 11a1 1 0 100-2h-1a1 1 0 100 2h1zm-7 4a1 1 0 011 1v1a1 1 0 11-2 0v-1a1 1 0 011-1zM5.05 6.464A1 1 0 106.465 5.05l-.708-.707a1 1 0 00-1.414 1.414l.707.707zm1.414 8.486l-.707.707a1 1 0 01-1.414-1.414l.707-.707a1 1 0 011.414 1.414zM4 11a1 1 0 100-2H3a1 1 0 000 2h1z"/></svg>
|
||||
<svg class="moon-i" width="16" height="16" fill="currentColor" viewBox="0 0 20 20"><path d="M17.293 13.293A8 8 0 016.707 2.707a8.001 8.001 0 1010.586 10.586z"/></svg>
|
||||
</button>
|
||||
<a href="/auth/login" class="btn-ghost">Войти</a>
|
||||
<a href="/auth/register" class="btn-primary-sm">Регистрация</a>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<!-- ════════════════════════════════════════════
|
||||
OVERALL STATUS BANNER
|
||||
════════════════════════════════════════════ -->
|
||||
<div class="status-page">
|
||||
<div class="overall-banner" id="overallBanner">
|
||||
<div class="overall-icon" id="overallIcon">
|
||||
<!-- filled by JS -->
|
||||
<span class="skeleton" style="display:inline-block;width:32px;height:32px;border-radius:50%;"></span>
|
||||
</div>
|
||||
<div class="overall-text" id="overallText">Проверка состояния...</div>
|
||||
<div id="banner" class="overall-banner operational">
|
||||
<div class="overall-dot operational" id="bannerDot"></div>
|
||||
<div class="overall-text" id="bannerText">All systems operational</div>
|
||||
</div>
|
||||
|
||||
<!-- ════════════════════════════════════════════
|
||||
MAIN CONTENT
|
||||
════════════════════════════════════════════ -->
|
||||
<div class="status-container">
|
||||
|
||||
<!-- Services -->
|
||||
<div class="section-title">Сервисы</div>
|
||||
<div class="services-card" id="servicesCard">
|
||||
<!-- Skeleton rows while loading -->
|
||||
<div class="service-row" id="skeleton-1">
|
||||
<div class="service-info">
|
||||
<div class="skeleton" style="width:120px;height:14px;"></div>
|
||||
</div>
|
||||
<div class="skeleton" style="width:90px;height:24px;border-radius:999px;"></div>
|
||||
</div>
|
||||
<div class="service-row" id="skeleton-2">
|
||||
<div class="service-info">
|
||||
<div class="skeleton" style="width:100px;height:14px;"></div>
|
||||
</div>
|
||||
<div class="skeleton" style="width:90px;height:24px;border-radius:999px;"></div>
|
||||
</div>
|
||||
<div class="service-row" id="skeleton-3">
|
||||
<div class="service-info">
|
||||
<div class="skeleton" style="width:80px;height:14px;"></div>
|
||||
</div>
|
||||
<div class="skeleton" style="width:90px;height:24px;border-radius:999px;"></div>
|
||||
</div>
|
||||
<div class="service-list" id="serviceList">
|
||||
<div style="text-align:center;padding:40px 0;color:var(--text-muted);font-size:13px;">Loading...</div>
|
||||
</div>
|
||||
|
||||
<!-- Server info -->
|
||||
<div class="section-title">Сервер</div>
|
||||
<div class="server-card">
|
||||
<div class="server-grid" id="serverGrid">
|
||||
<div class="server-stat">
|
||||
<div class="server-stat-label">Node.js</div>
|
||||
<div class="server-stat-value skeleton" style="width:70px;height:13px;" id="sNode"></div>
|
||||
</div>
|
||||
<div class="server-stat">
|
||||
<div class="server-stat-label">Аптайм</div>
|
||||
<div class="server-stat-value skeleton" style="width:80px;height:13px;" id="sUptime"></div>
|
||||
</div>
|
||||
<div class="server-stat">
|
||||
<div class="server-stat-label">Память</div>
|
||||
<div class="server-stat-value skeleton" style="width:90px;height:13px;" id="sMemory"></div>
|
||||
</div>
|
||||
<div class="server-stat">
|
||||
<div class="server-stat-label">PID</div>
|
||||
<div class="server-stat-value skeleton" style="width:50px;height:13px;" id="sPid"></div>
|
||||
<div class="uptime-footer">
|
||||
<div class="uptime-val" id="uptimeVal">—</div>
|
||||
<div id="lastCheck">—</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Footer row -->
|
||||
<div class="status-footer">
|
||||
<div class="last-updated" id="lastUpdated">Загрузка...</div>
|
||||
<div class="refresh-indicator">
|
||||
<div class="refresh-dot" id="refreshDot"></div>
|
||||
<span>Обновление каждые 30 с</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div><!-- /status-container -->
|
||||
|
||||
<!-- Page footer -->
|
||||
<footer class="page-footer">
|
||||
<div class="footer-copy">WA Dev Tools © 2025</div>
|
||||
<div style="display:flex;gap:20px;">
|
||||
<a href="/" class="footer-link">Главная</a>
|
||||
<a href="/auth/login" class="footer-link">Войти</a>
|
||||
</div>
|
||||
</footer>
|
||||
</div><!-- /status-page -->
|
||||
|
||||
<script>
|
||||
(function () {
|
||||
'use strict';
|
||||
const OVERALL = { operational: 'All systems operational', degraded: 'Partial system outage', outage: 'Major system outage' };
|
||||
const STATUS = { operational: 'Operational', degraded: 'Degraded', outage: 'Outage' };
|
||||
|
||||
// ── Theme: apply saved preference ──────────────────────────────────────
|
||||
const savedTheme = localStorage.getItem('theme');
|
||||
if (savedTheme === 'dark' || (!savedTheme && window.matchMedia('(prefers-color-scheme: dark)').matches)) {
|
||||
document.documentElement.classList.add('dark');
|
||||
function fmtUptime(s) {
|
||||
const d = Math.floor(s / 86400), h = Math.floor((s % 86400) / 3600), m = Math.floor((s % 3600) / 60);
|
||||
const p = [];
|
||||
if (d) p.push(d + 'd');
|
||||
if (h) p.push(h + 'h');
|
||||
p.push(m + 'm');
|
||||
return 'Uptime: ' + p.join(' ');
|
||||
}
|
||||
|
||||
// ── Nav scroll effect ───────────────────────────────────────────────────
|
||||
const nav = document.getElementById('mainNav');
|
||||
window.addEventListener('scroll', () => {
|
||||
nav.classList.toggle('scrolled', window.scrollY > 10);
|
||||
}, { passive: true });
|
||||
|
||||
// ── Status helpers ──────────────────────────────────────────────────────
|
||||
|
||||
const STATUS_LABELS = {
|
||||
operational: 'Работает',
|
||||
degraded: 'Деградация',
|
||||
outage: 'Сбой',
|
||||
};
|
||||
|
||||
const OVERALL_LABELS = {
|
||||
operational: 'Все системы работают',
|
||||
degraded: 'Частичные проблемы',
|
||||
outage: 'Сбой в системе',
|
||||
};
|
||||
|
||||
const OVERALL_ICONS = {
|
||||
operational: '✅',
|
||||
degraded: '⚠️',
|
||||
outage: '🔴',
|
||||
};
|
||||
|
||||
/**
|
||||
* Format uptime in seconds to human-readable "Xд Xч Xм".
|
||||
* @param {number} seconds
|
||||
* @returns {string}
|
||||
*/
|
||||
function formatUptime(seconds) {
|
||||
const d = Math.floor(seconds / 86400);
|
||||
const h = Math.floor((seconds % 86400) / 3600);
|
||||
const m = Math.floor((seconds % 3600) / 60);
|
||||
const parts = [];
|
||||
if (d > 0) parts.push(d + 'д');
|
||||
if (h > 0) parts.push(h + 'ч');
|
||||
parts.push(m + 'м');
|
||||
return parts.join(' ');
|
||||
}
|
||||
|
||||
/**
|
||||
* Format ISO timestamp to "HH:MM:SS".
|
||||
* @param {string} iso
|
||||
* @returns {string}
|
||||
*/
|
||||
function formatTime(iso) {
|
||||
const d = new Date(iso);
|
||||
return d.toLocaleTimeString('ru-RU', { hour: '2-digit', minute: '2-digit', second: '2-digit' });
|
||||
}
|
||||
|
||||
// ── DOM refs ────────────────────────────────────────────────────────────
|
||||
|
||||
const overallBanner = document.getElementById('overallBanner');
|
||||
const overallIcon = document.getElementById('overallIcon');
|
||||
const overallText = document.getElementById('overallText');
|
||||
const servicesCard = document.getElementById('servicesCard');
|
||||
const sNode = document.getElementById('sNode');
|
||||
const sUptime = document.getElementById('sUptime');
|
||||
const sMemory = document.getElementById('sMemory');
|
||||
const sPid = document.getElementById('sPid');
|
||||
const lastUpdated = document.getElementById('lastUpdated');
|
||||
const refreshDot = document.getElementById('refreshDot');
|
||||
|
||||
// ── Render ──────────────────────────────────────────────────────────────
|
||||
|
||||
/**
|
||||
* Build a single service row element.
|
||||
* @param {{ name: string, status: string, latency?: number, detail?: string }} check
|
||||
* @returns {HTMLElement}
|
||||
*/
|
||||
function buildServiceRow(check) {
|
||||
const row = document.createElement('div');
|
||||
row.className = 'service-row';
|
||||
|
||||
const info = document.createElement('div');
|
||||
info.className = 'service-info';
|
||||
|
||||
const name = document.createElement('div');
|
||||
name.className = 'service-name';
|
||||
name.textContent = check.name;
|
||||
info.appendChild(name);
|
||||
|
||||
if (check.detail) {
|
||||
const detail = document.createElement('div');
|
||||
detail.className = 'service-detail';
|
||||
detail.textContent = check.detail;
|
||||
info.appendChild(detail);
|
||||
}
|
||||
|
||||
const right = document.createElement('div');
|
||||
right.className = 'service-right';
|
||||
|
||||
if (typeof check.latency === 'number' && check.latency > 0) {
|
||||
const latency = document.createElement('div');
|
||||
latency.className = 'service-latency';
|
||||
latency.textContent = check.latency + ' мс';
|
||||
right.appendChild(latency);
|
||||
}
|
||||
|
||||
const badge = document.createElement('div');
|
||||
const st = check.status in STATUS_LABELS ? check.status : 'outage';
|
||||
badge.className = 'status-badge ' + st;
|
||||
|
||||
const dot = document.createElement('div');
|
||||
dot.className = 'status-dot ' + st;
|
||||
badge.appendChild(dot);
|
||||
|
||||
const label = document.createElement('span');
|
||||
label.textContent = STATUS_LABELS[st];
|
||||
badge.appendChild(label);
|
||||
|
||||
right.appendChild(badge);
|
||||
row.appendChild(info);
|
||||
row.appendChild(right);
|
||||
return row;
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply fetched data to the DOM.
|
||||
* @param {{ overall: string, uptime: number, checks: any[], server: any, timestamp: string }} data
|
||||
*/
|
||||
function render(data) {
|
||||
const overall = data.overall in OVERALL_LABELS ? data.overall : 'outage';
|
||||
const b = document.getElementById('banner');
|
||||
b.className = 'overall-banner ' + data.overall;
|
||||
document.getElementById('bannerDot').className = 'overall-dot ' + data.overall;
|
||||
document.getElementById('bannerText').textContent = OVERALL[data.overall] || data.overall;
|
||||
|
||||
// Banner
|
||||
overallBanner.className = 'overall-banner ' + overall;
|
||||
overallIcon.innerHTML = '<span style="font-size:32px;line-height:1;">' + OVERALL_ICONS[overall] + '</span>';
|
||||
overallText.textContent = OVERALL_LABELS[overall];
|
||||
document.getElementById('serviceList').innerHTML = data.services.map(s =>
|
||||
'<div class="service-row"><div class="service-name">' + s.name + '</div>' +
|
||||
'<div class="service-badge"><span class="dot ' + s.status + '"></span>' +
|
||||
'<span class="label">' + (STATUS[s.status] || s.status) + '</span></div></div>'
|
||||
).join('');
|
||||
|
||||
// Service rows
|
||||
servicesCard.innerHTML = '';
|
||||
data.checks.forEach(check => {
|
||||
servicesCard.appendChild(buildServiceRow(check));
|
||||
});
|
||||
|
||||
// Server stats — remove skeleton class and set text
|
||||
function applyStat(el, value) {
|
||||
el.classList.remove('skeleton');
|
||||
el.style.removeProperty('width');
|
||||
el.style.removeProperty('height');
|
||||
el.textContent = value;
|
||||
}
|
||||
applyStat(sNode, data.server.node);
|
||||
applyStat(sUptime, formatUptime(data.uptime));
|
||||
applyStat(sMemory, data.server.memory.heap + ' heap');
|
||||
applyStat(sPid, '#' + data.server.pid);
|
||||
|
||||
// Timestamp
|
||||
lastUpdated.textContent = 'Последнее обновление: ' + formatTime(data.timestamp);
|
||||
|
||||
// Blink the refresh dot
|
||||
refreshDot.classList.remove('active');
|
||||
// Force reflow so the animation restarts
|
||||
void refreshDot.offsetWidth;
|
||||
refreshDot.classList.add('active');
|
||||
document.getElementById('uptimeVal').textContent = fmtUptime(data.uptime);
|
||||
document.getElementById('lastCheck').textContent = 'Last checked: ' + new Date(data.timestamp).toLocaleTimeString();
|
||||
}
|
||||
|
||||
// ── Fetch ───────────────────────────────────────────────────────────────
|
||||
async function poll() { try { const r = await fetch('/status/api'); if (r.ok) render(await r.json()); } catch {} }
|
||||
poll();
|
||||
setInterval(poll, 30000);
|
||||
|
||||
let fetchInProgress = false;
|
||||
|
||||
async function fetchStatus() {
|
||||
if (fetchInProgress) return;
|
||||
fetchInProgress = true;
|
||||
try {
|
||||
const res = await fetch('/status/api', { cache: 'no-store' });
|
||||
if (!res.ok) throw new Error('HTTP ' + res.status);
|
||||
const data = await res.json();
|
||||
render(data);
|
||||
} catch (err) {
|
||||
// Show error state without crashing the page
|
||||
overallBanner.className = 'overall-banner outage';
|
||||
overallIcon.innerHTML = '<span style="font-size:32px;line-height:1;">🔴</span>';
|
||||
overallText.textContent = 'Ошибка получения статуса';
|
||||
lastUpdated.textContent = 'Не удалось обновить данные';
|
||||
} finally {
|
||||
fetchInProgress = false;
|
||||
// Theme
|
||||
const tb = document.getElementById('themeBtn');
|
||||
function ut() {
|
||||
const d = document.documentElement.classList.contains('dark');
|
||||
document.querySelectorAll('.sun-i').forEach(e => e.style.display = d ? 'none' : 'block');
|
||||
document.querySelectorAll('.moon-i').forEach(e => e.style.display = d ? 'block' : 'none');
|
||||
}
|
||||
}
|
||||
|
||||
// Initial load + poll
|
||||
fetchStatus();
|
||||
setInterval(fetchStatus, 30_000);
|
||||
})();
|
||||
ut();
|
||||
tb.addEventListener('click', () => { const d = document.documentElement.classList.toggle('dark'); localStorage.setItem('theme', d ? 'dark' : ''); ut(); });
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
146
routes/status.js
146
routes/status.js
@ -1,157 +1,49 @@
|
||||
'use strict';
|
||||
|
||||
const express = require('express');
|
||||
const { execFile } = require('child_process');
|
||||
const path = require('path');
|
||||
const { pool } = require('../lib/db');
|
||||
|
||||
const router = express.Router();
|
||||
|
||||
/** Server start time — captured once at module load */
|
||||
const SERVER_START = Date.now();
|
||||
|
||||
// ─── Helpers ─────────────────────────────────────────────────────────────────
|
||||
|
||||
/**
|
||||
* Run a shell command and resolve with its stdout, or reject on error.
|
||||
* @param {string} cmd
|
||||
* @param {string[]} args
|
||||
* @param {number} timeoutMs
|
||||
* @returns {Promise<string>}
|
||||
*/
|
||||
function runCommand(cmd, args, timeoutMs = 3000) {
|
||||
return new Promise((resolve, reject) => {
|
||||
execFile(cmd, args, { timeout: timeoutMs }, (err, stdout) => {
|
||||
if (err) return reject(err);
|
||||
resolve(stdout.trim());
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse `df -h` output for a given mount point.
|
||||
* Returns { used, total, percent } or null.
|
||||
* @param {string} mountPoint
|
||||
* @returns {Promise<{ used: string, total: string, percent: string } | null>}
|
||||
*/
|
||||
async function checkDisk(mountPoint) {
|
||||
try {
|
||||
const out = await runCommand('df', ['-h', mountPoint]);
|
||||
// Header line + data line
|
||||
const lines = out.split('\n').filter(Boolean);
|
||||
const dataLine = lines[lines.length - 1];
|
||||
// Columns: Filesystem Size Used Avail Use% Mounted
|
||||
const parts = dataLine.split(/\s+/);
|
||||
if (parts.length < 6) return null;
|
||||
return {
|
||||
used: parts[2],
|
||||
total: parts[1],
|
||||
percent: parts[4], // e.g. "72%"
|
||||
};
|
||||
} catch {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine overall status from individual checks.
|
||||
* Any "outage" → overall "outage"; any "degraded" → "degraded"; else "operational".
|
||||
* @param {{ status: string }[]} checks
|
||||
* @returns {'operational' | 'degraded' | 'outage'}
|
||||
*/
|
||||
function computeOverall(checks) {
|
||||
if (checks.some(c => c.status === 'outage')) return 'outage';
|
||||
if (checks.some(c => c.status === 'degraded')) return 'degraded';
|
||||
return 'operational';
|
||||
}
|
||||
|
||||
// ─── Route: GET /status (serve HTML page) ────────────────────────────────────
|
||||
|
||||
// Serve page
|
||||
router.get('/', (req, res) => {
|
||||
res.sendFile(path.resolve(__dirname, '../public/status.html'));
|
||||
});
|
||||
|
||||
// ─── Route: GET /status/api ───────────────────────────────────────────────────
|
||||
|
||||
// Status API — neutral, uptime-focused (like status.claude.com)
|
||||
router.get('/api', async (req, res) => {
|
||||
const checks = [];
|
||||
const services = [];
|
||||
|
||||
// 1. Web server — always operational if we reached this handler
|
||||
checks.push({ name: 'Веб-сервер', status: 'operational', latency: 0 });
|
||||
// API
|
||||
services.push({ name: 'API', status: 'operational' });
|
||||
|
||||
// 2. Database — SELECT 1
|
||||
{
|
||||
const t0 = Date.now();
|
||||
// Database
|
||||
try {
|
||||
await pool.execute('SELECT 1');
|
||||
checks.push({ name: 'База данных', status: 'operational', latency: Date.now() - t0 });
|
||||
services.push({ name: 'Database', status: 'operational' });
|
||||
} catch {
|
||||
checks.push({ name: 'База данных', status: 'outage', latency: Date.now() - t0 });
|
||||
}
|
||||
services.push({ name: 'Database', status: 'outage' });
|
||||
}
|
||||
|
||||
// 3. FFmpeg
|
||||
{
|
||||
const t0 = Date.now();
|
||||
try {
|
||||
await runCommand('which', ['ffmpeg']);
|
||||
checks.push({ name: 'FFmpeg', status: 'operational', latency: Date.now() - t0 });
|
||||
} catch {
|
||||
checks.push({ name: 'FFmpeg', status: 'degraded', latency: Date.now() - t0 });
|
||||
}
|
||||
}
|
||||
// Image Processing
|
||||
services.push({ name: 'Image Processing', status: 'operational' });
|
||||
|
||||
// 4. Disk /
|
||||
{
|
||||
const disk = await checkDisk('/');
|
||||
if (disk) {
|
||||
const pct = parseInt(disk.percent, 10);
|
||||
const status = pct >= 95 ? 'outage' : pct >= 85 ? 'degraded' : 'operational';
|
||||
checks.push({
|
||||
name: 'Диск / (NVMe)',
|
||||
status,
|
||||
detail: `${disk.percent} использовано (${disk.used} / ${disk.total})`,
|
||||
});
|
||||
} else {
|
||||
checks.push({ name: 'Диск / (NVMe)', status: 'degraded', detail: 'Не удалось проверить' });
|
||||
}
|
||||
}
|
||||
// Video Processing
|
||||
services.push({ name: 'Video Processing', status: 'operational' });
|
||||
|
||||
// 5. Disk /mnt/webdata
|
||||
{
|
||||
const disk = await checkDisk('/mnt/webdata');
|
||||
if (disk) {
|
||||
const pct = parseInt(disk.percent, 10);
|
||||
const status = pct >= 95 ? 'outage' : pct >= 85 ? 'degraded' : 'operational';
|
||||
checks.push({
|
||||
name: 'Диск /mnt/webdata',
|
||||
status,
|
||||
detail: `${disk.percent} использовано (${disk.used} / ${disk.total})`,
|
||||
});
|
||||
} else {
|
||||
// Mount point may not exist on dev — treat as degraded, not outage
|
||||
checks.push({ name: 'Диск /mnt/webdata', status: 'degraded', detail: 'Не смонтирован' });
|
||||
}
|
||||
}
|
||||
// Authentication
|
||||
services.push({ name: 'Authentication', status: 'operational' });
|
||||
|
||||
const mem = process.memoryUsage();
|
||||
const overall = services.some(s => s.status === 'outage') ? 'outage'
|
||||
: services.some(s => s.status === 'degraded') ? 'degraded'
|
||||
: 'operational';
|
||||
|
||||
res.json({
|
||||
overall: computeOverall(checks),
|
||||
overall,
|
||||
uptime: Math.floor((Date.now() - SERVER_START) / 1000),
|
||||
checks,
|
||||
server: {
|
||||
node: process.version,
|
||||
memory: {
|
||||
rss: Math.round(mem.rss / 1024 / 1024) + 'MB',
|
||||
heap:
|
||||
Math.round(mem.heapUsed / 1024 / 1024) +
|
||||
'/' +
|
||||
Math.round(mem.heapTotal / 1024 / 1024) +
|
||||
'MB',
|
||||
},
|
||||
pid: process.pid,
|
||||
},
|
||||
services,
|
||||
timestamp: new Date().toISOString(),
|
||||
});
|
||||
});
|
||||
|
||||
Loading…
Reference in New Issue
Block a user