From 067d7dc9f708d5ebeda1072fb6dc82e960de0d81 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Mon, 28 May 2018 14:57:54 +0200 Subject: treewide: convert HTML tables to div Mostly convert HTML tables to div based markup to allow for easier styling in the future. Also change JS accessor code accordingly. Signed-off-by: Jo-Philipp Wich --- .../luci-app-ocserv/luasrc/view/ocserv_status.htm | 83 ++++++++++------------ 1 file changed, 37 insertions(+), 46 deletions(-) (limited to 'applications/luci-app-ocserv/luasrc/view') diff --git a/applications/luci-app-ocserv/luasrc/view/ocserv_status.htm b/applications/luci-app-ocserv/luasrc/view/ocserv_status.htm index 03a9ed70ee..66e44e9676 100644 --- a/applications/luci-app-ocserv/luasrc/view/ocserv_status.htm +++ b/applications/luci-app-ocserv/luasrc/view/ocserv_status.htm @@ -5,8 +5,8 @@ function(x) { var tb = document.getElementById('ocserv_status_table'); - if (tb && (idx < tb.rows.length)) - tb.rows[0].parentNode.removeChild(tb.rows[idx]); + if (tb && (idx + 1 < tb.childNodes.length)) + tb.removeChild(tb.childNodes[idx + 1]); } ); } @@ -18,38 +18,28 @@ if (st && tb) { /* clear all rows */ - while( tb.rows.length > 1 ) - tb.deleteRow(1); + while (tb.firstElementChild !== tb.lastElementChild) + tb.removeChild(tb.lastElementChild); - for( var i = 0; i < st.length; i++ ) + for (var i = 0; i < st.length; i++) { - var tr = tb.insertRow(-1); - tr.className = 'cbi-section-table-row cbi-rowstyle-' + ((i % 2) + 1); - - tr.insertCell(-1).innerHTML = st[i].user; - tr.insertCell(-1).innerHTML = st[i].group; - tr.insertCell(-1).innerHTML = st[i].vpn_ip; - tr.insertCell(-1).innerHTML = st[i].ip; - tr.insertCell(-1).innerHTML = st[i].device; - tr.insertCell(-1).innerHTML = st[i].time; - tr.insertCell(-1).innerHTML = st[i].cipher; - tr.insertCell(-1).innerHTML = st[i].status; - - tr.insertCell(-1).innerHTML = String.format( - '', - st[i].id - ); + tb.appendChild(E('
'.format((i % 2) + 1), [ + E('
', st[i].user), + E('
', st[i].group), + E('
', st[i].vpn_ip), + E('
', st[i].ip), + E('
', st[i].device), + E('
', st[i].time), + E('
', st[i].cipher), + E('
', st[i].status), + E('
', + E('' + .format(st[i].id))) + ])); } - if( tb.rows.length == 1 ) - { - var tr = tb.insertRow(-1); - tr.className = 'cbi-section-table-row'; - - var td = tr.insertCell(-1); - td.colSpan = 5; - td.innerHTML = '
<%:There are no active users.%>
'; - } + if (tb.firstElementChild === tb.lastElementChild) + tb.appendChild(E('

<%:There are no active users.%>
')); } } ); @@ -57,20 +47,21 @@
<%:Active OpenConnect Users%> - - - - - - - - - - - - - - - -
<%:User%><%:Group%><%:IP Address%><%:VPN IP Address%><%:Device%><%:Time%><%:Cipher%><%:Status%> 

<%:Collecting data...%>
+
+
+
<%:User%>
+
<%:Group%>
+
<%:IP Address%>
+
<%:VPN IP Address%>
+
<%:Device%>
+
<%:Time%>
+
<%:Cipher%>
+
<%:Status%>
+
 
+
+
+

<%:Collecting data...%>
+
+
+ -- cgit v1.2.3