From mboxrd@z Thu Jan 1 00:00:00 1970
Return-Path:
Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68])
(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
key-exchange X25519 server-signature RSA-PSS (2048 bits))
(No client certificate requested)
by lists.proxmox.com (Postfix) with ESMTPS id 2372BE773
for ; Tue, 26 Sep 2023 14:27:45 +0200 (CEST)
Received: from firstgate.proxmox.com (localhost [127.0.0.1])
by firstgate.proxmox.com (Proxmox) with ESMTP id 083FD5B5
for ; Tue, 26 Sep 2023 14:27:15 +0200 (CEST)
Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com
[94.136.29.106])
(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
key-exchange X25519 server-signature RSA-PSS (2048 bits))
(No client certificate requested)
by firstgate.proxmox.com (Proxmox) with ESMTPS
for ; Tue, 26 Sep 2023 14:27:14 +0200 (CEST)
Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1])
by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 4589D470F0
for ; Tue, 26 Sep 2023 14:27:14 +0200 (CEST)
Message-ID:
Date: Tue, 26 Sep 2023 14:27:13 +0200
MIME-Version: 1.0
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
Thunderbird/102.15.1
Content-Language: en-US
To: Thomas Lamprecht ,
Proxmox VE development discussion
References: <20230921130917.2000926-1-p.hufnagl@proxmox.com>
<20230921130917.2000926-3-p.hufnagl@proxmox.com>
From: Philipp Hufnagl
In-Reply-To:
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
X-SPAM-LEVEL: Spam detection results: 0
AWL 0.734 Adjusted score from AWL reputation of From: address
BAYES_00 -1.9 Bayes spam probability is 0 to 1%
DMARC_MISSING 0.1 Missing DMARC policy
KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment
NICE_REPLY_A -1.473 Looks like a legit reply (A)
SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record
SPF_PASS -0.001 SPF: sender matches SPF record
Subject: Re: [pve-devel] [PATCH manager v8 2/2] fix #4849: ui: download to
storage: automatically dectect and configure compression
X-BeenThere: pve-devel@lists.proxmox.com
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Proxmox VE development discussion
List-Unsubscribe: ,
List-Archive:
List-Post:
List-Help:
List-Subscribe: ,
X-List-Received-Date: Tue, 26 Sep 2023 12:27:45 -0000
On 9/26/23 12:59, Thomas Lamprecht wrote:
> 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
>> ---
>> 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();
>> },
>> });
>
Sorry for the issues. This was my first larger feature. I will
try to improve next time!