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 <[email protected]>
---
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



_______________________________________________
pve-devel mailing list
[email protected]
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to