From fcf103ffd435cefa17e6cf0a9eec520716b314e2 Mon Sep 17 00:00:00 2001 From: Dominik Csapak Date: Fri, 26 Jul 2024 09:40:17 +0200 Subject: [PATCH] ui: resource mappings: fix editing of mapping for non first node 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 --- 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); + } },