From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <pve-devel-bounces@lists.proxmox.com>
Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9])
	by lore.proxmox.com (Postfix) with ESMTPS id CF75F1FF2C7
	for <inbox@lore.proxmox.com>; Wed, 24 Jul 2024 11:44:44 +0200 (CEST)
Received: from firstgate.proxmox.com (localhost [127.0.0.1])
	by firstgate.proxmox.com (Proxmox) with ESMTP id A284518839;
	Wed, 24 Jul 2024 11:45:17 +0200 (CEST)
Message-ID: <2933183f-8da4-42c6-9dbb-f7a20cd3d295@proxmox.com>
Date: Wed, 24 Jul 2024 11:44:39 +0200
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
To: Proxmox VE development discussion <pve-devel@lists.proxmox.com>,
 Dominik Csapak <d.csapak@proxmox.com>
References: <20240426071724.1126646-1-d.csapak@proxmox.com>
Content-Language: en-US
From: Fiona Ebner <f.ebner@proxmox.com>
In-Reply-To: <20240426071724.1126646-1-d.csapak@proxmox.com>
X-SPAM-LEVEL: Spam detection results:  0
 AWL -0.061 Adjusted score from AWL reputation of From: address
 BAYES_00                 -1.9 Bayes spam probability is 0 to 1%
 DMARC_MISSING             0.1 Missing DMARC policy
 KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment
 SPF_HELO_NONE           0.001 SPF: HELO does not publish an SPF Record
 SPF_PASS               -0.001 SPF: sender matches SPF record
Subject: Re: [pve-devel] [PATCH manager] ui: resource mappings: fix editing
 of mapping for non first node
X-BeenThere: pve-devel@lists.proxmox.com
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Proxmox VE development discussion <pve-devel.lists.proxmox.com>
List-Unsubscribe: <https://lists.proxmox.com/cgi-bin/mailman/options/pve-devel>, 
 <mailto:pve-devel-request@lists.proxmox.com?subject=unsubscribe>
List-Archive: <http://lists.proxmox.com/pipermail/pve-devel/>
List-Post: <mailto:pve-devel@lists.proxmox.com>
List-Help: <mailto:pve-devel-request@lists.proxmox.com?subject=help>
List-Subscribe: <https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel>, 
 <mailto:pve-devel-request@lists.proxmox.com?subject=subscribe>
Reply-To: Proxmox VE development discussion <pve-devel@lists.proxmox.com>
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: pve-devel-bounces@lists.proxmox.com
Sender: "pve-devel" <pve-devel-bounces@lists.proxmox.com>

Am 26.04.24 um 09:17 schrieb Dominik Csapak:
> when editing the pci mapping, we set the nodename of the pciselector
> 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.
> 

It's the first node that's not in the disallowedNodes AFAICT.

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

I wondered why the USB mappings don't suffer the same issue though. The
nodeChange() callback gets called with the correct value when editing
the mapping for a specific node, even though the node selector
definition and setting of disallowedNodes is the same as for the PCI
mappings.

Looking at Javascript backtraces, it seems like there might be some kind
of race going on (whether the me.getStore().load() for
PVE.form.NodeSelector finishes early or not), but not clue why it
happens for one, but not the other.

That said, adding a similar condition for the USB mappings would still
be good IMHO.

> Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>

Reviewed-by: Fiona Ebner <f.ebner@proxmox.com>

> ---
>  www/manager6/window/PCIMapEdit.js | 6 ++++--
>  1 file changed, 4 insertions(+), 2 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) {


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