small-package/luci-app-ssr-mudb-server/luasrc/view/ssr_mudb_server/status.htm

27 lines
1021 B
HTML

<%
local ipkg = require "luci.model.ipkg"
-%>
<div class="cbi-value">
<label class="cbi-value-title"><%:Status%></label>
<div class="cbi-value-field" id="run_status" style="font-weight: bold;"><%:Collecting data...%></div>
</div>
<script type="text/javascript">
//<![CDATA[
var run_status = document.getElementById('run_status');
var style = run_status.getAttribute("style");
<% if ipkg.installed("python3") then %>
XHR.poll(2, '<%=luci.dispatcher.build_url("admin", "vpn", "ssr_mudb_server", "status")%>', null,
function(x, result) {
run_status.setAttribute("style", result.status ? style + "color: green;" : style + "color: red;");
run_status.innerHTML = result.status ? '<%=translate("RUNNING")%>' : '<%=translate("NOT RUNNING")%>';
}
)
<% else %>
run_status.setAttribute("style", style + "color: red;");
run_status.innerHTML = '<%=translate("NOT INSTALLED")%><br><%=translate("please Install the python3")%><br>opkg update && opkg install python3</font></b>';
<% end %>
//]]>
</script>