feat(infra): responsive UI with mobile-first design and blur header
- Mobile-first responsive: single column → 2 columns → auto-fill grid - Sticky header with backdrop-filter blur - Cards with hover glow and fade-in animation - SVG charts scale with container (max-width constraint per breakpoint) - Touch-friendly link targets on mobile - Custom dark scrollbar - 5 breakpoints: 480, 640, 768, 1024, 1280px
This commit is contained in:
@@ -6,87 +6,114 @@
|
||||
<title>Hub Dashboard</title>
|
||||
<style>
|
||||
*{margin:0;padding:0;box-sizing:border-box}
|
||||
body{font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,sans-serif;background:#0d1117;color:#e6edf3;line-height:1.5}
|
||||
body{font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,sans-serif;background:#0d1117;color:#e6edf3;line-height:1.5;-webkit-font-smoothing:antialiased}
|
||||
|
||||
/* ── Header ── */
|
||||
.hdr{display:flex;justify-content:space-between;align-items:center;padding:14px 24px;border-bottom:1px solid #30363d;background:#161b22;position:sticky;top:0;z-index:100;gap:12px}
|
||||
.hl{display:flex;align-items:center;gap:12px;min-width:0}
|
||||
.hl .l{width:30px;height:30px;border-radius:7px;background:linear-gradient(135deg,#58a6ff,#bc8cff);display:flex;align-items:center;justify-content:center;font-weight:700;font-size:13px;color:#fff;flex-shrink:0}
|
||||
.hl h1{font-size:17px;font-weight:600;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
||||
.hl .s{color:#8b949e;font-size:12px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
||||
.hr{display:flex;align-items:center;gap:14px;flex-shrink:0}
|
||||
.hb{display:flex;align-items:center;gap:6px;font-size:12px;padding:4px 14px;border-radius:20px;font-weight:500;white-space:nowrap}
|
||||
.hb.g{background:rgba(63,185,80,0.12);color:#3fb950}
|
||||
.hb.y{background:rgba(210,153,34,0.12);color:#d29922}
|
||||
.hb.r{background:rgba(248,81,73,0.12);color:#f85149}
|
||||
.hb .d{width:8px;height:8px;border-radius:50%}
|
||||
.hdr{display:flex;justify-content:space-between;align-items:center;padding:12px 20px;border-bottom:1px solid #30363d;background:rgba(22,27,34,.92);backdrop-filter:blur(12px);-webkit-backdrop-filter:blur(12px);position:sticky;top:0;z-index:100;gap:8px}
|
||||
.hl{display:flex;align-items:center;gap:10px;min-width:0}
|
||||
.hl .l{width:28px;height:28px;border-radius:6px;background:linear-gradient(135deg,#58a6ff,#bc8cff);display:flex;align-items:center;justify-content:center;font-weight:700;font-size:12px;color:#fff;flex-shrink:0}
|
||||
.hl h1{font-size:16px;font-weight:600;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
||||
.hl .s{color:#8b949e;font-size:11px;display:none}
|
||||
.hr{display:flex;align-items:center;gap:10px;flex-shrink:0}
|
||||
.hb{display:flex;align-items:center;gap:5px;font-size:11px;padding:4px 12px;border-radius:20px;font-weight:500;white-space:nowrap}
|
||||
.hb.g{background:rgba(63,185,80,.12);color:#3fb950}
|
||||
.hb.y{background:rgba(210,153,34,.12);color:#d29922}
|
||||
.hb.r{background:rgba(248,81,73,.12);color:#f85149}
|
||||
.hb .d{width:7px;height:7px;border-radius:50%}
|
||||
.hb.g .d{background:#3fb950}.hb.y .d{background:#d29922}.hb.r .d{background:#f85149}
|
||||
.up{color:#6e7681;font-size:11px;white-space:nowrap}
|
||||
.up{color:#6e7681;font-size:10px;white-space:nowrap}
|
||||
|
||||
/* ── Main container ── */
|
||||
.c{max-width:1440px;margin:0 auto;padding:16px 24px}
|
||||
/* ── Container ── */
|
||||
.c{max-width:1440px;margin:0 auto;padding:12px 16px}
|
||||
|
||||
/* ── Fully dynamic grid ── */
|
||||
.g{display:grid;gap:14px;grid-template-columns:repeat(auto-fill,minmax(340px,1fr))}
|
||||
/* ── Grid — fully responsive ── */
|
||||
.g{display:grid;gap:10px}
|
||||
@media(min-width:481px){.g{gap:12px;padding:0 4px}}
|
||||
@media(min-width:769px){.g{grid-template-columns:repeat(auto-fill,minmax(320px,1fr));gap:14px;padding:0 8px}}
|
||||
|
||||
/* ── Cards ── */
|
||||
.cd{background:#161b22;border:1px solid #30363d;border-radius:8px;padding:16px}
|
||||
.ch{display:flex;justify-content:space-between;align-items:center;margin-bottom:12px;gap:8px}
|
||||
.ch h2{font-size:12px;font-weight:600;text-transform:uppercase;letter-spacing:0.06em;color:#8b949e;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
||||
.ch .b{font-size:10px;background:#1c2333;padding:2px 10px;border-radius:10px;color:#8b949e;white-space:nowrap;flex-shrink:0}
|
||||
.cg{display:flex;justify-content:center;align-items:center}
|
||||
.cd{background:#161b22;border:1px solid #30363d;border-radius:8px;padding:14px;transition:border-color .2s,box-shadow .2s}
|
||||
.cd:hover{border-color:#3d444d;box-shadow:0 0 0 1px transparent,0 1px 3px rgba(0,0,0,.3)}
|
||||
@media(max-width:480px){.cd{padding:12px;border-radius:6px}}
|
||||
|
||||
.ch{display:flex;justify-content:space-between;align-items:center;margin-bottom:10px;gap:8px}
|
||||
.ch h2{font-size:11px;font-weight:600;text-transform:uppercase;letter-spacing:.06em;color:#8b949e;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
||||
.ch .b{font-size:9px;background:#1c2333;padding:2px 8px;border-radius:8px;color:#8b949e;white-space:nowrap;flex-shrink:0;line-height:1.6}
|
||||
.cg{display:flex;justify-content:center;align-items:center;width:100%}
|
||||
.cg svg{max-width:100%;height:auto}
|
||||
|
||||
/* ── Service tiles ── */
|
||||
.sg{display:grid;gap:5px;grid-template-columns:repeat(auto-fill,minmax(140px,1fr))}
|
||||
.st{display:flex;align-items:center;gap:7px;padding:7px 9px;border:1px solid #30363d;border-radius:6px;font-size:12px}
|
||||
.st:hover{background:#1c2333}
|
||||
.st .i{width:7px;height:7px;border-radius:50%;flex-shrink:0}
|
||||
.sg{display:flex;flex-wrap:wrap;gap:4px}
|
||||
.st{display:inline-flex;align-items:center;gap:5px;padding:5px 8px;border:1px solid #30363d;border-radius:5px;font-size:11px;transition:all .15s;cursor:default}
|
||||
.st:hover{background:#1c2333;border-color:#3d444d}
|
||||
.st .i{width:6px;height:6px;border-radius:50%;flex-shrink:0}
|
||||
.st .i.g{background:#3fb950}.st .i.r{background:#f85149}.st .i.y{background:#d29922}.st .i.b{background:#58a6ff}
|
||||
.st .n{font-family:'SF Mono','Fira Code',monospace;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
||||
.st .n{font-family:'SF Mono','Fira Code',Consolas,monospace;font-size:10px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
||||
|
||||
/* ── Stat boxes ── */
|
||||
.sg2{display:grid;grid-template-columns:1fr 1fr;gap:7px}
|
||||
.sb{background:#1c2333;border-radius:6px;padding:12px 8px;text-align:center}
|
||||
.sv{font-size:22px;font-weight:700;font-family:'SF Mono',monospace}
|
||||
.sl2{font-size:10px;color:#8b949e;margin-top:2px;text-transform:uppercase;letter-spacing:.04em}
|
||||
.sg2{display:grid;grid-template-columns:1fr 1fr;gap:6px}
|
||||
.sb{background:#1c2333;border-radius:6px;padding:10px 6px;text-align:center}
|
||||
.sv{font-size:20px;font-weight:700;font-family:'SF Mono','Fira Code',monospace;line-height:1.2}
|
||||
.sl2{font-size:9px;color:#8b949e;margin-top:2px;text-transform:uppercase;letter-spacing:.04em}
|
||||
.sv.a{color:#58a6ff}.sv.g{color:#3fb950}.sv.r{color:#f85149}.sv.y{color:#d29922}
|
||||
|
||||
/* ── System resource gauges ── */
|
||||
.sg3{display:grid;grid-template-columns:repeat(auto-fill,minmax(200px,1fr));gap:8px}
|
||||
.ns{font-size:10px;color:#6e7681;text-align:center;margin-top:4px}
|
||||
.sg3{display:grid;grid-template-columns:repeat(auto-fit,minmax(160px,1fr));gap:6px}
|
||||
.ns{font-size:9px;color:#6e7681;text-align:center;margin-top:2px;padding-top:4px;border-top:1px solid #21262d}
|
||||
|
||||
/* ── Links ── */
|
||||
.lk{display:flex;flex-wrap:wrap;gap:5px}
|
||||
.lk a{color:#58a6ff;text-decoration:none;font-size:11px;padding:4px 10px;border:1px solid #30363d;border-radius:6px;transition:all.15s}
|
||||
.lk{display:flex;flex-wrap:wrap;gap:4px}
|
||||
.lk a{color:#58a6ff;text-decoration:none;font-size:10px;padding:4px 8px;border:1px solid #30363d;border-radius:5px;transition:all .15s;line-height:1.4}
|
||||
.lk a:hover{background:#1c2333;border-color:#58a6ff}
|
||||
@media(max-width:480px){.lk a{padding:6px 10px;font-size:11px}}
|
||||
|
||||
/* ── Traces ── */
|
||||
.tl{list-style:none}
|
||||
.ti{padding:7px 0;border-bottom:1px solid #30363d;font-size:12px;display:flex;justify-content:space-between;align-items:center;gap:8px}
|
||||
.ti{padding:6px 0;border-bottom:1px solid #21262d;font-size:11px;display:flex;justify-content:space-between;align-items:center;gap:6px}
|
||||
.ti:last-child{border-bottom:none}
|
||||
.ts{font-weight:500;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
||||
.to{color:#8b949e;font-size:11px;font-family:'SF Mono','Fira Code',monospace;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
||||
.tt{display:flex;gap:10px;font-size:11px;color:#8b949e;flex-shrink:0;align-items:center}
|
||||
.to{color:#8b949e;font-size:10px;font-family:'SF Mono','Fira Code',monospace;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:200px}
|
||||
.tt{display:flex;gap:8px;font-size:10px;color:#8b949e;flex-shrink:0;align-items:center}
|
||||
.td{font-family:'SF Mono',monospace;font-weight:500;color:#58a6ff}
|
||||
.te{color:#f85149}
|
||||
.te{color:#f85149;font-size:9px;padding:1px 5px;border-radius:3px;background:rgba(248,81,73,.1)}
|
||||
|
||||
.em{text-align:center;padding:20px;color:#6e7681;font-size:12px}
|
||||
.em{text-align:center;padding:16px;color:#6e7681;font-size:11px}
|
||||
|
||||
/* ── Responsive ── */
|
||||
@media(max-width:768px){
|
||||
.c{padding:12px}
|
||||
.g{grid-template-columns:1fr}
|
||||
.sg2{grid-template-columns:1fr 1fr}
|
||||
.sg3{grid-template-columns:1fr}
|
||||
.sg{grid-template-columns:repeat(auto-fill,minmax(120px,1fr))}
|
||||
.hdr{flex-wrap:wrap}
|
||||
.hr{width:100%;justify-content:space-between}
|
||||
/* ── Scaling SVGs ── */
|
||||
.cg svg{width:100%;height:auto;max-width:340px}
|
||||
@media(min-width:481px){.cg svg{max-width:400px}}
|
||||
@media(max-width:480px){.cg svg{max-width:100%}}
|
||||
.sg3 .cg svg{max-width:100%}
|
||||
|
||||
/* ── Animations ── */
|
||||
.g>.cd{animation:fadeIn .3s ease}
|
||||
@keyframes fadeIn{from{opacity:0;transform:translateY(6px)}to{opacity:1;transform:translateY(0)}}
|
||||
|
||||
/* ── Mobile first (single column) ── */
|
||||
@media(min-width:481px){
|
||||
.c{padding:16px 20px}
|
||||
.hdr{padding:14px 24px}
|
||||
.g{gap:12px;grid-template-columns:1fr}
|
||||
}
|
||||
@media(min-width:769px)and(max-width:1100px){
|
||||
.g{grid-template-columns:repeat(auto-fill,minmax(300px,1fr))}
|
||||
.sg3{grid-template-columns:1fr 1fr}
|
||||
@media(min-width:640px){
|
||||
.g{grid-template-columns:repeat(2,1fr)}
|
||||
.hl .s{display:inline}
|
||||
}
|
||||
@media(min-width:1024px){
|
||||
.g{grid-template-columns:repeat(auto-fill,minmax(320px,1fr));gap:14px}
|
||||
.c{padding:20px 28px}
|
||||
.sg3{grid-template-columns:repeat(3,1fr)}
|
||||
}
|
||||
@media(min-width:1280px){
|
||||
.g{gap:16px;grid-template-columns:repeat(auto-fill,minmax(350px,1fr))}
|
||||
.c{padding:24px 32px}
|
||||
}
|
||||
|
||||
/* ── Dark scrollbar ── */
|
||||
::-webkit-scrollbar{width:8px;height:8px}
|
||||
::-webkit-scrollbar-track{background:transparent}
|
||||
::-webkit-scrollbar-thumb{background:#30363d;border-radius:4px}
|
||||
::-webkit-scrollbar-thumb:hover{background:#3d444d}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
@@ -101,7 +128,7 @@
|
||||
</div>
|
||||
<div class="hr">
|
||||
{{if eq .TotalDown 0}}
|
||||
<span class="hb g"><span class="d"></span> All Systems Operational</span>
|
||||
<span class="hb g"><span class="d"></span> <span class="hbl">All Systems Operational</span></span>
|
||||
{{else if lt .TotalDown 3}}
|
||||
<span class="hb y"><span class="d"></span> {{.TotalDown}} degraded</span>
|
||||
{{else}}
|
||||
@@ -119,10 +146,10 @@
|
||||
<div class="ch"><h2>Services</h2><span class="b">{{len .Services}}</span></div>
|
||||
<div class="sg">
|
||||
{{range .Services}}
|
||||
<div class="st">
|
||||
<span class="st">
|
||||
<span class="i {{if eq .State "running"}}g{{else if eq .State "jaeger"}}b{{else}}r{{end}}"></span>
|
||||
<span class="n">{{.Name}}</span>
|
||||
</div>
|
||||
</span>
|
||||
{{else}}<div class="em">No services detected</div>{{end}}
|
||||
</div>
|
||||
</div>
|
||||
@@ -152,22 +179,22 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- System Resources (CPU / RAM / Disk) — auto muncul jika ada data -->
|
||||
<!-- System Resources (auto jika ada data) -->
|
||||
{{if .HasNodeData}}
|
||||
<div class="cd">
|
||||
<div class="ch"><h2>System Resources</h2>
|
||||
<span class="b">load: {{printf "%.2f" .Node.Load1}} {{printf "%.2f" .Node.Load5}} {{printf "%.2f" .Node.Load15}}</span>
|
||||
<span class="b">{{printf "%.2f" .Node.Load1}} {{printf "%.2f" .Node.Load5}} {{printf "%.2f" .Node.Load15}}</span>
|
||||
</div>
|
||||
<div class="sg3">
|
||||
<div class="cg">{{.CPUSVG}}</div>
|
||||
<div class="cg">{{.RAMSVG}}</div>
|
||||
<div class="cg">{{.DiskSVG}}</div>
|
||||
</div>
|
||||
{{if .Node.NetIn}}<div class="ns">Network: {{printf "%.1f" .Node.NetIn}} B/s in / {{printf "%.1f" .Node.NetOut}} B/s out</div>{{end}}
|
||||
{{if .Node.NetIn}}<div class="ns">↑ {{printf "%.1f" .Node.NetOut}} B/s ↓ {{printf "%.1f" .Node.NetIn}} B/s</div>{{end}}
|
||||
</div>
|
||||
{{end}}
|
||||
|
||||
<!-- Request Rate — auto muncul jika ada OTel data -->
|
||||
<!-- Request Rate (auto jika OTel aktif) -->
|
||||
{{if .HasOTelData}}
|
||||
<div class="cd">
|
||||
<div class="ch"><h2>Request Rate</h2>
|
||||
@@ -211,7 +238,7 @@
|
||||
<div class="tt">
|
||||
<span class="td">{{safeDur .Duration}}</span>
|
||||
<span>{{.Spans}}</span>
|
||||
{{if .HasError}}<span class="te">error</span>{{end}}
|
||||
{{if .HasError}}<span class="te">err</span>{{end}}
|
||||
</div>
|
||||
</div>
|
||||
{{end}}
|
||||
@@ -223,11 +250,13 @@
|
||||
</div>
|
||||
|
||||
<script>
|
||||
var ts = document.getElementById('ts');
|
||||
function tick(){ ts.textContent = 'updated ' + new Date().toLocaleTimeString(); }
|
||||
tick();
|
||||
setInterval(tick, 1000);
|
||||
setTimeout(function(){ location.reload(); }, 15000);
|
||||
(function(){
|
||||
var ts = document.getElementById('ts');
|
||||
function tick(){ ts.textContent = new Date().toLocaleTimeString([],{hour:'2-digit',minute:'2-digit'}) }
|
||||
tick();
|
||||
setInterval(tick, 10000);
|
||||
setTimeout(function(){ location.reload(); }, 15000);
|
||||
})();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user