The API returns an object where a format can map to 0 (unsupported) or
1 (supported). However, when deciding whether to disable the format
selector by counting the number of valid formats, the GUI only took
the number of entries into account, not the actual values, so it would
show the format selector even though there is only one entry with
value 1. Fix this by taking the values into account when counting the
number of valid formats.

Signed-off-by: Friedrich Weber <f.we...@proxmox.com>
---
 www/manager6/form/DiskStorageSelector.js | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/www/manager6/form/DiskStorageSelector.js 
b/www/manager6/form/DiskStorageSelector.js
index 3e964315..7c0882a5 100644
--- a/www/manager6/form/DiskStorageSelector.js
+++ b/www/manager6/form/DiskStorageSelector.js
@@ -73,7 +73,9 @@ Ext.define('PVE.form.DiskStorageSelector', {
 
         var select = !!rec.data.select_existing && !me.hideSelection;
 
-        formatsel.setDisabled(me.hideFormat || 
Ext.Object.getSize(validFormats) <= 1);
+        let numberOfValidFormats = Ext.Object.getValues(validFormats)
+            .filter(valid => !!valid).length;
+        formatsel.setDisabled(me.hideFormat || numberOfValidFormats <= 1);
         formatsel.setValue(selectFormat);
 
         hdfilesel.setDisabled(!select);
-- 
2.47.2



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to