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 v2 manager 2/2] ui: ContentView: don't show size if it is -1
Date: Wed, 14 Jun 2023 13:10:22 +0200	[thread overview]
Message-ID: <20230614111022.1432946-2-a.lauterer@proxmox.com> (raw)
In-Reply-To: <20230614111022.1432946-1-a.lauterer@proxmox.com>

If a disk image reports a size of '-1', something is most likely amiss.
The RBD storage plugin for example returns it, if the image is broken
and only remnants remain.

In such a situation, instead of showing '-1 B', we bette show nothing.

Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
---
This patch is not necessary, but I think will make it nicer to look at
and see broken images.

changes since v1:
instead of changing the size formatter in the widget toolkit, we handle
the case of size=-1 in the renderer directly

 www/manager6/storage/ContentView.js | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/www/manager6/storage/ContentView.js b/www/manager6/storage/ContentView.js
index 2761b48e..29926612 100644
--- a/www/manager6/storage/ContentView.js
+++ b/www/manager6/storage/ContentView.js
@@ -182,7 +182,12 @@ Ext.define('PVE.storage.ContentView', {
 	    'size': {
 		header: gettext('Size'),
 		width: 100,
-		renderer: Proxmox.Utils.format_size,
+		renderer: function(size) {
+		    if (Number(size) === -1) {
+			return '';
+		    }
+		    return Proxmox.Utils.format_size(size);
+		},
 		dataIndex: 'size',
 	    },
 	};
-- 
2.39.2





  reply	other threads:[~2023-06-14 11:10 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-14 11:10 [pve-devel] [PATCH v2 storage 1/2] rbd: improve handling of missing images Aaron Lauterer
2023-06-14 11:10 ` Aaron Lauterer [this message]
2023-07-18  7:26 ` Aaron Lauterer
2023-08-21 15:05 ` Fiona Ebner
2023-08-22  9:42   ` 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=20230614111022.1432946-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