automc ui: match wrapper-console palette + flat layout
CI / validate (push) Successful in 13s
CI / docker (push) Successful in 9s

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-06-10 18:43:04 +02:00
parent 39d7d4586b
commit cf3ed60bce
+54 -74
View File
@@ -1,94 +1,74 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>mc-router</title>
<style>
:root {
--bg: #0f1115; --panel: #161922; --panel-2: #1c2030;
--border: #2a2f42; --text: #d6d9e0; --muted: #7a8194;
--accent: #6aa9ff;
--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: #4ade80; }
.status.err { color: var(--err); }
<meta charset="utf-8">
<title>mc-router</title>
<style>
html, body { margin: 0; padding: 0; height: 100%; background: #0e0e0e; color: #eee;
font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 13px; line-height: 1.4; }
body { display: flex; flex-direction: column; }
header { padding: 8px 12px; background: #1a1a1a; border-bottom: 1px solid #333;
display: flex; justify-content: space-between; align-items: center; flex: 0 0 auto; }
header h1 { margin: 0; font-size: 14px; font-weight: 600; }
header h1 .meta { color: #888; font-weight: normal; margin-left: 10px; }
#status { font-size: 12px; color: #6f6; }
#status.disconnected { color: #f66; }
#status.connecting { color: #fc6; }
section { padding: 12px 16px; overflow: auto; border-bottom: 1px solid var(--border); }
section h2 {
margin: 0 0 10px; font-size: 12px; text-transform: uppercase;
letter-spacing: 0.7px; color: var(--muted); font-weight: 600;
display: flex; justify-content: space-between; align-items: center;
}
section h2 .clear {
background: transparent; color: var(--muted); border: 1px solid var(--border);
padding: 2px 8px; cursor: pointer; font: inherit; border-radius: 3px;
}
section h2 .clear:hover { color: var(--text); border-color: var(--accent); }
main { flex: 1; display: grid; grid-template-rows: 1fr 1fr; min-height: 0; }
section { padding: 12px 16px; overflow: auto; min-height: 0; }
section + section { border-top: 1px solid #333; }
table { width: 100%; border-collapse: collapse; }
th, td {
text-align: left; padding: 6px 10px;
border-bottom: 1px solid var(--border);
font-variant-numeric: tabular-nums;
}
th { color: var(--muted); font-weight: 500; font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; }
tbody tr:hover { background: var(--panel-2); }
.empty { color: var(--muted); padding: 20px; text-align: center; }
h2 { margin: 0 0 8px; font-size: 12px; font-weight: 600; color: #888;
text-transform: uppercase; letter-spacing: 0.6px;
display: flex; justify-content: space-between; align-items: center; }
h2 .count { color: #888; font-weight: normal; margin-left: 6px; }
h2 button { background: transparent; color: #888; border: 1px solid #333;
padding: 2px 8px; cursor: pointer; font: inherit; font-size: 11px; border-radius: 3px; }
h2 button:hover { color: #eee; border-color: #6cf; }
pre.logbox { margin: 0; white-space: pre-wrap; word-break: break-word; max-height: 100%; }
.log-line { padding: 1px 0; }
.log-line .ts { color: var(--muted); margin-right: 8px; }
.log-line .lvl { margin-right: 6px; font-weight: 600; }
.log-line.lvl-debug .lvl { color: var(--dbg); }
.log-line.lvl-info .lvl { color: var(--info); }
.log-line.lvl-warning .lvl, .log-line.lvl-warn .lvl { color: var(--warn); }
.log-line.lvl-error .lvl { color: var(--err); }
.log-line .attrs { color: var(--muted); margin-left: 8px; }
</style>
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: 4px 10px; border-bottom: 1px solid #1f1f1f; }
th { color: #888; font-weight: 500; font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; }
td.num { text-align: right; }
.empty { color: #888; padding: 16px 0; }
pre.logbox { margin: 0; white-space: pre-wrap; word-break: break-word; }
.log-line { padding: 0; }
.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-warning .lvl, .log-line.lvl-warn .lvl { color: #fc6; }
.log-line.lvl-error .lvl { color: #f66; }
.log-line .attrs { color: #888; margin-left: 8px; }
</style>
</head>
<body>
<header>
<h1>mc-router <span class="meta" id="meta">— connecting…</span></h1>
<span class="status" id="status">log stream: connecting</span>
</header>
<section class="routes">
<h2><span>Routes <span id="route-count" style="color:var(--muted);"></span></span></h2>
<header>
<h1>mc-router <span class="meta" id="meta">— connecting…</span></h1>
<span id="status" class="connecting">log stream: connecting</span>
</header>
<main>
<section>
<h2><span>Routes <span class="count" id="route-count"></span></span></h2>
<table>
<thead>
<tr>
<th>Server address (host)</th>
<th>Backend</th>
<th style="text-align:right;">Active</th>
<th class="num">Active</th>
</tr>
</thead>
<tbody id="route-rows"></tbody>
</table>
<div id="route-empty" class="empty">no routes registered</div>
<div class="empty" id="route-empty">no routes registered</div>
</section>
<section class="logs">
<h2>
<span>Logs</span>
<button class="clear" onclick="document.getElementById('logbox').innerHTML=''">clear</button>
</h2>
<section>
<h2><span>Logs</span><button onclick="document.getElementById('logbox').innerHTML=''">clear</button></h2>
<pre class="logbox" id="logbox"></pre>
</section>
</main>
<script>
async function refreshRoutes() {
@@ -109,7 +89,7 @@ async function refreshRoutes() {
const tr = document.createElement('tr');
tr.innerHTML = '<td>' + r.server_address + '</td>' +
'<td>' + r.backend + '</td>' +
'<td style="text-align:right;font-variant-numeric:tabular-nums;">' + r.active_connections + '</td>';
'<td class="num">' + r.active_connections + '</td>';
rows.appendChild(tr);
}
}
@@ -126,8 +106,8 @@ function startLogStream() {
const status = document.getElementById('status');
const box = document.getElementById('logbox');
const es = new EventSource('./api/logs');
es.onopen = () => { status.textContent = 'log stream: live'; status.className = 'status ok'; };
es.onerror = () => { status.textContent = 'log stream: reconnecting'; status.className = 'status err'; };
es.onopen = () => { status.textContent = 'log stream: live'; status.className = ''; };
es.onerror = () => { status.textContent = 'log stream: reconnecting'; status.className = 'disconnected'; };
es.onmessage = ev => {
let e;
try { e = JSON.parse(ev.data); } catch { return; }