Started work on process details.
Ylian Saint-Hilaire committed
Jun 13, 2021 at 14:52 UTC
3322b8754c45de64fed4ef2ff7ec3dbba0c744ca
2 files changed
+38
-2
agents/meshcore.js
+27
@@ -920,6 +920,33 @@ function handleServerCommand(data) {
920
}
921
break;
922
}
923
+ case 'psinfo': {
924
+ // Requestion details information about a process
925
+ if (data.pid) {
926
+ var info = {}; // TODO: Replace with real data. Feel free not to give all values if not available.
927
+ info.processName = "dummydata";
928
+ info.privateMemorySize = 123;
929
+ info.virtualMemorySize = 123;
930
+ info.workingSet = 123;
931
+ info.totalProcessorTime = 123; // Seconds
932
+ info.userProcessorTime = 123; // Seconds
933
+ info.startTime = "2012-12-30T23:59:59.000Z"; // Time in UTC ISO format
934
+ info.sessionId = 123;
935
+ info.privilegedProcessorTime = 123; // Seconds
936
+ info.PriorityBoostEnabled = true;
937
+ info.peakWorkingSet = 123;
938
+ info.peakVirtualMemorySize = 123;
939
+ info.peakPagedMemorySize = 123;
940
+ info.pagedSystemMemorySize = 123;
941
+ info.pagedMemorySize = 123;
942
+ info.nonpagedSystemMemorySize = 123;
943
+ info.mainWindowTitle = "dummydata";
944
+ info.machineName = "dummydata"; // Only set this if machine name is not "."
945
+ info.handleCount = 123;
946
+ mesh.SendCommand({ action: 'msg', type: 'psinfo', pid: data.pid, sessionid: data.sessionid, value: info });
947
+ }
948
+ break;
949
+ }
950
case 'pskill': {
951
// Kill a process
952
if (data.value) {
views/default.handlebars
+11
-2
@@ -2343,6 +2343,10 @@
2343
QH('p11DeskSessionSelector', x);
2344
QV('p11DeskSessionSelector', true);
2345
}
2346
+ } else if (message.type == 'psinfo') {
2347
+ if (xxdialogTag == ('ps|' + message.nodeid + '|' + message.pid)) {
2348
+ console.log('aa', message);
2349
+ }
2350
}
2351
}
2352
} else {
@@ -8484,13 +8488,18 @@
8488
for (var i in p) {
8489
if (p[i].p != 0) {
8490
var c = p[i].c;
8487
- if (c.length > 30) { c = '<span title="' + EscapeHtml(c) + '">' + EscapeHtml(c.substring(0,30)) + '...</span>' } else { c = EscapeHtml(c); }
8488
- 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>';
8491
+ if (c.length > 30) { c = '<span onclick=showProcessDetails(' + p[i].p + ') title="' + EscapeHtml(c) + '">' + EscapeHtml(c.substring(0,30)) + '...</span>' } else { c = EscapeHtml(c); }
8492
+ 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>';
8493
}
8494
}
8495
QH('DeskToolsProcesses', x);
8496
}
8497
}
8498
+ function showProcessDetails(pid) {
8499
+ if (xxdialogMode) return;
8500
+ setDialogMode(2, format("Process Details, #{0}", pid), 1, null, "Requesting details...", 'ps|' + currentNode._id + '|' + pid);
8501
+ meshserver.send({ action: 'msg', type: 'psinfo', nodeid: currentNode._id, pid: pid });
8502
+ }
8503
function showDeskToolsServices(message) {
8504
deskTools.smsg = message;
8505
if (message == null) { QH('DeskToolsProcesses', ''); return; }