[pve-devel] [PATCH manager] ui: qemu pci edit: select correct radiobutton when editing

Dominik Csapak d.csapak at proxmox.com
Mon Apr 7 11:50:29 CEST 2025


This panel uses a view model for changing between mapping and raw for
disabling fields. Since the view model bindings take effect after
setVMConfig is called, the default value for 'isMapped' of true
overwrote the mode chosen from the config.

To fix that, set the value in the view model there too.

Additionally, check the 'mapped' radiobutton by default instead of
'raw', so that it is the same as the view model.

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 www/manager6/qemu/PCIEdit.js | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/www/manager6/qemu/PCIEdit.js b/www/manager6/qemu/PCIEdit.js
index 8f633cb6..fda41f50 100644
--- a/www/manager6/qemu/PCIEdit.js
+++ b/www/manager6/qemu/PCIEdit.js
@@ -9,6 +9,7 @@ Ext.define('PVE.qemu.PCIInputPanel', {
 	setVMConfig: function(vmconfig) {
 	    let me = this;
 	    let view = me.getView();
+	    let vm = me.getViewModel();
 	    me.vmconfig = vmconfig;
 
 	    let hostpci = me.vmconfig[view.confid] || '';
@@ -26,6 +27,7 @@ Ext.define('PVE.qemu.PCIInputPanel', {
 	    } else if (values.mapping) {
 		values.type = 'mapped';
 	    }
+	    vm.set('isMapped', values.type !== 'raw');
 
 	    values['x-vga'] = PVE.Parser.parseBoolean(values['x-vga'], 0);
 	    values.pcie = PVE.Parser.parseBoolean(values.pcie, 0);
@@ -180,6 +182,7 @@ Ext.define('PVE.qemu.PCIInputPanel', {
 		xtype: 'radiofield',
 		name: 'type',
 		inputValue: 'mapped',
+		checked: true,
 		boxLabel: gettext('Mapped Device'),
 		bind: {
 		    value: '{isMapped}',
@@ -205,7 +208,6 @@ Ext.define('PVE.qemu.PCIInputPanel', {
 		xtype: 'radiofield',
 		name: 'type',
 		inputValue: 'raw',
-		checked: true,
 		boxLabel: gettext('Raw Device'),
 	    },
 	    {
-- 
2.39.5





More information about the pve-devel mailing list