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

fix(containers-stats): accessing a down container stats wont display a js error anymore (#2484)

This commit is contained in:
baron_l 2018-11-23 09:44:34 +01:00 committed by Anthony Lapenna
parent d03fd5805a
commit 5e49f934b9

View file

@ -71,8 +71,12 @@ function ContainerStatsViewModel(data) {
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;
if (data.memory_stats.stats === undefined || data.memory_stats.usage === undefined) {
this.MemoryUsage = this.MemoryCache = 0;
} else {
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;