783 lines
25 KiB
HTML
783 lines
25 KiB
HTML
<div class="monitoring-layout">
|
|
<!-- Sidebar Navigation -->
|
|
<aside class="monitoring-sidebar">
|
|
<div class="monitoring-header">
|
|
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
<circle cx="12" cy="12" r="10" opacity="0.3"></circle>
|
|
<circle cx="12" cy="12" r="6.5" opacity="0.6"></circle>
|
|
<circle cx="12" cy="12" r="2" fill="currentColor" stroke="none"></circle>
|
|
<line x1="12" y1="2" x2="12" y2="5"></line>
|
|
<line x1="12" y1="19" x2="12" y2="22"></line>
|
|
<line x1="2" y1="12" x2="5" y2="12"></line>
|
|
<line x1="19" y1="12" x2="22" y2="12"></line>
|
|
</svg>
|
|
<span>Monitoring</span>
|
|
</div>
|
|
|
|
<nav class="monitoring-nav">
|
|
<a href="#dashboard" class="nav-item active"
|
|
hx-get="/api/monitoring/dashboard"
|
|
hx-target="#monitoring-content"
|
|
hx-swap="innerHTML"
|
|
hx-push-url="false"
|
|
onclick="setActiveNav(this)">
|
|
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
<rect x="3" y="3" width="7" height="9"></rect>
|
|
<rect x="14" y="3" width="7" height="5"></rect>
|
|
<rect x="14" y="12" width="7" height="9"></rect>
|
|
<rect x="3" y="16" width="7" height="5"></rect>
|
|
</svg>
|
|
<span>Dashboard</span>
|
|
</a>
|
|
<a href="#services" class="nav-item"
|
|
hx-get="/api/monitoring/services"
|
|
hx-target="#monitoring-content"
|
|
hx-swap="innerHTML"
|
|
hx-push-url="false"
|
|
onclick="setActiveNav(this)">
|
|
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
<rect x="2" y="2" width="20" height="8" rx="2" ry="2"></rect>
|
|
<rect x="2" y="14" width="20" height="8" rx="2" ry="2"></rect>
|
|
<line x1="6" y1="6" x2="6.01" y2="6"></line>
|
|
<line x1="6" y1="18" x2="6.01" y2="18"></line>
|
|
</svg>
|
|
<span>Services</span>
|
|
</a>
|
|
<a href="#resources" class="nav-item"
|
|
hx-get="/api/monitoring/resources"
|
|
hx-target="#monitoring-content"
|
|
hx-swap="innerHTML"
|
|
hx-push-url="false"
|
|
onclick="setActiveNav(this)">
|
|
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
<rect x="4" y="4" width="16" height="16" rx="2"></rect>
|
|
<rect x="9" y="9" width="6" height="6"></rect>
|
|
<line x1="9" y1="1" x2="9" y2="4"></line>
|
|
<line x1="15" y1="1" x2="15" y2="4"></line>
|
|
<line x1="9" y1="20" x2="9" y2="23"></line>
|
|
<line x1="15" y1="20" x2="15" y2="23"></line>
|
|
<line x1="20" y1="9" x2="23" y2="9"></line>
|
|
<line x1="20" y1="14" x2="23" y2="14"></line>
|
|
<line x1="1" y1="9" x2="4" y2="9"></line>
|
|
<line x1="1" y1="14" x2="4" y2="14"></line>
|
|
</svg>
|
|
<span>Resources</span>
|
|
</a>
|
|
<a href="#logs" class="nav-item"
|
|
hx-get="/api/monitoring/logs"
|
|
hx-target="#monitoring-content"
|
|
hx-swap="innerHTML"
|
|
hx-push-url="false"
|
|
onclick="setActiveNav(this)">
|
|
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
<path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"></path>
|
|
<polyline points="14 2 14 8 20 8"></polyline>
|
|
<line x1="16" y1="13" x2="8" y2="13"></line>
|
|
<line x1="16" y1="17" x2="8" y2="17"></line>
|
|
<polyline points="10 9 9 9 8 9"></polyline>
|
|
</svg>
|
|
<span>Logs</span>
|
|
</a>
|
|
<a href="#metrics" class="nav-item"
|
|
hx-get="/api/monitoring/metrics"
|
|
hx-target="#monitoring-content"
|
|
hx-swap="innerHTML"
|
|
hx-push-url="false"
|
|
onclick="setActiveNav(this)">
|
|
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
<line x1="18" y1="20" x2="18" y2="10"></line>
|
|
<line x1="12" y1="20" x2="12" y2="4"></line>
|
|
<line x1="6" y1="20" x2="6" y2="14"></line>
|
|
</svg>
|
|
<span>Metrics</span>
|
|
</a>
|
|
<a href="#alerts" class="nav-item"
|
|
hx-get="/api/monitoring/alerts"
|
|
hx-target="#monitoring-content"
|
|
hx-swap="innerHTML"
|
|
hx-push-url="false"
|
|
onclick="setActiveNav(this)">
|
|
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
<path d="M18 8A6 6 0 0 0 6 8c0 7-3 9-3 9h18s-3-2-3-9"></path>
|
|
<path d="M13.73 21a2 2 0 0 1-3.46 0"></path>
|
|
</svg>
|
|
<span>Alerts</span>
|
|
<span class="alert-badge" id="alert-count"
|
|
hx-get="/api/monitoring/alerts/count"
|
|
hx-trigger="load, every 30s"
|
|
hx-swap="innerHTML">0</span>
|
|
</a>
|
|
<a href="#health" class="nav-item"
|
|
hx-get="/api/monitoring/health"
|
|
hx-target="#monitoring-content"
|
|
hx-swap="innerHTML"
|
|
hx-push-url="false"
|
|
onclick="setActiveNav(this)">
|
|
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
<path d="M22 12h-4l-3 9L9 3l-3 9H2"></path>
|
|
</svg>
|
|
<span>Health</span>
|
|
<span class="health-indicator"
|
|
hx-get="/api/monitoring/health/status"
|
|
hx-trigger="load, every 10s"
|
|
hx-swap="outerHTML"></span>
|
|
</a>
|
|
</nav>
|
|
|
|
<div class="monitoring-footer">
|
|
<a href="/suite" class="back-link">
|
|
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
<line x1="19" y1="12" x2="5" y2="12"></line>
|
|
<polyline points="12 19 5 12 12 5"></polyline>
|
|
</svg>
|
|
Back to Suite
|
|
</a>
|
|
<div class="system-status">
|
|
<span class="status-indicator running"></span>
|
|
<span class="status-text"
|
|
hx-get="/api/monitoring/system/status"
|
|
hx-trigger="load, every 15s"
|
|
hx-swap="innerHTML">All Systems Operational</span>
|
|
</div>
|
|
</div>
|
|
</aside>
|
|
|
|
<!-- Main Content Area -->
|
|
<main class="monitoring-main">
|
|
<div class="monitoring-toolbar">
|
|
<div class="toolbar-left">
|
|
<h1 id="page-title">Dashboard</h1>
|
|
<span class="last-updated"
|
|
hx-get="/api/monitoring/timestamp"
|
|
hx-trigger="load, every 5s"
|
|
hx-swap="innerHTML">--</span>
|
|
</div>
|
|
<div class="toolbar-right">
|
|
<div class="time-range-selector">
|
|
<select id="time-range" onchange="updateTimeRange(this.value)">
|
|
<option value="15m">Last 15 minutes</option>
|
|
<option value="1h" selected>Last 1 hour</option>
|
|
<option value="6h">Last 6 hours</option>
|
|
<option value="24h">Last 24 hours</option>
|
|
<option value="7d">Last 7 days</option>
|
|
<option value="30d">Last 30 days</option>
|
|
</select>
|
|
</div>
|
|
<button class="toolbar-btn" onclick="refreshMonitoring()" title="Refresh">
|
|
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
<polyline points="23 4 23 10 17 10"></polyline>
|
|
<polyline points="1 20 1 14 7 14"></polyline>
|
|
<path d="M3.51 9a9 9 0 0 1 14.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0 0 20.49 15"></path>
|
|
</svg>
|
|
</button>
|
|
<button class="toolbar-btn" onclick="toggleAutoRefresh()" id="auto-refresh-btn" title="Auto Refresh">
|
|
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
<circle cx="12" cy="12" r="10"></circle>
|
|
<polyline points="12 6 12 12 16 14"></polyline>
|
|
</svg>
|
|
</button>
|
|
<button class="toolbar-btn" onclick="exportData()" title="Export">
|
|
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"></path>
|
|
<polyline points="7 10 12 15 17 10"></polyline>
|
|
<line x1="12" y1="15" x2="12" y2="3"></line>
|
|
</svg>
|
|
</button>
|
|
<a href="/metrics" target="_blank" class="toolbar-btn" title="Prometheus Metrics">
|
|
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
<circle cx="12" cy="12" r="10"></circle>
|
|
<line x1="12" y1="8" x2="12" y2="12"></line>
|
|
<line x1="12" y1="16" x2="12.01" y2="16"></line>
|
|
</svg>
|
|
</a>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="monitoring-content" id="monitoring-content"
|
|
hx-get="/api/monitoring/dashboard"
|
|
hx-trigger="load"
|
|
hx-swap="innerHTML">
|
|
<!-- Dashboard content loaded via HTMX -->
|
|
<div class="loading-state">
|
|
<div class="spinner"></div>
|
|
<p>Loading monitoring data...</p>
|
|
</div>
|
|
</div>
|
|
</main>
|
|
</div>
|
|
|
|
<!-- Quick Stats Bar (always visible) -->
|
|
<div class="quick-stats-bar">
|
|
<div class="quick-stat"
|
|
hx-get="/api/monitoring/quick/cpu"
|
|
hx-trigger="load, every 5s"
|
|
hx-swap="innerHTML">
|
|
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
<rect x="4" y="4" width="16" height="16" rx="2"></rect>
|
|
<rect x="9" y="9" width="6" height="6"></rect>
|
|
</svg>
|
|
<span class="stat-label">CPU</span>
|
|
<span class="stat-value">--%</span>
|
|
</div>
|
|
<div class="quick-stat"
|
|
hx-get="/api/monitoring/quick/memory"
|
|
hx-trigger="load, every 5s"
|
|
hx-swap="innerHTML">
|
|
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
<rect x="2" y="6" width="20" height="12" rx="2"></rect>
|
|
<line x1="6" y1="12" x2="6" y2="12"></line>
|
|
<line x1="10" y1="12" x2="10" y2="12"></line>
|
|
<line x1="14" y1="12" x2="14" y2="12"></line>
|
|
<line x1="18" y1="12" x2="18" y2="12"></line>
|
|
</svg>
|
|
<span class="stat-label">Memory</span>
|
|
<span class="stat-value">--%</span>
|
|
</div>
|
|
<div class="quick-stat"
|
|
hx-get="/api/monitoring/quick/disk"
|
|
hx-trigger="load, every 30s"
|
|
hx-swap="innerHTML">
|
|
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
<ellipse cx="12" cy="5" rx="9" ry="3"></ellipse>
|
|
<path d="M21 12c0 1.66-4 3-9 3s-9-1.34-9-3"></path>
|
|
<path d="M3 5v14c0 1.66 4 3 9 3s9-1.34 9-3V5"></path>
|
|
</svg>
|
|
<span class="stat-label">Disk</span>
|
|
<span class="stat-value">--%</span>
|
|
</div>
|
|
<div class="quick-stat"
|
|
hx-get="/api/monitoring/quick/network"
|
|
hx-trigger="load, every 5s"
|
|
hx-swap="innerHTML">
|
|
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
<path d="M5 12.55a11 11 0 0 1 14.08 0"></path>
|
|
<path d="M1.42 9a16 16 0 0 1 21.16 0"></path>
|
|
<path d="M8.53 16.11a6 6 0 0 1 6.95 0"></path>
|
|
<line x1="12" y1="20" x2="12.01" y2="20"></line>
|
|
</svg>
|
|
<span class="stat-label">Network</span>
|
|
<span class="stat-value">-- MB/s</span>
|
|
</div>
|
|
<div class="quick-stat"
|
|
hx-get="/api/monitoring/quick/requests"
|
|
hx-trigger="load, every 5s"
|
|
hx-swap="innerHTML">
|
|
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
<polyline points="22 12 18 12 15 21 9 3 6 12 2 12"></polyline>
|
|
</svg>
|
|
<span class="stat-label">Requests</span>
|
|
<span class="stat-value">--/s</span>
|
|
</div>
|
|
</div>
|
|
|
|
<style>
|
|
.monitoring-layout {
|
|
display: flex;
|
|
min-height: calc(100vh - 64px);
|
|
background: var(--bg);
|
|
}
|
|
|
|
/* Sidebar */
|
|
.monitoring-sidebar {
|
|
width: 240px;
|
|
background: var(--surface);
|
|
border-right: 1px solid var(--border);
|
|
display: flex;
|
|
flex-direction: column;
|
|
position: sticky;
|
|
top: 64px;
|
|
height: calc(100vh - 64px);
|
|
overflow-y: auto;
|
|
}
|
|
|
|
.monitoring-header {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 0.75rem;
|
|
padding: 1.25rem 1rem;
|
|
border-bottom: 1px solid var(--border);
|
|
color: var(--text);
|
|
font-weight: 600;
|
|
font-size: 1rem;
|
|
}
|
|
|
|
.monitoring-header svg {
|
|
color: var(--primary);
|
|
}
|
|
|
|
.monitoring-nav {
|
|
flex: 1;
|
|
padding: 0.75rem 0;
|
|
}
|
|
|
|
.nav-item {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 0.75rem;
|
|
padding: 0.75rem 1rem;
|
|
color: var(--text-secondary);
|
|
text-decoration: none;
|
|
transition: all 0.2s ease;
|
|
position: relative;
|
|
}
|
|
|
|
.nav-item:hover {
|
|
background: var(--surface-hover);
|
|
color: var(--text);
|
|
}
|
|
|
|
.nav-item.active {
|
|
background: var(--primary-light);
|
|
color: var(--primary);
|
|
border-right: 3px solid var(--primary);
|
|
}
|
|
|
|
.nav-item svg {
|
|
flex-shrink: 0;
|
|
}
|
|
|
|
.alert-badge {
|
|
margin-left: auto;
|
|
background: var(--error);
|
|
color: white;
|
|
font-size: 0.7rem;
|
|
font-weight: 600;
|
|
padding: 0.15rem 0.4rem;
|
|
border-radius: 10px;
|
|
min-width: 18px;
|
|
text-align: center;
|
|
}
|
|
|
|
.alert-badge:empty,
|
|
.alert-badge:contains("0") {
|
|
display: none;
|
|
}
|
|
|
|
.health-indicator {
|
|
margin-left: auto;
|
|
width: 8px;
|
|
height: 8px;
|
|
border-radius: 50%;
|
|
background: var(--success);
|
|
}
|
|
|
|
.health-indicator.warning {
|
|
background: var(--warning);
|
|
}
|
|
|
|
.health-indicator.error {
|
|
background: var(--error);
|
|
}
|
|
|
|
.monitoring-footer {
|
|
padding: 1rem;
|
|
border-top: 1px solid var(--border);
|
|
}
|
|
|
|
.back-link {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 0.5rem;
|
|
color: var(--text-secondary);
|
|
text-decoration: none;
|
|
font-size: 0.875rem;
|
|
padding: 0.5rem 0;
|
|
transition: color 0.2s ease;
|
|
}
|
|
|
|
.back-link:hover {
|
|
color: var(--primary);
|
|
}
|
|
|
|
.system-status {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 0.5rem;
|
|
margin-top: 0.75rem;
|
|
padding-top: 0.75rem;
|
|
border-top: 1px solid var(--border);
|
|
font-size: 0.75rem;
|
|
color: var(--text-secondary);
|
|
}
|
|
|
|
.status-indicator {
|
|
width: 8px;
|
|
height: 8px;
|
|
border-radius: 50%;
|
|
flex-shrink: 0;
|
|
}
|
|
|
|
.status-indicator.running {
|
|
background: var(--success);
|
|
box-shadow: 0 0 8px var(--success);
|
|
}
|
|
|
|
.status-indicator.warning {
|
|
background: var(--warning);
|
|
box-shadow: 0 0 8px var(--warning);
|
|
}
|
|
|
|
.status-indicator.error {
|
|
background: var(--error);
|
|
box-shadow: 0 0 8px var(--error);
|
|
}
|
|
|
|
/* Main Content */
|
|
.monitoring-main {
|
|
flex: 1;
|
|
display: flex;
|
|
flex-direction: column;
|
|
min-width: 0;
|
|
}
|
|
|
|
.monitoring-toolbar {
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: space-between;
|
|
padding: 1rem 1.5rem;
|
|
background: var(--surface);
|
|
border-bottom: 1px solid var(--border);
|
|
position: sticky;
|
|
top: 64px;
|
|
z-index: 100;
|
|
}
|
|
|
|
.toolbar-left {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 1rem;
|
|
}
|
|
|
|
.toolbar-left h1 {
|
|
font-size: 1.25rem;
|
|
font-weight: 600;
|
|
color: var(--text);
|
|
}
|
|
|
|
.last-updated {
|
|
font-size: 0.75rem;
|
|
color: var(--text-secondary);
|
|
background: var(--bg);
|
|
padding: 0.25rem 0.5rem;
|
|
border-radius: 4px;
|
|
}
|
|
|
|
.toolbar-right {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 0.5rem;
|
|
}
|
|
|
|
.time-range-selector select {
|
|
background: var(--bg);
|
|
border: 1px solid var(--border);
|
|
color: var(--text);
|
|
padding: 0.5rem 0.75rem;
|
|
border-radius: 6px;
|
|
font-size: 0.875rem;
|
|
cursor: pointer;
|
|
}
|
|
|
|
.time-range-selector select:focus {
|
|
outline: none;
|
|
border-color: var(--primary);
|
|
}
|
|
|
|
.toolbar-btn {
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
width: 36px;
|
|
height: 36px;
|
|
background: var(--bg);
|
|
border: 1px solid var(--border);
|
|
border-radius: 6px;
|
|
color: var(--text-secondary);
|
|
cursor: pointer;
|
|
transition: all 0.2s ease;
|
|
text-decoration: none;
|
|
}
|
|
|
|
.toolbar-btn:hover {
|
|
background: var(--surface-hover);
|
|
color: var(--text);
|
|
border-color: var(--primary);
|
|
}
|
|
|
|
.toolbar-btn.active {
|
|
background: var(--primary-light);
|
|
color: var(--primary);
|
|
border-color: var(--primary);
|
|
}
|
|
|
|
.monitoring-content {
|
|
flex: 1;
|
|
padding: 1.5rem;
|
|
overflow-y: auto;
|
|
}
|
|
|
|
/* Loading State */
|
|
.loading-state {
|
|
display: flex;
|
|
flex-direction: column;
|
|
align-items: center;
|
|
justify-content: center;
|
|
padding: 4rem;
|
|
color: var(--text-secondary);
|
|
}
|
|
|
|
.spinner {
|
|
width: 40px;
|
|
height: 40px;
|
|
border: 3px solid var(--border);
|
|
border-top-color: var(--primary);
|
|
border-radius: 50%;
|
|
animation: spin 1s linear infinite;
|
|
margin-bottom: 1rem;
|
|
}
|
|
|
|
@keyframes spin {
|
|
to {
|
|
transform: rotate(360deg);
|
|
}
|
|
}
|
|
|
|
/* Quick Stats Bar */
|
|
.quick-stats-bar {
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
gap: 2rem;
|
|
padding: 0.75rem 1.5rem;
|
|
background: var(--surface);
|
|
border-top: 1px solid var(--border);
|
|
position: fixed;
|
|
bottom: 0;
|
|
left: 240px;
|
|
right: 0;
|
|
z-index: 100;
|
|
}
|
|
|
|
.quick-stat {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 0.5rem;
|
|
font-size: 0.875rem;
|
|
}
|
|
|
|
.quick-stat svg {
|
|
color: var(--primary);
|
|
}
|
|
|
|
.stat-label {
|
|
color: var(--text-secondary);
|
|
}
|
|
|
|
.stat-value {
|
|
color: var(--text);
|
|
font-weight: 600;
|
|
font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Fira Code', monospace;
|
|
}
|
|
|
|
.stat-value.warning {
|
|
color: var(--warning);
|
|
}
|
|
|
|
.stat-value.error {
|
|
color: var(--error);
|
|
}
|
|
|
|
/* Dashboard Grid (default content) */
|
|
.dashboard-grid {
|
|
display: grid;
|
|
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
|
|
gap: 1.5rem;
|
|
}
|
|
|
|
.dashboard-card {
|
|
background: var(--surface);
|
|
border: 1px solid var(--border);
|
|
border-radius: 12px;
|
|
padding: 1.25rem;
|
|
}
|
|
|
|
.card-header {
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: space-between;
|
|
margin-bottom: 1rem;
|
|
}
|
|
|
|
.card-title {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 0.5rem;
|
|
font-weight: 600;
|
|
color: var(--text);
|
|
}
|
|
|
|
.card-title svg {
|
|
color: var(--primary);
|
|
}
|
|
|
|
.card-action {
|
|
font-size: 0.75rem;
|
|
color: var(--primary);
|
|
text-decoration: none;
|
|
}
|
|
|
|
.card-action:hover {
|
|
text-decoration: underline;
|
|
}
|
|
|
|
/* Responsive */
|
|
@media (max-width: 1024px) {
|
|
.monitoring-sidebar {
|
|
width: 200px;
|
|
}
|
|
|
|
.quick-stats-bar {
|
|
left: 200px;
|
|
gap: 1rem;
|
|
}
|
|
|
|
.quick-stat .stat-label {
|
|
display: none;
|
|
}
|
|
}
|
|
|
|
@media (max-width: 768px) {
|
|
.monitoring-layout {
|
|
flex-direction: column;
|
|
}
|
|
|
|
.monitoring-sidebar {
|
|
width: 100%;
|
|
height: auto;
|
|
position: relative;
|
|
top: 0;
|
|
}
|
|
|
|
.monitoring-nav {
|
|
display: flex;
|
|
overflow-x: auto;
|
|
padding: 0.5rem;
|
|
gap: 0.25rem;
|
|
}
|
|
|
|
.nav-item {
|
|
flex-direction: column;
|
|
padding: 0.5rem 0.75rem;
|
|
font-size: 0.75rem;
|
|
white-space: nowrap;
|
|
border-right: none !important;
|
|
border-radius: 6px;
|
|
}
|
|
|
|
.nav-item.active {
|
|
border-bottom: 2px solid var(--primary);
|
|
}
|
|
|
|
.nav-item span:not(.alert-badge):not(.health-indicator) {
|
|
display: none;
|
|
}
|
|
|
|
.monitoring-footer {
|
|
display: none;
|
|
}
|
|
|
|
.monitoring-toolbar {
|
|
flex-direction: column;
|
|
gap: 0.75rem;
|
|
align-items: stretch;
|
|
position: relative;
|
|
top: 0;
|
|
}
|
|
|
|
.toolbar-left,
|
|
.toolbar-right {
|
|
justify-content: space-between;
|
|
}
|
|
|
|
.quick-stats-bar {
|
|
left: 0;
|
|
gap: 0.5rem;
|
|
padding: 0.5rem;
|
|
flex-wrap: wrap;
|
|
}
|
|
|
|
.quick-stat {
|
|
font-size: 0.75rem;
|
|
}
|
|
|
|
.monitoring-content {
|
|
padding-bottom: 80px;
|
|
}
|
|
}
|
|
</style>
|
|
|
|
<script>
|
|
function setActiveNav(element) {
|
|
document.querySelectorAll('.monitoring-nav .nav-item').forEach(item => {
|
|
item.classList.remove('active');
|
|
});
|
|
element.classList.add('active');
|
|
|
|
// Update page title
|
|
const title = element.querySelector('span:not(.alert-badge):not(.health-indicator)').textContent;
|
|
document.getElementById('page-title').textContent = title;
|
|
}
|
|
|
|
function updateTimeRange(range) {
|
|
// Store selected time range
|
|
localStorage.setItem('monitoring-time-range', range);
|
|
|
|
// Trigger refresh of current view
|
|
htmx.trigger('#monitoring-content', 'refresh');
|
|
}
|
|
|
|
function refreshMonitoring() {
|
|
htmx.trigger('#monitoring-content', 'refresh');
|
|
|
|
// Visual feedback
|
|
const btn = event.currentTarget;
|
|
btn.classList.add('active');
|
|
setTimeout(() => btn.classList.remove('active'), 500);
|
|
}
|
|
|
|
let autoRefresh = true;
|
|
function toggleAutoRefresh() {
|
|
autoRefresh = !autoRefresh;
|
|
const btn = document.getElementById('auto-refresh-btn');
|
|
btn.classList.toggle('active', autoRefresh);
|
|
|
|
if (autoRefresh) {
|
|
// Re-enable polling by refreshing the page content
|
|
htmx.trigger('#monitoring-content', 'refresh');
|
|
}
|
|
}
|
|
|
|
function exportData() {
|
|
const timeRange = document.getElementById('time-range').value;
|
|
window.open(`/api/monitoring/export?range=${timeRange}`, '_blank');
|
|
}
|
|
|
|
// Initialize
|
|
document.addEventListener('DOMContentLoaded', function() {
|
|
// Restore time range preference
|
|
const savedRange = localStorage.getItem('monitoring-time-range');
|
|
if (savedRange) {
|
|
document.getElementById('time-range').value = savedRange;
|
|
}
|
|
|
|
// Set auto-refresh button state
|
|
document.getElementById('auto-refresh-btn').classList.toggle('active', autoRefresh);
|
|
});
|
|
|
|
// Handle HTMX events for loading states
|
|
document.body.addEventListener('htmx:beforeRequest', function(evt) {
|
|
if (evt.target.id === 'monitoring-content') {
|
|
evt.target.innerHTML = '<div class="loading-state"><div class="spinner"></div><p>Loading...</p></div>';
|
|
}
|
|
});
|
|
</script>
|