pve-manager/www/manager6/qemu/CPUOptions.js
Dominik Csapak bf96f60deb use IntegerField from widget toolkit
there we implemented deleteEmpty, which we can use in some cases.
this also fixes a bug in the ControllerSelector where
an empty field would be allowed (but should not)

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Reviewed-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2018-01-25 13:36:37 +01:00

78 lines
1.8 KiB
JavaScript

Ext.define('PVE.qemu.CPUOptionsInputPanel', {
extend: 'PVE.panel.InputPanel',
alias: 'widget.PVE.qemu.CPUOptionsInputPanel',
onGetValues: function(values) {
var me = this;
PVE.Utils.delete_if_default(values, 'cpulimit', '0', 0);
PVE.Utils.delete_if_default(values, 'cpuunits', '1024', 0);
return values;
},
initComponent : function() {
var me = this;
var items = [
{
xtype: 'proxmoxintegerfield',
name: 'vcpus',
minValue: 1,
maxValue: me.maxvcpus,
value: '',
fieldLabel: gettext('VCPUs'),
deleteEmpty: true,
allowBlank: true,
emptyText: me.maxvcpus
},
{
xtype: 'numberfield',
name: 'cpulimit',
minValue: 0,
maxValue: me.maxvcpus,
value: '',
step: 1,
fieldLabel: gettext('CPU limit'),
allowBlank: true,
emptyText: gettext('unlimited')
},
{
xtype: 'proxmoxintegerfield',
name: 'cpuunits',
fieldLabel: gettext('CPU units'),
minValue: 8,
maxValue: 500000,
value: '1024',
deleteEmpty: true,
allowBlank: true
}
];
me.items = items;
me.callParent();
}
});
Ext.define('PVE.qemu.CPUOptions', {
extend: 'PVE.window.Edit',
initComponent : function() {
var me = this;
var ipanel = Ext.create('PVE.qemu.CPUOptionsInputPanel', {
maxvcpus: me.maxvcpus
});
Ext.apply(me, {
subject: gettext('CPU options'),
items: [ ipanel ]
});
me.callParent();
me.load();
}
});