add userSessionsSort for session sorting (#6177)
Signed-off-by: si458 <simonsmith5521@gmail.com>
This commit is contained in:
parent
c053c14dd0
commit
0a89d07937
|
@ -1701,6 +1701,11 @@
|
||||||
"default": false,
|
"default": false,
|
||||||
"description": "When enabled, this will show the notes panel in the device view"
|
"description": "When enabled, this will show the notes panel in the device view"
|
||||||
},
|
},
|
||||||
|
"userSessionsSort": {
|
||||||
|
"type": "string",
|
||||||
|
"default": "SessionId",
|
||||||
|
"description": "Arrange the Connect sessions offered when multiple Terminal Sessions are present by 'SessionId', 'StationName' or 'Username' with 'SessionId' as the default sorting criteria."
|
||||||
|
},
|
||||||
"agentInviteCodes": {
|
"agentInviteCodes": {
|
||||||
"type": "boolean",
|
"type": "boolean",
|
||||||
"default": false,
|
"default": false,
|
||||||
|
|
|
@ -193,6 +193,7 @@
|
||||||
"minify": true,
|
"minify": true,
|
||||||
"_hidePowerTimeline": true,
|
"_hidePowerTimeline": true,
|
||||||
"_showNotesPanel": true,
|
"_showNotesPanel": true,
|
||||||
|
"_userSessionsSort": "Username",
|
||||||
"_newAccounts": true,
|
"_newAccounts": true,
|
||||||
"_newAccountsUserGroups": [ "ugrp//xxxxxxxxxxxxxxxxx" ],
|
"_newAccountsUserGroups": [ "ugrp//xxxxxxxxxxxxxxxxx" ],
|
||||||
"_userNameIsEmail": true,
|
"_userNameIsEmail": true,
|
||||||
|
|
|
@ -1654,6 +1654,16 @@
|
||||||
else if (userSessions.length == 1) { connectDesktop(null, 1, userSessions[0].SessionId, message.tag); } // One active session, connect to it
|
else if (userSessions.length == 1) { connectDesktop(null, 1, userSessions[0].SessionId, message.tag); } // One active session, connect to it
|
||||||
else {
|
else {
|
||||||
var x = '';
|
var x = '';
|
||||||
|
var sortBy = "{{{userSessionsSort}}}";
|
||||||
|
if (sortBy != '') {
|
||||||
|
userSessions.sort(function(a, b) {
|
||||||
|
if (!a[sortBy]) return -1; // a comes before b
|
||||||
|
if (!b[sortBy]) return 1; // b comes before a
|
||||||
|
if (a[sortBy] < b[sortBy]) return -1;
|
||||||
|
if (a[sortBy] > b[sortBy]) return 1;
|
||||||
|
return 0;
|
||||||
|
});
|
||||||
|
}
|
||||||
for (var i in userSessions) {
|
for (var i in userSessions) {
|
||||||
x += '<div style="text-align:left;cursor:pointer;background-color:gray;margin:5px;padding:5px;border-radius:5px" onclick=connectDesktop(event,1,' + userSessions[i].SessionId + ',' + message.tag + ')>' + userSessions[i].State + ', ' + userSessions[i].StationName;
|
x += '<div style="text-align:left;cursor:pointer;background-color:gray;margin:5px;padding:5px;border-radius:5px" onclick=connectDesktop(event,1,' + userSessions[i].SessionId + ',' + message.tag + ')>' + userSessions[i].State + ', ' + userSessions[i].StationName;
|
||||||
if (userSessions[i].Username) { if (userSessions[i].Domain) { x += ' - ' + userSessions[i].Domain + '/' + userSessions[i].Username; } else { x += ' - ' + userSessions[i].Username; } }
|
if (userSessions[i].Username) { if (userSessions[i].Domain) { x += ' - ' + userSessions[i].Domain + '/' + userSessions[i].Username; } else { x += ' - ' + userSessions[i].Username; } }
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en" dir="ltr" xmlns="http://www.w3.org/1999/xhtml">
|
<html lang="en" dir="ltr" xmlns="http://www.w3.org/1999/xhtml">
|
||||||
<head>
|
<head>
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||||
|
@ -2689,6 +2689,16 @@
|
||||||
else if (userSessions.length === 1) { connectDesktop(null, 1, userSessions[0].SessionId, message.tag); } // One active session, connect to it
|
else if (userSessions.length === 1) { connectDesktop(null, 1, userSessions[0].SessionId, message.tag); } // One active session, connect to it
|
||||||
else {
|
else {
|
||||||
var x = '';
|
var x = '';
|
||||||
|
var sortBy = "{{{userSessionsSort}}}";
|
||||||
|
if (sortBy != '') {
|
||||||
|
userSessions.sort(function(a, b) {
|
||||||
|
if (!a[sortBy]) return -1; // a comes before b
|
||||||
|
if (!b[sortBy]) return 1; // b comes before a
|
||||||
|
if (a[sortBy] < b[sortBy]) return -1;
|
||||||
|
if (a[sortBy] > b[sortBy]) return 1;
|
||||||
|
return 0;
|
||||||
|
});
|
||||||
|
}
|
||||||
for (var i in userSessions) {
|
for (var i in userSessions) {
|
||||||
x += '<div style="text-align:left;cursor:pointer;background-color:gray;margin:5px;padding:5px;border-radius:5px" onclick=connectDesktop(event,1,' + userSessions[i].SessionId + ',' + message.tag + ')>' + userSessions[i].State + (userSessions[i].StationName ? (', ' + userSessions[i].StationName) : '');
|
x += '<div style="text-align:left;cursor:pointer;background-color:gray;margin:5px;padding:5px;border-radius:5px" onclick=connectDesktop(event,1,' + userSessions[i].SessionId + ',' + message.tag + ')>' + userSessions[i].State + (userSessions[i].StationName ? (', ' + userSessions[i].StationName) : '');
|
||||||
if (userSessions[i].Username) { if (userSessions[i].Domain) { x += ' - ' + userSessions[i].Domain + '/' + userSessions[i].Username; } else { x += ' - ' + userSessions[i].Username; } }
|
if (userSessions[i].Username) { if (userSessions[i].Domain) { x += ' - ' + userSessions[i].Domain + '/' + userSessions[i].Username; } else { x += ' - ' + userSessions[i].Username; } }
|
||||||
|
|
|
@ -3152,7 +3152,8 @@ module.exports.CreateWebServer = function (parent, db, args, certificates, doneF
|
||||||
webRelayPort: ((args.relaydns != null) ? ((typeof args.aliasport == 'number') ? args.aliasport : args.port) : ((parent.webrelayserver != null) ? ((typeof args.relayaliasport == 'number') ? args.relayaliasport : parent.webrelayserver.port) : 0)),
|
webRelayPort: ((args.relaydns != null) ? ((typeof args.aliasport == 'number') ? args.aliasport : args.port) : ((parent.webrelayserver != null) ? ((typeof args.relayaliasport == 'number') ? args.relayaliasport : parent.webrelayserver.port) : 0)),
|
||||||
webRelayDns: ((args.relaydns != null) ? args.relaydns[0] : ''),
|
webRelayDns: ((args.relaydns != null) ? args.relaydns[0] : ''),
|
||||||
hidePowerTimeline: (domain.hidepowertimeline ? 'true' : 'false'),
|
hidePowerTimeline: (domain.hidepowertimeline ? 'true' : 'false'),
|
||||||
showNotesPanel: (domain.shownotespanel ? 'true' : 'false')
|
showNotesPanel: (domain.shownotespanel ? 'true' : 'false'),
|
||||||
|
userSessionsSort: (domain.usersessionssort ? domain.usersessionssort : 'SessionId')
|
||||||
}, dbGetFunc.req, domain), user);
|
}, dbGetFunc.req, domain), user);
|
||||||
}
|
}
|
||||||
xdbGetFunc.req = req;
|
xdbGetFunc.req = req;
|
||||||
|
|
Loading…
Reference in New Issue