[pve-devel] Trying to create a patch for changing migration settings in the GUI
Caspar Smit
casparsmit at supernas.eu
Tue Jun 20 13:03:07 CEST 2017
Hi all,
I'm trying to create a patch which allows the migration settings (from
datacenter.cfg) to be edited from the GUI. But since this is a setting
containing multiple parameters (type and network) and my javascript skills
are horrible, i got stuck.
Here's what i got so far:
Added the migration setting to the dcOptionView:
migration: {
header: gettext('Migration Settings'),
editor: 'PVE.dc.MigrationEdit',
required: true,
renderer: function(value) {
if (!value) {
return PVE.Utils.noneText;
}
return 'type=' + value.type + ',network=' +
value.network;
}
}
I had to return the type and network seperately or else it showed [object
Object] because it is an array.
Then added the editor:
Ext.define('PVE.dc.MigrationEdit', {
extend: 'PVE.window.Edit',
initComponent : function() {
var me = this;
Ext.applyIf(me, {
subject: gettext('Migration Settings'),
items: {
xtype: 'pvetextfield',
name: 'migration',
emptyText: PVE.Utils.noneText,
deleteEmpty: true,
fieldLabel: gettext('Migration Settings')
}
});
me.callParent();
me.load();
}
});
This will show [object Object] in the editor since i don't know how to
format an array in the editor correctly.
I hope maybe someone can push me in the right direction.
PS. I can enter something like "type=secure,network=10.10.10.0/24" and it
will get changed in the datacenter.cfg file correctly.
Thanks in advance
Kind regards,
Caspar
More information about the pve-devel
mailing list