From: Florian Eckert Date: Wed, 10 Jan 2018 14:17:19 +0000 (+0100) Subject: luci-app-mwan3: move/rename hotplugscript tab X-Git-Url: http://git.archive.openwrt.org/?p=project%2Fluci.git;a=commitdiff_plain;h=6ac76568e770082ade633370b4e287cc9a0f4f1b;hp=08b40acc4e63b203ea4e3577f6e853f20bdfc864 luci-app-mwan3: move/rename hotplugscript tab - move hotplugscript tab to Configuration - rename hotplugscript tab to notify Signed-off-by: Florian Eckert --- diff --git a/applications/luci-app-mwan3/luasrc/controller/mwan3.lua b/applications/luci-app-mwan3/luasrc/controller/mwan3.lua index c24beda28..4877f611e 100644 --- a/applications/luci-app-mwan3/luasrc/controller/mwan3.lua +++ b/applications/luci-app-mwan3/luasrc/controller/mwan3.lua @@ -43,12 +43,13 @@ function index() entry({"admin", "network", "mwan", "configuration", "rule"}, arcombine(cbi("mwan/rule"), cbi("mwan/ruleconfig")), _("Rules"), 40).leaf = true + entry({"admin", "network", "mwan", "configuration", "notify"}, + cbi("mwan/notify"), + _("Notification"), 50).leaf = true entry({"admin", "network", "mwan", "advanced"}, - alias("admin", "network", "mwan", "advanced", "hotplugscript"), + alias("admin", "network", "mwan", "advanced", "mwanconfig"), _("Advanced"), 100) - entry({"admin", "network", "mwan", "advanced", "hotplugscript"}, - form("mwan/advanced_hotplugscript")) entry({"admin", "network", "mwan", "advanced", "mwanconfig"}, form("mwan/advanced_mwanconfig")) entry({"admin", "network", "mwan", "advanced", "networkconfig"}, diff --git a/applications/luci-app-mwan3/luasrc/model/cbi/mwan/advanced_hotplugscript.lua b/applications/luci-app-mwan3/luasrc/model/cbi/mwan/advanced_hotplugscript.lua deleted file mode 100644 index 1b9708021..000000000 --- a/applications/luci-app-mwan3/luasrc/model/cbi/mwan/advanced_hotplugscript.lua +++ /dev/null @@ -1,40 +0,0 @@ --- ------ hotplug script configuration ------ -- - -fs = require "nixio.fs" -ut = require "luci.util" - -script = "/etc/mwan3.user" - -m5 = SimpleForm("luci", nil) - m5:append(Template("mwan/advanced_hotplugscript")) -- highlight current tab - -f = m5:section(SimpleSection, nil, - translate("This section allows you to modify the content of \"/etc/mwan3.user\".
" .. - "The file is also preserved during sysupgrade.
" .. - "
" .. - "Notes:
" .. - "This file is interpreted as a shell script.
" .. - "The first line of the script must be "#!/bin/sh" without quotes.
" .. - "Lines beginning with # are comments and are not executed.
" .. - "Put your custom mwan3 action here, they will
" .. - "be executed with each netifd hotplug interface event
" .. - "on interfaces for which mwan3 is enabled.
" .. - "
" .. - "There are three main environment variables that are passed to this script.
" .. - "
" .. - "$ACTION Either \"ifup\" or \"ifdown\"
" .. - "$INTERFACE Name of the interface which went up or down (e.g. \"wan\" or \"wwan\")
" .. - "$DEVICE Physical device name which interface went up or down (e.g. \"eth0\" or \"wwan0\")
" .. - "
")) - -t = f:option(TextValue, "lines") - t.rmempty = true - t.rows = 20 - function t.cfgvalue() - return fs.readfile(script) - end - function t.write(self, section, data) -- format and write new data to script - return fs.writefile(script, ut.trim(data:gsub("\r\n", "\n")) .. "\n") - end - -return m5 diff --git a/applications/luci-app-mwan3/luasrc/model/cbi/mwan/notify.lua b/applications/luci-app-mwan3/luasrc/model/cbi/mwan/notify.lua new file mode 100644 index 000000000..8746072eb --- /dev/null +++ b/applications/luci-app-mwan3/luasrc/model/cbi/mwan/notify.lua @@ -0,0 +1,39 @@ +-- ------ hotplug script configuration ------ -- + +fs = require "nixio.fs" +ut = require "luci.util" + +script = "/etc/mwan3.user" + +m5 = SimpleForm("luci", nil) + +f = m5:section(SimpleSection, nil, + translate("This section allows you to modify the content of \"/etc/mwan3.user\".
" .. + "The file is also preserved during sysupgrade.
" .. + "
" .. + "Notes:
" .. + "This file is interpreted as a shell script.
" .. + "The first line of the script must be "#!/bin/sh" without quotes.
" .. + "Lines beginning with # are comments and are not executed.
" .. + "Put your custom mwan3 action here, they will
" .. + "be executed with each netifd hotplug interface event
" .. + "on interfaces for which mwan3 is enabled.
" .. + "
" .. + "There are three main environment variables that are passed to this script.
" .. + "
" .. + "$ACTION Either \"ifup\" or \"ifdown\"
" .. + "$INTERFACE Name of the interface which went up or down (e.g. \"wan\" or \"wwan\")
" .. + "$DEVICE Physical device name which interface went up or down (e.g. \"eth0\" or \"wwan0\")
" .. + "
")) + +t = f:option(TextValue, "lines") + t.rmempty = true + t.rows = 20 + function t.cfgvalue() + return fs.readfile(script) + end + function t.write(self, section, data) -- format and write new data to script + return fs.writefile(script, ut.trim(data:gsub("\r\n", "\n")) .. "\n") + end + +return m5 diff --git a/applications/luci-app-mwan3/luasrc/view/mwan/advanced_diagnostics.htm b/applications/luci-app-mwan3/luasrc/view/mwan/advanced_diagnostics.htm index 448348594..d29009595 100644 --- a/applications/luci-app-mwan3/luasrc/view/mwan/advanced_diagnostics.htm +++ b/applications/luci-app-mwan3/luasrc/view/mwan/advanced_diagnostics.htm @@ -1,7 +1,6 @@ <%+header%>