StatusView: fix usage calculation for fields without valid values

Sometimes, total can be zero (e.g. for swap when it's not used), which
leads to the usage being NaN. This led to the progressbar not being
updated for InfoWidgets, leaving a spurious '0%' as text.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
This commit is contained in:
Dominik Csapak 2022-03-10 15:31:37 +01:00 committed by Thomas Lamprecht
parent 5c7c81d39b
commit 8315a64201

View File

@ -47,7 +47,7 @@ Ext.define('Proxmox.panel.StatusView', {
*/ */
if (used.used !== undefined && if (used.used !== undefined &&
used.total !== undefined) { used.total !== undefined) {
return used.used/used.total; return used.total > 0 ? used.used/used.total : 0;
} }
} }