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 BB4166A080 for ; Fri, 12 Mar 2021 16:25:05 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 7FFCB34896 for ; Fri, 12 Mar 2021 16:24:35 +0100 (CET) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [212.186.127.180]) (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 id 759113478E for ; Fri, 12 Mar 2021 16:24:28 +0100 (CET) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 4142A46410 for ; Fri, 12 Mar 2021 16:24:28 +0100 (CET) From: Wolfgang Bumiller To: pmg-devel@lists.proxmox.com Date: Fri, 12 Mar 2021 16:24:10 +0100 Message-Id: <20210312152421.30114-22-w.bumiller@proxmox.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210312152421.30114-1-w.bumiller@proxmox.com> References: <20210312152421.30114-1-w.bumiller@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.035 Adjusted score from AWL reputation of From: address KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment RCVD_IN_DNSWL_MED -2.3 Sender listed at https://www.dnswl.org/, medium trust SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: [pmg-devel] [PATCH v2 widget-toolkit 3/7] add ACME forms X-BeenThere: pmg-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Mail Gateway development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Mar 2021 15:25:05 -0000 Mostly copied from PVE, but the user needs to set the URL property so their stores can load the data, whereas in PVE this was hardcoded. API selector: needs its url to point to the challenge-schema url Acme Account selector: needs its url to point to the acme account index Acme Plugin selector: needs its url to point to the plugin index Signed-off-by: Wolfgang Bumiller --- * No changes since v1 src/Makefile | 1 + src/form/ACME.js | 109 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 110 insertions(+) create mode 100644 src/form/ACME.js diff --git a/src/Makefile b/src/Makefile index 3861bfc..d0435b8 100644 --- a/src/Makefile +++ b/src/Makefile @@ -35,6 +35,7 @@ JSSRC= \ form/DiskSelector.js \ form/MultiDiskSelector.js \ form/TaskTypeSelector.js \ + form/ACME.js \ button/Button.js \ button/HelpButton.js \ grid/ObjectGrid.js \ diff --git a/src/form/ACME.js b/src/form/ACME.js new file mode 100644 index 0000000..8b93e30 --- /dev/null +++ b/src/form/ACME.js @@ -0,0 +1,109 @@ +Ext.define('Proxmox.form.ACMEApiSelector', { + extend: 'Ext.form.field.ComboBox', + alias: 'widget.pmxACMEApiSelector', + + fieldLabel: gettext('DNS API'), + displayField: 'name', + valueField: 'id', + + store: { + model: 'proxmox-acme-challenges', + autoLoad: true, + }, + + triggerAction: 'all', + queryMode: 'local', + allowBlank: false, + editable: true, + forceSelection: true, + anyMatch: true, + selectOnFocus: true, + + getSchema: function() { + let me = this; + let val = me.getValue(); + if (val) { + let record = me.getStore().findRecord('id', val, 0, false, true, true); + if (record) { + return record.data.schema; + } + } + return {}; + }, + + initComponent: function() { + let me = this; + + if (!me.url) { + throw "no url given"; + } + + me.callParent(); + me.getStore().getProxy().setUrl(me.url); + }, +}); + +Ext.define('Proxmox.form.ACMEAccountSelector', { + extend: 'Ext.form.field.ComboBox', + alias: 'widget.pmxACMEAccountSelector', + + displayField: 'name', + valueField: 'name', + + store: { + model: 'proxmox-acme-accounts', + autoLoad: true, + }, + + triggerAction: 'all', + queryMode: 'local', + allowBlank: false, + editable: false, + forceSelection: true, + + isEmpty: function() { + return this.getStore().getData().length === 0; + }, + + initComponent: function() { + let me = this; + + if (!me.url) { + throw "no url given"; + } + + me.callParent(); + me.getStore().getProxy().setUrl(me.url); + }, +}); + +Ext.define('Proxmox.form.ACMEPluginSelector', { + extend: 'Ext.form.field.ComboBox', + alias: 'widget.pmxACMEPluginSelector', + + fieldLabel: gettext('Plugin'), + displayField: 'plugin', + valueField: 'plugin', + + store: { + model: 'proxmox-acme-plugins', + autoLoad: true, + filters: item => item.data.type === 'dns', + }, + + triggerAction: 'all', + queryMode: 'local', + allowBlank: false, + editable: false, + + initComponent: function() { + let me = this; + + if (!me.url) { + throw "no url given"; + } + + me.callParent(); + me.getStore().getProxy().setUrl(me.url); + }, +}); -- 2.20.1