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 v3 3/4] ui: add hideFormatWhenStorageEmpty option to DiskStorageSelector
Date: Wed, 21 May 2025 15:39:15 +0200	[thread overview]
Message-ID: <915ebb31-499d-4ca7-9aa8-9e9d2e2080c7@proxmox.com> (raw)
In-Reply-To: <20250307092546.102655-4-m.frank@proxmox.com>

Am 07.03.25 um 10:25 schrieb Markus Frank:
> Prerequisite for "ui: restore window: add diskformat option"
> 
> The hide condition is copied from the format selector item in the same
> file.
> 
> Signed-off-by: Markus Frank <m.frank@proxmox.com>

With the eslint issue below fixed:
Reviewed-by: Fiona Ebner <f.ebner@proxmox.com>

> ---
> v3:
> * added (me.hideFormatWhenStorageEmpty && !me.autoSelect) to the hide
> condition in initComponent instead of manually hiding it in the next
> patch (4/4).
> 
>  www/manager6/form/DiskStorageSelector.js | 12 +++++++++++-
>  1 file changed, 11 insertions(+), 1 deletion(-)
> 
> diff --git a/www/manager6/form/DiskStorageSelector.js b/www/manager6/form/DiskStorageSelector.js
> index 0ef48f51..37cb8b4b 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
> @@ -47,6 +48,9 @@ Ext.define('PVE.form.DiskStorageSelector', {
>  	    hdfilesel.setVisible(false);
>  
>  	    formatsel.setDisabled(true);
> +	    if (me.hideFormatWhenStorageEmpty) {
> +		formatsel.setVisible(false);
> +	    }
>  	    return;
>  	}
>  
> @@ -73,6 +77,11 @@ Ext.define('PVE.form.DiskStorageSelector', {
>  
>  	var select = !!rec.data.select_existing && !me.hideSelection;
>  
> +	// 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);
> +
>  	formatsel.setDisabled(me.hideFormat || Ext.Object.getSize(validFormats) <= 1);
>  	formatsel.setValue(selectFormat);
>  
> @@ -161,7 +170,8 @@ Ext.define('PVE.form.DiskStorageSelector', {
>  		fieldLabel: gettext('Format'),
>  		nodename: me.nodename,
>  		disabled: true,
> -		hidden: me.hideFormat || me.storageContent === 'rootdir',
> +		hidden: me.hideFormat || me.storageContent === 'rootdir'
> +		    || (me.hideFormatWhenStorageEmpty && !me.autoSelect),

eslint complains:
[./form/DiskStorageSelector.js]:
WARN: line 174 col 7: operator-linebreak - '||' should be placed at the
end of the line. (*)

>  		value: 'qcow2',
>  		allowBlank: false,
>  	    },



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


  reply	other threads:[~2025-05-21 13:39 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-07  9:25 [pve-devel] [PATCH storage/qemu-server/manager v3 0/4] restore with a specified file format Markus Frank
2025-03-07  9:25 ` [pve-devel] [PATCH storage v3 1/4] add standard option for VM disk formats in file-based storages Markus Frank
2025-05-21 13:09   ` Fiona Ebner
2025-03-07  9:25 ` [pve-devel] [PATCH qemu-server v3 2/4] fix 4888: qmrestore: add disk-format option Markus Frank
2025-05-21 13:09   ` Fiona Ebner
2025-03-07  9:25 ` [pve-devel] [PATCH manager v3 3/4] ui: add hideFormatWhenStorageEmpty option to DiskStorageSelector Markus Frank
2025-05-21 13:39   ` Fiona Ebner [this message]
2025-03-07  9:25 ` [pve-devel] [PATCH manager v3 4/4] ui: restore window: add disk-format option Markus Frank
2025-05-21 13:39   ` 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=915ebb31-499d-4ca7-9aa8-9e9d2e2080c7@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