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 <jo@mein.io>
This commit is contained in:
parent
b56fb05eb9
commit
f4ba55532f
1 changed files with 30 additions and 31 deletions
|
@ -17,29 +17,28 @@
|
||||||
var tb = document.getElementById('ocserv_status_table');
|
var tb = document.getElementById('ocserv_status_table');
|
||||||
if (st && tb)
|
if (st && tb)
|
||||||
{
|
{
|
||||||
/* clear all rows */
|
var rows = [];
|
||||||
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++)
|
||||||
{
|
{
|
||||||
tb.appendChild(E('<div class="tr cbi-section-table-row cbi-rowstyle-%d">'.format((i % 2) + 1), [
|
rows.push([
|
||||||
E('<div class="td">', st[i].user),
|
st[i].user,
|
||||||
E('<div class="td">', st[i].group),
|
st[i].group,
|
||||||
E('<div class="td">', st[i].vpn_ip),
|
st[i].vpn_ip,
|
||||||
E('<div class="td">', st[i].ip),
|
st[i].ip,
|
||||||
E('<div class="td">', st[i].device),
|
st[i].device,
|
||||||
E('<div class="td">', st[i].time),
|
st[i].time,
|
||||||
E('<div class="td">', st[i].cipher),
|
st[i].cipher,
|
||||||
E('<div class="td">', st[i].status),
|
st[i].status,
|
||||||
E('<div class="td">',
|
E('input', {
|
||||||
E('<input class="cbi-button cbi-input-remove" type="button" value="<%:Disconnect%>" onclick="ocserv_disconnect(%d)" />'
|
type: 'button',
|
||||||
.format(st[i].id)))
|
class: 'cbi-button cbi-button-remove',
|
||||||
]));
|
onclick: 'ocserv_disconnect(%d)'.format(st[i].id)
|
||||||
|
})
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tb.firstElementChild === tb.lastElementChild)
|
cbi_update_table(tb, rows, '<em><%:There are no active users.%></em>');
|
||||||
tb.appendChild(E('<div class="tr cbi-section-table-row"><div class="td"><em><br /><%:There are no active users.%></em></div></div>'));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
@ -47,20 +46,20 @@
|
||||||
|
|
||||||
<fieldset class="cbi-section">
|
<fieldset class="cbi-section">
|
||||||
<legend><%:Active OpenConnect Users%></legend>
|
<legend><%:Active OpenConnect Users%></legend>
|
||||||
<div class="table cbi-section-table" id="ocserv_status_table">
|
<div class="table" id="ocserv_status_table">
|
||||||
<div class="tr cbi-section-table-titles">
|
<div class="tr table-titles">
|
||||||
<div class="th cbi-section-table-cell"><%:User%></div>
|
<div class="th"><%:User%></div>
|
||||||
<div class="th cbi-section-table-cell"><%:Group%></div>
|
<div class="th"><%:Group%></div>
|
||||||
<div class="th cbi-section-table-cell"><%:IP Address%></div>
|
<div class="th"><%:IP Address%></div>
|
||||||
<div class="th cbi-section-table-cell"><%:VPN IP Address%></div>
|
<div class="th"><%:VPN IP Address%></div>
|
||||||
<div class="th cbi-section-table-cell"><%:Device%></div>
|
<div class="th"><%:Device%></div>
|
||||||
<div class="th cbi-section-table-cell"><%:Time%></div>
|
<div class="th"><%:Time%></div>
|
||||||
<div class="th cbi-section-table-cell"><%:Cipher%></div>
|
<div class="th"><%:Cipher%></div>
|
||||||
<div class="th cbi-section-table-cell"><%:Status%></div>
|
<div class="th"><%:Status%></div>
|
||||||
<div class="th cbi-section-table-cell"> </div>
|
<div class="th"> </div>
|
||||||
</div>
|
</div>
|
||||||
<div class="tr cbi-section-table-row">
|
<div class="tr placeholder">
|
||||||
<div class="td" colspan="5"><em><br /><%:Collecting data...%></em></div>
|
<div class="td"><em><br /><%:Collecting data...%></em></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
Loading…
Reference in a new issue