summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorHannu Nyman <hannu.nyman@iki.fi>2018-03-02 23:31:56 +0200
committerGitHub <noreply@github.com>2018-03-02 23:31:56 +0200
commit2913111ffe52ae22f05f7a5e059d83ea400dd9ad (patch)
treede7724da122584098359d594122140160553b0a4
parentbf49505ea0a07c35719a7b71f8212e547d999d62 (diff)
parentdcb041e3965d6cb706094720975267a9d61f74c0 (diff)
Merge pull request #1652 from TDT-AG/pr/20180301-luci-app-mwan3-fix-status-page
luci-app-mwan3: fix status pages
-rw-r--r--applications/luci-app-mwan3/luasrc/model/cbi/mwan/interface.lua2
-rw-r--r--applications/luci-app-mwan3/luasrc/view/mwan/overview_status_interface.htm49
-rw-r--r--applications/luci-app-mwan3/luasrc/view/mwan/status_interface.htm93
3 files changed, 11 insertions, 133 deletions
diff --git a/applications/luci-app-mwan3/luasrc/model/cbi/mwan/interface.lua b/applications/luci-app-mwan3/luasrc/model/cbi/mwan/interface.lua
index 920dc6afb..4b1a070d1 100644
--- a/applications/luci-app-mwan3/luasrc/model/cbi/mwan/interface.lua
+++ b/applications/luci-app-mwan3/luasrc/model/cbi/mwan/interface.lua
@@ -93,7 +93,7 @@ function configCheck()
local trackingNumber = uci:get("mwan3", iface, "track_ip")
overview[iface]["tracking"] = 0
- if #trackingNumber > 0 then
+ if trackingNumber and #trackingNumber > 0 then
overview[iface]["tracking"] = #trackingNumber
overview[iface]["reliability"] = false
local reliabilityNumber = tonumber(uci:get("mwan3", iface, "reliability"))
diff --git a/applications/luci-app-mwan3/luasrc/view/mwan/overview_status_interface.htm b/applications/luci-app-mwan3/luasrc/view/mwan/overview_status_interface.htm
index 6dc3d1274..86b5ac696 100644
--- a/applications/luci-app-mwan3/luasrc/view/mwan/overview_status_interface.htm
+++ b/applications/luci-app-mwan3/luasrc/view/mwan/overview_status_interface.htm
@@ -15,30 +15,27 @@ XHR.poll(5, '<%=luci.dispatcher.build_url("admin", "status", "mwan", "interface_
for ( var iface in status.interfaces)
{
var state = '';
- var css = '';
switch (status.interfaces[iface].status)
{
case 'online':
state = '<%:Online (tracking active)%>';
- css = 'wanon';
break;
case 'notMonitored':
state = '<%:Online (tracking off)%>';
- css = 'wanon';
break;
case 'offline':
state = '<%:Offline%>';
- css = 'wanoff';
break;
default:
state = '<%:Disabled%>';
- css = 'wanoff';
break;
}
statusview += String.format(
- '<span class="%s"><strong>%s</strong><br />%s</span>',
- css,
- iface,
+ '<div><strong>Interface: </strong>%s</div>',
+ iface
+ );
+ statusview += String.format(
+ '<div><strong>Status: </strong>%s</div></br></br>',
state
);
}
@@ -53,36 +50,8 @@ XHR.poll(5, '<%=luci.dispatcher.build_url("admin", "status", "mwan", "interface_
//]]></script>
<fieldset id="interface_field" class="cbi-section">
- <legend><%:MWAN Interface Live Status%></legend>
- <div id="mwan_status_text"><img src="<%=resource%>/icons/loading.gif" alt="<%:Loading%>" style="vertical-align:middle" /><%:Collecting data...%></div>
+ <legend><%:MWAN Interfaces%></legend>
+ <div id="mwan_status_text">
+ <img src="<%=resource%>/icons/loading.gif" alt="<%:Loading%>" style="vertical-align:middle" /><%:Collecting data...%>
+ </div>
</fieldset>
-
-<style type="text/css">
- .container { /* container for entire page. fixes bootstrap theme's ridiculously small page width */
- max-width: 1044px;
- }
- #mwan_status_text {
- display: table;
- font-size: 14px;
- margin: auto;
- max-width: 1044px;
- min-width: 246px;
- width: 100%;
- }
- .wanon {
- background-color: rgb(144, 240, 144);
- }
- .wanoff {
- background-color: rgb(240, 144, 144);
- }
- .wanon, .wanoff {
- border-radius: 60px;
- box-shadow: 0px 2px 5px -3px;
- float: left;
- margin: 8px 3px 0px 3px;
- min-height: 30px;
- min-width: 235px;
- padding: 5px 10px 8px 10px;
- text-align: center;
- }
-</style>
diff --git a/applications/luci-app-mwan3/luasrc/view/mwan/status_interface.htm b/applications/luci-app-mwan3/luasrc/view/mwan/status_interface.htm
index 21e59a801..cb476967f 100644
--- a/applications/luci-app-mwan3/luasrc/view/mwan/status_interface.htm
+++ b/applications/luci-app-mwan3/luasrc/view/mwan/status_interface.htm
@@ -14,98 +14,7 @@
</ul>
<script type="text/javascript" src="<%=resource%>/cbi.js"></script>
-<script type="text/javascript">//<![CDATA[
- XHR.poll(5, '<%=luci.dispatcher.build_url("admin", "status", "mwan", "interface_status")%>', null,
- function(x, status)
- {
- var legend = document.getElementById('diag-rc-legend');
- var statusDiv = document.getElementById('diag-rc-output');
- legend.style.display = 'none';
- if (status.interfaces)
- {
- var statusview = '';
- for ( var iface in status.interfaces)
- {
- var state = '';
- var css = '';
- switch (status.interfaces[iface].status)
- {
- case 'online':
- state = '<%:Online (tracking active)%>';
- css = 'wanon';
- break;
- case 'notMonitored':
- state = '<%:Online (tracking off)%>';
- css = 'wanon';
- break;
- case 'offline':
- state = '<%:Offline%>';
- css = 'wanoff';
- break;
- default:
- state = '<%:Disabled%>';
- css = 'wanoff';
- break;
- }
- statusview += String.format(
- '<span class="%s"><strong>%s</strong><br />%s</span>',
- css,
- iface,
- state
- );
- }
- statusDiv.innerHTML = statusview;
- }
- else
- {
- statusDiv.innerHTML = '<strong><%:No MWAN interfaces found%></strong>';
- }
- }
- );
-//]]></script>
-<div class="cbi-map">
- <h2 name="content"><%:MWAN Status - Interface%></h2>
- <%if not require("luci.sys").init.enabled("mwan3") then%>
- <div><strong><%:INFO: MWAN not running%></strong></div>
- <%end%>
- <fieldset class="cbi-section">
- <legend id="diag-rc-legend"><%:Collecting data...%></legend>
- <span id="diag-rc-output">
- <img src="<%=resource%>/icons/loading.gif" alt="<%:Loading%>" style="vertical-align: middle;" />
- </span>
- </fieldset>
-</div>
-
-<style type="text/css">
- #mwan_status_text {
- display: table;
- font-size: 14px;
- margin: auto;
- max-width: 1044px;
- min-width: 246px;
- width: 100%;
- }
- .wanon {
- background-color: rgb(144, 240, 144);
- }
- .wanoff {
- background-color: rgb(240, 144, 144);
- }
- .wanon, .wanoff {
- border-radius: 60px;
- box-shadow: 0px 2px 5px -3px;
- float: left;
- margin: 8px 3px 0px 3px;
- min-height: 30px;
- min-width: 235px;
- padding: 5px 10px 8px 10px;
- text-align: center;
- }
- #mwan_statuslog_text {
- padding: 20px;
- text-align: left;
- }
-</style>
+<%+mwan/overview_status_interface%>
<%+footer%>