From: Dominik Csapak <d.csapak@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH widget-toolkit] StatusView: fix usage calculation for fields without valid values
Date: Thu, 10 Mar 2022 15:31:37 +0100 [thread overview]
Message-ID: <20220310143137.1384472-1-d.csapak@proxmox.com> (raw)
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>
---
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;
}
}
--
2.30.2
next reply other threads:[~2022-03-10 14:32 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-10 14:31 Dominik Csapak [this message]
2022-03-11 9:13 ` Matthias Heiserer
2022-03-11 9:52 ` Dominik Csapak
2022-04-26 6:29 ` [pve-devel] applied: " Thomas Lamprecht
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220310143137.1384472-1-d.csapak@proxmox.com \
--to=d.csapak@proxmox.com \
--cc=pve-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal