From 03dc912ebd92f8d38b124cacfacfc9266be18050 Mon Sep 17 00:00:00 2001 From: Florian Eckert Date: Wed, 17 Jan 2018 15:10:51 +0100 Subject: luci-app-mwan3: remove some config parameter from interface overview table Signed-off-by: Florian Eckert --- .../luasrc/model/cbi/mwan/interface.lua | 53 ++++------------------ 1 file changed, 9 insertions(+), 44 deletions(-) (limited to 'applications/luci-app-mwan3/luasrc/model') diff --git a/applications/luci-app-mwan3/luasrc/model/cbi/mwan/interface.lua b/applications/luci-app-mwan3/luasrc/model/cbi/mwan/interface.lua index 95af9bbbfd..23a94a153d 100644 --- a/applications/luci-app-mwan3/luasrc/model/cbi/mwan/interface.lua +++ b/applications/luci-app-mwan3/luasrc/model/cbi/mwan/interface.lua @@ -105,7 +105,6 @@ end m5 = Map("mwan3", translate("MWAN - Interfaces"), interfaceWarnings(configCheck())) - m5:append(Template("mwan/config_css")) mwan_interface = m5:section(TypedSection, "interface", nil, @@ -137,24 +136,10 @@ enabled = mwan_interface:option(DummyValue, "enabled", translate("Enabled")) end end -track_ip = mwan_interface:option(DummyValue, "track_ip", translate("Tracking IP")) - track_ip.rawhtml = true - function track_ip.cfgvalue(self, s) - tracked = self.map:get(s, "track_ip") - if tracked then - local ipList = "" - for k,v in pairs(tracked) do - ipList = ipList .. v .. "
" - end - return ipList - else - return "—" - end - end - track_method = mwan_interface:option(DummyValue, "track_method", translate("Tracking method")) track_method.rawhtml = true function track_method.cfgvalue(self, s) + local tracked = self.map:get(s, "track_ip") if tracked then return self.map:get(s, "track_method") or "—" else @@ -165,6 +150,7 @@ track_method = mwan_interface:option(DummyValue, "track_method", translate("Trac reliability = mwan_interface:option(DummyValue, "reliability", translate("Tracking reliability")) reliability.rawhtml = true function reliability.cfgvalue(self, s) + local tracked = self.map:get(s, "track_ip") if tracked then return self.map:get(s, "reliability") or "—" else @@ -172,34 +158,10 @@ reliability = mwan_interface:option(DummyValue, "reliability", translate("Tracki end end -count = mwan_interface:option(DummyValue, "count", translate("Ping count")) - count.rawhtml = true - function count.cfgvalue(self, s) - if tracked then - return self.map:get(s, "count") or "—" - else - return "—" - end - end - -timeout = mwan_interface:option(DummyValue, "timeout", translate("Ping timeout")) - timeout.rawhtml = true - function timeout.cfgvalue(self, s) - if tracked then - local timeoutValue = self.map:get(s, "timeout") - if timeoutValue then - return timeoutValue .. "s" - else - return "—" - end - else - return "—" - end - end - interval = mwan_interface:option(DummyValue, "interval", translate("Ping interval")) interval.rawhtml = true function interval.cfgvalue(self, s) + local tracked = self.map:get(s, "track_ip") if tracked then local intervalValue = self.map:get(s, "interval") if intervalValue then @@ -215,6 +177,7 @@ interval = mwan_interface:option(DummyValue, "interval", translate("Ping interva down = mwan_interface:option(DummyValue, "down", translate("Interface down")) down.rawhtml = true function down.cfgvalue(self, s) + local tracked = self.map:get(s, "track_ip") if tracked then return self.map:get(s, "down") or "—" else @@ -225,6 +188,7 @@ down = mwan_interface:option(DummyValue, "down", translate("Interface down")) up = mwan_interface:option(DummyValue, "up", translate("Interface up")) up.rawhtml = true function up.cfgvalue(self, s) + local tracked = self.map:get(s, "track_ip") if tracked then return self.map:get(s, "up") or "—" else @@ -235,9 +199,10 @@ up = mwan_interface:option(DummyValue, "up", translate("Interface up")) metric = mwan_interface:option(DummyValue, "metric", translate("Metric")) metric.rawhtml = true function metric.cfgvalue(self, s) - local metricValue = sys.exec("uci -p /var/state get network." .. s .. ".metric") - if metricValue ~= "" then - return metricValue + local uci = uci.cursor(nil, "/var/state") + local metric = uci:get("network", s, "metric") + if metric then + return metric else return "—" end -- cgit v1.2.3