Update to show zone ID on device list

This commit is contained in:
Junior 2026-01-10 16:24:12 -05:00
parent a6feddf8c3
commit e4dc7b69f2
3 changed files with 15 additions and 1 deletions

View File

@ -2,7 +2,7 @@
require "../header.php";
$query = "SELECT mac, ipaddress, label, board, firmware, service, lastupdate FROM devices ORDER BY label, lastupdate DESC";
$query = "SELECT mac, ipaddress, label, board, firmware, service, zoneid, lastupdate FROM devices ORDER BY label, lastupdate DESC";
$sth = $globaldbh->prepare($query);
$sth->execute();
@ -15,6 +15,7 @@ while ( $row = $sth->fetch(PDO::FETCH_ASSOC) ) {
$d["board"] = $row["board"];
$d["firmware"] = $row["firmware"];
$d["service"] = $row["service"];
$d["zoneid"] = $row["zoneid"];
$d["lastupdate"] = $row["lastupdate"];
$data[] = $d;
}

View File

@ -27,4 +27,16 @@ $sth->bindValue(":firmware", $firmware, PDO::PARAM_STR);
$sth->bindValue(":service", $service, PDO::PARAM_STR);
$sth->execute();
$query = "SELECT zoneid FROM devices WHERE mac=:mac";
$sth = $globaldbh->prepare($query);
$sth->bindValue(":mac", $mac, PDO::PARAM_STR);
$sth->execute();
$zoneid = 0;
if ( $row = $sth->fetch(PDO::FETCH_ASSOC) ) {
$zoneid = $row["zoneid"];
}
echo($zoneid);
exit();

View File

@ -75,6 +75,7 @@ function getDevices() {
html += "<div class='device-container'>";
html += "<div class='device-property'><span class='device-property-label'>Service:</span>" + escapeHTML(device.service) + "</div>";
html += "<div class='device-property'><span class='device-property-label'>Label:</span>" + escapeHTML(device.label) + "</div>";
html += "<div class='device-property'><span class='device-property-label'>ZoneId:</span>" + device.zoneid + "</div>";
html += "<div class='device-property'><span class='device-property-label'>Board:</span>" + escapeHTML(device.board) + "</div>";
html += "<div class='device-property'><span class='device-property-label'>IP Address:</span>" + escapeHTML(device.ipaddress) + "</div>";
html += "<div class='device-property'><span class='device-property-label'>Last Update:</span>" + escapeHTML(device.lastupdate) + "</div>";