feb git sync

This commit is contained in:
2026-02-11 14:00:11 -08:00
parent 94c31f4be3
commit 978f640e96
13 changed files with 571 additions and 139 deletions

View File

@ -34,6 +34,8 @@ function fetchSSDData() {
For a live dashboard, please visit <a href=/>home</a>.
</div>
<div class="container">
Search for disk:<br>
<input id="search" type="text" placeholder="Search by ID, model, serial…" /><p>
<?php
$ssdData = fetchSSDData(); // Fetch data from the API
// Start the table
@ -44,20 +46,20 @@ function fetchSSDData() {
<th>Disk ID</th>
<th>Model String</th>
<th>Serial Number</th>
<th>TB Written</th>
<th>GB Written</th>
<th>Disk Capacity</th>
<th>Disk Flavor</th>
<th>SMART Result</th>
</tr>
</thead>';
// Table body - one row per SSD
echo '<tbody>';
echo '<tbody id="ssd-body">';
foreach ($ssdData as $ssd) {
// Escape the values so the page stays safe
$id = htmlspecialchars($ssd['id']);
$model = htmlspecialchars($ssd['model']);
$serial = htmlspecialchars($ssd['serial']);
$tbw = htmlspecialchars($ssd['TBW']);
$tbw = htmlspecialchars($ssd['gb_written']);
$cap = htmlspecialchars($ssd['capacity']);
$flavor = htmlspecialchars($ssd['flavor']);
$smart = htmlspecialchars($ssd['smart']);
@ -77,4 +79,37 @@ function fetchSSDData() {
</div>
</body>
<script>
document.addEventListener('DOMContentLoaded', () => {
const searchInput = document.getElementById('search');
const tbody = document.getElementById('ssd-body');
const rows = Array.from(tbody.rows); // snapshot of rows
// Optional: a simple debounce so we don't react on every keystroke
const debounce = (fn, delay) => {
let timer;
return (...args) => {
clearTimeout(timer);
timer = setTimeout(() => fn.apply(this, args), delay);
};
};
const filterRows = debounce(() => {
const query = searchInput.value.trim().toLowerCase();
rows.forEach(row => {
// Grab all cells in this row as a single string
const rowText = Array.from(row.cells)
.map(cell => cell.textContent)
.join(' ')
.toLowerCase();
row.style.display = rowText.includes(query) ? '' : 'none';
});
}, 200); // 200ms debounce
searchInput.addEventListener('input', filterRows);
});
</script>
</html>