[pve-devel] [PATCH manager 11/12] fix #4225: ui: qemu: cdedit: enable required checkbox for isos

Daniel Herzig d.herzig at proxmox.com
Fri Oct 25 17:02:42 CEST 2024


Enables the 'required' checkbox for the IsoSelector.
If the parameter is not set, the backend will use the default (set to
1).

Behaviour:
* Only send parameter if not default (required=0)
* Checked if parameter is missing (default)
* Unchecked when adding a new CD-ROM

Signed-off-by: Daniel Herzig <d.herzig at proxmox.com>
---
 www/manager6/qemu/CDEdit.js | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/www/manager6/qemu/CDEdit.js b/www/manager6/qemu/CDEdit.js
index 3cc16205..9f518f68 100644
--- a/www/manager6/qemu/CDEdit.js
+++ b/www/manager6/qemu/CDEdit.js
@@ -12,6 +12,7 @@ Ext.define('PVE.qemu.CDInputPanel', {
 	me.drive.media = 'cdrom';
 	if (values.mediaType === 'iso') {
 	    me.drive.file = values.cdimage;
+	    me.drive.required = values.required ? undefined : '0';
 	} else if (values.mediaType === 'cdrom') {
 	    me.drive.file = 'cdrom';
 	} else {
@@ -44,6 +45,9 @@ Ext.define('PVE.qemu.CDInputPanel', {
 	} else {
 	    values.mediaType = 'iso';
 	    values.cdimage = drive.file;
+	    if (drive.required === '1' || drive.required === undefined) {
+		values.required = '1';
+	    }
 	}
 
 	me.drive = drive;
@@ -88,6 +92,7 @@ Ext.define('PVE.qemu.CDInputPanel', {
 			cdImageField.validate();
 		    } else {
 			cdImageField.reset();
+			delete me.drive.required;
 		    }
 		},
 	    },
@@ -98,6 +103,7 @@ Ext.define('PVE.qemu.CDInputPanel', {
 	    nodename: me.nodename,
 	    insideWizard: me.insideWizard,
 	    name: 'cdimage',
+	    showRequired: true,
 	});
 
 	items.push(me.isosel);
-- 
2.39.5





More information about the pve-devel mailing list