1
0
Fork 0
mirror of https://github.com/Ylianst/MeshCentral.git synced 2025-02-12 11:01:52 +00:00

Started work on process details.

This commit is contained in:
Ylian Saint-Hilaire 2021-06-13 14:52:59 -07:00
parent f73cc51fcc
commit 3322b8754c
2 changed files with 38 additions and 2 deletions

View file

@ -920,6 +920,33 @@ function handleServerCommand(data) {
}
break;
}
case 'psinfo': {
// Requestion details information about a process
if (data.pid) {
var info = {}; // TODO: Replace with real data. Feel free not to give all values if not available.
info.processName = "dummydata";
info.privateMemorySize = 123;
info.virtualMemorySize = 123;
info.workingSet = 123;
info.totalProcessorTime = 123; // Seconds
info.userProcessorTime = 123; // Seconds
info.startTime = "2012-12-30T23:59:59.000Z"; // Time in UTC ISO format
info.sessionId = 123;
info.privilegedProcessorTime = 123; // Seconds
info.PriorityBoostEnabled = true;
info.peakWorkingSet = 123;
info.peakVirtualMemorySize = 123;
info.peakPagedMemorySize = 123;
info.pagedSystemMemorySize = 123;
info.pagedMemorySize = 123;
info.nonpagedSystemMemorySize = 123;
info.mainWindowTitle = "dummydata";
info.machineName = "dummydata"; // Only set this if machine name is not "."
info.handleCount = 123;
mesh.SendCommand({ action: 'msg', type: 'psinfo', pid: data.pid, sessionid: data.sessionid, value: info });
}
break;
}
case 'pskill': {
// Kill a process
if (data.value) {

View file

@ -2343,6 +2343,10 @@
QH('p11DeskSessionSelector', x);
QV('p11DeskSessionSelector', true);
}
} else if (message.type == 'psinfo') {
if (xxdialogTag == ('ps|' + message.nodeid + '|' + message.pid)) {
console.log('aa', message);
}
}
}
} else {
@ -8484,13 +8488,18 @@
for (var i in p) {
if (p[i].p != 0) {
var c = p[i].c;
if (c.length > 30) { c = '<span title="' + EscapeHtml(c) + '">' + EscapeHtml(c.substring(0,30)) + '...</span>' } else { c = EscapeHtml(c); }
x += '<div class=deskToolsBar><div style=width:50px;float:left;text-align:right;padding-right:5px>' + EscapeHtml(p[i].p) + '</div><a href=# style=float:right;padding-right:5px;cursor:pointer title="' + "Stop process" + '" onclick=\'return stopProcess(' + EscapeHtml(p[i].p) + ',"' + EscapeHtml(p[i].c) + '")\'><img width=10 height=10 src="images/trash.png"></a><div style=float:right;padding-right:5px>' + (p[i].u ? EscapeHtml(p[i].u) : '') + '</div><div>' + c + '</div></div>';
if (c.length > 30) { c = '<span onclick=showProcessDetails(' + p[i].p + ') title="' + EscapeHtml(c) + '">' + EscapeHtml(c.substring(0,30)) + '...</span>' } else { c = EscapeHtml(c); }
x += '<div onclick=showProcessDetails(' + p[i].p + ') class=deskToolsBar><div style=width:50px;float:left;text-align:right;padding-right:5px>' + EscapeHtml(p[i].p) + '</div><a href=# style=float:right;padding-right:5px;cursor:pointer title="' + "Stop process" + '" onclick=\'return stopProcess(' + EscapeHtml(p[i].p) + ',"' + EscapeHtml(p[i].c) + '")\'><img width=10 height=10 src="images/trash.png"></a><div style=float:right;padding-right:5px>' + (p[i].u ? EscapeHtml(p[i].u) : '') + '</div><div>' + c + '</div></div>';
}
}
QH('DeskToolsProcesses', x);
}
}
function showProcessDetails(pid) {
if (xxdialogMode) return;
setDialogMode(2, format("Process Details, #{0}", pid), 1, null, "Requesting details...", 'ps|' + currentNode._id + '|' + pid);
meshserver.send({ action: 'msg', type: 'psinfo', nodeid: currentNode._id, pid: pid });
}
function showDeskToolsServices(message) {
deskTools.smsg = message;
if (message == null) { QH('DeskToolsProcesses', ''); return; }