luci-app-olsr: reenable the "auto refresh" feature 2294/head
authorpmelange <isprotejesvalkata@gmail.com>
Sun, 18 Nov 2018 13:26:23 +0000 (14:26 +0100)
committerpmelange <isprotejesvalkata@gmail.com>
Thu, 6 Dec 2018 19:57:35 +0000 (20:57 +0100)
Signed-off-by: pmelange <isprotejesvalkata@gmail.com>
applications/luci-app-olsr-services/luasrc/view/freifunk-services/services.htm
applications/luci-app-olsr/luasrc/view/status-olsr/hna.htm
applications/luci-app-olsr/luasrc/view/status-olsr/neighbors.htm
applications/luci-app-olsr/luasrc/view/status-olsr/routes.htm
applications/luci-app-olsr/luasrc/view/status-olsr/smartgw.htm

index f6a81d0020d2ad620ad5a44809e8de5104103be4..0aac36de87dc5ac18e44c7b289d0f442b3eb608f 100644 (file)
@@ -126,7 +126,12 @@ end
                var tbody = document.getElementById('olsr_services');
                        if (tbody)
                        {
-                               var s = '';
+                               var s = '<div class="tr cbi-section-table-titles">' +
+                               '<div class="th cbi-section-table-cell"><%:Url%></div>' +
+                               '<div class="th cbi-section-table-cell"><%:Protocol%></div>' +
+                               '<div class="th cbi-section-table-cell"><%:Source%></div>' +
+                               '</div>';
+
                                for (var idx = 0; idx < info.length; idx++)
                                {
                                var service = info[idx];
@@ -152,7 +157,7 @@ end
 
        <fieldset class="cbi-section">
        <legend><%:Internal services%></legend>
-       <div class="table cbi-section-table">
+       <div class="table cbi-section-table" id="olsr_services">
                        <div class="tr cbi-section-table-titles">
                                <div class="th cbi-section-table-cell"><%:Url%></div>
                                <div class="th cbi-section-table-cell"><%:Protocol%></div>
index 85cdc5f4796d17edfc00e72c8bad83166708728d..34cf5633631a25a220fca9dc2afd54607e329420 100644 (file)
@@ -35,7 +35,12 @@ XHR.poll(10, '<%=REQUEST_URI%>', { status: 1 },
        var hnadiv = document.getElementById('olsrd_hna');
        if (hnadiv)
        {
-               var s = '';
+               var s = '<div class="tr cbi-section-table-titles">' +
+                       '<div class="th cbi-section-table-cell"><%:Announced network%></div>' +
+                       '<div class="th cbi-section-table-cell"><%:OLSR gateway%></div>' +
+                       '<div class="th cbi-section-table-cell"><%:Validity Time%></div>' +
+                       '</div>';
+
                for (var idx = 0; idx < info.length; idx++)
                {
                        var hna = info[idx];
@@ -80,7 +85,7 @@ XHR.poll(10, '<%=REQUEST_URI%>', { status: 1 },
 <fieldset class="cbi-section">
 
        <legend><%:Overview of currently active OLSR host net announcements%></legend>
-       <div class="table cbi-section-table">
+       <div class="table cbi-section-table" id="olsrd_hna">
                <div class="tr cbi-section-table-titles">
                        <div class="th cbi-section-table-cell"><%:Announced network%></div>
                        <div class="th cbi-section-table-cell"><%:OLSR gateway%></div>
index 262326b490f9f3167b87a6fbb7abca0edea81f56..8cdda14916212b3e3293f14121d558299307c37c 100644 (file)
@@ -56,7 +56,17 @@ end
                var nt = document.getElementById('olsr_neigh_table');
                        if (nt)
                        {
-                               var s = '';
+                               var s = '<div class="tr cbi-section-table-cell">' +
+                               '<div class="th cbi-section-table-cell"><%:Neighbour IP%></div>' +
+                               '<div class="th cbi-section-table-cell"><%:Hostname%></div>' +
+                               '<div class="th cbi-section-table-cell"><%:Interface%></div>' +
+                               '<div class="th cbi-section-table-cell"><%:Local interface IP%></div>' +
+                               '<div class="th cbi-section-table-cell">LQ</div>' +
+                               '<div class="th cbi-section-table-cell">NLQ</div>' +
+                               '<div class="th cbi-section-table-cell">ETX</div>' +
+                               '<div class="th cbi-section-table-cell">SNR</div>' +
+                               '</div>';
+
                                for (var idx = 0; idx < info.length; idx++)
                                {
                                        var neigh = info[idx];
@@ -91,7 +101,7 @@ end
                                                '<div class="td cbi-section-table-cell left" style="background-color:%s">%s</div>' +
                                                '<div class="td cbi-section-table-cell left" style="background-color:%s">%s</div>' +
                                                '<div class="td cbi-section-table-cell left" style="background-color:%s">%s</div>' +
-                                               '<div class="td cbi-section-table-cell left" style="background-color:%s title="Signal: %s Noise: %s">%s</div>' +
+                                               '<div class="td cbi-section-table-cell left" style="background-color:%s" title="Signal: %s Noise: %s">%s</div>' +
                                                '</div>',
                                                neigh.dfgcolor, neigh.ifn, neigh.dfgcolor, neigh.lip, neigh.dfgcolor, neigh.lq, neigh.dfgcolor, neigh.nlq, neigh.color, neigh.cost, neigh.snr_color, neigh.signal, neigh.noise, neigh.snr || '?'
                                        );
@@ -111,7 +121,7 @@ end
 <fieldset class="cbi-section">
        <legend><%:Overview of currently established OLSR connections%></legend>
 
-       <div class="table cbi-section-table">
+       <div class="table cbi-section-table" id="olsr_neigh_table">
                        <div class="tr cbi-section-table-cell">
                                <div class="th cbi-section-table-cell"><%:Neighbour IP%></div>
                                <div class="th cbi-section-table-cell"><%:Hostname%></div>
index ba738c016db8992825245727b631d4d9ac207049..624047f40c8dcac4a3a86ea7cd5b5a5b495743c1 100644 (file)
@@ -13,7 +13,7 @@ local i = 1
 if luci.http.formvalue("status") == "1" then
        local rv = {}
        for k, route in ipairs(routes) do
-               local ETX = string.format("%.3f", tonumber(route.rtpMetricCost)/1024 or 0)
+               local ETX = string.format("%.3f", tonumber(route.etx) or 0)
                rv[#rv+1] = {
                        hostname = route.hostname,
                        dest = route.destination,
@@ -43,7 +43,14 @@ XHR.poll(20, '<%=REQUEST_URI%>', { status: 1 },
                var rt = document.getElementById('olsrd_routes');
                        if (rt)
                        {
-                               var s = '';
+                               var s = '<div class="tr cbi-section-table-cell">' +
+                               '<div class="th cbi-section-table-cell"><%:Announced network%></div>' +
+                               '<div class="th cbi-section-table-cell"><%:OLSR gateway%></div>' +
+                               '<div class="th cbi-section-table-cell"><%:Interface%></div>' +
+                               '<div class="th cbi-section-table-cell"><%:Metric%></div>' +
+                               '<div class="th cbi-section-table-cell">ETX</div>' +
+                               '</div>';
+
                                for (var idx = 0; idx < info.length; idx++)
                                {
                                        var route = info[idx];
@@ -57,7 +64,7 @@ XHR.poll(20, '<%=REQUEST_URI%>', { status: 1 },
                                                )
 
                                        if (route.hostname) {
-                                               if (hna.proto == '6') {
+                                               if (route.proto == '6') {
                                                        s += String.format(
                                                                ' / <a href="http://[%s]/cgi-bin-status.html">%s</a>',
                                                                route.hostname, route.hostname || '?'
@@ -95,8 +102,8 @@ XHR.poll(20, '<%=REQUEST_URI%>', { status: 1 },
 <fieldset class="cbi-section">
 <legend><%:Overview of currently known routes to other OLSR nodes%></legend>
 
-<div class="table cbi-section-table">
-               <div class="tr cbi-section-table-titles">
+<div class="table cbi-section-table" id="olsrd_routes">
+               <div class="tr cbi-section-table-cell">
                        <div class="th cbi-section-table-cell"><%:Announced network%></div>
                        <div class="th cbi-section-table-cell"><%:OLSR gateway%></div>
                        <div class="th cbi-section-table-cell"><%:Interface%></div>
index fc86e17d9c4f094b34eaf7cd4fe355e83fc3424a..8cd2088e425985969cb3d897885f416c5b8518a3 100644 (file)
@@ -51,7 +51,18 @@ XHR.poll(10, '<%=REQUEST_URI%>', { status: 1 },
        var smartgwdiv = document.getElementById('olsrd_smartgw');
        if (smartgwdiv)
        {
-               var s = '';
+               var s = '<div class="tr cbi-section-table-titles">' +
+                       '<div class="th cbi-section-table-cell"><%:Gateway%></div>' +
+                       '<div class="th cbi-section-table-cell"><%:Selected%></div>' +
+                       '<div class="th cbi-section-table-cell"><%:ETX%></div>' +
+                       '<div class="th cbi-section-table-cell"><%:Hops%></div>' +
+                       '<div class="th cbi-section-table-cell"><%:Uplink%></div>' +
+                       '<div class="th cbi-section-table-cell"><%:Downlink%></div>' +
+                       '<div class="th cbi-section-table-cell"><%:IPv4%></div>' +
+                       '<div class="th cbi-section-table-cell"><%:IPv6%></div>' +
+                       '<div class="th cbi-section-table-cell"><%:Prefix%></div>' +
+                       '</div>';
+
                for (var idx = 0; idx < info.length; idx++)
                {
                        var smartgw = info[idx];
@@ -91,7 +102,7 @@ XHR.poll(10, '<%=REQUEST_URI%>', { status: 1 },
 
        <fieldset class="cbi-section">
                <legend><%:Overview of smart gateways in this network%></legend>
-               <div class="table cbi-section-table">
+               <div class="table cbi-section-table" id="olsrd_smartgw">
                        <div class="tr cbi-section-table-titles">
                                <div class="th cbi-section-table-cell"><%:Gateway%></div>
                                <div class="th cbi-section-table-cell"><%:Selected%></div>
@@ -102,7 +113,6 @@ XHR.poll(10, '<%=REQUEST_URI%>', { status: 1 },
                                <div class="th cbi-section-table-cell"><%:IPv4%></div>
                                <div class="th cbi-section-table-cell"><%:IPv6%></div>
                                <div class="th cbi-section-table-cell"><%:Prefix%></div>
-
                        </div>
 
                        <% for k, gw in ipairs(gws.ipv4, gws.ipv6) do