From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <t.lamprecht@proxmox.com>
Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature RSA-PSS (2048 bits))
 (No client certificate requested)
 by lists.proxmox.com (Postfix) with ESMTPS id 6A93E70AFA
 for <pve-devel@lists.proxmox.com>; Fri, 25 Jun 2021 09:15:13 +0200 (CEST)
Received: from firstgate.proxmox.com (localhost [127.0.0.1])
 by firstgate.proxmox.com (Proxmox) with ESMTP id 5B3DF13E88
 for <pve-devel@lists.proxmox.com>; Fri, 25 Jun 2021 09:14:43 +0200 (CEST)
Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com
 [94.136.29.106])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256)
 (No client certificate requested)
 by firstgate.proxmox.com (Proxmox) with ESMTPS id C273213E6A
 for <pve-devel@lists.proxmox.com>; Fri, 25 Jun 2021 09:14:42 +0200 (CEST)
Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1])
 by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 8E20246798
 for <pve-devel@lists.proxmox.com>; Fri, 25 Jun 2021 09:14:42 +0200 (CEST)
Message-ID: <d5e19e52-a6fb-864d-35b5-8495868957d4@proxmox.com>
Date: Fri, 25 Jun 2021 09:14:31 +0200
MIME-Version: 1.0
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:90.0) Gecko/20100101
 Thunderbird/90.0
Content-Language: en-US
To: Proxmox VE development discussion <pve-devel@lists.proxmox.com>,
 Dominik Csapak <d.csapak@proxmox.com>
References: <20210624151139.23052-1-d.csapak@proxmox.com>
From: Thomas Lamprecht <t.lamprecht@proxmox.com>
In-Reply-To: <20210624151139.23052-1-d.csapak@proxmox.com>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
X-SPAM-LEVEL: Spam detection results:  0
 AWL 0.622 Adjusted score from AWL reputation of From: address
 BAYES_00                 -1.9 Bayes spam probability is 0 to 1%
 KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment
 NICE_REPLY_A           -0.001 Looks like a legit reply (A)
 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: panel/GuestStatusView: readd
 necessary xtypes
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>
X-List-Received-Date: Fri, 25 Jun 2021 07:15:13 -0000

On 24.06.21 17:11, Dominik Csapak wrote:
> currently, cbind only applies properties on objects which have
> an 'xtype' property.
> 
> commit 38e6634a8fe8c11ec23e555ce55bc1972ccb5ea1
> removed those, thinking the xtype in the 'defaults' is enough
> 
> add them back, noting that cbind does need it, to prevent removal
> 
> Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
> ---
> we should probably cherry-pick it into stable-6 as well
> 

would have worked but I ran into such issues a few times already during development,
so after our off-list discussion and checking out my git stash I found a fix for cbind
itself I had lying around for a bit, so I applied that instead as it should make this
easier/more flexible in general

Thanks nonetheless for the quick fix.

----8<----
>From 5995eddcc48ddb63d235905cd0a948f38c5e9164 Mon Sep 17 00:00:00 2001
From: Thomas Lamprecht <t.lamprecht@proxmox.com>
Date: Fri, 25 Jun 2021 08:42:39 +0200
Subject: [PATCH] cbind mixin: also descend in elements with an cbind property

Not only into those with an xtype one, as we can either have a
implicit default xtype (e.g., in tbars for buttons, or set explicitly
via the `defaults` mechanism) or want to apply cbinds to stores or
other objects.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
---
 src/mixin/CBind.js | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/mixin/CBind.js b/src/mixin/CBind.js
index afef53a..8b4153c 100644
--- a/src/mixin/CBind.js
+++ b/src/mixin/CBind.js
@@ -88,7 +88,7 @@ Ext.define('Proxmox.Mixin.CBind', {
 	    found = false;
 	    for (i = 0; i < arrayLength; i++) {
 		el = org[i];
-		if (el.constructor === Object && el.xtype) {
+		if (el.constructor === Object && (el.xtype || el.cbind)) {
 		    found = true;
 		    break;
 		}
@@ -99,7 +99,7 @@ Ext.define('Proxmox.Mixin.CBind', {
 	    copy = [];
 	    for (i = 0; i < arrayLength; i++) {
 		el = org[i];
-		if (el.constructor === Object && el.xtype) {
+		if (el.constructor === Object && (el.xtype || el.cbind)) {
 		    elcopy = cloneTemplateObject(el);
 		    if (elcopy.cbind) {
 			applyCBind(elcopy);
@@ -123,7 +123,7 @@ Ext.define('Proxmox.Mixin.CBind', {
 		    res[prop] = el;
 		    continue;
 		}
-		if (el.constructor === Object && el.xtype) {
+		if (el.constructor === Object && (el.xtype || el.cbind)) {
 		    copy = cloneTemplateObject(el);
 		    if (copy.cbind) {
 			applyCBind(copy);
@@ -146,7 +146,7 @@ Ext.define('Proxmox.Mixin.CBind', {
 		el = me[prop];
 		if (el === undefined || el === null) continue;
 		if (typeof el === 'object' && el.constructor === Object) {
-		    if (el.xtype && prop !== 'config') {
+		    if ((el.xtype || el.cbind) && prop !== 'config') {
 			me[prop] = cloneTemplateObject(el);
 		    }
 		} else if (el.constructor === Array) {
-- 
2.30.2