271 lines
8.5 KiB
HTML

{{NAVBAR}}
<!DOCTYPE html>
<html lang="en">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="global-style.css" rel="stylesheet">
<title>Welcome</title>
<style>
#first_td_th {
width:200px;
}
#second_td_th {
width:200px;
}
</style>
</head>
<body>
<h1>ATA Booth Summary</h1>
<fieldset>
<legend>Booth Overview</legend>
<div id="spacer-20"></div>
<table>
<tr>
<td id="first_td_th">
<label>Mode: </label><label id="booth-mode">...</label>
</td>
<td id="second_td_th">
<label>LED Strip1: </label><label id="booth-strip1-active">...</label>
</td>
<td>
<label>Front Light: </label><label id="booth-front-light">...</label>
</td>
</tr>
<tr><td>
<div id="spacer-10"></div>
</td></tr>
<tr>
<td>
<label>App: </label><label id="booth-app">...</label>
</td>
<td>
<label>LED Strip2: </label><label id="booth-strip2-active">...</label>
</td>
<td>
<label>Rear Light: </label><label id="booth-rear-light">...</label>
</td>
</tr>
<tr><td>
<div id="spacer-10"></div>
</td></tr>
<tr>
<td>
...
</td>
<td>
...
</td>
<td>
<label>OLED: </label><label id="booth-oled">...</label>
</td>
</tr>
</table>
<div id="spacer-20"></div>
</fieldset>
<div id="spacer-20"></div>
<fieldset>
<legend>System Info:</legend>
<div id="spacer-20"></div>
<table>
<tr>
<td id="first_td_th">
<label>Firmware: </label><label id="system-firmware">...</label>
</td>
<td id="second_td_th">
<label>Flash Size: </label><label id="system-flash-size">...</label>
</td>
<td>
<label>RAM Size: </label><label id="system-ram-size">...</label>
</td>
</tr>
<tr><td>
<div id="spacer-10"></div>
</td></tr>
<tr>
<td>
<label>Booth T&deg;: </label><label id="system-boothT">...</label>
</td>
<td>
<label>Flash free: </label><label id="system-flash-free">...</label>
</td>
<td>
<label>RAM Used: </label><label id="system-ram-used">...</label>
</td>
</tr>
<tr><td>
<div id="spacer-10"></div>
</td></tr>
<tr>
<td>
<label>Setpoint T&deg;: </label><label id="system-setpoint">...</label>
</td>
<td>
...
</td>
<td>
<label>RAM free: </label><label id="system-ram-free">...</label>
</td>
</tr>
</table>
<div id="spacer-20"></div>
</fieldset>
<div id="spacer-20"></div>
<fieldset>
<legend>Network / WiFi</legend>
<div id="spacer-20"></div>
<table>
<tr>
<td id="first_td_th">
<label>IP: </label><label id="wifi-ip-addr">XXX.XXX.XXX.XXX</label>
</td>
<td id="second_td_th">
<label>MAC: </label><label id="wifi-mac-addr">XX:XX:XX:XX:XX:XX</label>
</td>
<td>
<label>SSID: </label><label id="wifi-ssid">...</label>
</td>
</tr>
<tr><td>
<div id="spacer-10"></div>
</td></tr>
<tr>
<td>
<label>RSSi: </label><label id="wifi-rssi">...</label>
</td>
<td>
<label>Ch: </label><label id="wifi-ch">...</label>
</td>
<td>
<label>Encryp: </label><label id="wifi-encryp">...</label>
</td>
</tr>
</table>
<div id="spacer-20"></div>
</fieldset>
<div id="spacer-20"></div>
<fieldset>
<legend>Bluetooth LE</legend>
<div id="spacer-20"></div>
<table>
<tr>
<td id="first_td_th">
<label>Active: </label><label id="ble-active">...</label>
</td>
<td id="second_td_th">
<label>Connected: </label><label id="ble-connected">...</label>
</td>
<td>
<label>Name: </label><label id="ble-name">...</label>
</td>
</tr>
</table>
<div id="spacer-20"></div>
</fieldset>
<script>
window.onload = function() { OnPageLoad(); };
const boothMode = document.getElementById('booth-mode');
const boothStrip1Active = document.getElementById('booth-strip1-active');
const boothFrontLight = document.getElementById('booth-front-light');
const boothApp = document.getElementById('booth-app');
const boothStrip2Active = document.getElementById('booth-strip2-active');
const boothRearLight = document.getElementById('booth-rear-light');
const boothOled = document.getElementById('booth-oled');
const systemFirmware = document.getElementById('system-firmware');
const systemFlashSize = document.getElementById('system-flash-size');
const systemRamSize = document.getElementById('system-ram-size');
const systemRamUsed = document.getElementById('system-ram-used');
const systemBoothT = document.getElementById('system-boothT');
const systemRamFree = document.getElementById('system-ram-free');
const systemSetpoint = document.getElementById('system-setpoint');
const wifiIpAddr = document.getElementById('wifi-ip-addr');
const wifiMacAddr = document.getElementById('wifi-mac-addr');
const wifiSsid = document.getElementById('wifi-ssid');
const wifiRssi = document.getElementById('wifi-rssi');
const wifiCh = document.getElementById('wifi-ch');
const wifiEncryp = document.getElementById('wifi-encryp');
const bleActive = document.getElementById('ble-active');
const bleConnected = document.getElementById('ble-connected');
const bleName = document.getElementById('ble-name');
function OnPageLoad(){
fetch_json_file('sys-summary').then(result =>{
let summaryJson = result.data;
console.log(summaryJson);
Fill_Page(summaryJson);
});
}
function fetch_json_file(fileName){
const params = new URLSearchParams();
params.append('type', fileName);
const url = '/get?' + params.toString();
return fetch(url, {
method: 'GET'
})
.then(response => {
if (response.ok) { return response.json(); }
else { throw new Error('fetching ' + fileName + ' failed'); }
})
.then(data => { return{data:data}; })
}
function Fill_Page(js){
boothMode.innerHTML = js.booth.mode;
boothStrip1Active.innerHTML = js.booth.strip1 ? 'Active' : 'Inactive';
boothFrontLight.innerHTML = js.booth['front-light'] ? 'Active' : 'Inactive';
boothApp.innerHTML = js.booth.app.split(' ')[0];
boothStrip2Active.innerHTML = js.booth.strip2 ? 'Active' : 'Inactive';
boothRearLight.innerHTML = js.booth['rear-light'] ? 'Active' : 'Inactive';
boothOled.innerHTML = js.booth['booth-oled'] ? 'Active' : 'Inactive';
systemFirmware.innerHTML = js.system['firm-ver'];
systemFlashSize.innerHTML = js.chip['flash-size'];
systemRamSize.innerHTML = (js.chip['ram-size'] / 1024).toFixed(2) + 'KB';
systemRamUsed.innerHTML = (js.chip['ram-free'] / 1024).toFixed(2) + 'KB';
systemRamFree.innerHTML = (js.chip['ram-free'] / 1024).toFixed(2) + 'KB';
systemBoothT.innerHTML = js.temperature.temp.toFixed(2) + 'F';
systemSetpoint.innerHTML = js.temperature.sp1.toFixed(2) + 'F';
wifiIpAddr.innerHTML = js.wifi['client-ip'];
wifiMacAddr.innerHTML = js.wifi['mac-addr'];
//wifiSsid = js.
wifiRssi.innerHTML = js.wifi.rssi + 'dBm';
wifiCh.innerHTML = js.wifi.ch;
wifiEncryp.innerHTML = js.wifi.encryp;
bleActive.innerHTML = js.ble.en ? 'Active' : 'Inactive';
bleConnected.innerHTML = js.ble.clients;
bleName.innerHTML = js.ble.ssid;
}
</script>
</body>
</html>