From ce8101ae75fa8767bf84f692c5424e2cf3441f34 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Tue, 19 Jun 2018 17:18:02 +0200 Subject: luci-app-upnp: rework lease status indicator Turn the dynamic lease status table into responsive table by using the cbi_update_table() helper in conjunction with title annotation attributes. Signed-off-by: Jo-Philipp Wich --- .../luci-app-upnp/luasrc/view/upnp_status.htm | 51 +++++++++++----------- 1 file changed, 25 insertions(+), 26 deletions(-) (limited to 'applications') diff --git a/applications/luci-app-upnp/luasrc/view/upnp_status.htm b/applications/luci-app-upnp/luasrc/view/upnp_status.htm index 1e0922579..459c63c1d 100644 --- a/applications/luci-app-upnp/luasrc/view/upnp_status.htm +++ b/applications/luci-app-upnp/luasrc/view/upnp_status.htm @@ -16,40 +16,39 @@ var tb = document.getElementById('upnp_status_table'); if (st && tb) { - /* clear all rows */ - while (tb.firstElementChild !== tb.lastElementChild) - tb.removeChild(tb.lastElementChild); + var rows = []; for (var i = 0; i < st.length; i++) - tb.appendChild(E('
'.format((i % 2) + 1), [ - E('
', st[i].proto), - E('
', st[i].extport), - E('
', st[i].intaddr), - E('
', st[i].intport), - E('
', st[i].descr), - E(''.format(st[i].num)) - ])); + rows.push([ + st[i].proto, + st[i].extport, + st[i].intaddr, + st[i].intport, + st[i].descr, + E(''.format(st[i].num)) + ]); - if (tb.firstElementChild === tb.lastElementChild) - tb.appendChild(E('

<%:There are no active redirects.%>
')); + cbi_update_table(tb, rows, '<%:There are no active redirects.%>'); } } ); //]]> -
+
<%:Active UPnP Redirects%> -
-
-
<%:Protocol%>
-
<%:External Port%>
-
<%:Client Address%>
-
<%:Client Port%>
-
<%:Description%>
-
 
-
-
-

<%:Collecting data...%>
+
+
+
+
<%:Protocol%>
+
<%:External Port%>
+
<%:Client Address%>
+
<%:Client Port%>
+
<%:Description%>
+
 
+
+
+
<%:Collecting data...%>
+
-
+
-- cgit v1.2.3