public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH manager v2] ui: resource mappings: fix editing of mapping for non first node
@ 2024-07-26  7:40 Dominik Csapak
  2024-07-26  9:10 ` [pve-devel] applied: " Fiona Ebner
  0 siblings, 1 reply; 2+ messages in thread
From: Dominik Csapak @ 2024-07-26  7:40 UTC (permalink / raw)
  To: pve-devel

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



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


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

end of thread, other threads:[~2024-07-26  9:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-07-26  7:40 [pve-devel] [PATCH manager v2] ui: resource mappings: fix editing of mapping for non first node Dominik Csapak
2024-07-26  9:10 ` [pve-devel] applied: " Fiona Ebner

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