gluon-status-page: add channels to status-page

This commit is contained in:
aiyion.prime 2021-04-12 13:42:22 +02:00
parent b72588a014
commit 344d3ab686
6 changed files with 66 additions and 1 deletions

View File

@ -150,6 +150,11 @@
<tr><th><%:Wireless 2.4 GHz%></th><td><%= statistics('clients/wifi24') %></td></tr>
<tr><th><%:Wireless 5 GHz%></th><td><%= statistics('clients/wifi5') %></td></tr>
</table>
<div id="radios" style="display: none">
<h3><%:Radios%></h3>
<table id="radio-devices">
</table>
</div>
<h3><%:Traffic%></h3>
<table>

File diff suppressed because one or more lines are too long

View File

@ -28,6 +28,9 @@ msgstr "1 Tag"
msgid "Automatic updates"
msgstr "Automatische Updates"
msgid "Channel"
msgstr "Kanal"
msgid "Clients"
msgstr "Clients"
@ -91,6 +94,9 @@ msgstr "Übersicht"
msgid "Primary MAC address"
msgstr "Primäre MAC-Adresse"
msgid "Radios"
msgstr ""
msgid "RAM"
msgstr "RAM"

View File

@ -19,6 +19,9 @@ msgstr ""
msgid "Automatic updates"
msgstr ""
msgid "Channel"
msgstr ""
msgid "Clients"
msgstr ""
@ -82,6 +85,9 @@ msgstr ""
msgid "Primary MAC address"
msgstr ""
msgid "Radios"
msgstr ""
msgid "RAM"
msgstr ""

View File

@ -15,6 +15,7 @@ if we ever add Russion to gluon-web, the following strings can be reused:
"Uptime": "Время работы",
"Load average": "Загрузка системы",
"Gateway": "Шлюз",
"Channel": "Канал",
"Clients": "Клиенты",
"Transmitted": "Передано",
"Received": "Получено",

View File

@ -208,6 +208,48 @@
});
}
function update_radios(wireless) {
function channel(frequency) {
if (frequency===2484)
return 14
if (2412<=frequency && frequency<=2472)
return (frequency-2407)/5
if (5160<=frequency && frequency<=5885)
return (frequency-5000)/5
return 'unknown'
}
var div = document.getElementById('radios');
if (!wireless) {
div.style.display = 'none';
return;
}
div.style.display = '';
var table = document.getElementById('radio-devices');
while (table.lastChild)
table.removeChild(table.lastChild);
wireless.forEach(function (radio) {
var tr = document.createElement('tr');
var th = document.createElement('th');
// TODO enhancement possible, as soon as #2204 is resolved
// (use actual radio names)
th.textContent = "radio";
tr.appendChild(th);
var td = document.createElement('td');
td.innerHTML = radio.frequency + " MHz<br />Channel " + channel(radio.frequency);
tr.appendChild(td);
table.appendChild(tr);
});
}
var statisticsElems = document.querySelectorAll('[data-statistics]');
add_event_source('/cgi-bin/dyn/statistics', function(data, dataPrev) {
@ -233,6 +275,11 @@
} catch (e) {
console.error(e);
}
try {
update_radios(data.wireless);
} catch (e) {
console.error(e);
}
})
function haversine(lat1, lon1, lat2, lon2) {