gluon-status-page: add channels to status-page
This commit is contained in:
		
							parent
							
								
									b72588a014
								
							
						
					
					
						commit
						344d3ab686
					
				| @ -150,6 +150,11 @@ | |||||||
| 					<tr><th><%:Wireless 2.4 GHz%></th><td><%= statistics('clients/wifi24') %></td></tr> | 					<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> | 					<tr><th><%:Wireless 5 GHz%></th><td><%= statistics('clients/wifi5') %></td></tr> | ||||||
| 				</table> | 				</table> | ||||||
|  | 					<div id="radios" style="display: none"> | ||||||
|  | 					<h3><%:Radios%></h3> | ||||||
|  | 					<table id="radio-devices"> | ||||||
|  | 					</table> | ||||||
|  | 				</div> | ||||||
| 
 | 
 | ||||||
| 				<h3><%:Traffic%></h3> | 				<h3><%:Traffic%></h3> | ||||||
| 				<table> | 				<table> | ||||||
|  | |||||||
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							| @ -28,6 +28,9 @@ msgstr "1 Tag" | |||||||
| msgid "Automatic updates" | msgid "Automatic updates" | ||||||
| msgstr "Automatische Updates" | msgstr "Automatische Updates" | ||||||
| 
 | 
 | ||||||
|  | msgid "Channel" | ||||||
|  | msgstr "Kanal" | ||||||
|  | 
 | ||||||
| msgid "Clients" | msgid "Clients" | ||||||
| msgstr "Clients" | msgstr "Clients" | ||||||
| 
 | 
 | ||||||
| @ -91,6 +94,9 @@ msgstr "Übersicht" | |||||||
| msgid "Primary MAC address" | msgid "Primary MAC address" | ||||||
| msgstr "Primäre MAC-Adresse" | msgstr "Primäre MAC-Adresse" | ||||||
| 
 | 
 | ||||||
|  | msgid "Radios" | ||||||
|  | msgstr "" | ||||||
|  | 
 | ||||||
| msgid "RAM" | msgid "RAM" | ||||||
| msgstr "RAM" | msgstr "RAM" | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -19,6 +19,9 @@ msgstr "" | |||||||
| msgid "Automatic updates" | msgid "Automatic updates" | ||||||
| msgstr "" | msgstr "" | ||||||
| 
 | 
 | ||||||
|  | msgid "Channel" | ||||||
|  | msgstr "" | ||||||
|  | 
 | ||||||
| msgid "Clients" | msgid "Clients" | ||||||
| msgstr "" | msgstr "" | ||||||
| 
 | 
 | ||||||
| @ -82,6 +85,9 @@ msgstr "" | |||||||
| msgid "Primary MAC address" | msgid "Primary MAC address" | ||||||
| msgstr "" | msgstr "" | ||||||
| 
 | 
 | ||||||
|  | msgid "Radios" | ||||||
|  | msgstr "" | ||||||
|  | 
 | ||||||
| msgid "RAM" | msgid "RAM" | ||||||
| msgstr "" | msgstr "" | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -15,6 +15,7 @@ if we ever add Russion to gluon-web, the following strings can be reused: | |||||||
| "Uptime": "Время работы", | "Uptime": "Время работы", | ||||||
| "Load average": "Загрузка системы", | "Load average": "Загрузка системы", | ||||||
| "Gateway": "Шлюз", | "Gateway": "Шлюз", | ||||||
|  | "Channel": "Канал", | ||||||
| "Clients": "Клиенты", | "Clients": "Клиенты", | ||||||
| "Transmitted": "Передано", | "Transmitted": "Передано", | ||||||
| "Received": "Получено", | "Received": "Получено", | ||||||
|  | |||||||
| @ -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]'); | 	var statisticsElems = document.querySelectorAll('[data-statistics]'); | ||||||
| 
 | 
 | ||||||
| 	add_event_source('/cgi-bin/dyn/statistics', function(data, dataPrev) { | 	add_event_source('/cgi-bin/dyn/statistics', function(data, dataPrev) { | ||||||
| @ -233,6 +275,11 @@ | |||||||
| 		} catch (e) { | 		} catch (e) { | ||||||
| 			console.error(e); | 			console.error(e); | ||||||
| 		} | 		} | ||||||
|  | 		try { | ||||||
|  | 			update_radios(data.wireless); | ||||||
|  | 		} catch (e) { | ||||||
|  | 			console.error(e); | ||||||
|  | 		} | ||||||
| 	}) | 	}) | ||||||
| 
 | 
 | ||||||
| 	function haversine(lat1, lon1, lat2, lon2) { | 	function haversine(lat1, lon1, lat2, lon2) { | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user