public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Friedrich Weber <f.weber@proxmox.com>
To: Proxmox VE development discussion <pve-devel@lists.proxmox.com>,
	Stefan Sterz <s.sterz@proxmox.com>
Subject: Re: [pve-devel] [PATCH manager] ui: pool members: avoid setting request parameter for all edit windows
Date: Fri, 22 Mar 2024 15:39:19 +0100	[thread overview]
Message-ID: <276c489f-6f2e-4971-8df7-6d0d9268d168@proxmox.com> (raw)
In-Reply-To: <CZTJX9PIK57H.2BNBMZIYKTIFH@proxmox.com>

On 14/03/2024 15:43, Stefan Sterz wrote:
> On Wed Mar 13, 2024 at 9:44 AM CET, Friedrich Weber wrote:
>> Currently, after adding a storage to a pool, opening any edit window
>> will send a GET request with a superfluous `poolid` parameter and
>> cause a parameter verification error in the GUI. This breaks all edit
>> windows of the current session. A workaround is to reload the current
>> browser session.
>>
>> This happens because the `PVE.pool.AddStorage` component inadvertently
>> adds `poolid` to an `extraRequestParams` object that is shared by all
>> instances of `Proxmox.window.Edit`, affecting all edit windows in the
>> current session. Fix this by instead creating a new object that is
>> local to the component.
>>
>> Fixes: cd731902b7a724b1ab747276f9c6343734f1d8cb
>> Signed-off-by: Friedrich Weber <f.weber@proxmox.com>
>> ---
>>
>> Notes:
>>     To check if we have this problem at other places, I did a quick search
>>     for `extraRequestParams` in PVE+PBS: Seems like for all other usages,
>>     the object is created fresh already.
>>
>>  www/manager6/grid/PoolMembers.js | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/www/manager6/grid/PoolMembers.js b/www/manager6/grid/PoolMembers.js
>> index 75f20cab..61e27dff 100644
>> --- a/www/manager6/grid/PoolMembers.js
>> +++ b/www/manager6/grid/PoolMembers.js
>> @@ -123,7 +123,7 @@ Ext.define('PVE.pool.AddStorage', {
>>  	me.isAdd = true;
>>  	me.url = "/pools/";
>>  	me.method = 'PUT';
>> -	me.extraRequestParams.poolid = me.pool;
>> +	me.extraRequestParams = { 'poolid': me.pool };
> 
> note that you don't need to quote `poolid` here as it doesn't contain
> hyphens as such. quickly grepping over our codebase it seems that not
> quoting keys is preferred if it isn't needed

You're right, thanks for spotting this (my Python upbringing got the
better of me here).

I'll send a v2 that fixes this, and will probably include a patch that
rewrites the other occurrences of `extraRequestParams`.




      reply	other threads:[~2024-03-22 14:39 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-13  8:44 Friedrich Weber
2024-03-13  9:04 ` Friedrich Weber
2024-03-14 14:43 ` Stefan Sterz
2024-03-22 14:39   ` Friedrich Weber [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=276c489f-6f2e-4971-8df7-6d0d9268d168@proxmox.com \
    --to=f.weber@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