From 93afa9192b35611e1ceadd595e48ccbc38b4d777 Mon Sep 17 00:00:00 2001 From: D Stephenson Date: Wed, 13 May 2026 17:31:21 +0000 Subject: [PATCH] Fix scan log dismiss button visibility and truncate error messages Dismiss button is now always visible with a bordered style instead of hidden-until-JS. Netmiko error messages are truncated to first line (120 chars) so verbose multi-line errors don't flood the log panel. Co-Authored-By: Claude Sonnet 4.6 --- index.html | 23 ++++++++++------------- scanner.py | 3 ++- 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/index.html b/index.html index ecf952b..45faae7 100644 --- a/index.html +++ b/index.html @@ -419,14 +419,16 @@ var Xr=function(e){if(!(this instanceof Xr))return new Xr(e);this.id="Thenable/1 .scan-log-dismiss { margin-left: auto; background: none; - border: none; - color: #484f58; + border: 1px solid #30363d; + border-radius: 4px; + color: #8b949e; cursor: pointer; - font-size: 14px; - padding: 0 4px; - line-height: 1; + font-size: 13px; + padding: 2px 7px; + line-height: 1.4; + flex-shrink: 0; } - .scan-log-dismiss:hover { color: #8b949e; } + .scan-log-dismiss:hover { color: #e6edf3; border-color: #8b949e; } .spinner { width: 14px; height: 14px; border: 2px solid rgba(79,142,247,.3); @@ -598,7 +600,7 @@ var Xr=function(e){if(!(this instanceof Xr))return new Xr(e);this.id="Thenable/1
Scanning... - +
@@ -949,7 +951,6 @@ async function pollStatus() { progressWrap.classList.add('visible'); statusBar.classList.add('visible'); document.getElementById('scanSpinner').style.display = ''; - document.getElementById('scanLogDismiss').style.display = 'none'; const pct = s.total > 0 ? Math.round((s.done / s.total) * 100) : 0; progressBar.style.width = pct + '%'; @@ -989,18 +990,14 @@ async function pollStatus() { ).join(''); logBody.scrollTop = logBody.scrollHeight; + spinner.style.display = 'none'; if (s.fail > 0) { - // Keep panel open so user can read errors - spinner.style.display = 'none'; statusText.innerHTML = `Scan complete  —  ` + `✓ ${s.ok}  ` + `✗ ${s.fail} failed`; - dismissBtn.style.display = 'block'; } else { statusBar.classList.remove('visible'); - spinner.style.display = ''; - dismissBtn.style.display = 'none'; } } diff --git a/scanner.py b/scanner.py index af72657..39eb83a 100644 --- a/scanner.py +++ b/scanner.py @@ -112,9 +112,10 @@ def run_scan(dept: str = None, workers: int = 5, login_delay: int = 3): scan_state["fail"] += 1 error = result.get("error", "Unknown error") scan_state["errors"].append({"ip": ip, "error": error}) + error_short = error.splitlines()[0][:120] scan_state["log_lines"].append({ "ts": ts, "ok": False, - "text": f"✗ {ip} — {error}", + "text": f"✗ {ip} — {error_short}", }) scan_all_switches(switches, progress_callback=on_progress, max_workers=workers, login_delay=login_delay)