luci2.wireless: fix WDS interface status in getWirelessStatus()
authorJo-Philipp Wich <jow@openwrt.org>
Fri, 13 Feb 2015 22:49:48 +0000 (23:49 +0100)
committerJo-Philipp Wich <jow@openwrt.org>
Fri, 13 Feb 2015 22:49:48 +0000 (23:49 +0100)
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
luci2/htdocs/luci2/wireless.js

index 1ba6b81471b1e3895c9f4c163e9caa3b0ed73448..c724f85b4c555ab3abf721d5784838f4f5f2058e 100644 (file)
@@ -63,6 +63,7 @@ Class.extend({
                        return L.rpc.flush();
                }).then(function(networks) {
                        var rv = { };
+                       var net_by_devname = { };
 
                        var phy_attrs = [
                                'country', 'channel', 'frequency', 'frequency_offset',
@@ -80,7 +81,7 @@ Class.extend({
                                        rv[networks[i].phy] = { networks: [ ] }
                                );
 
-                               var net = {
+                               var net = net_by_devname[networks[i].device] = {
                                        device: networks[i].device
                                };
 
@@ -90,6 +91,17 @@ Class.extend({
                                for (var j = 0; j < net_attrs.length; j++)
                                        net[net_attrs[j]] = networks[i][net_attrs[j]];
 
+                               /* copy parent interface properties to wds interfaces */
+                               if (net.device.match(/^(.+)\.sta\d+$/) &&
+                                   net_by_devname[RegExp.$1])
+                               {
+                                       var pnet = net_by_devname[RegExp.$1];
+                                       for (var j = 0; j < net_attrs.length; j++)
+                                               if (typeof(networks[i][net_attrs[j]]) === 'undefined' ||
+                                                   net_attrs[j] == 'encryption')
+                                                       net[net_attrs[j]] = pnet[net_attrs[j]];
+                               }
+
                                phy.networks.push(net);
                        }