luci-app-mwan3: refactoring detail status view and controller
Signed-off-by: Florian Eckert <fe@dev.tdt.de>
This commit is contained in:
parent
5b92193978
commit
406564c7db
2 changed files with 16 additions and 29 deletions
|
@ -68,16 +68,13 @@ function mwan_Status()
|
||||||
end
|
end
|
||||||
|
|
||||||
function detailedStatus()
|
function detailedStatus()
|
||||||
local mArray = {}
|
local statusInfo = ut.trim(sys.exec("/usr/sbin/mwan3 status"))
|
||||||
|
luci.http.prepare_content("text/plain")
|
||||||
-- detailed mwan status
|
if statusInfo ~= "" then
|
||||||
local detailStatusInfo = ut.trim(sys.exec("/usr/sbin/mwan3 status"))
|
luci.http.write(statusInfo)
|
||||||
if detailStatusInfo ~= "" then
|
else
|
||||||
mArray.mwandetail = { detailStatusInfo }
|
luci.http.write("Unable to get status information")
|
||||||
end
|
end
|
||||||
|
|
||||||
luci.http.prepare_content("application/json")
|
|
||||||
luci.http.write_json(mArray)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function diagnosticsData(interface, task)
|
function diagnosticsData(interface, task)
|
||||||
|
|
|
@ -10,33 +10,23 @@
|
||||||
<script type="text/javascript" src="<%=resource%>/cbi.js"></script>
|
<script type="text/javascript" src="<%=resource%>/cbi.js"></script>
|
||||||
<script type="text/javascript">//<![CDATA[
|
<script type="text/javascript">//<![CDATA[
|
||||||
XHR.poll(5, '<%=luci.dispatcher.build_url("admin", "status", "mwan", "detailed_status")%>', null,
|
XHR.poll(5, '<%=luci.dispatcher.build_url("admin", "status", "mwan", "detailed_status")%>', null,
|
||||||
function(x, mArray)
|
function(x)
|
||||||
{
|
{
|
||||||
var status = document.getElementById('mwan_detail_text');
|
var legend = document.getElementById('diag-rc-legend');
|
||||||
if (mArray.mwandetail)
|
var output = document.getElementById('diag-rc-output');
|
||||||
{
|
legend.style.display = 'none';
|
||||||
status.innerHTML = String.format('<pre>%s</pre>', mArray.mwandetail[0]);
|
output.innerHTML = String.format('<pre>%h</pre>', x.responseText);
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
status.innerHTML = '<strong><%:No detailed status information available%></strong>';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
//]]></script>
|
//]]></script>
|
||||||
|
|
||||||
<div id="mwan_detail_status">
|
<div>
|
||||||
<fieldset class="cbi-section">
|
<fieldset class="cbi-section">
|
||||||
<legend><%:MWAN Detailed Status%></legend>
|
<legend id="diag-rc-legend"><%:Collecting data...%></legend>
|
||||||
<div id="mwan_detail_text"><img src="<%=resource%>/icons/loading.gif" alt="<%:Loading%>" style="vertical-align:middle" /><%:Collecting data...%></div>
|
<span id="diag-rc-output">
|
||||||
|
<img src="<%=resource%>/icons/loading.gif" alt="<%:Loading%>" style="vertical-align: middle;" />
|
||||||
|
</span>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<style type="text/css">
|
|
||||||
#mwan_detail_text {
|
|
||||||
padding: 20px;
|
|
||||||
text-align: left;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
||||||
<%+footer%>
|
<%+footer%>
|
||||||
|
|
Loading…
Reference in a new issue