[pve-devel] [PATCH manager v2] ui: resource mappings: fix editing of mapping for non first node

Dominik Csapak d.csapak at proxmox.com
Fri Jul 26 09:40:17 CEST 2024


when editing the pci mapping, we set the nodename of the pci/usbselector
to the selected node. At the same time we disable and hide the node
selector, but it still changes it's value to the 'first' node
(alphabetically sorted) and that triggers a change event.

To prevent that we accidentally set the node of the pci/usbselector
too, we need to check here if the field is disabled.

There seems to be a race when loading the nodes for the nodeselector
which leads to inconsistent behaviour, so this was only encountered for
the pciselector, but theoretically it could also happen for the
usbselector so adding that condition to both.

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
changes from v1:
* also fixed it for usbselector, but mention in the commit message that
  this is just a safety measure and was never encountered there

 www/manager6/window/PCIMapEdit.js | 6 ++++--
 www/manager6/window/USBMapEdit.js | 8 +++++---
 2 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/www/manager6/window/PCIMapEdit.js b/www/manager6/window/PCIMapEdit.js
index d43f04eb..faf58255 100644
--- a/www/manager6/window/PCIMapEdit.js
+++ b/www/manager6/window/PCIMapEdit.js
@@ -126,8 +126,10 @@ Ext.define('PVE.window.PCIMapEditWindow', {
 	    this.lookup('pciselector').setMdev(value);
 	},
 
-	nodeChange: function(_field, value) {
-	    this.lookup('pciselector').setNodename(value);
+	nodeChange: function(field, value) {
+	    if (!field.isDisabled()) {
+		this.lookup('pciselector').setNodename(value);
+	    }
 	},
 
 	pciChange: function(_field, value) {
diff --git a/www/manager6/window/USBMapEdit.js b/www/manager6/window/USBMapEdit.js
index 358f0778..69a40026 100644
--- a/www/manager6/window/USBMapEdit.js
+++ b/www/manager6/window/USBMapEdit.js
@@ -101,9 +101,11 @@ Ext.define('PVE.window.USBMapEditWindow', {
 	    usbsel.setDisabled(!value);
 	},
 
-	nodeChange: function(_field, value) {
-	    this.lookup('id').setNodename(value);
-	    this.lookup('path').setNodename(value);
+	nodeChange: function(field, value) {
+	    if (!field.isDisabled()) {
+		this.lookup('id').setNodename(value);
+		this.lookup('path').setNodename(value);
+	    }
 	},
 
 
-- 
2.39.2





More information about the pve-devel mailing list