On 10.03.2022 15:31, Dominik Csapak wrote:
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.csa...@proxmox.com>
---
src/panel/StatusView.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/panel/StatusView.js b/src/panel/StatusView.js
index 4a60dae..e2e81e2 100644
--- a/src/panel/StatusView.js
+++ b/src/panel/StatusView.js
@@ -47,7 +47,7 @@ Ext.define('Proxmox.panel.StatusView', {
*/
if (used.used !== undefined &&
used.total !== undefined) {
- return used.used/used.total;
+ return used.total > 0 ? used.used/used.total : 0;
}
}
When used.used or used.total is undefined, the function still returns
NaN. Have you considered using the or operator?
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel