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>,
	Philipp Hufnagl <p.hufnagl@proxmox.com>
Subject: Re: [pve-devel] [PATCH manager v8 2/2] fix #4849: ui: download to storage: automatically dectect and configure compression
Date: Tue, 26 Sep 2023 12:59:51 +0200	[thread overview]
Message-ID: <bee4e22a-0811-4842-9872-950b44035867@proxmox.com> (raw)
In-Reply-To: <20230921130917.2000926-3-p.hufnagl@proxmox.com>

Am 21/09/2023 um 15:09 schrieb Philipp Hufnagl:
> extends the download iso prompt with a "compression algorithm" drop down
> under advanced. User can configure there if a decompression algorithm
> should be used from the storage backend. The compression algorithm will
> be automatically guessed when calling query_url_metadata
> 
> Signed-off-by: Philipp Hufnagl <p.hufnagl@proxmox.com>
> ---
>  www/manager6/Makefile                       |  1 +
>  www/manager6/form/DecompressionSelector.js  | 13 +++++++++++++
>  www/manager6/window/DownloadUrlToStorage.js | 14 +++++++++++++-
>  3 files changed, 27 insertions(+), 1 deletion(-)
>  create mode 100644 www/manager6/form/DecompressionSelector.js
> 
> diff --git a/www/manager6/Makefile b/www/manager6/Makefile
> index 59a5d8a7..87e66ece 100644
> --- a/www/manager6/Makefile
> +++ b/www/manager6/Makefile
> @@ -34,6 +34,7 @@ JSSRC= 							\
>  	form/ContentTypeSelector.js			\
>  	form/ControllerSelector.js			\
>  	form/DayOfWeekSelector.js			\
> +	form/DecompressionSelector.js			\
>  	form/DiskFormatSelector.js			\
>  	form/DiskStorageSelector.js			\
>  	form/FileSelector.js				\
> diff --git a/www/manager6/form/DecompressionSelector.js b/www/manager6/form/DecompressionSelector.js
> new file mode 100644
> index 00000000..abd19316
> --- /dev/null
> +++ b/www/manager6/form/DecompressionSelector.js
> @@ -0,0 +1,13 @@
> +Ext.define('PVE.form.DecompressionSelector', {
> +    extend: 'Proxmox.form.KVComboBox',
> +    alias: ['widget.pveDecompressionSelector'],
> +    config: {
> +	deleteEmpty: false,
> +    },
> +    comboItems: [
> +		['__default__', Proxmox.Utils.NoneText],
> +		['lzo', 'LZO'],
> +		['gz', 'GZIP'],
> +		['zst', 'ZSTD'],
> +    ],
> +});

For such small things, that have no other use sites, I normally
prefer to just define the values inline..

And finding other use sites for such things is not trivial, as that
would mean we will couple the values that both sites can understand,
which for compression might not be the case (e.g., in the future we
might want to support downloading bz2 here, but not want to support
it for backups).

> diff --git a/www/manager6/window/DownloadUrlToStorage.js b/www/manager6/window/DownloadUrlToStorage.js
> index 90320da4..36ad13fa 100644
> --- a/www/manager6/window/DownloadUrlToStorage.js
> +++ b/www/manager6/window/DownloadUrlToStorage.js
> @@ -66,6 +66,7 @@ Ext.define('PVE.window.DownloadUrlToStorage', {
>  		params: {
>  		    url: queryParam.url,
>  		    'verify-certificates': queryParam['verify-certificates'],
> +		    'detect-compression': view.content === 'iso' ? 1 : 0,
>  		},
>  		waitMsgTarget: view,
>  		failure: res => {
> @@ -84,6 +85,7 @@ Ext.define('PVE.window.DownloadUrlToStorage', {
>  			filename: data.filename || "",
>  			size: (data.size && Proxmox.Utils.format_size(data.size)) || gettext("Unknown"),
>  			mimetype: data.mimetype || gettext("Unknown"),
> +			compression: data.compression || '__default__',
>  		    });
>  		},
>  	    });
> @@ -203,6 +205,17 @@ Ext.define('PVE.window.DownloadUrlToStorage', {
>  			change: 'setQueryEnabled',
>  		    },
>  		},
> +		{
> +		    xtype: 'pveDecompressionSelector',
> +		    name: 'compression',
> +		    fieldLabel: gettext('Decompression algorithm'),
> +		    allowBlank: true,
> +		    hasNoneOption: true,
> +		    value: '__default__',
> +		    cbind: {
> +			hidden: get => get('content') !== 'iso',
> +		    },
> +		},
>  	    ],
>  	},
>  	{
> @@ -223,7 +236,6 @@ Ext.define('PVE.window.DownloadUrlToStorage', {
>  	if (!me.storage) {
>  	    throw "no storage ID specified";
>  	}
> -

please avoid unrelated change in the future.

>  	me.callParent();
>      },
>  });





  reply	other threads:[~2023-09-26 11:00 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-21 13:09 [pve-devel] [PATCH manager v8 0/2] fix #4849: allow download of compressed ISOs Philipp Hufnagl
2023-09-21 13:09 ` [pve-devel] [PATCH manager v8 1/2] fix #4849: api: download to storage: automatically dectect and configure compression Philipp Hufnagl
2023-09-26 10:56   ` Thomas Lamprecht
2023-09-26 12:25     ` Philipp Hufnagl
2023-09-26 14:23       ` Thomas Lamprecht
2023-09-26 14:54         ` Philipp Hufnagl
2023-09-26 14:57           ` Thomas Lamprecht
2023-09-27  8:03     ` Philipp Hufnagl
2023-09-27  8:33       ` Thomas Lamprecht
2023-09-27  8:57         ` Philipp Hufnagl
2023-09-27 17:19           ` Thomas Lamprecht
2023-09-21 13:09 ` [pve-devel] [PATCH manager v8 2/2] fix #4849: ui: " Philipp Hufnagl
2023-09-26 10:59   ` Thomas Lamprecht [this message]
2023-09-26 12:27     ` Philipp Hufnagl
2023-09-22 14:02 ` [pve-devel] [PATCH manager v8 0/2] fix #4849: allow download of compressed ISOs Dominik Csapak
2023-09-26  7:39 ` [pve-devel] applied-series: [PATCH manager v9 " Fabian Grünbichler

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=bee4e22a-0811-4842-9872-950b44035867@proxmox.com \
    --to=t.lamprecht@proxmox.com \
    --cc=p.hufnagl@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