diff options
author | Dirk Brenken <dev@brenken.org> | 2018-11-10 11:19:50 +0100 |
---|---|---|
committer | Dirk Brenken <dev@brenken.org> | 2018-11-10 11:19:50 +0100 |
commit | e50021f77fbc593cee841a02ad66c4bfea072f9e (patch) | |
tree | a768ced11497e719dd048965f86e43c30107d25b /applications/luci-app-banip/luasrc/view/banip/runtime.htm | |
parent | 40de466475a617f42d1f5cfa03d0342676e84c9b (diff) |
luci-app-banip: new package
for details & LuCI screenshots see base package desprition/PR:
https://github.com/openwrt/packages/pull/7373
Signed-off-by: Dirk Brenken <dev@brenken.org>
Diffstat (limited to 'applications/luci-app-banip/luasrc/view/banip/runtime.htm')
-rw-r--r-- | applications/luci-app-banip/luasrc/view/banip/runtime.htm | 130 |
1 files changed, 130 insertions, 0 deletions
diff --git a/applications/luci-app-banip/luasrc/view/banip/runtime.htm b/applications/luci-app-banip/luasrc/view/banip/runtime.htm new file mode 100644 index 000000000..041fcb143 --- /dev/null +++ b/applications/luci-app-banip/luasrc/view/banip/runtime.htm @@ -0,0 +1,130 @@ +<%# +Copyright 2018 Dirk Brenken (dev@brenken.org) +This is free software, licensed under the Apache License, Version 2.0 +-%> + +<%+banip/banip_css%> +<script type="text/javascript"> +//<![CDATA[ + function status_update(json) + { + var btn1 = document.getElementById("btn1"); + var btn1_running = document.getElementById("btn1_running"); + var view = document.getElementById("value_1"); + var input = json.data.status; + + btn1.value = "<%:Refresh%>"; + btn1.name = "do_refresh"; + view.innerHTML = input || "-"; + if (input != "running") + { + btn1.disabled = false; + running(btn1_running, 0); + } + view = document.getElementById("value_2"); + input = json.data.version; + view.innerHTML = input || "-"; + view = document.getElementById("value_3"); + input = json.data.fetch_info; + view.innerHTML = input || "-"; + view = document.getElementById("value_4"); + input = json.data.ipset_info; + view.innerHTML = input || "-"; + view = document.getElementById("value_5"); + input = json.data.last_run; + view.innerHTML = input || "-"; + } + +function btn_action(action) + { + var btn1 = document.getElementById("btn1"); + var btn1_running = document.getElementById("btn1_running"); + + btn1.disabled = true; + running(btn1_running, 1); + + new XHR.get('<%=luci.dispatcher.build_url("admin", "services", "banip")%>/action/' + action.name, null, + function(x) + { + if (!x) + { + return; + } + }); + } + + function running(element, state) + { + if (state === 1) + { + var running_html = '<img src="<%=resource%>/icons/loading.gif" alt="<%:Loading%>" width="16" height="16" style="vertical-align:middle" />'; + element.innerHTML = running_html; + } + else + { + element.innerHTML = ''; + } + } + + XHR.get('<%=luci.dispatcher.build_url("admin", "services", "banip", "status")%>', null, + function(x, json_info) + { + if (!x || !json_info) + { + return; + } + status_update(json_info) + }); + + XHR.poll(5, '<%=luci.dispatcher.build_url("admin", "services", "banip", "status")%>', null, + function(x, json_info) + { + if (!x || !json_info) + { + return; + } + status_update(json_info) + }); +//]]> +</script> + +<h3><%:Runtime Information%></h3> +<div class="cbi-value" id="status_1"> + <label class="cbi-value-title" for="status_1"><%:banIP Status%></label> + <div class="cbi-value-field"> + <span class="runtime" id="value_1">-</span> + </div> +</div> +<div class="cbi-value" id="status_2"> + <label class="cbi-value-title" for="status_2"><%:banIP Version%></label> + <div class="cbi-value-field"> + <span class="runtime" id="value_2">-</span> + </div> +</div> +<div class="cbi-value" id="status_3"> + <label class="cbi-value-title" for="status_3"><%:Download Utility (SSL Library)%></label> + <div class="cbi-value-field"> + <span class="runtime" id="value_3">-</span> + </div> +</div> +<div class="cbi-value" id="status_4"> + <label class="cbi-value-title" for="status_4"><%:IPSet Information%></label> + <div class="cbi-value-field"> + <span class="runtime" id="value_4">-</span> + </div> +</div> +<div class="cbi-value" id="status_5"> + <label class="cbi-value-title" for="status_5"><%:Last Run%></label> + <div class="cbi-value-field"> + <span class="runtime" id="value_5">-</span> + </div> +</div> +<hr /> +<div class="cbi-value" id="button_1"> + <label class="cbi-value-title" for="button_1"><%:Refresh IPSets%></label> + <div class="cbi-value-field"> + <input class="cbi-button cbi-button-apply" id="btn1" type="button" name="do_refresh" value="<%:Refresh%>" onclick="btn_action(this)" /> + <span id="btn1_running" style="display:inline-block; width:16px; height:16px; margin:0 5px"></span> + </div> +</div> + |