mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2025-03-09 15:40:18 +00:00
Added Device Group Summary Panel, other fixes.
This commit is contained in:
parent
c890eb5468
commit
3cb56ee4ec
16 changed files with 1471 additions and 208 deletions
|
@ -146,6 +146,7 @@
|
|||
<table id=MeshSubMenu cellpadding=0 cellspacing=0 class=style1>
|
||||
<tr>
|
||||
<td tabindex=0 id=MeshGeneral class="topbar_td style3x" onclick=go(20,event) onkeypress="if (event.key == 'Enter') go(20)">General</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"> </td>
|
||||
</tr>
|
||||
</table>
|
||||
|
@ -246,7 +247,7 @@
|
|||
<div id=NoMeshesPanel style="display:none">
|
||||
<table>
|
||||
<tr>
|
||||
<td valign="top" style="width: 50px">
|
||||
<td valign="top" style="width:50px">
|
||||
<img src="images/info.png" />
|
||||
</td>
|
||||
<td>
|
||||
|
@ -779,6 +780,28 @@
|
|||
<h1>General - <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="Back" 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">Connectivity</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">
|
||||
<tr>
|
||||
|
@ -1028,6 +1051,7 @@
|
|||
var autoReconnect = true;
|
||||
var powerStatetable = ['', "Powered", "Sleep", "Sleep", "Sleep", "Hibernating", "Power off", "Present"];
|
||||
var StatusStrs = ["Disconnected", "Connecting...", "Setup...", "Connected", "Intel® AMT Connected"];
|
||||
var agentsStr = ["Unknown", "Windows 32bit console", "Windows 64bit console", "Windows 32bit service", "Windows 64bit service", "Linux 32bit", "Linux 64bit", "MIPS", "XENx86", "Android ARM", "Linux ARM", "MacOS 32bit", "Android x86", "PogoPlug ARM", "Android APK", "Linux Poky x86-32bit", "MacOS 64bit", "ChromeOS", "Linux Poky x86-64bit", "Linux NoKVM x86-32bit", "Linux NoKVM x86-64bit", "Windows MinCore console", "Windows MinCore service", "NodeJS", "ARM-Linaro", "ARMv6l / ARMv7l", "ARMv8 64bit", "ARMv6l / ARMv7l / NoKVM", "Unknown", "Unknown", "FreeBSD x86-64"];
|
||||
var sort = 0;
|
||||
var searchFocus = 0;
|
||||
var mapSearchFocus = 0;
|
||||
|
@ -1234,6 +1258,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);
|
||||
|
||||
|
@ -1427,7 +1454,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(); }
|
||||
|
@ -2640,7 +2667,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);
|
||||
|
@ -2680,10 +2707,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>' + "User" + '<th style=color:gray;width:120px>' + "Address" + '<th style=color:gray;width:100px>' + "Connectivity"; //<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];
|
||||
|
@ -2792,8 +2815,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>' + "User" + '<th style=color:gray;width:120px>' + "Address" + '<th style=color:gray;width:100px>' + "Connectivity"; }
|
||||
|
||||
var groupNames = [];
|
||||
for (var i in groups) { groupNames.push(i); }
|
||||
groupNames.sort(function (a, b) { return a.toLowerCase().localeCompare(b.toLowerCase()); });
|
||||
|
@ -2844,7 +2865,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>' + "User" + '<th style=color:gray;width:120px>' + "Address" + '<th style=color:gray;width:100px>' + "Connectivity" + 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>';
|
||||
|
@ -4388,7 +4417,6 @@
|
|||
}
|
||||
|
||||
// Attribute: Mesh Agent
|
||||
var agentsStr = ["Unknown", "Windows 32bit console", "Windows 64bit console", "Windows 32bit service", "Windows 64bit service", "Linux 32bit", "Linux 64bit", "MIPS", "XENx86", "Android ARM", "Linux ARM", "MacOS 32bit", "Android x86", "PogoPlug ARM", "Android APK", "Linux Poky x86-32bit", "MacOS 64bit", "ChromeOS", "Linux Poky x86-64bit", "Linux NoKVM x86-32bit", "Linux NoKVM x86-64bit", "Windows MinCore console", "Windows MinCore service", "NodeJS", "ARM-Linaro", "ARMv6l / ARMv7l", "ARMv8 64bit", "ARMv6l / ARMv7l / NoKVM", "Unknown", "Unknown", "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]; }
|
||||
|
@ -7853,6 +7881,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", "Agent", "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> ' + 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> ' + 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> ' + "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> ' + "Agent" + '<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> ' + "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> ' + "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
|
||||
//
|
||||
|
@ -8335,8 +8448,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 session"); } else { lastAccess += nobreak(format("{0} sessions", sessions)); }
|
||||
} else {
|
||||
|
@ -9540,7 +9653,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');
|
||||
|
@ -9567,6 +9680,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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue