public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Aaron Lauterer <a.lauterer@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH widget-toolkit 2/2] utils: format_size: show negative size as NA
Date: Wed, 19 Apr 2023 12:34:39 +0200	[thread overview]
Message-ID: <20230419103439.2111975-2-a.lauterer@proxmox.com> (raw)
In-Reply-To: <20230419103439.2111975-1-a.lauterer@proxmox.com>

Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
---

AFAIK we do not have negative sizes anywhere, and if, it is an
indication that something is wrong.

 src/Utils.js | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/Utils.js b/src/Utils.js
index ef72630..8cdbe86 100644
--- a/src/Utils.js
+++ b/src/Utils.js
@@ -688,6 +688,9 @@ utilities: {
     },
 
     format_size: function(size, useSI) {
+	if (size < 0) {
+	    return gettext("N/A");
+	}
 	let units = ['', 'K', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y'];
 	let order = 0;
 	const baseValue = useSI ? 1000 : 1024;
-- 
2.30.2





  reply	other threads:[~2023-04-19 10:34 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-19 10:34 [pve-devel] [PATCH storage 1/2] rbd: improve handling of missing images Aaron Lauterer
2023-04-19 10:34 ` Aaron Lauterer [this message]
2023-06-01 14:22   ` [pve-devel] [PATCH widget-toolkit 2/2] utils: format_size: show negative size as NA Thomas Lamprecht
2023-06-02 10:04     ` Aaron Lauterer
2023-05-26  8:34 ` [pve-devel] [PATCH storage 1/2] rbd: improve handling of missing images Aaron Lauterer

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=20230419103439.2111975-2-a.lauterer@proxmox.com \
    --to=a.lauterer@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal