1
0
Fork 0
mirror of https://github.com/Ylianst/MeshCentral.git synced 2025-03-09 15:40:18 +00:00

Improved internalization.

This commit is contained in:
Ylian Saint-Hilaire 2019-12-23 14:25:27 -08:00
parent 74e2529655
commit 2e81ba0bf9
18 changed files with 1805 additions and 1228 deletions

View file

@ -3640,11 +3640,11 @@
function onSearchInputChanged() {
var x = Q('SearchInput').value.toLowerCase().trim(); putstore('_search', x);
var userSearch = null, ipSearch = null, groupSearch = null;
if (x.startsWith('user:')) { userSearch = x.substring(5); }
else if (x.startsWith('u:')) { userSearch = x.substring(2); }
else if (x.startsWith('ip:')) { ipSearch = x.substring(3); }
else if (x.startsWith('group:')) { groupSearch = x.substring(6); }
else if (x.startsWith('g:')) { groupSearch = x.substring(2); }
if (x.startsWith("user:")) { userSearch = x.substring(5); }
else if (x.startsWith("u:")) { userSearch = x.substring(2); }
else if (x.startsWith("ip:")) { ipSearch = x.substring(3); }
else if (x.startsWith("group:")) { groupSearch = x.substring(6); }
else if (x.startsWith("g:")) { groupSearch = x.substring(2); }
if (x == '') {
// No search
@ -3973,7 +3973,7 @@
});
// On right click open the context menu
contextmenu.on("open", function (evt) {
contextmenu.on('open', function (evt) {
var feature = xxmap.map.forEachFeatureAtPixel(evt.pixel, function(ft, l){ return ft; });
xxmap.contextmenu.clear(); //Clear the context menu
if (feature) {
@ -7710,8 +7710,8 @@
function p20editmeshfeatures() {
if (xxdialogMode) return;
var flags = (currentMesh.flags)?currentMesh.flags:0;
var x = '<div><label><input type=checkbox id=d20flag1 ' + ((flags & 1) ? 'checked' : '') + '>Remove device on disconnect</label><br></div>';
x += '<div><label><input type=checkbox id=d20flag2 ' + ((flags & 2) ? 'checked' : '') + '>Sync server device name to hostname</label><br></div>';
var x = '<div><label><input type=checkbox id=d20flag1 ' + ((flags & 1) ? 'checked' : '') + '>' + "Remove device on disconnect" + '</label><br></div>';
x += '<div><label><input type=checkbox id=d20flag2 ' + ((flags & 2) ? 'checked' : '') + '>' + "Sync server device name to hostname" + '</label><br></div>';
setDialogMode(2, "Edit Device Group Features", 3, p20editmeshfeaturesEx, x);
}
@ -7939,10 +7939,10 @@
if (xxdialogMode) return false;
var meshNotify = 0;
if (userinfo.links && userinfo.links[currentMesh._id] && userinfo.links[currentMesh._id].notify) { meshNotify = userinfo.links[currentMesh._id].notify; }
var x = 'Notification settings must also be turned on in account settings.<br /><br />';
x += '<div><label><input id=p20notifyIntelDeviceConnect type=checkbox />Device connections.</label></div>';
x += '<div><label><input id=p20notifyIntelDeviceDisconnect type=checkbox />Device disconnections.</label></div>';
x += '<div><label><input id=p20notifyIntelAmtKvmActions type=checkbox />Intel&reg; AMT desktop and serial events.</label></div>';
var x = "Notification settings must also be turned on in account settings." + '<br /><br />';
x += '<div><label><input id=p20notifyIntelDeviceConnect type=checkbox />' + "Device connections." + '</label></div>';
x += '<div><label><input id=p20notifyIntelDeviceDisconnect type=checkbox />' + "Device disconnections." + '</label></div>';
x += '<div><label><input id=p20notifyIntelAmtKvmActions type=checkbox />' + "Intel&reg; AMT desktop and serial events." + '</label></div>';
setDialogMode(2, "Notification Settings", 3, p20editMeshNotifyEx, x);
Q('p20notifyIntelDeviceConnect').checked = (meshNotify & 2);
Q('p20notifyIntelDeviceDisconnect').checked = (meshNotify & 4);
@ -8506,7 +8506,7 @@
// Display the users using the sorted list
var x = '<table class=p3usersTable cellpadding=0 cellspacing=0>', addHeader = true;
x += '<th>' + "Name" + '<th style=width:80px>Groups<th style=width:120px>' + nobreak("Last Access") + '<th style=width:120px>' + "Permissions";
x += '<th>' + "Name" + '<th style=width:80px>' + "Groups" + '<th style=width:120px>' + nobreak("Last Access") + '<th style=width:120px>' + "Permissions";
// Online users
for (var i in sortedUserIds) {
@ -8963,9 +8963,9 @@
// Show bottom buttons
x = '<div style=float:right;font-size:x-small>';
if (deletePossible) x += '<a href=# style=cursor:pointer onclick=\'return p30showDeleteUserDialog()\' title="Remove this user">Delete User</a>';
if (deletePossible) x += '<a href=# style=cursor:pointer onclick=\'return p30showDeleteUserDialog()\' title="Remove this user">' + "Delete User" + '</a>';
x += '</div><div style=font-size:x-small>';
if (userinfo.siteadmin == 0xFFFFFFFF) x += '<a href=# style=cursor:pointer onclick=\'return p30showUserChangePassDialog(' + multiFactor + ')\' title="Change the password for this user">Change Password</a>';
if (userinfo.siteadmin == 0xFFFFFFFF) x += '<a href=# style=cursor:pointer onclick=\'return p30showUserChangePassDialog(' + multiFactor + ')\' title="Change the password for this user">' + "Change Password" + '</a>';
x += '</div><br>'
QH('p30html3', x);
@ -9106,7 +9106,7 @@
++count;
date = new Date(date.getTime() - (1000 * 60 * 60 * 24)); // Substract one day
}
QH('p30html2', '<table style="color:black;background-color:#EEE;border-color:#AAA;border-width:1px;border-style:solid;border-collapse:collapse" border=0 cellpadding=2 cellspacing=0 width=100%><tbody><tr style=background-color:#AAAAAA;font-weight:bold><th scope=col style=text-align:center;width:150px>Day</th><th scope=col style=text-align:center>7 Day Login State</th></tr>' + x + '</tbody></table>');
QH('p30html2', '<table style="color:black;background-color:#EEE;border-color:#AAA;border-width:1px;border-style:solid;border-collapse:collapse" border=0 cellpadding=2 cellspacing=0 width=100%><tbody><tr style=background-color:#AAAAAA;font-weight:bold><th scope=col style=text-align:center;width:150px>' + "Day" + '</th><th scope=col style=text-align:center>' + "7 Day Login State" + '</th></tr>' + x + '</tbody></table>');
}
//
@ -9410,6 +9410,31 @@
});
}
var serverStatsStrings = {
ServerState: "Server State",
AgentErrorCounters: "Agent Error Counters",
UnknownGroup: "Unknown Group",
InvalidPKCSsignature: "Invalid PKCS signature",
InvalidRSAsiguature: "Invalid RSA siguature",
InvalidJSON: "Invalid JSON",
UnknownAction: "Unknown Action",
BadWebCertificate: "Bad Web Certificate",
BadSignature: "Bad Signature",
MaxSessionsReached: "Max Sessions Reached",
UnknownDeviceGroup: "Unknown Device Group",
InvalidDeviceGroupType: "Invalid Device Group Type",
DuplicateAgent: "Duplicate Agent",
ConnectedIntelAMT: "Connected Intel&reg; AMT",
RelayErrors: "Relay Errors",
UserAccounts: "User Accounts",
DeviceGroups: "Device Groups",
AgentSessions: "Agent Sessions",
ConnectedUsers: "Connected Users",
UsersSessions: "Users Sessions",
RelaySessions: "Relay Sessions",
RelayCount: "Relay Count"
};
var lastServerStats = null;
function updateGeneralServerStats(message) {
if (message != null) { lastServerStats = message; } else { message = lastServerStats; }
@ -9419,7 +9444,7 @@
if (typeof message.cpuavg == 'object') {
var m = Math.min(message.cpuavg[0], 1);
window.serverStatCpu.config.data.datasets[0].data = [m, 1 - m];
QH('serverCpuChartText', '<div style=margin-bottom:5px>CPU Load</div><div><b title=\"' + "CPU load in the last minute" + '\">' + (Math.round(message.cpuavg[0] * 100.0) / 100.0) + '</b>, <b title=\"' + "CPU load in the last 5 minutes" + '\">' + (Math.round(message.cpuavg[1] * 100.0) / 100.0) + '</b>, <b title=\"' + "CPU load in the last 15 minutes" + '\">' + (Math.round(message.cpuavg[2] * 100.0) / 100.0) + '</b></div>');
QH('serverCpuChartText', '<div style=margin-bottom:5px>' + "CPU Load" + '</div><div><b title=\"' + "CPU load in the last minute" + '\">' + (Math.round(message.cpuavg[0] * 100.0) / 100.0) + '</b>, <b title=\"' + "CPU load in the last 5 minutes" + '\">' + (Math.round(message.cpuavg[1] * 100.0) / 100.0) + '</b>, <b title=\"' + "CPU load in the last 15 minutes" + '\">' + (Math.round(message.cpuavg[2] * 100.0) / 100.0) + '</b></div>');
QS('serverCpuChartView')['display'] = 'inline-block';
window.serverStatCpu.update();
}
@ -9431,12 +9456,13 @@
}
// Display all of the server values
// serverStatsStrings
var x = '<div style=width:100% cellpadding=0 cellspacing=0>';
if (typeof message.values == 'object') {
for (var i in message.values) {
x += '<div class=userTableHeader style=margin-bottom:4px;width:200px>' + i + '</div>';
x += '<div class=userTableHeader style=margin-bottom:4px;width:200px>' + (serverStatsStrings[i]?serverStatsStrings[i]:i) + '</div>';
for (var j in message.values[i]) {
x += '<div style=display:inline-block><table class=serverStateTableCell><tr><td class=h1></td><td><span>' + j + '</span><span style=float:right>' + message.values[i][j] + '</span></td><td class=h2></td></tr></table></div>';
x += '<div style=display:inline-block><table class=serverStateTableCell><tr><td class=h1></td><td><span>' + (serverStatsStrings[j]?serverStatsStrings[j]:j) + '</span><span style=float:right>' + message.values[i][j] + '</span></td><td class=h2></td></tr></table></div>';
}
}
}
@ -9527,10 +9553,10 @@
data = {
labels: [pastDate(0), timeAfter],
datasets: [
{ label: 'External', data: [], backgroundColor: 'rgba(158, 151, 16, .1)', borderColor: 'rgb(158, 151, 16)', fill: true },
{ label: 'Heap Used', data: [], backgroundColor: 'rgba(16, 84, 158, .1)', borderColor: 'rgb(16, 84, 158)', fill: true },
{ label: 'Heap Total', data: [], backgroundColor: 'rgba(255, 99, 132, .1)', borderColor: 'rgb(255, 99, 132)', fill: true },
{ label: 'RSS', data: [], backgroundColor: 'rgba(39, 158, 16, .1)', borderColor: 'rgb(39, 158, 16)', fill: true }
{ label: "External", data: [], backgroundColor: 'rgba(158, 151, 16, .1)', borderColor: 'rgb(158, 151, 16)', fill: true },
{ label: "Heap Used", data: [], backgroundColor: 'rgba(16, 84, 158, .1)', borderColor: 'rgb(16, 84, 158)', fill: true },
{ label: "Heap Total", data: [], backgroundColor: 'rgba(255, 99, 132, .1)', borderColor: 'rgb(255, 99, 132)', fill: true },
{ label: "RSS", data: [], backgroundColor: 'rgba(39, 158, 16, .1)', borderColor: 'rgb(39, 158, 16)', fill: true }
]
};
for (var i = 0; i < serverTimelineStats.length; i++) {