From f4ba55532f01bc484543074c174f198a0ddd3087 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Fri, 20 Jul 2018 09:07:23 +0200 Subject: luci-app-ocserv: update user status template - Use cbi_update_table() helper to refresh user list - Cleanup markup and remove uneeded CSS classes Signed-off-by: Jo-Philipp Wich --- .../luci-app-ocserv/luasrc/view/ocserv_status.htm | 61 +++++++++++----------- 1 file changed, 30 insertions(+), 31 deletions(-) (limited to 'applications/luci-app-ocserv/luasrc/view/ocserv_status.htm') diff --git a/applications/luci-app-ocserv/luasrc/view/ocserv_status.htm b/applications/luci-app-ocserv/luasrc/view/ocserv_status.htm index 66e44e9676..44e1965821 100644 --- a/applications/luci-app-ocserv/luasrc/view/ocserv_status.htm +++ b/applications/luci-app-ocserv/luasrc/view/ocserv_status.htm @@ -17,29 +17,28 @@ var tb = document.getElementById('ocserv_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].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))) - ])); + rows.push([ + st[i].user, + st[i].group, + st[i].vpn_ip, + st[i].ip, + st[i].device, + st[i].time, + st[i].cipher, + st[i].status, + E('input', { + type: 'button', + class: 'cbi-button cbi-button-remove', + onclick: 'ocserv_disconnect(%d)'.format(st[i].id) + }) + ]); } - if (tb.firstElementChild === tb.lastElementChild) - tb.appendChild(E('

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

<%:Collecting data...%>
+
+

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