Added Device Group Summary Panel, other fixes.

This commit is contained in:
Ylian Saint-Hilaire
2019-12-18 12:00:08 -08:00
parent c890eb5468
commit 3cb56ee4ec
16 changed files with 1471 additions and 208 deletions

View File

@@ -144,6 +144,7 @@
<table id="MeshSubMenu" cellpadding="0" cellspacing="0" class="style1">
<tbody><tr>
<td tabindex="0" id="MeshGeneral" class="topbar_td style3x" onclick="go(20,event)" onkeypress="if (event.key == 'Enter') go(20)">Geral</td>
<td tabindex="0" id="MeshSummary" class="topbar_td style3x" onclick="go(21,event)" onkeypress="if (event.key == 'Enter') go(21)">Summary</td>
<td class="topbar_td_end style3">&nbsp;</td>
</tr>
</tbody></table>
@@ -244,7 +245,7 @@
<div id="NoMeshesPanel" style="display:none">
<table>
<tbody><tr>
<td valign="top" style="width: 50px">
<td valign="top" style="width:50px">
<img src="images/info.png">
</td>
<td>
@@ -777,6 +778,28 @@
<h1>Geral - <span id="p20meshName"></span></h1>
<p id="p20info"></p>
</div>
<div id="p21" style="display:none">
<div style="float:left"><div class="backButton" tabindex="0" onclick="goBack()" title="Voltar" onkeypress="if (event.key == 'Enter') goBack()"><div class="backButtonEx"></div></div></div>
<h1>Summary - <span id="p21meshName"></span></h1>
<div style="width:100%">
<div style="display:table;margin:0 auto;">
<div style="width:250px;height:250px;display:inline-block;text-align:center">
<div style="margin:10px;font-size:16px">Power States</div>
<canvas id="meshPowerChart" style="width:250px;height:250px"></canvas>
</div>
<div id="meshOsChartDiv" style="width:250px;height:250px;display:inline-block;text-align:center">
<div style="margin:10px;font-size:16px">Agent Types</div>
<canvas id="meshOsChart" style="width:250px;height:250px"></canvas>
</div>
<div style="width:250px;height:250px;display:inline-block;text-align:center">
<div style="margin:10px;font-size:16px">Conectividade</div>
<canvas id="meshConnChart" style="width:250px;height:250px"></canvas>
</div>
</div>
</div>
<br><br>
<p id="p21info"></p>
</div>
<div id="p30" style="display:none">
<table style="width:100%" cellpadding="0" cellspacing="0">
<tbody><tr>
@@ -1026,6 +1049,7 @@
var autoReconnect = true;
var powerStatetable = ['', "Ligado", "Hibernar", "Hibernar", "Hibernar", "Hibernando", "Desligar", "Presente"];
var StatusStrs = ["Desconectado", "Conectando...", "Configurando...", "Conectado", "Intel&reg; AMT conectado"];
var agentsStr = ["Desconhecido", "Windows 32 Bits console", "Windows 64 Bits console", "Serviço Windows 32 Bits", "Serviço Windows 64 Bits", "Linux 32 bits", "Linux 64 bits", "MIPS", "XENx86", "Android ARM", "Linux ARM", "MacOS 32 bits", "Android x86", "PogoPlug ARM", "Android APK", "Linux Poky x86-32 bits", "MacOS 64 bits", "ChromeOS", "Linux Poky x86-64 bits", "Linux NoKVM x86-32 bits", "Linux NoKVM x86-64 bits", "Windows MinCore console", "Windows MinCore service", "NodeJS", "ARM-Linaro", "ARMv6l / ARMv7l", "ARMv8 64bit", "ARMv6l / ARMv7l / NoKVM", "Desconhecido", "Desconhecido", "FreeBSD x86-64"];
var sort = 0;
var searchFocus = 0;
var mapSearchFocus = 0;
@@ -1232,6 +1256,9 @@
// Setup the user interface in the right mode
userInterfaceSelectMenu();
// Setup Mesh summary panel
setupMeshSummaryStats();
// If SSPI or LDAP authentication not used, allow batch account creation.
QV('p4UserBatchCreate', (features & 0x00080000) == 0);
@@ -1425,7 +1452,7 @@
if (updateNaggleFlags & 1) { onSearchInputChanged(); }
if (updateNaggleFlags & 2) { onSortSelectChange(false); }
if (updateNaggleFlags & 128) { updateMeshes(); }
if (updateNaggleFlags & 4) { updateDevices(); }
if (updateNaggleFlags & 4) { updateDevices(); if (xxcurrentView == 21) { p21updateMesh(); } }
if (updateNaggleFlags & 8) { drawNotifications(); }
{{{StartGeoLocationJS}}}if (updateNaggleFlags & 16) { updateMapMarkers(); }{{{EndGeoLocationJS}}}
if (updateNaggleFlags & 32) { eventsUpdate(); }
@@ -2638,7 +2665,7 @@
var oldviewmode = 0;
function updateDevices() {
if (nodes == null) { return; }
var r = '', c = 0, current = null, count = 0, displayedMeshes = {}, view = Q('viewselect').value, groups = {}, groupCount = {};
var r = '', c = 0, current = null, count = 0, scount = 0, displayedMeshes = {}, view = Q('viewselect').value, groups = {}, groupCount = {};
QV('xdevices', view < 4);
QV('xdevicesmap', view == 4);
QV('devListToolbar', view < 3);
@@ -2678,10 +2705,6 @@
var deviceBoxWidth = Math.floor(totalDeviceViewWidth / 301);
deviceBoxWidth = 301 + Math.floor((totalDeviceViewWidth - (deviceBoxWidth * 301)) / deviceBoxWidth);
if ((view == 2) && (sort != 3)) {
r += '<table style=width:100%;margin-top:4px cellpadding=0 cellspacing=0><th style=color:gray><th style=color:gray;width:120px>' + "Do utilizador" + '<th style=color:gray;width:120px>' + "Endereço" + '<th style=color:gray;width:100px>' + "Conectividade"; //<th style=color:gray;width:100px>State';
}
// Go thru the list of nodes and display them
for (var i in nodes) {
var node = nodes[i];
@@ -2790,8 +2813,6 @@
// If displaying devices by groups, sort the group names and display the devices.
if (sort == 3) {
if (view == 2) { r = '<table style=width:100%;margin-top:4px cellpadding=0 cellspacing=0><th style=color:gray><th style=color:gray;width:120px>' + "Do utilizador" + '<th style=color:gray;width:120px>' + "Endereço" + '<th style=color:gray;width:100px>' + "Conectividade"; }
var groupNames = [];
for (var i in groups) { groupNames.push(i); }
groupNames.sort(function (a, b) { return a.toLowerCase().localeCompare(b.toLowerCase()); });
@@ -2842,7 +2863,15 @@
}
}
}
r += '</tr></table><div style=height:1px></div>'; // This height of 1 div fixes a problem in Linux firefox browsers
if (r != '') {
if (view == 2) {
// This height of 1 div at the end to fix a problem in Linux firefox browsers
r = '<table style=width:100%;margin-top:4px cellpadding=0 cellspacing=0><th style=color:gray><th style=color:gray;width:120px>' + "Do utilizador" + '<th style=color:gray;width:120px>' + "Endereço" + '<th style=color:gray;width:100px>' + "Conectividade" + r + '</tr></table><div style=height:1px></div>'; //<th style=color:gray;width:100px>State';
}
} else {
if (sort == 3) { r = '<div style="margin:10px"><i>' + "No devices with tags found." + '</i></div>'; }
}
// Add a "Add Device Group" option
r += '<div style=border-top-style:solid;border-top-width:1px;border-top-color:#DDDDDD;cursor:pointer;font-size:10px>';
@@ -4386,7 +4415,6 @@
}
// Attribute: Mesh Agent
var agentsStr = ["Desconhecido", "Windows 32 Bits console", "Windows 64 Bits console", "Serviço Windows 32 Bits", "Serviço Windows 64 Bits", "Linux 32 bits", "Linux 64 bits", "MIPS", "XENx86", "Android ARM", "Linux ARM", "MacOS 32 bits", "Android x86", "PogoPlug ARM", "Android APK", "Linux Poky x86-32 bits", "MacOS 64 bits", "ChromeOS", "Linux Poky x86-64 bits", "Linux NoKVM x86-32 bits", "Linux NoKVM x86-64 bits", "Windows MinCore console", "Windows MinCore service", "NodeJS", "ARM-Linaro", "ARMv6l / ARMv7l", "ARMv8 64bit", "ARMv6l / ARMv7l / NoKVM", "Desconhecido", "Desconhecido", "FreeBSD x86-64"];
if ((node.agent != null) && (node.agent.id != null) && (node.agent.ver != null)) {
var str = '';
if (node.agent.id <= agentsStr.length) { str = agentsStr[node.agent.id]; } else { str = agentsStr[0]; }
@@ -7851,6 +7879,91 @@
meshserver.send({ action: 'changemeshnotify', meshid: currentMesh._id, notify: meshNotify });
}
//
// Mesh Summary
//
function setupMeshSummaryStats() {
window.meshPowerChart = new Chart(document.getElementById('meshPowerChart').getContext('2d'), {
type: 'doughnut',
data: { datasets: [{ data: [0, 0], backgroundColor: ['#20F', '#40D', '#60B', '#809', '#A07', '#C05'] }] },
options: { responsive: true, legend: { position: 'none' }, animation: { animateScale: true, animateRotate: true } }
});
window.meshOsChart = new Chart(document.getElementById('meshOsChart').getContext('2d'), {
type: 'doughnut',
data: { datasets: [{ data: [0, 0], backgroundColor: ['#20F', '#40D', '#60B', '#809', '#A07', '#C05'] }] },
options: { responsive: true, legend: { position: 'none' }, animation: { animateScale: true, animateRotate: true } }
});
window.meshConnChart = new Chart(document.getElementById('meshConnChart').getContext('2d'), {
type: 'doughnut',
data: { datasets: [{ data: [0, 0], backgroundColor: ['#20F', '#40D', '#60B', '#809', '#A07', '#C05'] }], labels: ["Not Connected", "Agente", "Intel AMT", "Agent + Intel AMT"] },
options: { responsive: true, legend: { position: 'none' }, animation: { animateScale: true, animateRotate: true } }
});
}
function p21updateMesh() {
if (currentMesh == null) return;
QH('p21meshName', EscapeHtml(currentMesh.name));
// Update charts
var power = {};
var conn = {};
var agentTypes = {};
var powerStates = {};
var connectivityStates = [ 0, 0, 0, 0 ]; // None, Agent, AMT, Agent + AMT
for (var i in nodes) {
if (nodes[i].meshid == currentMesh._id) {
if (nodes[i].agent) { if (agentTypes[nodes[i].agent.id] == null) { agentTypes[nodes[i].agent.id] = 1; } else { agentTypes[nodes[i].agent.id]++; } }
if (nodes[i].pwr) { if (powerStates[nodes[i].pwr] == null) { powerStates[nodes[i].pwr] = 1; } else { powerStates[nodes[i].pwr]++; } }
if (nodes[i].conn == 0) {
connectivityStates[0]++; }
else if ((nodes[i].conn & 6) != 0) { if ((nodes[i].conn & 1) != 0) { connectivityStates[3]++; } else { connectivityStates[2]++; } }
else if ((nodes[i].conn & 1) != 0) { connectivityStates[1]++; }
}
}
var agentsData = [], agentsLabels = [], powerData = [], powerLabels = [];
for (var i in agentTypes) { agentsData.push(agentTypes[i]); agentsLabels.push(agentsStr[i]); }
for (var i in powerStates) { powerData.push(powerStates[i]); powerLabels.push(powerStatetable[i]); }
window.meshPowerChart.config.data.datasets[0].data = powerData;
window.meshPowerChart.config.data.labels = powerLabels;
window.meshPowerChart.update();
if (currentMesh.mtype == 2) {
window.meshOsChart.config.data.datasets[0].data = agentsData;
window.meshOsChart.config.data.labels = agentsLabels;
window.meshOsChart.update();
}
window.meshConnChart.config.data.datasets[0].data = connectivityStates;
window.meshConnChart.update();
// Only show the OS chart if the mesh is agent type.
QS('meshOsChartDiv')['display'] = (currentMesh.mtype == 2)?'inline-block':'none';
// Update tables
var x = '<br />', count = 0;
if (powerData.length > 0) {
count = 0;
x += '<table style="margin-top:10px;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:left;width:430px>' + "Power States" + '</th><th scope=col style=text-align:left></th></tr>';
for (var i in powerStates) { x += '<tr style=' + (((++count % 2) == 0) ? 'background-color:#DDD' : '') + '><td><divclass=m2></div><div>&nbsp;' + powerStatetable[i] + '<div></div></div></td><td><div style=float:right>' + powerStates[i] + ' </div><div></div></td></tr>'; }
x += '</tbody></table>';
}
if ((agentsData.length > 0) && (currentMesh.mtype == 2)) {
x += '<table style="margin-top:10px;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:left;width:430px>' + "Agent Types" + '</th><th scope=col style=text-align:left></th></tr>';
for (var i in agentTypes) { x += '<tr style=' + (((++count % 2) == 0) ? 'background-color:#DDD' : '') + '><td><divclass=m2></div><div>&nbsp;' + agentsStr[i] + '<div></div></div></td><td><div style=float:right>' + agentTypes[i] + ' </div><div></div></td></tr>'; }
x += '</tbody></table>';
}
count = 0;
x += '<table style="margin-top:10px;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:left;width:430px>' + "Power States" + '</th><th scope=col style=text-align:left></th></tr>';
if (connectivityStates[0] > 0) { x += '<tr style=' + (((++count % 2) == 0) ? 'background-color:#DDD' : '') + '><td><divclass=m2></div><div>&nbsp;' + "Not Connected" + '<div></div></div></td><td><div style=float:right>' + connectivityStates[0] + ' </div><div></div></td></tr>'; }
if (connectivityStates[1] > 0) { x += '<tr style=' + (((++count % 2) == 0) ? 'background-color:#DDD' : '') + '><td><divclass=m2></div><div>&nbsp;' + "Agente" + '<div></div></div></td><td><div style=float:right>' + connectivityStates[1] + ' </div><div></div></td></tr>'; }
if (connectivityStates[2] > 0) { x += '<tr style=' + (((++count % 2) == 0) ? 'background-color:#DDD' : '') + '><td><divclass=m2></div><div>&nbsp;' + "Intel AMT" + '<div></div></div></td><td><div style=float:right>' + connectivityStates[2] + ' </div><div></div></td></tr>'; }
if (connectivityStates[3] > 0) { x += '<tr style=' + (((++count % 2) == 0) ? 'background-color:#DDD' : '') + '><td><divclass=m2></div><div>&nbsp;' + "Agent + Intel AMT" + '<div></div></div></td><td><div style=float:right>' + connectivityStates[3] + ' </div><div></div></td></tr>'; }
x += '</tbody></table>';
QH('p21info', x);
}
//
// MY FILES
//
@@ -8333,8 +8446,8 @@
if (sessions != null) {
gray = '';
if (self) {
msg = '<span style=float:right;margin-top:1px;margin-right:4px title=' + "Chat" + '><a href=# onclick=userChat(event,\"" + encodeURIComponent(user._id) + "\",\"" + encodeURIComponent(user.name) + "\")><img src=\'images/icon-chat.png\' height=16 width=16 style=padding-top:2px /></a></span>';
msg += '<span style=float:right;margin-top:1px;margin-left:4px;margin-right:4px title=Notify><a href=# onclick=\'return showUserAlertDialog(event,\"" + encodeURIComponent(user._id) + "\")\'><img src=\'images/icon-notify.png\' height=16 width=16 style=padding-top:2px /></a></span>';
msg = '<span style=float:right;margin-top:1px;margin-right:4px title=' + "Chat" + '><a href=# onclick=userChat(event,\"' + encodeURIComponent(user._id) + '\",\"' + encodeURIComponent(user.name) + '\")><img src=\'images/icon-chat.png\' height=16 width=16 style=padding-top:2px /></a></span>';
msg += '<span style=float:right;margin-top:1px;margin-left:4px;margin-right:4px title=Notify><a href=# onclick=\'return showUserAlertDialog(event,\"' + encodeURIComponent(user._id) + '\")\'><img src=\'images/icon-notify.png\' height=16 width=16 style=padding-top:2px /></a></span>';
}
if (sessions == 1) { lastAccess += nobreak("1 sessão"); } else { lastAccess += nobreak(format("{0} sessões", sessions)); }
} else {
@@ -9538,7 +9651,7 @@
QV('MeshSubMenuSpan', x >= 20 && x < 30);
QV('UserSubMenuSpan', x >= 30 && x < 40);
QV('ServerSubMenuSpan', x == 6 || x == 115 || x == 40 || x == 41 || x == 42 || x == 43);
var panels = { 10: 'MainDev', 11: 'MainDevDesktop', 12: 'MainDevTerminal', 13: 'MainDevFiles', 14: 'MainDevAmt', 15: 'MainDevConsole', 16: 'MainDevEvents', 17: 'MainDevInfo', 19: 'MainDevPlugins', 20: 'MeshGeneral', 30: 'UserGeneral', 31: 'UserEvents', 6: 'ServerGeneral', 40: 'ServerStats', 41: 'ServerTrace', 42: 'ServerPlugins', 115: 'ServerConsole' };
var panels = { 10: 'MainDev', 11: 'MainDevDesktop', 12: 'MainDevTerminal', 13: 'MainDevFiles', 14: 'MainDevAmt', 15: 'MainDevConsole', 16: 'MainDevEvents', 17: 'MainDevInfo', 19: 'MainDevPlugins', 20: 'MeshGeneral', 21: 'MeshSummary', 30: 'UserGeneral', 31: 'UserEvents', 6: 'ServerGeneral', 40: 'ServerStats', 41: 'ServerTrace', 42: 'ServerPlugins', 115: 'ServerConsole' };
for (var i in panels) {
QC(panels[i]).remove('style3x');
QC(panels[i]).remove('style3sel');
@@ -9565,6 +9678,9 @@
// MyServer Plugins
if (x == 42) { refreshPluginLatest(); }
// Update Mesh Summary
if (x == 21) { p21updateMesh(); }
// Update the web page title
if ((currentNode) && (x >= 10) && (x < 20)) {
document.title = decodeURIComponent('{{{extitle}}}') + ' - ' + currentNode.name + ' - ' + meshes[currentNode.meshid].name;