ui: remove connection status dot entirely
This commit is contained in:
@@ -21,12 +21,9 @@
|
|||||||
<div class="max-w-7xl mx-auto px-4 md:px-8 py-6 md:py-10">
|
<div class="max-w-7xl mx-auto px-4 md:px-8 py-6 md:py-10">
|
||||||
|
|
||||||
<!-- Header -->
|
<!-- Header -->
|
||||||
<header class="flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4 mb-8">
|
<header class="mb-8">
|
||||||
<div>
|
<h1 class="text-xl md:text-2xl font-semibold tracking-tight">SNEK Dashboard</h1>
|
||||||
<h1 class="text-xl md:text-2xl font-semibold tracking-tight">SNEK Dashboard</h1>
|
<p class="text-sm text-slate-500 mt-0.5">Live Sens'it uplink decoding</p>
|
||||||
<p class="text-sm text-slate-500 mt-0.5">Live Sens'it uplink decoding</p>
|
|
||||||
</div>
|
|
||||||
<span id="conn-dot" class="w-2 h-2 rounded-full bg-slate-300" title="disconnected"></span>
|
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
<!-- Devices -->
|
<!-- Devices -->
|
||||||
@@ -241,22 +238,8 @@ async function bootstrap() {
|
|||||||
renderMessages();
|
renderMessages();
|
||||||
}
|
}
|
||||||
|
|
||||||
function setConn(state) {
|
|
||||||
const dot = document.getElementById('conn-dot');
|
|
||||||
const map = {
|
|
||||||
live: ['bg-emerald-500', 'connected'],
|
|
||||||
off: ['bg-rose-500', 'disconnected'],
|
|
||||||
idle: ['bg-slate-300', 'connecting'],
|
|
||||||
};
|
|
||||||
const [color, title] = map[state] || map.idle;
|
|
||||||
dot.className = `w-2 h-2 rounded-full ${color}`;
|
|
||||||
dot.title = title;
|
|
||||||
}
|
|
||||||
|
|
||||||
function connectSSE() {
|
function connectSSE() {
|
||||||
const es = new EventSource('/events');
|
const es = new EventSource('/events');
|
||||||
es.onopen = () => setConn('live');
|
|
||||||
es.onerror = () => setConn('off');
|
|
||||||
es.onmessage = (ev) => {
|
es.onmessage = (ev) => {
|
||||||
try {
|
try {
|
||||||
const msg = JSON.parse(ev.data);
|
const msg = JSON.parse(ev.data);
|
||||||
|
|||||||
Reference in New Issue
Block a user