From bcdd688eb8ef8df4304fd2081a88586ccbd7f222 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Sat, 5 Oct 2013 20:13:17 +0000 Subject: [PATCH] luci2: various network function fixes * fix empty device descriptions for alias interfaces in LuCI2.network.getNetworkStatus() * fix crash with inactive interfaces in LuCI2.network.findWanInterfaces() * fix LuCI2.network.getDeviceStatus() function name after only greedy search and replace --- luci2/htdocs/luci2/luci2.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/luci2/htdocs/luci2/luci2.js b/luci2/htdocs/luci2/luci2.js index 52ea2e7..fc5d84a 100644 --- a/luci2/htdocs/luci2/luci2.js +++ b/luci2/htdocs/luci2/luci2.js @@ -788,13 +788,13 @@ function LuCI2() var net = nets[i] = networks[i]; var dev = net.l3_device || net.l2_device; if (dev) - net.device = devs[dev] = { }; + net.device = devs[dev] || (devs[dev] = { }); } _luci2.rpc.batch(); for (var dev in devs) - _luci2.network.listDeviceNamestatus(dev); + _luci2.network.getDeviceStatus(dev); return _luci2.rpc.flush(); }).then(function(devices) { @@ -817,7 +817,7 @@ function LuCI2() if (!devs[brm[j]]) { devs[brm[j]] = { }; - _luci2.network.listDeviceNamestatus(brm[j]); + _luci2.network.getDeviceStatus(brm[j]); } devs[devices[i]['device']].subdevices[j] = devs[brm[j]]; @@ -867,6 +867,9 @@ function LuCI2() for (var i = 0; i < interfaces.length; i++) { + if (!interfaces[i].route) + continue; + for (var j = 0; j < interfaces[i].route.length; j++) { var rt = interfaces[i].route[j]; @@ -928,7 +931,7 @@ function LuCI2() } }), - listDeviceNamestatus: _luci2.rpc.declare({ + getDeviceStatus: _luci2.rpc.declare({ object: 'network.device', method: 'status', params: [ 'name' ], -- 2.11.0