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', { ...@@ -2,6 +2,31 @@ Ext.define('PVE.qemu.CPUOptionsInputPanel', {
extend: 'PVE.panel.InputPanel', extend: 'PVE.panel.InputPanel',
alias: 'widget.PVE.qemu.CPUOptionsInputPanel', 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() { initComponent : function() {
var me = this; var me = this;
...@@ -23,8 +48,7 @@ Ext.define('PVE.qemu.CPUOptionsInputPanel', { ...@@ -23,8 +48,7 @@ Ext.define('PVE.qemu.CPUOptionsInputPanel', {
value: '', value: '',
step: 1, step: 1,
fieldLabel: gettext('CPU limit'), fieldLabel: gettext('CPU limit'),
allowBlank: false allowBlank: true
}, },
{ {
xtype: 'numberfield', xtype: 'numberfield',
...@@ -33,9 +57,8 @@ Ext.define('PVE.qemu.CPUOptionsInputPanel', { ...@@ -33,9 +57,8 @@ Ext.define('PVE.qemu.CPUOptionsInputPanel', {
minValue: 8, minValue: 8,
maxValue: 500000, maxValue: 500000,
value: 1024, value: 1024,
allowBlank: false allowBlank: true
} }
]; ];
me.items = items; me.items = items;
......
...@@ -298,11 +298,6 @@ Ext.define('PVE.qemu.HardwareView', { ...@@ -298,11 +298,6 @@ Ext.define('PVE.qemu.HardwareView', {
}; };
var run_cpuoptions = function() { var run_cpuoptions = function() {
var rec = sm.getSelection()[0];
if (!rec) {
return;
}
var sockets = me.getObjectValue('sockets', 1); var sockets = me.getObjectValue('sockets', 1);
var cores = me.getObjectValue('cores', 1); var cores = me.getObjectValue('cores', 1);
...@@ -310,7 +305,6 @@ Ext.define('PVE.qemu.HardwareView', { ...@@ -310,7 +305,6 @@ Ext.define('PVE.qemu.HardwareView', {
maxvcpus: sockets * cores, maxvcpus: sockets * cores,
vmid: vmid, vmid: vmid,
pveSelNode: me.pveSelNode, pveSelNode: me.pveSelNode,
confid: rec.data.key,
url: '/api2/extjs/' + baseurl url: '/api2/extjs/' + baseurl
}); });
...@@ -364,10 +358,8 @@ Ext.define('PVE.qemu.HardwareView', { ...@@ -364,10 +358,8 @@ Ext.define('PVE.qemu.HardwareView', {
handler: run_diskthrottle handler: run_diskthrottle
}); });
var cpuoptions_btn = new PVE.button.Button({ var cpuoptions_btn = new Ext.Button({
text: gettext('CPU options'), text: gettext('CPU options'),
selModel: sm,
disabled: true,
handler: run_cpuoptions handler: run_cpuoptions
}); });
...@@ -438,7 +430,6 @@ Ext.define('PVE.qemu.HardwareView', { ...@@ -438,7 +430,6 @@ Ext.define('PVE.qemu.HardwareView', {
resize_btn.disable(); resize_btn.disable();
move_btn.disable(); move_btn.disable();
diskthrottle_btn.disable(); diskthrottle_btn.disable();
cpuoptions_btn.disable();
revert_btn.disable(); revert_btn.disable();
return; return;
} }
...@@ -460,8 +451,6 @@ Ext.define('PVE.qemu.HardwareView', { ...@@ -460,8 +451,6 @@ Ext.define('PVE.qemu.HardwareView', {
diskthrottle_btn.setDisabled(pending || !isDisk); diskthrottle_btn.setDisabled(pending || !isDisk);
cpuoptions_btn.setDisabled(rowdef.tdCls != 'pve-itype-icon-processor');
revert_btn.setDisabled(!pending); 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