ui: add ACMEAPiSelector field

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@proxmox.com>
This commit is contained in:
Dominik Csapak 2020-05-05 14:38:16 +02:00 committed by Thomas Lamprecht
parent c0afd5cc0a
commit f81ef75756
2 changed files with 41 additions and 0 deletions

View File

@ -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 \

View File

@ -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 {};
},
});