Aggiunge filtri UTXO interattivi nel report HTML
This commit is contained in:
6
.gitignore
vendored
6
.gitignore
vendored
@@ -7,9 +7,15 @@ ENV/
|
|||||||
# Python
|
# Python
|
||||||
__pycache__/
|
__pycache__/
|
||||||
*.py[cod]
|
*.py[cod]
|
||||||
|
*.pyc
|
||||||
|
*.pyo
|
||||||
|
*.pyd
|
||||||
*$py.class
|
*$py.class
|
||||||
*.so
|
*.so
|
||||||
.Python
|
.Python
|
||||||
|
*.egg-info/
|
||||||
|
dist/
|
||||||
|
build/
|
||||||
|
|
||||||
# IDE
|
# IDE
|
||||||
.vscode/
|
.vscode/
|
||||||
|
|||||||
68
view_db.py
68
view_db.py
@@ -308,6 +308,43 @@ class P2PKDatabaseViewer:
|
|||||||
border-color: #667eea;
|
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 {{
|
table {{
|
||||||
width: 100%;
|
width: 100%;
|
||||||
border-collapse: collapse;
|
border-collapse: collapse;
|
||||||
@@ -475,6 +512,12 @@ class P2PKDatabaseViewer:
|
|||||||
<input type="text" id="searchInput" placeholder="🔍 Cerca per blocco, txid, o chiave pubblica..." onkeyup="filterTable()">
|
<input type="text" id="searchInput" placeholder="🔍 Cerca per blocco, txid, o chiave pubblica..." onkeyup="filterTable()">
|
||||||
</div>
|
</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)}
|
{self._generate_table_html(p2pk_data)}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -513,6 +556,31 @@ class P2PKDatabaseViewer:
|
|||||||
console.error('Errore durante la copia:', err);
|
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>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
Reference in New Issue
Block a user