mirror of
https://github.com/lumapu/ahoy.git
synced 2025-05-30 01:06:11 +02:00
beautified system.html (converted to table)
This commit is contained in:
parent
b2fc16e030
commit
4df61833ca
4 changed files with 104 additions and 21 deletions
|
@ -18,9 +18,9 @@
|
|||
</div>
|
||||
<div id="wrapper">
|
||||
<div id="content">
|
||||
<div><ul id="info"></ul></div>
|
||||
<div><ul id="radio"></ul></div>
|
||||
<div id="system"></div>
|
||||
<div id="info" class="col-sm-12 col-md-6 mt-3"></div>
|
||||
<div id="radio" class="col-sm-12 col-md-6 mt-3"></div>
|
||||
<div id="system" class="mt-3"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="footer">
|
||||
|
@ -45,19 +45,29 @@
|
|||
parseESP(obj);
|
||||
}
|
||||
|
||||
function genTabRow(key, value) {
|
||||
var r = div(["row", "p-1"]);
|
||||
r.appendChild(div(["col"], key));
|
||||
r.appendChild(div(["col"], value));
|
||||
return r;
|
||||
}
|
||||
|
||||
function parseSysInfo(obj) {
|
||||
const data = ["sdk", "cpu_freq", "chip_revision",
|
||||
"chip_model", "chip_cores", "esp_type", "mac", "wifi_rssi",
|
||||
"flash_size", "sketch_used", "heap_total", "heap_free", "heap_frag",
|
||||
"max_free_blk", "version", "core_version", "reboot_reason"];
|
||||
|
||||
var ul = document.getElementById("info");
|
||||
var main = document.getElementById("info");
|
||||
var h = div(["head", "p-2"]);
|
||||
var r = div(["row"]);
|
||||
r.appendChild(div(["col", "a-c"], "System Information"));
|
||||
h.appendChild(r);
|
||||
main.appendChild(h);
|
||||
|
||||
for (const [key, value] of Object.entries(obj)) {
|
||||
if(!data.includes(key) || (typeof value == 'undefined')) continue;
|
||||
var li = document.createElement("li");
|
||||
li.appendChild()
|
||||
li.appendChild(document.createTextNode(key + ": " + value));
|
||||
ul.appendChild(li);
|
||||
main.appendChild(genTabRow(key, value));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -65,21 +75,18 @@
|
|||
const pa = ["MIN", "LOW", "HIGH", "MAX"];
|
||||
const datarate = ["1 MBps", "2 MBps", "250 kbps"];
|
||||
|
||||
var ul = document.getElementById("radio");
|
||||
let data;
|
||||
var main = document.getElementById("radio");
|
||||
var h = div(["head", "p-2"]);
|
||||
var r = div(["row"]);
|
||||
r.appendChild(div(["col", "a-c"], "Radio"));
|
||||
h.appendChild(r);
|
||||
main.appendChild(h);
|
||||
|
||||
var li = document.createElement("li");
|
||||
li.appendChild(document.createTextNode("nrf24l01" + (obj["isPVariant"] ? "+ " : "") + (obj["isconnected"] ? "is connected " : "is not connected ")));
|
||||
ul.appendChild(li);
|
||||
main.appendChild(genTabRow("nrf24l01" + (obj["isPVariant"] ? "+ " : ""), (obj["isconnected"] ? "is connected " : "is not connected ")));
|
||||
|
||||
if(obj["isconnected"]) {
|
||||
var li = document.createElement("li");
|
||||
li.appendChild(document.createTextNode("Datarate: " + datarate[obj["DataRate"]]));
|
||||
ul.appendChild(li);
|
||||
|
||||
var li = document.createElement("li");
|
||||
li.appendChild(document.createTextNode("Power Level: " + pa[obj["power_level"]]));
|
||||
ul.appendChild(li);
|
||||
main.appendChild(genTabRow("Datarate", datarate[obj["DataRate"]]));
|
||||
main.appendChild(genTabRow("Power Level", pa[obj["power_level"]]));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue