xtype: 'pveACMEPluginEditor',
mixins: ['Proxmox.Mixin.CBind'],
+ onlineHelp: 'sysadmin_certs_acme_plugins',
+
isAdd: true,
isCreate: false,
- width: 400,
+ width: 550,
url: '/cluster/acme/plugins/',
- subject: gettext('Plugin'),
+ subject: 'ACME DNS Plugin',
+
items: [
{
xtype: 'inputpanel',
// we know where to add because we define it right below
let container = me.down('container');
let datafield = me.down('field[name=data]');
+ let hintfield = me.down('field[name=hint]');
if (!me.createdInitially) {
[me.originalValues] = PVE.Parser.parseACMEPluginData(datafield.getValue());
}
me.createdFields = {};
+ if (typeof schema.fields !== 'object') {
+ schema.fields = {};
+ }
// create custom fields according to schema
- for (const [name, definition] of Object.entries(schema)) {
+ let gotSchemaField = false;
+ let cmp = (a, b) => a[0].localeCompare(b[0]);
+ for (const [name, definition] of Object.entries(schema.fields).sort(cmp)) {
let xtype;
switch (definition.type) {
case 'string':
break;
}
+ let label = name;
+ if (typeof definition.name === "string") {
+ label = definition.name;
+ }
+
let field = Ext.create({
xtype,
name: `custom_${name}`,
- fieldLabel: name,
+ fieldLabel: label,
width: '100%',
- labelWidth: 120,
+ labelWidth: 150,
+ labelSeparator: '=',
+ emptyText: definition.default || '',
autoEl: definition.description ? {
tag: 'div',
'data-qtip': definition.description,
me.createdFields[name] = field;
container.add(field);
+ gotSchemaField = true;
+ }
+ datafield.setHidden(gotSchemaField); // prefer schema-fields
+
+ if (schema.description) {
+ hintfield.setValue(schema.description);
+ hintfield.setHidden(false);
+ } else {
+ hintfield.setValue('');
+ hintfield.setHidden(true);
}
// parse data from field and set it to the custom ones
allowBlank: false,
},
name: 'plugin',
- labelWidth: 120,
- fieldLabel: gettext('Plugin'),
+ labelWidth: 150,
+ fieldLabel: gettext('Plugin ID'),
},
{
xtype: 'proxmoxintegerfield',
name: 'validation-delay',
- labelWidth: 120,
+ labelWidth: 150,
fieldLabel: gettext('Validation Delay'),
emptyText: 30,
cbind: {
deleteEmpty: '{!isCreate}',
},
minValue: 0,
- maxValue: 172800,
+ maxValue: 48*60*60,
},
{
xtype: 'pveACMEApiSelector',
name: 'api',
- labelWidth: 120,
+ labelWidth: 150,
listeners: {
change: function(selector) {
let schema = selector.getSchema();
},
},
{
- fieldLabel: gettext('API Data'),
- labelWidth: 120,
xtype: 'textarea',
+ fieldLabel: gettext('API Data'),
+ labelWidth: 150,
name: 'data',
},
+ {
+ xtype: 'displayfield',
+ fieldLabel: gettext('Hint'),
+ labelWidth: 150,
+ name: 'hint',
+ hidden: true,
+ },
],
},
],