add order
This commit is contained in:
parent
53ec762bbb
commit
c288f25dfe
File diff suppressed because one or more lines are too long
|
@ -153,8 +153,6 @@ select.interface {
|
|||
return;
|
||||
}
|
||||
last_change = data["last_change"];
|
||||
$('#result>tbody').remove();
|
||||
$('#result').append('<tbody></ybody>');
|
||||
$.each(data, function(index, infos) {
|
||||
if (!infos) {
|
||||
return;
|
||||
|
@ -172,46 +170,77 @@ select.interface {
|
|||
}
|
||||
});
|
||||
} else if (index == "sessions") {
|
||||
$.each(infos, function(pid, infos) {
|
||||
var sessions = [];
|
||||
$.each(infos, function(pid, s) {
|
||||
s.pid = pid;
|
||||
sessions.push(s);
|
||||
});
|
||||
sessions.sort(function SortSearch(a, b){
|
||||
if(a['provider'] > b['provider']) {
|
||||
return 1;
|
||||
}
|
||||
if(a['provider'] < b['provider']) {
|
||||
return -1;
|
||||
}
|
||||
if(a['identifier'] > b['identifier']) {
|
||||
return 1;
|
||||
}
|
||||
if(a['identifier'] < b['identifier']) {
|
||||
return -1;
|
||||
}
|
||||
if(a['active-vpn'] > b['active-vpn']) {
|
||||
return 1;
|
||||
}
|
||||
if(a['active-vpn'] < b['active-vpn']) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
});
|
||||
$('#result>tbody').remove();
|
||||
$('#result').append('<tbody></ybody>');
|
||||
$.each(sessions, function(key, session) {
|
||||
pid = session.pid;
|
||||
|
||||
line = '<tr>';
|
||||
line +='<td';
|
||||
if(infos['status']=="Need Password") {
|
||||
if(session['status']=="Need Password") {
|
||||
line += ' rowspan="2"';
|
||||
}
|
||||
line +='>'+infos['identifier']+'</td>';
|
||||
line +='<td>'+infos['provider']+'</td>';
|
||||
if (possible=remotes[infos['provider']]) {
|
||||
line +='>'+session['identifier']+'</td>';
|
||||
line +='<td>'+session['provider']+'</td>';
|
||||
if (possible=remotes[session['provider']]) {
|
||||
line += '<td><select id="server_'+pid+'" onchange="server_change('+pid+')">'
|
||||
if (infos['active-vpn']=="") {
|
||||
if (session['active-vpn']=="") {
|
||||
line += '<option value="">----------------</option>'
|
||||
}
|
||||
$.each(possible, function(name, remote) {
|
||||
line += '<option value="'+remote+'"';
|
||||
if(remote == infos['active-vpn']) {
|
||||
if(remote == session['active-vpn']) {
|
||||
line += ' selected ';
|
||||
}
|
||||
line += '>'+name+'</option>';
|
||||
});
|
||||
line+='</select></td>'
|
||||
} else {
|
||||
line +='<td>'+infos['active-vpn']+'</td>';
|
||||
line +='<td>'+session['active-vpn']+'</td>';
|
||||
}
|
||||
line +='<td>'+infos['status']+'</td>';
|
||||
line +='<td>'+session['status']+'</td>';
|
||||
line += '<td>';
|
||||
line += '<a href="javascript:vpn_restart('+pid+')"><img width="24" height="24" src="refresh.png"/></a>';
|
||||
line += '<a href="javascript:vpn_kill('+pid+')"><img width="24" height="24" src="disconnect.png"/></a></td>';
|
||||
line += '<a href="javascript:vpn_restart('+pid+')"><img width="24" height="24" src="vpn/refresh.png"/></a>';
|
||||
line += '<a href="javascript:vpn_kill('+pid+')"><img width="24" height="24" src="vpn/disconnect.png"/></a></td>';
|
||||
line += '</td>\n';
|
||||
line += '</tr>\n';
|
||||
|
||||
if(infos['status'].startsWith("Need")) {
|
||||
if(session['status'].startsWith("Need")) {
|
||||
line +='<tr><td colspan="4">';
|
||||
line +='<form id="auth_'+pid+'" action="#" onsubmit="auth('+pid+') ; return false" >';
|
||||
if (infos['status'].includes("Password")) {
|
||||
if (session['status'].includes("Password")) {
|
||||
line +='<input class="user" placeholder="Enter login" size="15">';
|
||||
line +='<input type="password" placeholder="Password" size="15" class="pass">';
|
||||
}
|
||||
if (infos['status'].includes("OTP")) {
|
||||
line +='<input class="otp" placeholder="'+infos["message"]+'" size="15">';
|
||||
if (session['status'].includes("OTP")) {
|
||||
line +='<input class="otp" placeholder="'+session["message"]+'" size="15">';
|
||||
}
|
||||
line +='<input type="submit" value="G0">';
|
||||
line +='</form>';
|
||||
|
|
Loading…
Reference in New Issue