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 = {}; me.createdFields = {};
if (typeof schema.fields !== 'object') {
schema.fields = {};
}
// create custom fields according to schema // 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; let xtype;
switch (definition.type) { switch (definition.type) {
case 'string': case 'string':

View File

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