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>,
	Stefan Sterz <s.sterz@proxmox.com>
Subject: Re: [pve-devel] [PATCH widget-toolkit v3] window: edit: avoid sharing custom config objects between subclasses
Date: Mon, 8 Apr 2024 14:36:34 +0200	[thread overview]
Message-ID: <868ec1d0-6c32-4fa6-8652-e80e985d077e@proxmox.com> (raw)
In-Reply-To: <D0EOBOELACGB.NW2O42WALZD6@proxmox.com>

Am 08/04/2024 um 12:36 schrieb Stefan Sterz:
> On Mon Apr 8, 2024 at 11:30 AM CEST, Friedrich Weber wrote:
>> +    constructor: function(conf) {
>> +	let me = this;
>> +	// make copies in order to prevent subclasses from accidentally writing
>> +	// to objects that are shared with other edit window subclasses
>> +	me.extraRequestParams = Object.assign({}, me.extraRequestParams);
>> +	me.submitOptions = Object.assign({}, me.submitOptions);
>> +	me.initConfig(conf);
>> +	me.callParent();
> 
> 
> so, this seems like a fix bug a) creates bug b) type of situation...
> this patch means that editing a pool allows changing the name suddenly,
> but since we don't support that in the backend, that just creates a new
> pool :/
> 
> this is due to the `editable` attribute depending on `isCreate`, which
> in turn depends on the configs poolid being set. to fix this, the config
> needs to also be passed to `callParent` so it can set the configurations
> there too. so this line should be:
> 
>     me.callParent([conf]);
> 
> sorry, could have noticed that earlier in my suggestion. also this needs
> to be an arrray as `callParent` expects a list of arguments to pass to
> parent's function and not the parameters themselves directly.

Using `me.callParent(arguments)` might be more proof to future changes and
arguments is an array (or well, iterator) already







  reply	other threads:[~2024-04-08 12:36 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-08  9:30 Friedrich Weber
2024-04-08 10:36 ` Stefan Sterz
2024-04-08 12:36   ` Thomas Lamprecht [this message]
2024-04-09  7:55     ` Friedrich Weber

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=868ec1d0-6c32-4fa6-8652-e80e985d077e@proxmox.com \
    --to=t.lamprecht@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    --cc=s.sterz@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