[pve-devel] [PATCH manager 4/6] ui: add ACMEAPiSelector field

Dominik Csapak d.csapak at proxmox.com
Tue May 5 14:38:16 CEST 2020


which return all api types from /cluster/acme/challengeschema
and has a convenience method for getting the schema of the current value

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 www/manager6/Makefile                |  1 +
 www/manager6/form/ACMEAPiSelector.js | 40 ++++++++++++++++++++++++++++
 2 files changed, 41 insertions(+)
 create mode 100644 www/manager6/form/ACMEAPiSelector.js

diff --git a/www/manager6/Makefile b/www/manager6/Makefile
index ff93b224..62253ede 100644
--- a/www/manager6/Makefile
+++ b/www/manager6/Makefile
@@ -72,6 +72,7 @@ JSSRC= 				                 	\
 	form/SDNZoneSelector.js				\
 	form/SDNControllerSelector.js			\
 	form/TFASelector.js				\
+	form/ACMEAPiSelector.js				\
 	dc/Tasks.js					\
 	dc/Log.js					\
 	panel/StatusPanel.js				\
diff --git a/www/manager6/form/ACMEAPiSelector.js b/www/manager6/form/ACMEAPiSelector.js
new file mode 100644
index 00000000..1ae40849
--- /dev/null
+++ b/www/manager6/form/ACMEAPiSelector.js
@@ -0,0 +1,40 @@
+Ext.define('pve-acme-challenges', {
+    extend: 'Ext.data.Model',
+    fields: ['name', 'schema'],
+    proxy: {
+	type: 'proxmox',
+	    url: "/api2/json/cluster/acme/challengeschema",
+    },
+    idProperty: 'name',
+});
+
+Ext.define('PVE.form.ACMEApiSelector', {
+    extend: 'Ext.form.field.ComboBox',
+    alias: 'widget.pveACMEApiSelector',
+
+    fieldLabel: gettext('API'),
+    displayField: 'name',
+    valueField: 'name',
+
+    store: {
+	model: 'pve-acme-challenges',
+	autoLoad: true,
+    },
+
+    triggerAction: 'all',
+    queryMode: 'local',
+    allowBlank: false,
+    editable: false,
+
+    getSchema: function() {
+	let me = this;
+	let val = me.getValue();
+	if (val) {
+	    let record = me.getStore().findRecord('name', val);
+	    if (record) {
+		return record.data.schema;
+	    }
+	}
+	return {};
+    },
+});
-- 
2.20.1





More information about the pve-devel mailing list