diff options
author | Florian Eckert <fe@dev.tdt.de> | 2021-07-02 15:23:39 +0200 |
---|---|---|
committer | Florian Eckert <fe@dev.tdt.de> | 2021-07-09 08:38:11 +0200 |
commit | f5f6b3e4f8e3faed4e9c9926e283c9cf226d4bd8 (patch) | |
tree | e2718f194ede046a90274443f6b61198f35a0961 /applications/luci-app-mwan3/luasrc/view/mwan/overview_status_interface.htm | |
parent | 12067c8308936abb567001650105b33bec9a56a9 (diff) |
luci-app-mwan3: convert to JS
Signed-off-by: Florian Eckert <fe@dev.tdt.de>
Diffstat (limited to 'applications/luci-app-mwan3/luasrc/view/mwan/overview_status_interface.htm')
-rw-r--r-- | applications/luci-app-mwan3/luasrc/view/mwan/overview_status_interface.htm | 114 |
1 files changed, 0 insertions, 114 deletions
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 deleted file mode 100644 index b3210ee137..0000000000 --- a/applications/luci-app-mwan3/luasrc/view/mwan/overview_status_interface.htm +++ /dev/null @@ -1,114 +0,0 @@ -<%# - Copyright 2014 Aedan Renner <chipdankly@gmail.com> - Copyright 2018 Florian Eckert <fe@dev.tdt.de> - Licensed to the public under the GNU General Public License v2. --%> - -<script type="text/javascript">//<![CDATA[ - -function secondsToString(time) { - var seconds = parseInt(time, 10); - - var hrs = Math.floor(seconds / 3600); - seconds -= hrs*3600; - var mnts = Math.floor(seconds / 60); - seconds -= mnts*60; - return String.format("%sh:%sm:%ss", hrs, mnts, seconds); -} - -XHR.poll(-1, '<%=luci.dispatcher.build_url("admin", "status", "mwan", "interface_status")%>', null, - function(x, status) - { - var statusDiv = document.getElementById('mwan_status_text'); - if (status.interfaces) - { - var statusview = ''; - for ( var iface in status.interfaces) - { - var state = ''; - var css = ''; - var time = ''; - switch (status.interfaces[iface].status) - { - case 'online': - state = '<%:Online%>'; - time = String.format( - '<div><strong><%:Uptime%>: </strong>%s</div>', - secondsToString(status.interfaces[iface].online) - ); - css = 'success'; - break; - case 'offline': - state = '<%:Offline%>'; - time = String.format( - '<div><strong><%:Downtime%>: </strong>%s</div>', - secondsToString(status.interfaces[iface].offline) - ); - css = 'danger'; - break; - case 'notracking': - state = '<%:No Tracking%>'; - if ((status.interfaces[iface].uptime) > 0) { - time = String.format( - '<div><strong><%:Uptime%>: </strong>%s</div>', - secondsToString(status.interfaces[iface].uptime) - ); - css = 'success'; - } - else { - time = '<div> </div>' - css = 'warning'; - } - break; - default: - state = '<%:Disabled%>'; - time = '<div> </div>' - css = 'warning'; - break; - } - statusview += String.format( - '<div class="alert-message %s">', - css - ); - statusview += String.format( - '<div><strong><%:Interface%>: </strong>%s</div>', - iface - ); - statusview += String.format( - '<div><strong><%:Status%>: </strong>%s</div>', - state - ); - if (time) - { - statusview += time; - } - statusview += '</div>' - } - statusDiv.innerHTML = statusview; - } - else - { - statusDiv.innerHTML = '<strong><%:No MWAN interfaces found%></strong>'; - } - } - ); -//]]></script> - -<style type="text/css"> - #mwan_status_text > div { - display: inline-block; - margin: 1rem; - padding: 1rem; - width: 15rem; - float: left; - line-height: 125%; - } -</style> - -<fieldset id="interface_field" class="cbi-section"> - <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> |