From b90494748333c5fe56f928d115cfb80ddad79cfa Mon Sep 17 00:00:00 2001 From: gael Date: Wed, 17 Dec 2025 22:43:00 -0500 Subject: [PATCH] Update gain_viz/templates/index.html --- gain_viz/templates/index.html | 583 +++++++++++++++++----------------- 1 file changed, 292 insertions(+), 291 deletions(-) diff --git a/gain_viz/templates/index.html b/gain_viz/templates/index.html index e03e8fd..48326fe 100644 --- a/gain_viz/templates/index.html +++ b/gain_viz/templates/index.html @@ -390,7 +390,7 @@ .plot-area { flex: 1; min-height: 0; - padding: 16px; /* Reduced padding */ + padding: 16px; background: #f8fafc; display: flex; flex-direction: column; @@ -400,7 +400,7 @@ display: flex; justify-content: space-between; align-items: center; - margin-bottom: 12px; /* Reduced margin */ + margin-bottom: 12px; flex-shrink: 0; } @@ -430,7 +430,7 @@ background: #fff; border: 1px solid var(--border); border-radius: var(--radius); - padding: 4px; /* Minimal padding */ + padding: 4px; display: flex; flex-direction: column; overflow: hidden; @@ -448,12 +448,13 @@ border-radius: 8px; display: block; background: #f8fafc; + image-rendering: -webkit-optimize-contrast; } /* TMUX Terminal - COMPACT */ .tmux-container { - height: 150px; /* Further reduced */ - margin-top: 8px; /* Minimal margin */ + height: 150px; + margin-top: 8px; display: flex; flex-direction: column; flex-shrink: 0; @@ -463,19 +464,19 @@ display: flex; justify-content: space-between; align-items: center; - padding: 4px 10px; /* Minimal padding */ + padding: 4px 10px; background: var(--terminal-bg); color: var(--terminal-text); border-top-left-radius: var(--radius); border-top-right-radius: var(--radius); - font-size: 0.8rem; /* Smaller font */ + font-size: 0.8rem; font-weight: 500; flex-shrink: 0; } .tmux-controls { display: flex; - gap: 4px; /* Minimal gap */ + gap: 4px; } .tmux-btn { @@ -483,9 +484,9 @@ border: none; color: var(--terminal-text); cursor: pointer; - padding: 2px 4px; /* Minimal padding */ + padding: 2px 4px; border-radius: 3px; - font-size: 0.7rem; /* Smaller font */ + font-size: 0.7rem; } .tmux-btn:hover { @@ -497,18 +498,18 @@ background: var(--terminal-bg); color: var(--terminal-text); font-family: 'Courier New', monospace; - font-size: 0.75rem; /* Smaller font */ - padding: 6px; /* Minimal padding */ + font-size: 0.75rem; + padding: 6px; overflow-y: auto; border-bottom-left-radius: var(--radius); border-bottom-right-radius: var(--radius); white-space: pre-wrap; word-wrap: break-word; - line-height: 1.2; /* Tighter line height */ + line-height: 1.2; } .tmux-terminal::-webkit-scrollbar { - width: 4px; /* Thinner scrollbar */ + width: 4px; } .tmux-terminal::-webkit-scrollbar-track { @@ -615,6 +616,7 @@ background: #94a3b8; } +
@@ -788,311 +790,310 @@
- + showStatus('gainStatusMessage','Gains reloaded','success'); + }); + + // Params Form + const paramForm = document.getElementById('paramForm'); + paramForm.addEventListener('submit', function(e){ + e.preventDefault(); + const btn = document.getElementById('paramUpdateBtn'); + const formData = new FormData(paramForm); + btn.disabled = true; + fetch('/update_params', { method:'POST', body: formData }) + .then(r => r.json()) + .then(data => { + btn.disabled = false; + if (data && data.status === 'success') { + showStatus('paramStatusMessage', data.message || 'Parameters updated', 'success'); + } else { + showStatus('paramStatusMessage', data.message || 'Error updating parameters', 'error'); + } + }) + .catch(err => { + btn.disabled = false; + console.error(err); + showStatus('paramStatusMessage','Server error','error'); + }); + }); + + // Plot refresh + document.getElementById('refreshPlotBtn').addEventListener('click', function() { + plotImg.src = '/plot?_ts=' + Date.now(); + }); + + // TMUX controls + document.getElementById('clearTmuxBtn').addEventListener('click', function() { + tmuxTerminal.textContent = ''; + }); + + document.getElementById('autoScrollTmuxBtn').addEventListener('click', function() { + autoScroll = !autoScroll; + this.textContent = `Auto Scroll: ${autoScroll ? 'ON' : 'OFF'}`; + }); + + // Stream control buttons + document.getElementById('startBtn').addEventListener('click', startStream); + document.getElementById('stopBtn').addEventListener('click', stopStream); + document.getElementById('pauseBtn').addEventListener('click', pauseStream); + + // Check stream state every 2 seconds + setInterval(checkStreamState, 2000); + + // Start TMUX output refresh + setInterval(fetchTmuxOutput, 1000); + + // Initial load + loadGains(); + checkStreamState(); + })(); + \ No newline at end of file