1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-07-24 15:59:41 +02:00

fix(container-stat): fix cpu/mem charts on Windows containers

* Fixing the CPU and Memory charts on Windows containers

* Fixing the CPU and Memory charts on Windows containers
This commit is contained in:
Yassir Hannoun 2018-11-08 01:31:33 +01:00 committed by Anthony Lapenna
parent 55b50c2a49
commit 309620545c
3 changed files with 42 additions and 17 deletions

View file

@ -63,9 +63,17 @@ function ContainerViewModel(data) {
}
function ContainerStatsViewModel(data) {
this.Date = data.read;
this.MemoryUsage = data.memory_stats.usage - data.memory_stats.stats.cache;
this.MemoryCache = data.memory_stats.stats.cache;
this.read = data.read;
this.preread = data.preread;
if(data.memory_stats.privateworkingset !== undefined) { // Windows
this.MemoryUsage = data.memory_stats.privateworkingset;
this.MemoryCache = 0;
this.NumProcs = data.num_procs;
this.isWindows = true;
} else { // Linux
this.MemoryUsage = data.memory_stats.usage - data.memory_stats.stats.cache;
this.MemoryCache = data.memory_stats.stats.cache;
}
this.PreviousCPUTotalUsage = data.precpu_stats.cpu_usage.total_usage;
this.PreviousCPUSystemUsage = data.precpu_stats.system_cpu_usage;
this.CurrentCPUTotalUsage = data.cpu_stats.cpu_usage.total_usage;