From 275b7d4c5ff94cc93c08aef8c741119588eb6709 Mon Sep 17 00:00:00 2001 From: davide3011 Date: Thu, 22 Jan 2026 16:21:52 +0100 Subject: [PATCH] Aggiunge filtri UTXO interattivi nel report HTML --- .gitignore | 6 +++++ view_db.py | 68 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 74 insertions(+) diff --git a/.gitignore b/.gitignore index 6ac7f4c..01a8809 100644 --- a/.gitignore +++ b/.gitignore @@ -7,9 +7,15 @@ ENV/ # Python __pycache__/ *.py[cod] +*.pyc +*.pyo +*.pyd *$py.class *.so .Python +*.egg-info/ +dist/ +build/ # IDE .vscode/ diff --git a/view_db.py b/view_db.py index 1783441..97d47f6 100755 --- a/view_db.py +++ b/view_db.py @@ -308,6 +308,43 @@ class P2PKDatabaseViewer: border-color: #667eea; }} + .filter-buttons {{ + margin: 20px 0; + text-align: center; + }} + + .filter-btn {{ + padding: 10px 20px; + margin: 0 5px; + border: 2px solid #667eea; + background: white; + color: #667eea; + border-radius: 20px; + cursor: pointer; + font-weight: bold; + font-size: 0.95em; + transition: all 0.3s; + }} + + .filter-btn:hover {{ + background: #f0f0f0; + }} + + .filter-btn.active {{ + background: #667eea; + color: white; + }} + + .filter-btn.unspent-filter.active {{ + background: #28a745; + border-color: #28a745; + }} + + .filter-btn.spent-filter.active {{ + background: #dc3545; + border-color: #dc3545; + }} + table {{ width: 100%; border-collapse: collapse; @@ -475,6 +512,12 @@ class P2PKDatabaseViewer: +
+ + + +
+ {self._generate_table_html(p2pk_data)} @@ -513,6 +556,31 @@ class P2PKDatabaseViewer: console.error('Errore durante la copia:', err); }}); }} + + function filterByStatus(status) {{ + const table = document.getElementById('dataTable'); + if (!table) return; + + const tr = table.getElementsByTagName('tr'); + const buttons = document.querySelectorAll('.filter-btn'); + + // Aggiorna stato pulsanti + buttons.forEach(btn => btn.classList.remove('active')); + event.target.classList.add('active'); + + // Filtra righe in base allo stato UTXO + for (let i = 1; i < tr.length; i++) {{ + const row = tr[i]; + + if (status === 'all') {{ + row.style.display = ''; + }} else if (status === 'unspent') {{ + row.style.display = row.classList.contains('unspent') ? '' : 'none'; + }} else if (status === 'spent') {{ + row.style.display = row.classList.contains('spent') ? '' : 'none'; + }} + }} + }}