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 568D91FF170 for ; Thu, 29 May 2025 16:33:07 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 0AAF916568; Thu, 29 May 2025 16:33:12 +0200 (CEST) From: Christian Ebner To: pbs-devel@lists.proxmox.com Date: Thu, 29 May 2025 16:31:58 +0200 Message-Id: <20250529143207.694497-34-c.ebner@proxmox.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250529143207.694497-1-c.ebner@proxmox.com> References: <20250529143207.694497-1-c.ebner@proxmox.com> MIME-Version: 1.0 X-SPAM-LEVEL: Spam detection results: 0 AWL -0.967 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] [RFC v2 proxmox-backup 33/42] 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 --- www/window/S3BucketEdit.js | 125 +++++++++++++++++++++++++++++++++++++ 1 file changed, 125 insertions(+) create mode 100644 www/window/S3BucketEdit.js diff --git a/www/window/S3BucketEdit.js b/www/window/S3BucketEdit.js new file mode 100644 index 000000000..1491ddbe5 --- /dev/null +++ b/www/window/S3BucketEdit.js @@ -0,0 +1,125 @@ +Ext.define('PBS.window.S3BucketEdit', { + extend: 'Proxmox.window.Edit', + alias: 'widget.pbsS3BucketEdit', + mixins: ['Proxmox.Mixin.CBind'], + + onlineHelp: 'backup_s3bucket', + + isAdd: true, + + subject: gettext('S3 Bucket'), + + 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('Unique Identifier'), + renderer: Ext.htmlEncode, + allowBlank: false, + minLength: 4, + cbind: { + editable: '{isCreate}', + }, + }, + { + xtype: 'proxmoxtextfield', + name: 'host', + fieldLabel: gettext('Host'), + allowBlank: false, + emptyText: gettext('FQDN or IP-address'), + }, + { + xtype: 'proxmoxtextfield', + name: 'port', + fieldLabel: gettext('Port'), + emptyText: gettext("default"), + cbind: { + deleteEmpty: '{!isCreate}', + }, + }, + ], + + column2: [ + { + xtype: 'proxmoxtextfield', + name: 'bucket', + fieldLabel: gettext('Bucket'), + allowBlank: false, + }, + { + xtype: 'proxmoxtextfield', + name: 'region', + fieldLabel: gettext('Region'), + emptyText: gettext("default"), + }, + { + 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 (me.isCreate) { + /// Secrets are stored into separate config, but set the same id for both configs + values['secrets-id'] = values.id; + } + if (values['access-key'] === '') { + delete values['access-key'] + } + if (values['secret-key'] === '') { + delete values['secret-key'] + } + + return values; + }, +}); -- 2.39.5 _______________________________________________ pbs-devel mailing list pbs-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel