luci-base: network.js: recognize uci declared network devices
authorJo-Philipp Wich <jo@mein.io>
Mon, 27 Jul 2020 13:44:03 +0000 (15:44 +0200)
committerJo-Philipp Wich <jo@mein.io>
Wed, 5 Aug 2020 11:53:12 +0000 (13:53 +0200)
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
modules/luci-base/htdocs/luci-static/resources/network.js

index 8d825d73a0824d047a6e56706c53c3f577492716..856421cd319960fccc0b943fa81f4e011633bdb0 100644 (file)
@@ -1224,6 +1224,22 @@ Network = baseclass.extend(/** @lends LuCI.network.prototype */ {
                                devices[netid] = this.instantiateDevice(netid);
                        }
 
+                       /* find uci declared devices */
+                       var uciDevices = uci.sections('network', 'device');
+
+                       for (var i = 0; i < uciDevices.length; i++) {
+                               var type = uciDevices[i].type,
+                                   name = uciDevices[i].name;
+
+                               if (!type || !name || devices.hasOwnProperty(name))
+                                       continue;
+
+                               if (type == 'bridge')
+                                       _state.isBridge[name] = true;
+
+                               devices[name] = this.instantiateDevice(name);
+                       }
+
                        var rv = [];
 
                        for (var netdev in devices)