public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Fiona Ebner <f.ebner@proxmox.com>
To: Proxmox VE development discussion <pve-devel@lists.proxmox.com>,
	Markus Frank <m.frank@proxmox.com>
Subject: Re: [pve-devel] [PATCH manager v2 3/4] ui: form: add hideFormatWhenStorageEmpty option to DiskStorageSelector
Date: Wed, 5 Mar 2025 13:49:57 +0100	[thread overview]
Message-ID: <a56e1eef-3a41-4516-bb5c-c0a99ac91dbf@proxmox.com> (raw)
In-Reply-To: <20250212130229.249568-4-m.frank@proxmox.com>

"form:" by itself doesn't provide much information as a prefix

Am 12.02.25 um 14:02 schrieb Markus Frank:
> Prerequisite for "ui: window: add diskformat option to restore window"
> 
> The hide condition is copied from the format selector item in the same
> file.
> 
> Signed-off-by: Markus Frank <m.frank@proxmox.com>
> ---
>  www/manager6/form/DiskStorageSelector.js | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/www/manager6/form/DiskStorageSelector.js b/www/manager6/form/DiskStorageSelector.js
> index 0ef48f51..e2064934 100644
> --- a/www/manager6/form/DiskStorageSelector.js
> +++ b/www/manager6/form/DiskStorageSelector.js
> @@ -30,6 +30,7 @@ Ext.define('PVE.form.DiskStorageSelector', {
>  
>      // hides the format field (e.g. for TPM state)
>      hideFormat: false,
> +    hideFormatWhenStorageEmpty: false,
>  
>      // sets the initial size value
>      // string because else we get a type confusion
> @@ -41,12 +42,20 @@ Ext.define('PVE.form.DiskStorageSelector', {
>  	var hdfilesel = me.getComponent('hdimage');
>  	var hdsizesel = me.getComponent('disksize');
>  
> +	// This is needed to make the format selector visible
> +	// after it has been hidden because of hideFormatWhenStorageEmpty.
> +	let hideFormatCondition = me.hideFormat || me.storageContent === 'rootdir';
> +	formatsel.setVisible(!hideFormatCondition);

Nit: could be moved further down in the code for better grouping things
to here:

> 	formatsel.setDisabled(me.hideFormat || Ext.Object.getSize(validFormats) <= 1);
> 	formatsel.setValue(selectFormat);

or is there a reason that wouldn't work?

Looking at the next patch, it seems like you manually hide it at first
from the use-site. Maybe we should do it in initComponent() instead?
I.e. also hide if me.hideFormatWhenStorageEmpty && !me.autoSelect.

Going for a view model and bindings might be best to modernize the
component a bit and make such things easier, but not a blocker from my side.


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


  reply	other threads:[~2025-03-05 12:50 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-12 13:02 [pve-devel] [PATCH storage/qemu-server/manager v2 0/4] Restore with a specified file format Markus Frank
2025-02-12 13:02 ` [pve-devel] [PATCH storage v2 1/4] add standard option for VM disk formats in file-based storages Markus Frank
2025-03-05 12:49   ` Fiona Ebner
2025-02-12 13:02 ` [pve-devel] [PATCH qemu-server v2 2/4] fix 4888: qmrestore: add disk-format option Markus Frank
2025-03-05 12:49   ` Fiona Ebner
2025-02-12 13:02 ` [pve-devel] [PATCH manager v2 3/4] ui: form: add hideFormatWhenStorageEmpty option to DiskStorageSelector Markus Frank
2025-03-05 12:49   ` Fiona Ebner [this message]
2025-02-12 13:02 ` [pve-devel] [PATCH manager v2 4/4] ui: window: add disk-format option to the restore window Markus Frank
2025-03-05 12:49   ` Fiona Ebner

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=a56e1eef-3a41-4516-bb5c-c0a99ac91dbf@proxmox.com \
    --to=f.ebner@proxmox.com \
    --cc=m.frank@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