From bdcb760d6214cb9011f4a6fa20a56fa959bc696f Mon Sep 17 00:00:00 2001 From: Stan Grishin Date: Fri, 3 Apr 2020 12:50:10 +0000 Subject: luci-app-https-dns-proxy: better service control & buttons styling Signed-off-by: Stan Grishin --- .../luasrc/view/https-dns-proxy/buttons.htm | 83 ++++++++++++++-------- 1 file changed, 52 insertions(+), 31 deletions(-) (limited to 'applications/luci-app-https-dns-proxy/luasrc/view/https-dns-proxy/buttons.htm') diff --git a/applications/luci-app-https-dns-proxy/luasrc/view/https-dns-proxy/buttons.htm b/applications/luci-app-https-dns-proxy/luasrc/view/https-dns-proxy/buttons.htm index 52d2b50e52..b7fcd472ed 100644 --- a/applications/luci-app-https-dns-proxy/luasrc/view/https-dns-proxy/buttons.htm +++ b/applications/luci-app-https-dns-proxy/luasrc/view/https-dns-proxy/buttons.htm @@ -1,56 +1,77 @@ -<%# - Copyright 2019 Stan Grishin --%> +<%# Copyright 2020 Stan Grishin -%> + +<%+https-dns-proxy/css%> +<%+https-dns-proxy/js%> <%- local packageName = "https-dns-proxy" - local enabledFlag = luci.sys.init.enabled(packageName) - local ubusStatus = luci.util.ubus("service", "list", { name = packageName }) + local serviceRunning, serviceEnabled = false, false; - if not ubusStatus or not ubusStatus[packageName] then - tmpfsStatusCode = 0 - else - tmpfsStatusCode = 1 + serviceEnabled = luci.sys.init.enabled(packageName) + local ubusStatus = luci.util.ubus("service", "list", { name = packageName }) + if ubusStatus and ubusStatus[packageName] then + serviceRunning = true end - if tmpfsStatusCode == 0 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" + if serviceEnabled then + btn_start_status = true + btn_action_status = true + btn_stop_status = true + btn_enable_status = false + btn_disable_status = true 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" + btn_start_status = false + btn_action_status = false + btn_stop_status = false + btn_enable_status = true + btn_disable_status = false end - if not enabledFlag 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" + if serviceRunning then + btn_start_status = false + btn_action_status = true + btn_stop_status = true else - btn_enable_style = "cbi-button cbi-button-apply -disabled" - btn_disable_style = "cbi-button cbi-button-reset important" + btn_action_status = false + btn_stop_status = false end -%> -<%+https-dns-proxy/css%> -<%+https-dns-proxy/js%> -
- + - + - +         - + - +
+ +<%-if not btn_start_status then%> + +<%-end%> +<%-if not btn_action_status then%> + +<%-end%> +<%-if not btn_stop_status then%> + +<%-end%> +<%-if not btn_enable_status then%> + +<%-end%> +<%-if not btn_disable_status then%> + +<%-end%> -- cgit v1.2.3