luci-app-mwan3: add dependecy to size option
[project/luci.git] / applications / luci-app-mwan3 / luasrc / model / cbi / mwan / interfaceconfig.lua
index 9f1db08..8cfeecd 100644 (file)
@@ -1,3 +1,7 @@
+-- Copyright 2014 Aedan Renner <chipdankly@gmail.com>
+-- Copyright 2018 Florian Eckert <fe@dev.tdt.de>
+-- Licensed to the public under the GNU General Public License v2.
+
 dsp = require "luci.dispatcher"
 arg[1] = arg[1] or ""
 
@@ -50,6 +54,7 @@ count:value("5")
 
 size = mwan_interface:option(Value, "size", translate("Ping size"))
 size.default = "56"
+size:depends("track_method", "ping")
 size:value("8")
 size:value("24")
 size:value("56")
@@ -167,7 +172,7 @@ metric = mwan_interface:option(DummyValue, "metric", translate("Metric"),
        translate("This displays the metric assigned to this interface in /etc/config/network"))
 metric.rawhtml = true
 function metric.cfgvalue(self, s)
-       local uci = uci.cursor(nil, "/var/state")
+       local uci = require "luci.model.uci".cursor(nil, "/var/state")
        local metric = uci:get("network", arg[1], "metric")
        if metric then
                return metric