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 413BC1FF16F for ; Tue, 22 Jul 2025 12:10:45 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 629843588A; Tue, 22 Jul 2025 12:11:53 +0200 (CEST) From: Christian Ebner To: pbs-devel@lists.proxmox.com Date: Tue, 22 Jul 2025 12:10:44 +0200 Message-ID: <20250722101106.526438-29-c.ebner@proxmox.com> X-Mailer: git-send-email 2.47.2 In-Reply-To: <20250722101106.526438-1-c.ebner@proxmox.com> References: <20250722101106.526438-1-c.ebner@proxmox.com> MIME-Version: 1.0 X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1753179084318 X-SPAM-LEVEL: Spam detection results: 0 AWL -0.955 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 KAM_MAILER 2 Automated Mailer Tag Left in Email 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] [PATCH proxmox-backup v11 24/46] ui: add s3 client edit window for configuration create/edit 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" Adds an edit window for creating or editing S3 client configurations. Loosely based on the same edit window for the remote configuration. Signed-off-by: Christian Ebner Reviewed-by: Lukas Wagner Reviewed-by: Hannes Laimer --- changes since version 10: - no changes www/window/S3ClientEdit.js | 143 +++++++++++++++++++++++++++++++++++++ 1 file changed, 143 insertions(+) create mode 100644 www/window/S3ClientEdit.js diff --git a/www/window/S3ClientEdit.js b/www/window/S3ClientEdit.js new file mode 100644 index 000000000..932495e56 --- /dev/null +++ b/www/window/S3ClientEdit.js @@ -0,0 +1,143 @@ +Ext.define('PBS.window.S3ClientEdit', { + extend: 'Proxmox.window.Edit', + alias: 'widget.pbsS3ClientEdit', + mixins: ['Proxmox.Mixin.CBind'], + + onlineHelp: 'backup_s3client', + + isAdd: true, + + subject: gettext('S3 Endpoint'), + + fieldDefaults: { labelWidth: 120 }, + + cbindData: function (initialConfig) { + let me = this; + + let baseurl = '/api2/extjs/config/s3'; + let id = initialConfig.id; + + me.isCreate = !id; + me.url = id ? `${baseurl}/${id}` : baseurl; + me.method = id ? 'PUT' : 'POST'; + me.autoLoad = !!id; + return { + passwordEmptyText: me.isCreate ? '' : gettext('Unchanged'), + }; + }, + + items: { + xtype: 'inputpanel', + column1: [ + { + xtype: 'pmxDisplayEditField', + name: 'id', + fieldLabel: gettext('S3 Client ID'), + renderer: Ext.htmlEncode, + allowBlank: false, + minLength: 4, + cbind: { + editable: '{isCreate}', + }, + }, + { + xtype: 'proxmoxtextfield', + name: 'endpoint', + fieldLabel: gettext('Endpoint'), + allowBlank: false, + emptyText: gettext('e.g. {{bucket}}.s3.{{region}}.amazonaws.com'), + autoEl: { + tag: 'div', + 'data-qtip': gettext( + 'IP or FQDN S3 endpoint (allows {{bucket}} or {{region}} templating)', + ), + }, + }, + { + xtype: 'proxmoxtextfield', + name: 'port', + fieldLabel: gettext('Port'), + emptyText: gettext('default (443)'), + cbind: { + deleteEmpty: '{!isCreate}', + }, + }, + { + xtype: 'proxmoxcheckbox', + name: 'path-style', + fieldLabel: gettext('Path Style'), + autoEl: { + tag: 'div', + 'data-qtip': gettext('Use path style over vhost style bucket addressing.'), + }, + uncheckedValue: false, + value: false, + }, + ], + + column2: [ + { + xtype: 'proxmoxtextfield', + name: 'region', + fieldLabel: gettext('Region'), + emptyText: gettext('default (us-west-1)'), + cbind: { + deleteEmpty: '{!isCreate}', + }, + }, + { + xtype: 'proxmoxtextfield', + name: 'access-key', + fieldLabel: gettext('Access Key'), + cbind: { + emptyText: '{passwordEmptyText}', + allowBlank: '{!isCreate}', + }, + }, + { + xtype: 'textfield', + name: 'secret-key', + inputType: 'password', + fieldLabel: gettext('Secret Key'), + cbind: { + emptyText: '{passwordEmptyText}', + allowBlank: '{!isCreate}', + }, + }, + ], + + columnB: [ + { + xtype: 'proxmoxtextfield', + name: 'fingerprint', + fieldLabel: gettext('Fingerprint'), + emptyText: gettext( + "Server certificate's SHA-256 fingerprint, required for self-signed certificates", + ), + cbind: { + deleteEmpty: '{!isCreate}', + }, + }, + ], + }, + + getValues: function () { + let me = this; + let values = me.callParent(arguments); + + if (values.delete && !Ext.isArray(values.delete)) { + values.delete = values.delete.split(','); + } + PBS.Utils.delete_if_default(values, 'path-style', false, me.isCreate); + + if (values['access-key'] === '') { + delete values['access-key']; + } + + if (values['secret-key'] === '') { + delete values['secret-key']; + } + + return values; + }, +}); -- 2.47.2 _______________________________________________ pbs-devel mailing list pbs-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel