[pve-devel] [PATCH v2 manager 2/2] ui: ContentView: don't show size if it is -1

Aaron Lauterer a.lauterer at proxmox.com
Wed Jun 14 13:10:22 CEST 2023


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 at 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






More information about the pve-devel mailing list