From a339b8b649405819a8838cf2dd6e0cad813f89e6 Mon Sep 17 00:00:00 2001 From: Stan Grishin Date: Fri, 3 Apr 2020 12:25:17 +0000 Subject: luci-app-simple-adblock: better service control & buttons styling Signed-off-by: Stan Grishin --- .../luasrc/model/cbi/simple-adblock.lua | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'applications/luci-app-simple-adblock/luasrc/model/cbi/simple-adblock.lua') diff --git a/applications/luci-app-simple-adblock/luasrc/model/cbi/simple-adblock.lua b/applications/luci-app-simple-adblock/luasrc/model/cbi/simple-adblock.lua index ce5626f8e6..15e757cf41 100644 --- a/applications/luci-app-simple-adblock/luasrc/model/cbi/simple-adblock.lua +++ b/applications/luci-app-simple-adblock/luasrc/model/cbi/simple-adblock.lua @@ -49,13 +49,12 @@ elseif targetDNS == "unbound.adb_list" then outputGzip="/etc/" .. packageName .. ".unbound.gz" end -local tmpfs +local tmpfs, tmpfsMessage, tmpfsError, tmpfsStats +local tmpfsVersion, tmpfsStatus = "", "Stopped" if fs.access("/var/run/" .. packageName .. ".json") then tmpfs = jsonc.parse(util.trim(sys.exec("cat /var/run/" .. packageName .. ".json"))) end -local tmpfsVersion, tmpfsStatus = "", "Stopped" -local tmpfsMessage, tmpfsError, tmpfsStats if tmpfs and tmpfs['data'] then if tmpfs['data']['status'] and tmpfs['data']['status'] ~= "" then tmpfsStatus = tmpfs['data']['status'] @@ -109,7 +108,7 @@ errorTable["errorParsingList"] = translate("failed to parse") m = Map("simple-adblock", translate("Simple AdBlock Settings")) m.apply_on_parse = true m.on_after_apply = function(self) - sys.call("/etc/init.d/simple-adblock restart") + sys.call("/etc/init.d/simple-adblock restart") end h = m:section(NamedSection, "config", "simple-adblock", translate("Service Status") .. " [" .. tmpfsVersion .. "]") @@ -144,7 +143,6 @@ else ss = h:option(DummyValue, "_dummy", translate("Service Status")) ss.template = "simple-adblock/status" if tmpfsStatus == "statusSuccess" then --- ss.value = tmpfsStats ss.value = tmpfsVersion .. " " .. translate("is blocking") .. " " .. util.trim(sys.exec("wc -l < " .. outputFile)) .. " " .. translate("domains") .. " (" .. translate("with") .. @@ -172,8 +170,10 @@ else end end end - buttons = h:option(DummyValue, "_dummy") - buttons.template = "simple-adblock/buttons" + if tmpfsVersion ~= "" then + buttons = h:option(DummyValue, "_dummy") + buttons.template = packageName .. "/buttons" + end end s = m:section(NamedSection, "config", "simple-adblock", translate("Configuration")) -- cgit v1.2.3