ui: switch to wrapper-console palette + flat layout
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -1,118 +1,78 @@
|
|||||||
<!doctype html>
|
<!doctype html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<title>svc-proxy</title>
|
<title>svc-proxy</title>
|
||||||
<style>
|
<style>
|
||||||
:root {
|
html, body { margin: 0; padding: 0; height: 100%; background: #0e0e0e; color: #eee;
|
||||||
--bg: #0f1115;
|
font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 13px; line-height: 1.4; }
|
||||||
--panel: #161922;
|
body { display: flex; flex-direction: column; }
|
||||||
--panel-2: #1c2030;
|
header { padding: 8px 12px; background: #1a1a1a; border-bottom: 1px solid #333;
|
||||||
--border: #2a2f42;
|
display: flex; justify-content: space-between; align-items: center; flex: 0 0 auto; }
|
||||||
--text: #d6d9e0;
|
header h1 { margin: 0; font-size: 14px; font-weight: 600; }
|
||||||
--muted: #7a8194;
|
header h1 .meta { color: #888; font-weight: normal; margin-left: 10px; }
|
||||||
--accent: #6aa9ff;
|
#status { font-size: 12px; color: #6f6; }
|
||||||
--up: #4ade80;
|
#status.disconnected { color: #f66; }
|
||||||
--down: #f59e0b;
|
#status.connecting { color: #fc6; }
|
||||||
--err: #f87171;
|
|
||||||
--warn: #fbbf24;
|
|
||||||
--info: #93c5fd;
|
|
||||||
--dbg: #6b7280;
|
|
||||||
}
|
|
||||||
* { box-sizing: border-box; }
|
|
||||||
body {
|
|
||||||
margin: 0; padding: 0;
|
|
||||||
font: 13px/1.4 ui-monospace, "JetBrains Mono", Menlo, Consolas, monospace;
|
|
||||||
background: var(--bg); color: var(--text);
|
|
||||||
display: grid; grid-template-rows: auto 1fr 1fr; height: 100vh;
|
|
||||||
}
|
|
||||||
header {
|
|
||||||
padding: 10px 16px;
|
|
||||||
border-bottom: 1px solid var(--border);
|
|
||||||
background: var(--panel);
|
|
||||||
display: flex; justify-content: space-between; align-items: center;
|
|
||||||
}
|
|
||||||
h1 { margin: 0; font-size: 14px; font-weight: 600; letter-spacing: 0.5px; }
|
|
||||||
h1 .meta { color: var(--muted); margin-left: 12px; font-weight: normal; }
|
|
||||||
.status { color: var(--muted); font-size: 12px; }
|
|
||||||
.status.ok { color: var(--up); }
|
|
||||||
.status.err { color: var(--err); }
|
|
||||||
|
|
||||||
section { padding: 12px 16px; overflow: auto; border-bottom: 1px solid var(--border); }
|
main { flex: 1; display: grid; grid-template-rows: 1fr 1fr; min-height: 0; }
|
||||||
section h2 {
|
section { padding: 12px 16px; overflow: auto; min-height: 0; }
|
||||||
margin: 0 0 10px; font-size: 12px; text-transform: uppercase;
|
section + section { border-top: 1px solid #333; }
|
||||||
letter-spacing: 0.7px; color: var(--muted); font-weight: 600;
|
|
||||||
}
|
|
||||||
section.logs { font-size: 12.5px; }
|
|
||||||
section.logs h2 { display: flex; justify-content: space-between; align-items: center; }
|
|
||||||
section.logs h2 .clear {
|
|
||||||
background: transparent; color: var(--muted); border: 1px solid var(--border);
|
|
||||||
padding: 2px 8px; cursor: pointer; font: inherit; border-radius: 3px;
|
|
||||||
}
|
|
||||||
section.logs h2 .clear:hover { color: var(--text); border-color: var(--accent); }
|
|
||||||
|
|
||||||
table { width: 100%; border-collapse: collapse; }
|
h2 { margin: 0 0 8px; font-size: 12px; font-weight: 600; color: #888;
|
||||||
th, td {
|
text-transform: uppercase; letter-spacing: 0.6px;
|
||||||
text-align: left; padding: 6px 10px;
|
display: flex; justify-content: space-between; align-items: center; }
|
||||||
border-bottom: 1px solid var(--border);
|
h2 .count { color: #888; font-weight: normal; margin-left: 6px; }
|
||||||
font-variant-numeric: tabular-nums;
|
h2 button { background: transparent; color: #888; border: 1px solid #333;
|
||||||
}
|
padding: 2px 8px; cursor: pointer; font: inherit; font-size: 11px; border-radius: 3px; }
|
||||||
th { color: var(--muted); font-weight: 500; font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; }
|
h2 button:hover { color: #eee; border-color: #6cf; }
|
||||||
tbody tr:hover { background: var(--panel-2); }
|
|
||||||
td.num { text-align: right; }
|
|
||||||
td.up { color: var(--up); }
|
|
||||||
td.down { color: var(--down); }
|
|
||||||
td.idle.stale { color: var(--warn); }
|
|
||||||
td.idle.dead { color: var(--err); }
|
|
||||||
.empty { color: var(--muted); padding: 20px; text-align: center; }
|
|
||||||
|
|
||||||
pre.logbox {
|
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
|
||||||
margin: 0; white-space: pre-wrap; word-break: break-word;
|
th, td { text-align: left; padding: 4px 10px; border-bottom: 1px solid #1f1f1f; }
|
||||||
max-height: 100%;
|
th { color: #888; font-weight: 500; font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; }
|
||||||
}
|
td.num { text-align: right; }
|
||||||
.log-line { padding: 1px 0; }
|
td.up { color: #6f6; }
|
||||||
.log-line .ts { color: var(--muted); margin-right: 8px; }
|
td.down { color: #fc6; }
|
||||||
.log-line .lvl { margin-right: 6px; font-weight: 600; }
|
td.idle.stale { color: #fc6; }
|
||||||
.log-line.lvl-DEBUG .lvl { color: var(--dbg); }
|
td.idle.dead { color: #f66; }
|
||||||
.log-line.lvl-INFO .lvl { color: var(--info); }
|
.empty { color: #888; padding: 16px 0; }
|
||||||
.log-line.lvl-WARN .lvl { color: var(--warn); }
|
|
||||||
.log-line.lvl-ERROR .lvl { color: var(--err); }
|
pre.logbox { margin: 0; white-space: pre-wrap; word-break: break-word; }
|
||||||
.log-line .attrs { color: var(--muted); margin-left: 8px; }
|
.log-line { padding: 0; }
|
||||||
</style>
|
.log-line .ts { color: #888; margin-right: 8px; }
|
||||||
|
.log-line .lvl { margin-right: 6px; font-weight: 600; }
|
||||||
|
.log-line.lvl-DEBUG .lvl { color: #888; }
|
||||||
|
.log-line.lvl-INFO .lvl { color: #6cf; }
|
||||||
|
.log-line.lvl-WARN .lvl { color: #fc6; }
|
||||||
|
.log-line.lvl-ERROR .lvl { color: #f66; }
|
||||||
|
.log-line .attrs { color: #888; margin-left: 8px; }
|
||||||
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<header>
|
<header>
|
||||||
<h1>svc-proxy <span class="meta" id="meta">— connecting…</span></h1>
|
<h1>svc-proxy <span class="meta" id="meta">— connecting…</span></h1>
|
||||||
<span class="status" id="status">log stream: connecting</span>
|
<span id="status" class="connecting">log stream: connecting…</span>
|
||||||
</header>
|
</header>
|
||||||
|
<main>
|
||||||
<section class="conns">
|
<section>
|
||||||
<h2>Active connections <span id="conn-count" style="color:var(--muted);"></span></h2>
|
<h2><span>Active connections <span class="count" id="conn-count"></span></span></h2>
|
||||||
<table>
|
<table>
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Server</th>
|
<th>Server</th><th>Port</th><th>Client</th><th>Backend</th>
|
||||||
<th>Port</th>
|
<th class="num">Up</th><th class="num">Down</th>
|
||||||
<th>Client</th>
|
<th class="num">Idle</th><th class="num">Age</th>
|
||||||
<th>Backend</th>
|
|
||||||
<th class="num">Up</th>
|
|
||||||
<th class="num">Down</th>
|
|
||||||
<th class="num">Idle</th>
|
|
||||||
<th class="num">Age</th>
|
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody id="conn-rows"></tbody>
|
<tbody id="conn-rows"></tbody>
|
||||||
</table>
|
</table>
|
||||||
<div id="conn-empty" class="empty">no active bridges</div>
|
<div class="empty" id="conn-empty">no active bridges</div>
|
||||||
</section>
|
</section>
|
||||||
|
<section>
|
||||||
<section class="logs">
|
<h2><span>Logs</span><button onclick="document.getElementById('logbox').innerHTML=''">clear</button></h2>
|
||||||
<h2>
|
|
||||||
<span>Logs</span>
|
|
||||||
<button class="clear" onclick="document.getElementById('logbox').innerHTML=''">clear</button>
|
|
||||||
</h2>
|
|
||||||
<pre class="logbox" id="logbox"></pre>
|
<pre class="logbox" id="logbox"></pre>
|
||||||
</section>
|
</section>
|
||||||
|
</main>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
const fmtBytes = n => {
|
const fmtBytes = n => {
|
||||||
@@ -124,11 +84,8 @@ const fmtBytes = n => {
|
|||||||
const fmtAgo = secs => {
|
const fmtAgo = secs => {
|
||||||
if (secs < 60) return secs.toFixed(0) + 's';
|
if (secs < 60) return secs.toFixed(0) + 's';
|
||||||
if (secs < 3600) return Math.floor(secs/60) + 'm' + Math.floor(secs%60) + 's';
|
if (secs < 3600) return Math.floor(secs/60) + 'm' + Math.floor(secs%60) + 's';
|
||||||
const h = Math.floor(secs/3600);
|
return Math.floor(secs/3600) + 'h' + Math.floor((secs % 3600) / 60) + 'm';
|
||||||
const m = Math.floor((secs % 3600) / 60);
|
|
||||||
return h + 'h' + m + 'm';
|
|
||||||
};
|
};
|
||||||
|
|
||||||
async function refreshConnections() {
|
async function refreshConnections() {
|
||||||
try {
|
try {
|
||||||
const r = await fetch('./api/connections');
|
const r = await fetch('./api/connections');
|
||||||
@@ -173,8 +130,8 @@ function startLogStream() {
|
|||||||
const status = document.getElementById('status');
|
const status = document.getElementById('status');
|
||||||
const box = document.getElementById('logbox');
|
const box = document.getElementById('logbox');
|
||||||
const es = new EventSource('./api/logs');
|
const es = new EventSource('./api/logs');
|
||||||
es.onopen = () => { status.textContent = 'log stream: live'; status.className = 'status ok'; };
|
es.onopen = () => { status.textContent = 'log stream: live'; status.className = ''; };
|
||||||
es.onerror = () => { status.textContent = 'log stream: reconnecting'; status.className = 'status err'; };
|
es.onerror = () => { status.textContent = 'log stream: reconnecting…'; status.className = 'disconnected'; };
|
||||||
es.onmessage = ev => {
|
es.onmessage = ev => {
|
||||||
let e;
|
let e;
|
||||||
try { e = JSON.parse(ev.data); } catch { return; }
|
try { e = JSON.parse(ev.data); } catch { return; }
|
||||||
@@ -187,7 +144,6 @@ function startLogStream() {
|
|||||||
(e.msg || '') +
|
(e.msg || '') +
|
||||||
(e.attrs ? '<span class="attrs">' + e.attrs + '</span>' : '');
|
(e.attrs ? '<span class="attrs">' + e.attrs + '</span>' : '');
|
||||||
box.appendChild(div);
|
box.appendChild(div);
|
||||||
// Auto-scroll if near the bottom
|
|
||||||
const parent = box.parentElement;
|
const parent = box.parentElement;
|
||||||
if (parent.scrollHeight - parent.scrollTop - parent.clientHeight < 60) {
|
if (parent.scrollHeight - parent.scrollTop - parent.clientHeight < 60) {
|
||||||
parent.scrollTop = parent.scrollHeight;
|
parent.scrollTop = parent.scrollHeight;
|
||||||
|
|||||||
Reference in New Issue
Block a user