public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH manager 1/2] ui: disk storage selector: never send format when hideFormat is true
@ 2022-03-17  8:37 Fabian Ebner
  2022-03-17  8:37 ` [pve-devel] [PATCH manager 2/2] ui: disk storage selector: support storage with multiple formats without qcow2 Fabian Ebner
  2022-04-20 13:02 ` [pve-devel] applied-series: [PATCH manager 1/2] ui: disk storage selector: never send format when hideFormat is true Thomas Lamprecht
  0 siblings, 2 replies; 3+ messages in thread
From: Fabian Ebner @ 2022-03-17  8:37 UTC (permalink / raw)
  To: pve-devel

The backend will pick an appropriate format when nothing is specified. The
comment made it sound like 'raw' would be sent, but that didn't actually happen
on file-based storages, and now no format is sent, so adapt the comment too.

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

diff --git a/www/manager6/form/DiskStorageSelector.js b/www/manager6/form/DiskStorageSelector.js
index ac6b064f..14a678b7 100644
--- a/www/manager6/form/DiskStorageSelector.js
+++ b/www/manager6/form/DiskStorageSelector.js
@@ -28,7 +28,7 @@ Ext.define('PVE.form.DiskStorageSelector', {
     // hides the size field (e.g, for the efi disk dialog)
     hideSize: false,
 
-    // hides the format field (e.g. for TPM state), always assumes 'raw'
+    // hides the format field (e.g. for TPM state)
     hideFormat: false,
 
     // sets the initial size value
@@ -66,7 +66,7 @@ Ext.define('PVE.form.DiskStorageSelector', {
 
 	var select = !!rec.data.select_existing && !me.hideSelection;
 
-	formatsel.setDisabled(!selectformat);
+	formatsel.setDisabled(!selectformat || me.hideFormat);
 	formatsel.setValue(selectformat ? 'qcow2' : 'raw');
 
 	hdfilesel.setDisabled(!select);
-- 
2.30.2





^ permalink raw reply	[flat|nested] 3+ messages in thread

* [pve-devel] [PATCH manager 2/2] ui: disk storage selector: support storage with multiple formats without qcow2
  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
  2022-04-20 13:02 ` [pve-devel] applied-series: [PATCH manager 1/2] ui: disk storage selector: never send format when hideFormat is true Thomas Lamprecht
  1 sibling, 0 replies; 3+ messages in thread
From: Fabian Ebner @ 2022-03-17  8:37 UTC (permalink / raw)
  To: pve-devel

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





^ permalink raw reply	[flat|nested] 3+ messages in thread

* [pve-devel] applied-series: [PATCH manager 1/2] ui: disk storage selector: never send format when hideFormat is true
  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 ` [pve-devel] [PATCH manager 2/2] ui: disk storage selector: support storage with multiple formats without qcow2 Fabian Ebner
@ 2022-04-20 13:02 ` Thomas Lamprecht
  1 sibling, 0 replies; 3+ messages in thread
From: Thomas Lamprecht @ 2022-04-20 13:02 UTC (permalink / raw)
  To: Proxmox VE development discussion, Fabian Ebner

On 17.03.22 09:37, Fabian Ebner wrote:
> The backend will pick an appropriate format when nothing is specified. The
> comment made it sound like 'raw' would be sent, but that didn't actually happen
> on file-based storages, and now no format is sent, so adapt the comment too.
> 
> Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
> ---
>  www/manager6/form/DiskStorageSelector.js | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
>

applied series, thanks!




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-04-20 13:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 ` [pve-devel] [PATCH manager 2/2] ui: disk storage selector: support storage with multiple formats without qcow2 Fabian Ebner
2022-04-20 13:02 ` [pve-devel] applied-series: [PATCH manager 1/2] ui: disk storage selector: never send format when hideFormat is true Thomas Lamprecht

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