openwrt-feed/luci-app-mosdns/luasrc/view/mosdns/mosdns_flush_cache.htm

35 lines
1.3 KiB
HTML
Raw Normal View History

2024-05-23 16:40:16 +00:00
<%+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%>