ui: ACME selectors - adapt to new API path/return schema

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Thomas Lamprecht 2020-05-05 19:24:44 +02:00
parent f9c0feeb7e
commit 56e7fc7b9d
2 changed files with 9 additions and 6 deletions

View File

@ -49,8 +49,11 @@ Ext.define('PVE.dc.ACMEPluginEditor', {
me.createdFields = {};
if (typeof schema.fields !== 'object') {
schema.fields = {};
}
// create custom fields according to schema
for (const [name, definition] of Object.entries(schema)) {
for (const [name, definition] of Object.entries(schema.fields)) {
let xtype;
switch (definition.type) {
case 'string':

View File

@ -1,11 +1,11 @@
Ext.define('pve-acme-challenges', {
extend: 'Ext.data.Model',
fields: ['name', 'schema'],
fields: ['id', 'type', 'schema'],
proxy: {
type: 'proxmox',
url: "/api2/json/cluster/acme/challengeschema",
url: "/api2/json/cluster/acme/challenge-schema",
},
idProperty: 'name',
idProperty: 'id',
});
Ext.define('PVE.form.ACMEApiSelector', {
@ -14,7 +14,7 @@ Ext.define('PVE.form.ACMEApiSelector', {
fieldLabel: gettext('API'),
displayField: 'name',
valueField: 'name',
valueField: 'id',
store: {
model: 'pve-acme-challenges',
@ -30,7 +30,7 @@ Ext.define('PVE.form.ACMEApiSelector', {
let me = this;
let val = me.getValue();
if (val) {
let record = me.getStore().findRecord('name', val);
let record = me.getStore().findRecord('id', val);
if (record) {
return record.data.schema;
}