77b5a4ce4e
- Hub service receives reports from customer controllers - SQLite store with 90-day retention and auto-prune - REST API: POST /api/v1/report, GET /api/v1/customers - Dark theme dashboard with status overview table - Customer detail page with system, storage, containers, backup, health - Bearer token auth for report ingest, bcrypt auth for dashboard - K8s manifest for felhom-system namespace (Deployment, Service, Ingress, PVC) - Dockerfile with multi-stage build Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
194 lines
7.4 KiB
HTML
194 lines
7.4 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>{{.Customer.CustomerName}} — Felhom Hub</title>
|
|
<link rel="stylesheet" href="/style.css">
|
|
<meta http-equiv="refresh" content="60">
|
|
</head>
|
|
<body>
|
|
<div class="container">
|
|
<header>
|
|
<a href="/" class="back-link">← Back to Dashboard</a>
|
|
<h1>
|
|
<span class="status-dot" style="color: {{statusColor .OverallStatus}}">{{statusIcon .OverallStatus}}</span>
|
|
{{.Customer.CustomerName}}
|
|
</h1>
|
|
<p class="subtitle">Last report: {{timeAgo .Customer.ReceivedAt}} · Controller v{{.Customer.ControllerVersion}}</p>
|
|
</header>
|
|
|
|
<!-- System Info -->
|
|
<section class="card">
|
|
<h2>System</h2>
|
|
<div class="info-grid">
|
|
{{with .Report.system}}
|
|
<div class="info-item">
|
|
<span class="label">Hostname</span>
|
|
<span class="value">{{index . "hostname"}}</span>
|
|
</div>
|
|
<div class="info-item">
|
|
<span class="label">OS</span>
|
|
<span class="value">{{index . "os"}}</span>
|
|
</div>
|
|
<div class="info-item">
|
|
<span class="label">Kernel</span>
|
|
<span class="value">{{index . "kernel"}}</span>
|
|
</div>
|
|
<div class="info-item">
|
|
<span class="label">CPU</span>
|
|
<span class="value">{{index . "cpu_model"}} ({{index . "cpu_cores"}} cores)</span>
|
|
</div>
|
|
{{end}}
|
|
</div>
|
|
<div class="metrics-grid">
|
|
<div class="metric">
|
|
<span class="metric-label">CPU</span>
|
|
<span class="metric-value">{{formatFloat .Customer.CPUPercent}}%</span>
|
|
<div class="bar"><div class="bar-fill" style="width: {{formatFloat .Customer.CPUPercent}}%"></div></div>
|
|
</div>
|
|
<div class="metric">
|
|
<span class="metric-label">Memory</span>
|
|
<span class="metric-value">{{formatFloat .Customer.MemoryPercent}}%</span>
|
|
<div class="bar"><div class="bar-fill" style="width: {{formatFloat .Customer.MemoryPercent}}%"></div></div>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
|
|
<!-- Storage -->
|
|
<section class="card">
|
|
<h2>Storage</h2>
|
|
{{with .Report.storage}}
|
|
<div class="metrics-grid">
|
|
{{range .}}
|
|
<div class="metric">
|
|
<span class="metric-label">{{index . "mount"}}</span>
|
|
<span class="metric-value">{{printf "%.0f" (index . "percent")}}%</span>
|
|
<div class="bar"><div class="bar-fill" style="width: {{printf "%.0f" (index . "percent")}}%"></div></div>
|
|
<span class="metric-detail">{{printf "%.1f" (index . "used_gb")}} / {{printf "%.1f" (index . "total_gb")}} GB</span>
|
|
</div>
|
|
{{end}}
|
|
</div>
|
|
{{end}}
|
|
</section>
|
|
|
|
<!-- Containers -->
|
|
<section class="card">
|
|
<h2>Containers ({{.Customer.ContainerRunning}}/{{.Customer.ContainerTotal}})</h2>
|
|
{{with .Report.containers}}
|
|
{{$list := index . "list"}}
|
|
{{if $list}}
|
|
<table class="container-table">
|
|
<thead>
|
|
<tr>
|
|
<th>Name</th>
|
|
<th>State</th>
|
|
<th>CPU</th>
|
|
<th>Memory</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{{range $list}}
|
|
<tr>
|
|
<td>{{index . "name"}}</td>
|
|
<td><span class="container-state container-state-{{index . "state"}}">{{index . "state"}}</span></td>
|
|
<td>{{printf "%.1f" (index . "cpu_percent")}}%</td>
|
|
<td>{{printf "%.0f" (index . "memory_mb")}} MB</td>
|
|
</tr>
|
|
{{end}}
|
|
</tbody>
|
|
</table>
|
|
{{end}}
|
|
{{end}}
|
|
</section>
|
|
|
|
<!-- Backup -->
|
|
<section class="card">
|
|
<h2>Backup</h2>
|
|
{{with .Report.backup}}
|
|
<div class="info-grid">
|
|
<div class="info-item">
|
|
<span class="label">Enabled</span>
|
|
<span class="value">{{if index . "enabled"}}Yes{{else}}No{{end}}</span>
|
|
</div>
|
|
<div class="info-item">
|
|
<span class="label">Snapshots</span>
|
|
<span class="value">{{index . "snapshot_count"}}</span>
|
|
</div>
|
|
<div class="info-item">
|
|
<span class="label">Repo Size</span>
|
|
<span class="value">{{index . "repo_size_mb"}} MB</span>
|
|
</div>
|
|
<div class="info-item">
|
|
<span class="label">Integrity</span>
|
|
<span class="value">{{if index . "integrity_ok"}}OK{{else}}Unknown{{end}}</span>
|
|
</div>
|
|
</div>
|
|
{{end}}
|
|
</section>
|
|
|
|
<!-- Health -->
|
|
<section class="card">
|
|
<h2>Health</h2>
|
|
{{with .Report.health}}
|
|
<p class="health-status health-status-{{index . "status"}}">
|
|
Status: {{index . "status"}}
|
|
</p>
|
|
{{$issues := index . "issues"}}
|
|
{{if $issues}}
|
|
<h3>Issues</h3>
|
|
<ul class="issue-list">
|
|
{{range $issues}}
|
|
<li class="issue">{{.}}</li>
|
|
{{end}}
|
|
</ul>
|
|
{{end}}
|
|
{{$warnings := index . "warnings"}}
|
|
{{if $warnings}}
|
|
<h3>Warnings</h3>
|
|
<ul class="warning-list">
|
|
{{range $warnings}}
|
|
<li class="warning">{{.}}</li>
|
|
{{end}}
|
|
</ul>
|
|
{{end}}
|
|
{{end}}
|
|
</section>
|
|
|
|
<!-- Report History (last 24h) -->
|
|
{{if .History}}
|
|
<section class="card">
|
|
<h2>Report History (last 24h)</h2>
|
|
<details>
|
|
<summary>{{len .History}} reports</summary>
|
|
<table class="history-table">
|
|
<thead>
|
|
<tr>
|
|
<th>Time</th>
|
|
<th>Status</th>
|
|
<th>CPU</th>
|
|
<th>Memory</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{{range .History}}
|
|
<tr>
|
|
<td>{{.ReceivedAt.Format "15:04:05"}}</td>
|
|
<td><span class="status-badge status-badge-{{.HealthStatus}}">{{.HealthStatus}}</span></td>
|
|
<td>{{formatFloat .CPUPercent}}%</td>
|
|
<td>{{formatFloat .MemoryPercent}}%</td>
|
|
</tr>
|
|
{{end}}
|
|
</tbody>
|
|
</table>
|
|
</details>
|
|
</section>
|
|
{{end}}
|
|
|
|
<footer>
|
|
<p>Auto-refreshes every 60 seconds · <a href="/">Felhom Hub</a></p>
|
|
</footer>
|
|
</div>
|
|
</body>
|
|
</html>
|