[pmg-devel] [PATCH pmg-gui v2 2/2] dkim: list all available selectors

Stoiko Ivanov s.ivanov at proxmox.com
Tue Jan 14 19:31:37 CET 2020


by making the selector field a ComboBox, users can pick from any existing
selector without changing it, replace it or create a new one.

Signed-off-by: Stoiko Ivanov <s.ivanov at proxmox.com>
---
 js/DKIMSettings.js | 39 +++++++++++++++++++++++++++++++++++----
 1 file changed, 35 insertions(+), 4 deletions(-)

diff --git a/js/DKIMSettings.js b/js/DKIMSettings.js
index 590f759..f0f378f 100644
--- a/js/DKIMSettings.js
+++ b/js/DKIMSettings.js
@@ -88,6 +88,39 @@ Ext.define('PMG.SelectorViewer', {
     }
 });
 
+Ext.define('PMG.SelectorList', {
+    extend: 'Ext.form.ComboBox',
+    xtype: 'pmgDKIMSelectorList',
+
+    queryMode: 'local',
+    store: {
+	fields: [ 'selector' ],
+	filterOnLoad: true,
+	proxy: {
+	    type: 'proxmox',
+	    url: '/api2/json/config/dkim/selectors'
+	},
+	sorters: [
+	    {
+		property : 'selector',
+		direction: 'ASC'
+	    }
+	]
+    },
+
+    valueField: 'selector',
+    displayField: 'selector',
+    allowBlank: false,
+
+    initComponent: function() {
+	var me = this;
+
+	me.callParent();
+	me.store.load();
+    }
+
+});
+
 Ext.define('PMG.DKIMSettings', {
     extend: 'Proxmox.grid.ObjectGrid',
     xtype: 'pmgDKIM',
@@ -120,6 +153,7 @@ Ext.define('PMG.DKIMSettings', {
 		isCreate: true,
 		method: 'POST',
 		url: '/config/dkim/selector',
+		submitText: gettext('Update'),
 		items: [
 		    {
 			xtype: 'displayfield',
@@ -128,12 +162,9 @@ Ext.define('PMG.DKIMSettings', {
 			value: gettext('Warning: You need to update the _domainkey DNS records of all signed domains!'),
 		    },
 		    {
-			xtype: 'proxmoxtextfield',
+			xtype: 'pmgDKIMSelectorList',
 			fieldLabel: selector_text,
 			name: 'selector',
-			allowBlank: false,
-			required: true,
-			defaultValue: 'pmg'
 		    },
 		    {
 			xtype: 'proxmoxKVComboBox',
-- 
2.20.1




More information about the pmg-devel mailing list