From 5bf31bb1ae2b8192080ebc317fec1dfeaf337e76 Mon Sep 17 00:00:00 2001 From: Stan Grishin Date: Sun, 29 Mar 2020 05:22:21 +0000 Subject: luci-app-simple-adblock: better status/error display Signed-off-by: Stan Grishin --- .../luasrc/view/simple-adblock/buttons.htm | 69 ++++++++++++++++++++++ .../luasrc/view/simple-adblock/css.htm | 9 +++ .../luasrc/view/simple-adblock/error.htm | 13 ++++ .../luasrc/view/simple-adblock/js.htm | 59 ++++++++++++++++++ 4 files changed, 150 insertions(+) create mode 100644 applications/luci-app-simple-adblock/luasrc/view/simple-adblock/buttons.htm create mode 100644 applications/luci-app-simple-adblock/luasrc/view/simple-adblock/css.htm create mode 100644 applications/luci-app-simple-adblock/luasrc/view/simple-adblock/error.htm create mode 100644 applications/luci-app-simple-adblock/luasrc/view/simple-adblock/js.htm (limited to 'applications/luci-app-simple-adblock/luasrc/view/simple-adblock') diff --git a/applications/luci-app-simple-adblock/luasrc/view/simple-adblock/buttons.htm b/applications/luci-app-simple-adblock/luasrc/view/simple-adblock/buttons.htm new file mode 100644 index 0000000000..08b725cf7f --- /dev/null +++ b/applications/luci-app-simple-adblock/luasrc/view/simple-adblock/buttons.htm @@ -0,0 +1,69 @@ +<%# + Copyright 2019 Stan Grishin +-%> + +<%- + local packageName = "simple-adblock" + local enabledFlag = luci.model.uci.cursor():get(packageName, "config", "enabled") + if nixio.fs.access("/var/run/" .. packageName .. ".json") then + tmpfs = luci.jsonc.parse(luci.util.trim(luci.sys.exec("cat /var/run/" .. packageName .. ".json"))) + end + local tmpfsVersion, tmpfsStatus, tmpfsMessage, tmpfsError, tmpfsStats = "", "Stopped" + if tmpfs and tmpfs['data'] then + if tmpfs['data']['status'] and tmpfs['data']['status'] ~= "" then + tmpfsStatus = tmpfs['data']['status'] + end + if tmpfs['data']['message'] and tmpfs['data']['message'] ~= "" then + tmpfsMessage = tmpfs['data']['message'] + end + if tmpfs['data']['error'] and tmpfs['data']['error'] ~= "" then + tmpfsError = tmpfs['data']['error'] + end + if tmpfs['data']['stats'] and tmpfs['data']['stats'] ~= "" then + tmpfsStats = tmpfs['data']['stats'] + end + if tmpfs['data']['version'] and tmpfs['data']['version'] ~= "" then + tmpfsVersion = " (" .. packageName .. " " .. tmpfs['data']['version'] .. ")" + end + end + if tmpfsStatus == "Stopped" then + btn_start_style = "cbi-button cbi-button-apply important" + btn_action_style = "cbi-button cbi-button-apply important" + btn_stop_style = "cbi-button cbi-button-reset -disabled" + else + btn_start_style = "cbi-button cbi-button-apply -disabled" + btn_action_style = "cbi-button cbi-button-apply important" + btn_stop_style = "cbi-button cbi-button-reset important" + end + if enabledFlag ~= "1" then + btn_start_style = "cbi-button cbi-button-apply -disabled" + btn_action_style = "cbi-button cbi-button-apply -disabled" + btn_enable_style = "cbi-button cbi-button-apply important" + btn_disable_style = "cbi-button cbi-button-reset -disabled" + else + btn_enable_style = "cbi-button cbi-button-apply -disabled" + btn_disable_style = "cbi-button cbi-button-reset important" + end +-%> + +<%+simple-adblock/css%> +<%+simple-adblock/js%> + +
+
+ + + + + + +   +   +   +   + + + + +
+
diff --git a/applications/luci-app-simple-adblock/luasrc/view/simple-adblock/css.htm b/applications/luci-app-simple-adblock/luasrc/view/simple-adblock/css.htm new file mode 100644 index 0000000000..6fb3d51d3b --- /dev/null +++ b/applications/luci-app-simple-adblock/luasrc/view/simple-adblock/css.htm @@ -0,0 +1,9 @@ + diff --git a/applications/luci-app-simple-adblock/luasrc/view/simple-adblock/error.htm b/applications/luci-app-simple-adblock/luasrc/view/simple-adblock/error.htm new file mode 100644 index 0000000000..4ab2e11291 --- /dev/null +++ b/applications/luci-app-simple-adblock/luasrc/view/simple-adblock/error.htm @@ -0,0 +1,13 @@ +<%# +Copyright 2017-2019 Stan Grishin (stangri@melmac.net) +This is free software, licensed under the Apache License, Version 2.0 +-%> + +<%+cbi/valueheader%> + + + +<%+cbi/valuefooter%> diff --git a/applications/luci-app-simple-adblock/luasrc/view/simple-adblock/js.htm b/applications/luci-app-simple-adblock/luasrc/view/simple-adblock/js.htm new file mode 100644 index 0000000000..51198293f5 --- /dev/null +++ b/applications/luci-app-simple-adblock/luasrc/view/simple-adblock/js.htm @@ -0,0 +1,59 @@ + \ No newline at end of file -- cgit v1.2.3