Show apps using more than 1Gb within the selected period in system memory graph

This commit is contained in:
Johannes Zellner
2022-10-12 23:25:46 +02:00
parent c9a5e7216a
commit 813ad9f7cd
+14 -11
View File
@@ -204,18 +204,21 @@ angular.module('Application').controller('SystemController', ['$scope', '$locati
$scope.graphs[chartPropertyName] = new Chart(ctx, { type: 'line', data: graphData, options: options });
}
// var threshold = 1024 * 1024;
// var appsWithHighMemory = Object.keys(result.apps).map(function (appId) {
// result.apps[appId].id = appId;
// return result.apps[appId];
// }).filter(function (app) {
// if (!app.memory) return false; // not sure why we get empty objects
// return app.memory.datapoints.some(function (d) { return d[0] > threshold; });
// }).map(function (app) {
// return { data: app.memory, label: app.id };
// });
var threshold = 1024 * 1024 * 1024;
var appsWithHighMemory = Object.keys(result.apps).map(function (appId) {
result.apps[appId].id = appId;
var appsWithHighMemory = [];
var app = Client.getInstalledAppsByAppId()[appId];
if (!app) result.apps[appId].label = appId;
else result.apps[appId].label = app.label || app.fqdn;
return result.apps[appId];
}).filter(function (app) {
if (!app.memory) return false; // not sure why we get empty objects
return app.memory.datapoints.some(function (d) { return d[0] > threshold; });
}).map(function (app) {
return { data: app.memory, label: app.label };
});
fillGraph('#graphsCPUChart', [{ data: result.cpu, label: 'CPU' }], 'cpuChart', 100, 1);
fillGraph('#graphsSystemMemoryChart', [{ data: result.memory, label: 'Memory' }].concat(appsWithHighMemory), 'memoryChart', 1024 * 1024, Number.parseInt($scope.memory.memory / 1024 / 1024));