From 601112b723b6c72d33ace02510ff3fbec147bf15 Mon Sep 17 00:00:00 2001 From: Pizza <33816021+PizzaCow@users.noreply.github.com> Date: Wed, 1 Apr 2026 20:28:30 -0600 Subject: [PATCH] feat: hide/show empty devices toggle --- templates/index.html | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/templates/index.html b/templates/index.html index 23f277f..6fc374d 100644 --- a/templates/index.html +++ b/templates/index.html @@ -119,6 +119,9 @@ .status-up { color: var(--green); font-weight: 600; } .ip-cell { font-family: monospace; color: var(--accent); white-space: nowrap; } + /* Hide empty rows */ + body.hide-empty tr.no-ports { display: none; } + /* Port chips */ .port-chips { display: flex; flex-wrap: wrap; gap: 4px; } .port-chip { @@ -199,6 +202,7 @@
+ @@ -544,7 +548,12 @@ async function portScan(ip) { const ports = d.open_ports || []; if (ports.length === 0) { cell.innerHTML = `—`; + const row = document.getElementById(`row-${key}`); + if (row) row.classList.add('no-ports'); + document.getElementById('toggle-empty-btn').style.display = ''; } else { + const row = document.getElementById(`row-${key}`); + if (row) row.classList.remove('no-ports'); const chips = ports.map(p => { const browsable = [80, 443, 8080, 8443, 8006, 8123, 8888, 5000, 8001, 32400, 10000, 9090, 3000].includes(p.port); const tip = browsable @@ -568,6 +577,13 @@ async function portScan(ip) { } } +// ── Toggle empty rows ──────────────────────────────────────────────────────── + +function toggleEmpty() { + const hiding = document.body.classList.toggle('hide-empty'); + document.getElementById('toggle-empty-btn').textContent = hiding ? 'Show all' : 'Hide empty'; +} + // ── Auto-refresh ───────────────────────────────────────────────────────────── function startAutoRefresh() {