Skip to content
Snippets Groups Projects
Commit 128d20f3 authored by root's avatar root
Browse files

add HTML page

parent 64eea242
No related branches found
No related tags found
No related merge requests found
<!DOCTYPE html>
<html>
<head>
<title>Update Checker</title>
<meta charset="utf-8">
<script src="https://code.jquery.com/jquery-3.5.1.min.js" integrity="sha256-9/aliU8dGd2tb6OSsuzixeV4y/faTqgFtohetphbbj0=" crossorigin="anonymous"></script>
<style type="text/css">
body { font-family: sans-serif; }
.green { color: green; }
.red { color: red; }
table { border-collapse: collapse; }
table td, table th { border: 1px solid #000; border-left:0; border-right:0 }
</style>
<script>
function refreshUpdates() {
$.getJSON("/update_checker/data.json", function(data) {
$("#lastUpdate").text(data.timestamp)
var downloadedOffline = $("#downloadedOffline")
var downloaded = $("#downloaded")
downloadedOffline.empty()
downloaded.empty()
$.each(data["update_events"], function(k, upd) {
var line = $("<tr/>")
console.log(upd)
var maplink = "https://map.freifunk-stuttgart.de/#!/en/map/" + upd.mac.replace(/:/g, "").toLowerCase()
$("<td/>").append($("<a/>").text(upd.hostname).attr("href", maplink)).appendTo(line)
$("<td/>").text(upd.mac).appendTo(line)
$("<td/>").text(upd.from_release).appendTo(line)
$("<td/>").text(upd.to_release).appendTo(line)
$("<td/>").text(upd.model).appendTo(line)
var status = $("<td/>").text(upd.status)
if(upd.status) {
status.addClass("green")
} else {
status.addClass("red")
}
status.appendTo(line)
$("<td/>").text(upd.download_count).appendTo(line)
$("<td/>").text(upd.last_date).appendTo(line)
console.log(line)
if (upd.status) {
downloaded.append(line)
} else {
downloadedOffline.append(line)
}
})
})
}
$(document).ready(function() {
refreshUpdates()
//window.setInterval(refreshUpdates, 60*1000);
})
</script>
</head>
<body>
<h1>Update downloaded and offline</h1>
<p>Last update: <span id="lastUpdate">(never)</span></p>
<table>
<tr>
<th>Hostname</th>
<th>MAC</th>
<th>From Version</th>
<th>To Version</th>
<th>Model</th>
<th>Status</th>
<th>Download Count</th>
<th>Date</th>
</tr>
<tbody id="downloadedOffline"></tbody>
</table>
<h1>Update downloaded</h1>
<table>
<tr>
<th>Hostname</th>
<th>MAC</th>
<th>From Version</th>
<th>To Version</th>
<th>Model</th>
<th>Status</th>
<th>Download Count</th>
<th>Last Download</th>
</tr>
<tbody id="downloaded"></tbody>
</table>
</body>
</html>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment