public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Thomas Lamprecht <t.lamprecht@proxmox.com>
To: Proxmox VE development discussion <pve-devel@lists.proxmox.com>,
	Dominik Csapak <d.csapak@proxmox.com>
Subject: Re: [pve-devel] [PATCH manager] ui: panel/GuestStatusView: readd necessary xtypes
Date: Fri, 25 Jun 2021 09:14:31 +0200	[thread overview]
Message-ID: <d5e19e52-a6fb-864d-35b5-8495868957d4@proxmox.com> (raw)
In-Reply-To: <20210624151139.23052-1-d.csapak@proxmox.com>

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





      reply	other threads:[~2021-06-25  7:15 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-24 15:11 Dominik Csapak
2021-06-25  7:14 ` Thomas Lamprecht [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d5e19e52-a6fb-864d-35b5-8495868957d4@proxmox.com \
    --to=t.lamprecht@proxmox.com \
    --cc=d.csapak@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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