modules/admin-full: use firstchild() instead of fixed alias
[project/luci.git] / modules / admin-full / luasrc / controller / admin / network.lua
index e701d1d..954ba12 100644 (file)
@@ -31,7 +31,7 @@ function index()
        local page
 
        page = node("admin", "network")
-       page.target = alias("admin", "network", "network")
+       page.target = firstchild()
        page.title  = _("Network")
        page.order  = 50
        page.index  = true
@@ -48,16 +48,22 @@ function index()
                page.leaf = true
                page.subindex = true
 
-               page = entry({"admin", "network", "wireless_join"}, call("wifi_join"), nil, 16)
+               page = entry({"admin", "network", "wireless_join"}, call("wifi_join"), nil)
                page.leaf = true
 
-               page = entry({"admin", "network", "wireless_add"}, call("wifi_add"), nil, 16)
+               page = entry({"admin", "network", "wireless_add"}, call("wifi_add"), nil)
                page.leaf = true
 
-               page = entry({"admin", "network", "wireless_delete"}, call("wifi_delete"), nil, 16)
+               page = entry({"admin", "network", "wireless_delete"}, call("wifi_delete"), nil)
                page.leaf = true
 
-               page = entry({"admin", "network", "wireless_status"}, call("wifi_status"), nil, 16)
+               page = entry({"admin", "network", "wireless_status"}, call("wifi_status"), nil)
+               page.leaf = true
+
+               page = entry({"admin", "network", "wireless_reconnect"}, call("wifi_reconnect"), nil)
+               page.leaf = true
+
+               page = entry({"admin", "network", "wireless_shutdown"}, call("wifi_reconnect"), nil)
                page.leaf = true
 
                local wdev
@@ -247,7 +253,7 @@ function iface_status()
                                }
                        end
 
-                       for _, device in ipairs(net:get_interfaces()) do
+                       for _, device in ipairs(net:get_interfaces() or {}) do
                                data.subdevices[#data.subdevices+1] = {
                                        name       = device:shortname(),
                                        type       = device:type(),
@@ -263,6 +269,12 @@ function iface_status()
                        end
 
                        rv[#rv+1] = data
+               else
+                       rv[#rv+1] = {
+                               id   = iface,
+                               name = iface,
+                               type = "ethernet"
+                       }
                end
        end
 
@@ -282,23 +294,6 @@ function iface_reconnect()
 
        local net = netmd:get_network(iface)
        if net then
-               local ifn
-               for _, ifn in ipairs(net:get_interfaces()) do
-                       local wnet = ifn:get_wifinet()
-                       if wnet then
-                               local wdev = wnet:get_device()
-                               if wdev then
-                                       luci.sys.call(
-                                               "env -i /sbin/wifi up %q >/dev/null 2>/dev/null"
-                                                       % wdev:name()
-                                       )
-
-                                       luci.http.status(200, "Reconnected")
-                                       return
-                               end
-                       end
-               end
-
                luci.sys.call("env -i /sbin/ifup %q >/dev/null 2>/dev/null" % iface)
                luci.http.status(200, "Reconnected")
                return