improved AP status indicator

This commit is contained in:
Nic Limper
2024-11-03 13:33:30 +01:00
parent 61eb19dfe8
commit 1052102032
4 changed files with 21 additions and 13 deletions

Binary file not shown.

View File

@@ -32,7 +32,7 @@
</div>
<!-- /tabs -->
<div><span id="runstate"></div>
<div><span id="apstatecolor">&#11044;</span> <span id="apstate">loading</span></div>
<div><span id="apstatecolor" style="font-size: 18px; vertical-align: bottom;" class="material-symbols-outlined">hourglass</span> <span id="apstate">loading</span></div>
<div><a href="/edit" target="littlefs" class="filebutton material-symbols-outlined">folder_open</a>
</div>
</div>
@@ -46,10 +46,10 @@
<div id="hometab" class="tabcontent">
<table>
<tr onclick="setFilterAndShow('')">
<td class="material-symbols-outlined" style="color:#239f26" id="dashboardStatusIcon">
check_circle
<td class="material-symbols-outlined" id="dashboardStatusIcon">
hourglass
</td>
<td id="dashboardStatus" style="color:#239f26" colspan="2">
<td id="dashboardStatus" colspan="2">
initialising...
</td>
</tr>

View File

@@ -17,14 +17,14 @@ let tagDB = {};
const previewWindows = [];
const apstate = [
{ state: "offline", color: "red" },
{ state: "online", color: "green" },
{ state: "flashing", color: "orange" },
{ state: "wait for reset", color: "blue" },
{ state: "requires power cycle", color: "purple" },
{ state: "failed", color: "red" },
{ state: "coming online", color: "yellow" },
{ state: "AP without radio", color: "green" }
{ state: "offline, please wait...", color: "orange", icon: "warning" },
{ state: "online", color: "green", icon: "check_circle" },
{ state: "flashing", color: "orange", icon: "flash_on" },
{ state: "wait for reset", color: "blue", icon: "hourglass" },
{ state: "AP requires power cycle", color: "purple", icon: "refresh" },
{ state: "failed", color: "red", icon: "error" },
{ state: "coming online...", color: "orange", icon: "hourglass" },
{ state: "AP without radio", color: "green", icon: "wifi_off" }
];
const runstate = [
{ state: "⏹︎ stopped" },
@@ -71,9 +71,13 @@ window.addEventListener("loadConfig", function () {
if (data.savespace) {
}
if (data.apstate) {
$("#apstatecolor").innerHTML = apstate[data.apstate].icon;
$("#apstatecolor").style.color = apstate[data.apstate].color;
$("#apstate").innerHTML = apstate[data.apstate].state;
$('#dashboardStatus').innerHTML = apstate[data.apstate].state;
$('#dashboardStatus').style.color = apstate[data.apstate].color;
$('#dashboardStatusIcon').innerHTML = apstate[data.apstate].icon;
$('#dashboardStatusIcon').style.color = apstate[data.apstate].color;
}
});
});
@@ -215,10 +219,14 @@ function connect() {
$("#sysinfo").innerHTML = str;
if (msg.sys.apstate) {
$("#runstate").innerHTML = runstate[msg.sys.runstate].state;
$("#apstatecolor").innerHTML = apstate[msg.sys.apstate].icon;
$("#apstatecolor").style.color = apstate[msg.sys.apstate].color;
$("#apstate").innerHTML = apstate[msg.sys.apstate].state;
$("#runstate").innerHTML = runstate[msg.sys.runstate].state;
$('#dashboardStatus').innerHTML = apstate[msg.sys.apstate].state;
$('#dashboardStatus').style.color = apstate[msg.sys.apstate].color;
$('#dashboardStatusIcon').innerHTML = apstate[msg.sys.apstate].icon;
$('#dashboardStatusIcon').style.color = apstate[msg.sys.apstate].color;
}
servertimediff = (Date.now() / 1000) - msg.sys.currtime;
}