From 666ae6ab5e254c3c0a5d3ca88276388250089fc4 Mon Sep 17 00:00:00 2001 From: gael Date: Thu, 25 Sep 2025 11:08:48 -0400 Subject: [PATCH] Update gain_viz/templates/index.html --- gain_viz/templates/index.html | 103 ++++++++++++++++++++++++++++++++++ 1 file changed, 103 insertions(+) diff --git a/gain_viz/templates/index.html b/gain_viz/templates/index.html index 7fffd37..abb4d53 100644 --- a/gain_viz/templates/index.html +++ b/gain_viz/templates/index.html @@ -250,6 +250,32 @@ margin-bottom: 24px; } } + param-grid { + display: grid; + grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); + gap: 15px; + margin-bottom: 20px; + } + .param-group { + display: flex; + flex-direction: column; + } + .param-group label { + margin-bottom: 5px; + font-weight: bold; + color: #333; + } + .param-group input { + padding: 8px; + border: 1px solid #ddd; + border-radius: 4px; + font-size: 14px; + } + .param-group input:focus { + outline: none; + border-color: #007bff; + box-shadow: 0 0 5px rgba(0, 123, 255, 0.3); + } @@ -331,6 +357,37 @@
+

Spectrogram Parameters

+
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ +
+ +
+
+ +

Spectrum Analysis

Spectrum Analysis Plot @@ -430,6 +487,52 @@ }, 3000); } } + // Add parameter form handling + const paramForm = document.getElementById('paramContainer'); + const updateBtn = document.getElementById('updateBtn'); + + updateBtn.addEventListener('click', function(e) { + e.preventDefault(); + const formData = new FormData(); + let hasUpdates = false; + + // Collect all parameters + const inputs = paramForm.querySelectorAll('input, select'); + inputs.forEach(input => { + if (input.type === 'checkbox') { + if (input.checked) { + formData.append(input.name, input.value); + hasUpdates = true; + } + } else { + formData.append(input.name, input.value); + hasUpdates = true; + } + }); + + if (!hasUpdates) { + showStatus('Please update at least one parameter', 'error'); + return; + } + + fetch('/update_params', { + method: 'POST', + body: formData + }) + .then(res => res.json()) + .then(data => { + if (data.status === "success") { + showStatus(data.message, 'success'); + } else { + showStatus("Error updating parameters", 'error'); + } + }) + .catch(err => { + console.error(err); + showStatus("Server error", 'error'); + }); + }); + // Auto-refresh plot every 10ms setInterval(() => {