Aggiunge filtri UTXO interattivi nel report HTML

This commit is contained in:
2026-01-22 16:21:52 +01:00
parent 7f21839ebb
commit 275b7d4c5f
2 changed files with 74 additions and 0 deletions

6
.gitignore vendored
View File

@@ -7,9 +7,15 @@ ENV/
# Python
__pycache__/
*.py[cod]
*.pyc
*.pyo
*.pyd
*$py.class
*.so
.Python
*.egg-info/
dist/
build/
# IDE
.vscode/

View File

@@ -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:
<input type="text" id="searchInput" placeholder="🔍 Cerca per blocco, txid, o chiave pubblica..." onkeyup="filterTable()">
</div>
<div class="filter-buttons">
<button class="filter-btn active" onclick="filterByStatus('all')">🔍 Tutti i P2PK</button>
<button class="filter-btn unspent-filter" onclick="filterByStatus('unspent')">🟢 Solo Non Spesi</button>
<button class="filter-btn spent-filter" onclick="filterByStatus('spent')">🔴 Solo Spesi</button>
</div>
{self._generate_table_html(p2pk_data)}
</div>
@@ -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';
}}
}}
}}
</script>
</body>
</html>