From 9c97cdb7b6edcc62d29a72ca64cd682503e693f6 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Tue, 18 Oct 2011 13:20:43 +0000 Subject: [PATCH 1/1] modules/admin-full: better handle interfaces with unsupported protocols --- modules/admin-full/luasrc/controller/admin/network.lua | 6 ++++++ .../luasrc/view/admin_network/iface_overview.htm | 16 ++++++++++++++-- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/modules/admin-full/luasrc/controller/admin/network.lua b/modules/admin-full/luasrc/controller/admin/network.lua index 9d9aab4a2..1e6892e16 100644 --- a/modules/admin-full/luasrc/controller/admin/network.lua +++ b/modules/admin-full/luasrc/controller/admin/network.lua @@ -269,6 +269,12 @@ function iface_status() end rv[#rv+1] = data + else + rv[#rv+1] = { + id = iface, + name = iface, + type = "ethernet" + } end end diff --git a/modules/admin-full/luasrc/view/admin_network/iface_overview.htm b/modules/admin-full/luasrc/view/admin_network/iface_overview.htm index 0ead36837..21990bb7d 100644 --- a/modules/admin-full/luasrc/view/admin_network/iface_overview.htm +++ b/modules/admin-full/luasrc/view/admin_network/iface_overview.htm @@ -113,7 +113,7 @@ $Id$ } var d = document.getElementById(ifc.id + '-ifc-description'); - if (d && ifc.ifname) + if (d && ifc.proto && ifc.ifname) { if (ifc.is_up) { @@ -164,6 +164,18 @@ $Id$ d.innerHTML = html; } + else if (d && !ifc.proto) + { + var e = document.getElementById(ifc.id + '-ifc-edit'); + if (e) + e.disabled = true; + + d.innerHTML = String.format( + '<%:Unsupported protocol type.%>
' + + '<%:Install protocol extensions...%>', + '<%=luci.dispatcher.build_url("admin/system/packages")%>?query=luci-proto&display=available' + ); + } else if (d) { d.innerHTML = '<%:Interface not present or not connected yet.%>'; @@ -214,7 +226,7 @@ $Id$ - '" title="<%:Edit this interface%>" value="<%:Edit%>" /> + '" title="<%:Edit this interface%>" value="<%:Edit%>" id="<%=net%>-ifc-edit" /> '" title="<%:Delete this interface%>" value="<%:Delete%>" /> -- 2.11.0