Skip to content
This repository was archived by the owner on Mar 5, 2023. It is now read-only.

Commit

Permalink
webui: show wifi interface status
Browse files Browse the repository at this point in the history
  • Loading branch information
mwarning committed Sep 26, 2015
1 parent 049ba74 commit c51241a
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions files/www/lan/network.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ All required uci packages are stored variable uci.
The GUI code displayes and manipulated this variable.
*/
var uci = {};
var wifi_status = {};

var gid = 0;
var net_options = [["LAN", "lan"], ["Freifunk", "freifunk"], ["Mesh", "mesh"], ["WAN", "wan"], ["None", "none"]];
var txpower_choices = [
Expand All @@ -29,6 +31,8 @@ var txpower_choices = [

function init()
{
send("/cgi-bin/misc", { func : "wifi_status" }, function(data) {
wifi_status = JSON.parse(data);
send("/cgi-bin/network", { func : "get_settings" }, function(data) {
uci = fromUCI(data);
rebuild_other();
Expand All @@ -37,6 +41,7 @@ function init()
rebuild_switches();
adv_apply();
});
});
}

function updateFrom(src)
Expand Down Expand Up @@ -391,6 +396,23 @@ function delWifiSection(dev, mode)
});
}

function getWifiInterfaceState(dev, wid) {
var obj = wifi_status[dev];

if(!obj.up) {
return "Inaktiv";
}

var interfaces = obj['interfaces'];
for(var i = 0; interfaces && i < interfaces.length; i++) {
var e = interfaces[i];
if(e.section == wid) {
return ('ifname' in e) ? "Aktiv" : "Fehler";
}
}
return "Unbekannt";
}

function rebuild_wifi()
{
var root = $("wireless");
Expand Down Expand Up @@ -422,6 +444,10 @@ function rebuild_wifi()
for(var opt in wobj)
appendSetting(entry, ["wireless", wid, opt], wobj[opt], mode);

var state = getWifiInterfaceState(dev, wid);
var b = append_label(entry, "Status", state);
addHelpText(b, "Funktioniert das Interface? Manche WLAN-Treiber k\xf6nnen z.B kein AccessPoint und Mesh gleichzeitig.");

if(mode == "none")
{
append_button(entry, "L\xf6schen", function() {
Expand Down

0 comments on commit c51241a

Please sign in to comment.