From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) by lore.proxmox.com (Postfix) with ESMTPS id 3EFFF1FF13A for ; Wed, 27 May 2026 17:45:21 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 526D7971; Wed, 27 May 2026 17:45:18 +0200 (CEST) Date: Wed, 27 May 2026 17:44:43 +0200 From: Stoiko Ivanov To: David Gonzalo Rodriguez Subject: Re: [PATCH] Signed-off-by: David Gonzalo Rodriguez Message-ID: <20260527174443.553de27e@rosa.proxmox.com> In-Reply-To: <20260527144143.860766-1-z80user@gmail.com> References: <20260527144143.860766-1-z80user@gmail.com> X-Mailer: Claws Mail 4.3.1 (GTK 3.24.49; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1779896657575 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.088 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [proxmox.com] Message-ID-Hash: SVYTMH5G5V6UPNW5HECFNJABT4RWTWAU X-Message-ID-Hash: SVYTMH5G5V6UPNW5HECFNJABT4RWTWAU X-MailFrom: s.ivanov@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: pve-devel@lists.proxmox.com X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox VE development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Hi, Thanks for sending a contribution to Proxmox VE. I did not check the code closely - just a few remarks on collaborating via our mailing-lists: * please consider subscribing to the pve-devel list [0] - else each of your posts will be held for moderation, and your might miss replies, if someone replies only to the list) * our developer documentation has some pointers for commit-messages (e.g. adding the repository name next to PATCH, using a short information in the first line, and adding Signed-off-by at the end): https://pve.proxmox.com/wiki/Developer_Documentation#Commits_and_Commit_Messages * we would need a CLA from you in order to consider your patches for inclusion: https://pve.proxmox.com/wiki/Developer_Documentation#Software_License_and_Copyright Thanks! [0] https://lists.proxmox.com/postorius/lists/pve-devel.lists.proxmox.com/ On Wed, 27 May 2026 16:41:43 +0200 David Gonzalo Rodriguez wrote: > Fix the unit to show GiB on the user interface as default, it will show > "useSI" on the right units if is setup on the variable as true or false > The use a ternary expression here would produce incorrect results. > usually "useSI" is an object instead true or false. > --- > pve-common | 1 + > src/Utils.js | 22 ++++++++++++++++++++-- > 2 files changed, 21 insertions(+), 2 deletions(-) > create mode 160000 pve-common > > diff --git a/pve-common b/pve-common > new file mode 160000 > index 0000000..971bb05 > --- /dev/null > +++ b/pve-common > @@ -0,0 +1 @@ > +Subproject commit 971bb05bf9ef4897083d8366e459a92b2b36c763 this seems a bit odd/maybe a mistakenly added `git submodule`? > diff --git a/src/Utils.js b/src/Utils.js > index 7643316..71e027a 100644 > --- a/src/Utils.js > +++ b/src/Utils.js > @@ -808,17 +808,35 @@ Ext.define('Proxmox.Utils', { > ]; > let order = 0; > let commaDigits = 2; > - const baseValue = useSI ? 1000 : 1024; > + > +// Do not use a ternary expression here and on the next check. > +// `useSI` may not exist and implicit truthy/falsy conversion > +// would produce incorrect results. > + let baseValue = 1024; > + if (useSI === true) { > + baseValue = 1000; > + } > + if (useSI === false) { > + baseValue = 1024; > + } > while (size >= baseValue && order < unitsSI.length) { > size = size / baseValue; > order++; > } > > - let unit = useSI ? unitsSI[order] : unitsIEC[order]; > + unit = unitsIEC[order]; > + if (useSI === true) { > + unit = unitsSI[order]; > + } > + if (useSI === false) { > + unit = unitsIEC[order]; > + } > if (order === 0) { > commaDigits = 0; > } > return `${size.toFixed(commaDigits)} ${unit}`; > + > + > }, > > SizeUnits: {