From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: <pbs-devel-bounces@lists.proxmox.com> Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id E61871FF17F for <inbox@lore.proxmox.com>; Mon, 19 May 2025 13:47:39 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id ED2E18708; Mon, 19 May 2025 13:47:36 +0200 (CEST) From: Christian Ebner <c.ebner@proxmox.com> To: pbs-devel@lists.proxmox.com Date: Mon, 19 May 2025 13:46:31 +0200 Message-Id: <20250519114640.303640-31-c.ebner@proxmox.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250519114640.303640-1-c.ebner@proxmox.com> References: <20250519114640.303640-1-c.ebner@proxmox.com> MIME-Version: 1.0 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.031 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 SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: [pbs-devel] [RFC proxmox-backup 30/39] ui: add s3 bucket selector and allow to set s3 backend X-BeenThere: pbs-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Backup Server development discussion <pbs-devel.lists.proxmox.com> List-Unsubscribe: <https://lists.proxmox.com/cgi-bin/mailman/options/pbs-devel>, <mailto:pbs-devel-request@lists.proxmox.com?subject=unsubscribe> List-Archive: <http://lists.proxmox.com/pipermail/pbs-devel/> List-Post: <mailto:pbs-devel@lists.proxmox.com> List-Help: <mailto:pbs-devel-request@lists.proxmox.com?subject=help> List-Subscribe: <https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel>, <mailto:pbs-devel-request@lists.proxmox.com?subject=subscribe> Reply-To: Proxmox Backup Server development discussion <pbs-devel@lists.proxmox.com> Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pbs-devel-bounces@lists.proxmox.com Sender: "pbs-devel" <pbs-devel-bounces@lists.proxmox.com> Signed-off-by: Christian Ebner <c.ebner@proxmox.com> --- www/Makefile | 1 + www/form/S3BucketSelector.js | 40 ++++++++++++++++++++++++++++++++++++ www/window/DataStoreEdit.js | 35 +++++++++++++++++++++++++++++++ 3 files changed, 76 insertions(+) create mode 100644 www/form/S3BucketSelector.js diff --git a/www/Makefile b/www/Makefile index ca4683941..41deeee00 100644 --- a/www/Makefile +++ b/www/Makefile @@ -42,6 +42,7 @@ JSSRC= \ Schema.js \ form/TokenSelector.js \ form/AuthidSelector.js \ + form/S3BucketSelector.js \ form/RemoteSelector.js \ form/RemoteTargetSelector.js \ form/DataStoreSelector.js \ diff --git a/www/form/S3BucketSelector.js b/www/form/S3BucketSelector.js new file mode 100644 index 000000000..c9905feb9 --- /dev/null +++ b/www/form/S3BucketSelector.js @@ -0,0 +1,40 @@ +Ext.define('PBS.form.S3BucketSelector', { + extend: 'Proxmox.form.ComboGrid', + alias: 'widget.pbsS3BucketSelector', + + allowBlank: false, + autoSelect: false, + valueField: 'id', + displayField: 'id', + + store: { + model: 'pmx-s3bucket', + autoLoad: true, + sorters: 'id', + }, + + listConfig: { + columns: [ + { + header: gettext('S3 Bucket ID'), + sortable: true, + dataIndex: 'id', + renderer: Ext.String.htmlEncode, + flex: 1, + }, + { + header: gettext('Bucket'), + sortable: true, + dataIndex: 'bucket', + renderer: Ext.String.htmlEncode, + flex: 1, + }, + { + header: gettext('Host'), + sortable: true, + dataIndex: 'host', + flex: 1, + }, + ], + }, +}); diff --git a/www/window/DataStoreEdit.js b/www/window/DataStoreEdit.js index 4a0b8d819..dffd2b2e0 100644 --- a/www/window/DataStoreEdit.js +++ b/www/window/DataStoreEdit.js @@ -101,6 +101,7 @@ Ext.define('PBS.DataStoreEdit', { columnB: [ { xtype: 'checkbox', + name: 'removable-datastore', boxLabel: gettext('Removable datastore'), submitValue: false, listeners: { @@ -135,6 +136,37 @@ Ext.define('PBS.DataStoreEdit', { fieldLabel: gettext('Reuse existing datastore'), }, ], + advancedColumn2: [ + { + xtype: 'checkbox', + boxLabel: gettext('With S3 object store'), + submitValue: false, + listeners: { + change: function(checkbox, withS3Backend) { + let inputPanel = checkbox.up('inputpanel'); + + let bucketSelector = inputPanel.down('[name=backend]'); + bucketSelector.setDisabled(!withS3Backend); + bucketSelector.allowBlank = !withS3Backend; + bucketSelector.setValue(''); + + let removableDatastore = inputPanel.down('[name=removable-datastore]'); + removableDatastore.setDisabled(withS3Backend); + removableDatastore.allowBlank = withS3Backend; + removableDatastore.setValue(''); + }, + }, + }, + { + xtype: 'pbsS3BucketSelector', + name: 'backend', + fieldLabel: gettext('S3 Bucket ID'), + disabled: true, + cbind: { + editable: '{isCreate}', + }, + }, + ], onGetValues: function(values) { let me = this; @@ -143,6 +175,9 @@ Ext.define('PBS.DataStoreEdit', { // New datastores default to using the notification system values['notification-mode'] = 'notification-system'; } + if (values.backend) { + values.backend = PBS.Utils.printPropertyString({ 's3': values.backend }); + } return values; }, }, -- 2.39.5 _______________________________________________ pbs-devel mailing list pbs-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel