luci-app-mosdns: init at 97867ea
This commit is contained in:
parent
6c536e3c19
commit
90cc8ca0d2
44 changed files with 2546 additions and 0 deletions
21
luci-app-mosdns/luasrc/view/mosdns/mosdns_editor.htm
Normal file
21
luci-app-mosdns/luasrc/view/mosdns/mosdns_editor.htm
Normal file
|
@ -0,0 +1,21 @@
|
|||
<%+cbi/valueheader%>
|
||||
<script src="/luci-static/resources/mosdns/lib/codemirror.js"></script>
|
||||
<script src="/luci-static/resources/mosdns/addon/fold/foldcode.js"></script>
|
||||
<script src="/luci-static/resources/mosdns/addon/fold/foldgutter.js"></script>
|
||||
<script src="/luci-static/resources/mosdns/addon/fold/indent-fold.js"></script>
|
||||
<script src="/luci-static/resources/mosdns/mode/yaml/yaml.js"></script>
|
||||
<link rel="stylesheet" href="/luci-static/resources/mosdns/addon/fold/foldgutter.css" />
|
||||
<link rel="stylesheet" href="/luci-static/resources/mosdns/lib/codemirror.css" />
|
||||
<link rel="stylesheet" href="/luci-static/resources/mosdns/theme/dracula.css" />
|
||||
<script type="text/javascript">//<![CDATA[
|
||||
var editor = CodeMirror.fromTextArea(document.getElementById("cbid.mosdns.config.config_custom"), {
|
||||
mode: "text/yaml",
|
||||
styleActiveLine: true,
|
||||
lineNumbers: true,
|
||||
theme: "dracula",
|
||||
lineWrapping: true,
|
||||
matchBrackets: true
|
||||
}
|
||||
);//]]>
|
||||
</script>
|
||||
<%+cbi/valuefooter%>
|
34
luci-app-mosdns/luasrc/view/mosdns/mosdns_flush_cache.htm
Normal file
34
luci-app-mosdns/luasrc/view/mosdns/mosdns_flush_cache.htm
Normal file
|
@ -0,0 +1,34 @@
|
|||
<%+cbi/valueheader%>
|
||||
<script type="text/javascript">//<![CDATA[
|
||||
function flush_cache(btn, dataname)
|
||||
{
|
||||
btn.disabled = true;
|
||||
btn.value = '<%:Flushing...%> ';
|
||||
st=dataname;
|
||||
XHR.get('<%=luci.dispatcher.build_url("admin", "services", "mosdns", "flush_cache")%>',
|
||||
{ set:st },
|
||||
function(x,data)
|
||||
{
|
||||
var tb = document.getElementById(dataname+'-status');
|
||||
if (tb)
|
||||
{
|
||||
switch (data.flushing)
|
||||
{
|
||||
case true:
|
||||
tb.innerHTML = "<font color='green'>" + "<%:Flushing Success%>" + "</font>";
|
||||
break;
|
||||
case false:
|
||||
tb.innerHTML = "<font color='red'>" + "<%:Flushing Failed, Please check if MosDNS is enabled%>" + "</font>";
|
||||
break;
|
||||
}
|
||||
}
|
||||
btn.disabled = false;
|
||||
btn.value = '<%:Flush Cache%>';
|
||||
}
|
||||
);
|
||||
return false;
|
||||
}
|
||||
//]]></script>
|
||||
<input type="button" class="btn cbi-button-action" value="<%:Flush Cache%>" onclick="return flush_cache(this,'<%=self.option%>')" />
|
||||
<span id="<%=self.option%>-status"><em><%=self.value%></em></span>
|
||||
<%+cbi/valuefooter%>
|
34
luci-app-mosdns/luasrc/view/mosdns/mosdns_geo_update.htm
Normal file
34
luci-app-mosdns/luasrc/view/mosdns/mosdns_geo_update.htm
Normal file
|
@ -0,0 +1,34 @@
|
|||
<%+cbi/valueheader%>
|
||||
<script type="text/javascript">//<![CDATA[
|
||||
function update_data(btn, dataname)
|
||||
{
|
||||
btn.disabled = true;
|
||||
btn.value = '<%:Updating...%> ';
|
||||
st=dataname;
|
||||
XHR.get('<%=luci.dispatcher.build_url("admin", "services", "mosdns", "geo_update")%>',
|
||||
{ set:st },
|
||||
function(x,data)
|
||||
{
|
||||
var tb = document.getElementById(dataname+'-status');
|
||||
if (tb)
|
||||
{
|
||||
switch (data.updating)
|
||||
{
|
||||
case true:
|
||||
tb.innerHTML = "<font color='green'>" + "<%:Update success%>" + "</font>";
|
||||
break;
|
||||
case false:
|
||||
tb.innerHTML = "<font color='red'>" + "<%:Update failed, Please check the network status%>" + "</font>";
|
||||
break;
|
||||
}
|
||||
}
|
||||
btn.disabled = false;
|
||||
btn.value = '<%:Check And Update%>';
|
||||
}
|
||||
);
|
||||
return false;
|
||||
}
|
||||
//]]></script>
|
||||
<input type="button" class="btn cbi-button-action" value="<%:Check And Update%>" onclick="return update_data(this,'<%=self.option%>')" />
|
||||
<span id="<%=self.option%>-status"><em><%=self.value%></em></span>
|
||||
<%+cbi/valuefooter%>
|
33
luci-app-mosdns/luasrc/view/mosdns/mosdns_log.htm
Normal file
33
luci-app-mosdns/luasrc/view/mosdns/mosdns_log.htm
Normal file
|
@ -0,0 +1,33 @@
|
|||
<script type="text/javascript">
|
||||
//<![CDATA[
|
||||
function clear_log(btn) {
|
||||
XHR.get('<%=url([[admin]], [[services]], [[mosdns]], [[clear_log]])%>', null,
|
||||
function(x, data) {
|
||||
if(x && x.status == 200) {
|
||||
var log_textarea = document.getElementById('log_textarea');
|
||||
log_textarea.innerHTML = "";
|
||||
log_textarea.scrollTop = log_textarea.scrollHeight;
|
||||
}
|
||||
location.reload();
|
||||
}
|
||||
);
|
||||
}
|
||||
var scrolled = false;
|
||||
XHR.poll(2, '<%=url([[admin]], [[services]], [[mosdns]], [[get_log]])%>', null,
|
||||
function(x, data) {
|
||||
if(x && x.status == 200) {
|
||||
var log_textarea = document.getElementById('log_textarea');
|
||||
log_textarea.innerHTML = x.responseText;
|
||||
if (!scrolled) {
|
||||
log_textarea.scrollTop = log_textarea.scrollHeight;
|
||||
scrolled = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
//]]>
|
||||
</script>
|
||||
<fieldset class="cbi-section" id="_log_fieldset">
|
||||
<input class="btn cbi-button-action" type="button" onclick="clear_log()" value="<%:Clear logs%>" style="margin-left: 10px; margin-top: 10px;">
|
||||
<textarea id="log_textarea" class="cbi-input-textarea" style="width: calc(100% - 20px); height: 645px; margin: 10px;" data-update="change" rows="5" wrap="off" readonly="readonly"></textarea>
|
||||
</fieldset>
|
28
luci-app-mosdns/luasrc/view/mosdns/mosdns_status.htm
Normal file
28
luci-app-mosdns/luasrc/view/mosdns/mosdns_status.htm
Normal file
|
@ -0,0 +1,28 @@
|
|||
<script type="text/javascript">
|
||||
//<![CDATA[
|
||||
XHR.poll(3, '<%=url([[admin]], [[services]], [[mosdns]], [[status]])%>', null,
|
||||
function(x, data) {
|
||||
var tb = document.getElementById('mosdns_status');
|
||||
if (data && tb) {
|
||||
if (data.running) {
|
||||
var links = '<em><b style=color:green>MosDNS <%:RUNNING%></b></em>';
|
||||
tb.innerHTML = links;
|
||||
} else {
|
||||
tb.innerHTML = '<em><b style=color:red>MosDNS <%:NOT RUNNING%></b></em>';
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
//]]>
|
||||
</script>
|
||||
<style>
|
||||
.mar-10 {
|
||||
margin-left: 50px;
|
||||
margin-right: 10px;
|
||||
}
|
||||
</style>
|
||||
<fieldset class="cbi-section">
|
||||
<p id="mosdns_status">
|
||||
<em><%:Collecting data...%></em>
|
||||
</p>
|
||||
</fieldset>
|
Loading…
Add table
Add a link
Reference in a new issue