[pve-devel] RFC: use declarative style in ExtJS components
Emmanuel Kasper
e.kasper at proxmox.com
Thu Nov 19 17:24:45 CET 2015
On 11/19/2015 03:43 PM, Dietmar Maurer wrote:
>
>
>> On November 19, 2015 at 2:23 PM Emmanuel Kasper <e.kasper at proxmox.com> wrote:
>>
>>
>> Hi,
>>
>> I have noticed that we could save a bit of boilerplate code in many
>> places in the gui, when using the so called "declarative" style
>> of ExtJS,
>> Basically this involves moving non-dynamic properties (here
>> PVE.Utils.kvm_keymap_array() will always return the same array) to the class
>> body.
>>
>> Any objection to this style of code ?
>
> What if you want to use the widget.VNCKeyboardSelector outside the edit window?
If we the widget is used in more than one place, then it should have its
own class definition.
Hum, actually that's the case for VNCKeyboardSelector.
Actually the point I want to make was rather about:
Ext.define('PVE.form.VNCKeyboardSelector', {
extend: 'PVE.form.KVComboBox',
alias: ['widget.VNCKeyboardSelector'],
initComponent: function() {
var me = this;
me.data = PVE.Utils.kvm_keymap_array();
me.callParent();
}
});
vs
Ext.define('PVE.form.VNCKeyboardSelector', {
extend: 'PVE.form.KVComboBox',
alias: ['widget.VNCKeyboardSelector'],
data: PVE.Utils.kvm_keymap_array()
});
More information about the pve-devel
mailing list