Commit 8202ea51 authored by Dietmar Maurer's avatar Dietmar Maurer

always enable CPU option button, allow empty values

parent 7b38270b
......@@ -2,6 +2,31 @@ Ext.define('PVE.qemu.CPUOptionsInputPanel', {
extend: 'PVE.panel.InputPanel',
alias: 'widget.PVE.qemu.CPUOptionsInputPanel',
onGetValues: function(values) {
var me = this;
var delete_array = [];
if (values.vcpus === '') {
delete_array.push('vcpus');
delete values.vcpus;
}
if (values.cpulimit === '' || values.cpulimit == 0) {
delete_array.push('cpulimit');
delete values.cpulimit;
}
if (values.cpuunits === '' || values.cpuunits == 1024) {
delete_array.push('cpuunits');
delete values.cpuunits;
}
if (delete_array.length) {
values['delete'] = delete_array.join(',');
}
return values;
},
initComponent : function() {
var me = this;
......@@ -23,8 +48,7 @@ Ext.define('PVE.qemu.CPUOptionsInputPanel', {
value: '',
step: 1,
fieldLabel: gettext('CPU limit'),
allowBlank: false
allowBlank: true
},
{
xtype: 'numberfield',
......@@ -33,9 +57,8 @@ Ext.define('PVE.qemu.CPUOptionsInputPanel', {
minValue: 8,
maxValue: 500000,
value: 1024,
allowBlank: false
allowBlank: true
}
];
me.items = items;
......
......@@ -298,11 +298,6 @@ Ext.define('PVE.qemu.HardwareView', {
};
var run_cpuoptions = function() {
var rec = sm.getSelection()[0];
if (!rec) {
return;
}
var sockets = me.getObjectValue('sockets', 1);
var cores = me.getObjectValue('cores', 1);
......@@ -310,7 +305,6 @@ Ext.define('PVE.qemu.HardwareView', {
maxvcpus: sockets * cores,
vmid: vmid,
pveSelNode: me.pveSelNode,
confid: rec.data.key,
url: '/api2/extjs/' + baseurl
});
......@@ -364,10 +358,8 @@ Ext.define('PVE.qemu.HardwareView', {
handler: run_diskthrottle
});
var cpuoptions_btn = new PVE.button.Button({
var cpuoptions_btn = new Ext.Button({
text: gettext('CPU options'),
selModel: sm,
disabled: true,
handler: run_cpuoptions
});
......@@ -438,7 +430,6 @@ Ext.define('PVE.qemu.HardwareView', {
resize_btn.disable();
move_btn.disable();
diskthrottle_btn.disable();
cpuoptions_btn.disable();
revert_btn.disable();
return;
}
......@@ -460,8 +451,6 @@ Ext.define('PVE.qemu.HardwareView', {
diskthrottle_btn.setDisabled(pending || !isDisk);
cpuoptions_btn.setDisabled(rowdef.tdCls != 'pve-itype-icon-processor');
revert_btn.setDisabled(!pending);
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment