From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id A62041FF17A for ; Fri, 18 Jul 2025 12:01:00 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 5B656197C8; Fri, 18 Jul 2025 12:02:08 +0200 (CEST) Message-ID: <7bb55d70-bc35-4fd4-b6e1-14c771263593@proxmox.com> Date: Fri, 18 Jul 2025 12:02:04 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird To: Proxmox Backup Server development discussion , Christian Ebner References: <20250715125332.954494-1-c.ebner@proxmox.com> <20250715125332.954494-37-c.ebner@proxmox.com> Content-Language: de-AT, en-US From: Lukas Wagner In-Reply-To: <20250715125332.954494-37-c.ebner@proxmox.com> X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1752832922194 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.018 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 RCVD_IN_VALIDITY_CERTIFIED_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_RPBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_SAFE_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: Re: [pbs-devel] [PATCH proxmox-backup v8 27/45] ui: add s3 client selector and bucket field for s3 backend setup X-BeenThere: pbs-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Backup Server development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Proxmox Backup Server development discussion Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pbs-devel-bounces@lists.proxmox.com Sender: "pbs-devel" On 2025-07-15 14:53, Christian Ebner wrote: > In order to be able to create datastore with an s3 object store > backend. Implements a s3 client selector and exposes it in the > datastore edit window, together with the additional bucket name field > to associate with the datastore's s3 backend. > > Signed-off-by: Christian Ebner > --- > changes since version 7: > - use field endpoint insteand of host, fixing the selector listing > > www/Makefile | 1 + > www/form/S3ClientSelector.js | 33 +++++++++++++++++++++++++++ > www/window/DataStoreEdit.js | 44 ++++++++++++++++++++++++++++++++++++ > 3 files changed, 78 insertions(+) > create mode 100644 www/form/S3ClientSelector.js > > diff --git a/www/Makefile b/www/Makefile > index 767713c75..410e9f3e0 100644 > --- a/www/Makefile > +++ b/www/Makefile > @@ -42,6 +42,7 @@ JSSRC= \ > Schema.js \ > form/TokenSelector.js \ > form/AuthidSelector.js \ > + form/S3ClientSelector.js \ > form/RemoteSelector.js \ > form/RemoteTargetSelector.js \ > form/DataStoreSelector.js \ > diff --git a/www/form/S3ClientSelector.js b/www/form/S3ClientSelector.js > new file mode 100644 > index 000000000..243484909 > --- /dev/null > +++ b/www/form/S3ClientSelector.js > @@ -0,0 +1,33 @@ > +Ext.define('PBS.form.S3ClientSelector', { > + extend: 'Proxmox.form.ComboGrid', > + alias: 'widget.pbsS3ClientSelector', > + > + allowBlank: false, > + autoSelect: false, > + valueField: 'id', > + displayField: 'id', > + > + store: { > + model: 'pmx-s3client', > + autoLoad: true, > + sorters: 'id', > + }, > + > + listConfig: { > + columns: [ > + { > + header: gettext('S3 Client ID'), > + sortable: true, > + dataIndex: 'id', > + renderer: Ext.String.htmlEncode, > + flex: 1, > + }, > + { > + header: gettext('Endpoint'), > + sortable: true, > + dataIndex: 'endpoint', > + flex: 1, > + }, > + ], > + }, > +}); > diff --git a/www/window/DataStoreEdit.js b/www/window/DataStoreEdit.js > index cd94f0335..3379bf773 100644 > --- a/www/window/DataStoreEdit.js > +++ b/www/window/DataStoreEdit.js > @@ -61,6 +61,7 @@ Ext.define('PBS.DataStoreEdit', { > comboItems: [ > ['__default__', 'Local'], > ['removable', 'Removable'], > + ['s3', 'S3 (experimental)'], Missing gettext here as well > ], > cbind: { > disabled: '{!isCreate}', > @@ -68,18 +69,32 @@ Ext.define('PBS.DataStoreEdit', { > listeners: { > change: function (checkbox, selected) { > let isRemovable = selected === 'removable'; > + let isS3 = selected === 's3'; > > let inputPanel = checkbox.up('inputpanel'); > let pathField = inputPanel.down('[name=path]'); > let uuidEditField = inputPanel.down('[name=backing-device]'); > + let bucketField = inputPanel.down('[name=bucket]'); > + let s3ClientSelector = inputPanel.down('[name=s3client]'); > > uuidEditField.setDisabled(!isRemovable); > uuidEditField.allowBlank = !isRemovable; > uuidEditField.setValue(''); > > + bucketField.setDisabled(!isS3); > + bucketField.allowBlank = !isS3; > + bucketField.setValue(''); > + > + s3ClientSelector.setDisabled(!isS3); > + s3ClientSelector.allowBlank = !isS3; > + s3ClientSelector.setValue(''); > + > if (isRemovable) { > pathField.setFieldLabel(gettext('Path on Device')); > pathField.setEmptyText(gettext('A relative path')); > + } else if (isS3) { > + pathField.setFieldLabel(gettext('Store Cache')); > + pathField.setEmptyText(gettext('An absolute path')); > } else { > pathField.setFieldLabel(gettext('Backing Path')); > pathField.setEmptyText(gettext('An absolute path')); Yup, with these additional changes I'd definitely prefer the viewModel approach mentioned earlier :) > @@ -98,6 +113,15 @@ Ext.define('PBS.DataStoreEdit', { > emptyText: gettext('An absolute path'), > validator: (val) => val?.trim() !== '/', > }, > + { > + xtype: 'pbsS3ClientSelector', > + name: 's3client', > + fieldLabel: gettext('S3 Client ID'), > + disabled: true, > + cbind: { > + editable: '{isCreate}', > + }, > + }, > ], > column2: [ > { > @@ -132,6 +156,13 @@ Ext.define('PBS.DataStoreEdit', { > }, > emptyText: gettext('Device path'), > }, > + { > + xtype: 'proxmoxtextfield', > + name: 'bucket', > + fieldLabel: gettext('Bucket'), > + allowBlank: false, > + disabled: true, > + }, > ], > columnB: [ > { > @@ -154,7 +185,20 @@ Ext.define('PBS.DataStoreEdit', { > if (me.isCreate) { > // New datastores default to using the notification system > values['notification-mode'] = 'notification-system'; > + > + if (values.s3client) { > + let s3BackendConf = { > + type: 's3', > + client: values.s3client, > + bucket: values.bucket, > + }; > + values.backend = PBS.Utils.printPropertyString(s3BackendConf); > + } > } > + > + delete values.s3client; > + delete values.bucket; > + > return values; > }, > }, -- - Lukas _______________________________________________ pbs-devel mailing list pbs-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel