modules/admin-full: dynamically order lines in connection live status
authorJo-Philipp Wich <jow@openwrt.org>
Thu, 4 Sep 2014 11:35:23 +0000 (11:35 +0000)
committerJo-Philipp Wich <jow@openwrt.org>
Thu, 4 Sep 2014 11:35:23 +0000 (11:35 +0000)
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
modules/admin-full/luasrc/view/admin_status/connections.htm

index 6525391aad97fbc6f5d52f777a9290652b7f5009..80c8b70e3c3e9a0687ca71863d223f1c8575c47a 100644 (file)
@@ -281,6 +281,18 @@ You may obtain a copy of the License at
                                                pt_otr += ' ' + width + ',' + y_otr + ' ' + width + ',' + height;
 
 
+                                               var order = [
+                                                       [ line_udp, data_udp[data_udp.length-1] ],
+                                                       [ line_tcp, data_tcp[data_tcp.length-1] ],
+                                                       [ line_otr, data_otr[data_otr.length-1] ]
+                                               ];
+
+                                               order.sort(function(a, b) { return b[1] - a[1] });
+
+                                               for (var i = 0; i < order.length; i++)
+                                                       order[i][0].parentNode.appendChild(order[i][0]);
+
+
                                                line_udp.setAttribute('points', pt_udp);
                                                line_tcp.setAttribute('points', pt_tcp);
                                                line_otr.setAttribute('points', pt_otr);