public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Thomas Lamprecht <t.lamprecht@proxmox.com>
To: Proxmox VE development discussion <pve-devel@lists.proxmox.com>,
	Aaron Lauterer <a.lauterer@proxmox.com>
Subject: Re: [pve-devel] [PATCH widget-toolkit 2/2] utils: format_size: show negative size as NA
Date: Thu, 1 Jun 2023 16:22:46 +0200	[thread overview]
Message-ID: <c1edc7e6-f600-08b0-4800-465a6e932676@proxmox.com> (raw)
In-Reply-To: <20230419103439.2111975-2-a.lauterer@proxmox.com>

Am 19/04/2023 um 12:34 schrieb Aaron Lauterer:
> 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.

above belongs in the commit message, additionaly some background for why doing
this now (i.e., did you run into this or what made you make this change?)

> 
>  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");

catching this seems OK, but I'd rather just return the value then, as "N/A" (Not
Applicable) doesn't really makes sense here and just hides a potential underlying
problem.

> +	}
>  	let units = ['', 'K', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y'];
>  	let order = 0;
>  	const baseValue = useSI ? 1000 : 1024;





  reply	other threads:[~2023-06-01 14:22 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 ` [pve-devel] [PATCH widget-toolkit 2/2] utils: format_size: show negative size as NA Aaron Lauterer
2023-06-01 14:22   ` Thomas Lamprecht [this message]
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=c1edc7e6-f600-08b0-4800-465a6e932676@proxmox.com \
    --to=t.lamprecht@proxmox.com \
    --cc=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