mirror of https://github.com/portainer/portainer
fix(containers-stats): accessing a down container stats wont display a js error anymore (#2484)
parent
d03fd5805a
commit
5e49f934b9
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue