pve-manager/www/manager6/qemu/CPUOptions.js
Dominik Csapak 8a7e5598f1 add pveIntegerField and use it
this adds a subclass of Ext.form.field.Number with the settings for
Integers (allowDecimals: false and allowExponential: false and default
step size 1)

and use it where we only accept integers

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2016-11-02 17:14:06 +01:00

77 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, 'vcpus', '', 0);
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: 'pveIntegerField',
name: 'vcpus',
minValue: 1,
maxValue: me.maxvcpus,
value: '',
fieldLabel: gettext('VCPUs'),
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: 'pveIntegerField',
name: 'cpuunits',
fieldLabel: gettext('CPU units'),
minValue: 8,
maxValue: 500000,
value: '1024',
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();
}
});