all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Fabian Ebner <f.ebner@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH manager 2/2] ui: disk storage selector: support storage with multiple formats without qcow2
Date: Thu, 17 Mar 2022 09:37:48 +0100	[thread overview]
Message-ID: <20220317083748.16718-2-f.ebner@proxmox.com> (raw)
In-Reply-To: <20220317083748.16718-1-f.ebner@proxmox.com>

For future or external storages where the assumption "multiple formats implies
qcow2 is supported" doesn't hold.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
---
 www/manager6/form/DiskStorageSelector.js | 19 +++++++++++++------
 1 file changed, 13 insertions(+), 6 deletions(-)

diff --git a/www/manager6/form/DiskStorageSelector.js b/www/manager6/form/DiskStorageSelector.js
index 14a678b7..abd46deb 100644
--- a/www/manager6/form/DiskStorageSelector.js
+++ b/www/manager6/form/DiskStorageSelector.js
@@ -57,17 +57,24 @@ Ext.define('PVE.form.DiskStorageSelector', {
 	    return;
 	}
 
-	var selectformat = false;
+	let validFormats = {};
+	let selectFormat = 'raw';
 	if (rec.data.format) {
-	    var format = rec.data.format[0]; // 0 is the formats, 1 the default in the backend
-	    delete format.subvol; // we never need subvol in the gui
-	    selectformat = Ext.Object.getSize(format) > 1;
+	    validFormats = rec.data.format[0]; // 0 is the formats, 1 the default in the backend
+	    delete validFormats.subvol; // we never need subvol in the gui
+	    if (validFormats.qcow2) {
+		selectFormat = 'qcow2';
+	    } else if (validFormats.raw) {
+		selectFormat = 'raw';
+	    } else {
+		selectFormat = rec.data.format[1];
+	    }
 	}
 
 	var select = !!rec.data.select_existing && !me.hideSelection;
 
-	formatsel.setDisabled(!selectformat || me.hideFormat);
-	formatsel.setValue(selectformat ? 'qcow2' : 'raw');
+	formatsel.setDisabled(me.hideFormat || Ext.Object.getSize(validFormats) <= 1);
+	formatsel.setValue(selectFormat);
 
 	hdfilesel.setDisabled(!select);
 	hdfilesel.setVisible(select);
-- 
2.30.2





  reply	other threads:[~2022-03-17  8:37 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-17  8:37 [pve-devel] [PATCH manager 1/2] ui: disk storage selector: never send format when hideFormat is true Fabian Ebner
2022-03-17  8:37 ` Fabian Ebner [this message]
2022-04-20 13:02 ` [pve-devel] applied-series: " Thomas Lamprecht

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=20220317083748.16718-2-f.ebner@proxmox.com \
    --to=f.ebner@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal