public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Dominik Csapak <d.csapak@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH manager] ui: qemu pci edit: select correct radiobutton when editing
Date: Mon,  7 Apr 2025 11:50:29 +0200	[thread overview]
Message-ID: <20250407095029.2950635-1-d.csapak@proxmox.com> (raw)

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@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



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


             reply	other threads:[~2025-04-07  9:50 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-07  9:50 Dominik Csapak [this message]
2025-04-07  9:54 ` [pve-devel] applied: " 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=20250407095029.2950635-1-d.csapak@proxmox.com \
    --to=d.csapak@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 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