]> git.proxmox.com Git - pve-manager.git/blame - www/manager/qemu/ProcessorEdit.js
gui: preserve extra cpu options when changing CPU type
[pve-manager.git] / www / manager / qemu / ProcessorEdit.js
CommitLineData
aff192e6
DM
1Ext.define('PVE.qemu.ProcessorInputPanel', {
2 extend: 'PVE.panel.InputPanel',
3 alias: 'widget.PVE.qemu.ProcessorInputPanel',
4
0f2c29ad
WB
5 onGetValues: function(values) {
6 var me = this;
7 me.cpu.cputype = values['cputype'];
8 return {
9 cpu: PVE.Parser.printQemuCpu(me.cpu)
10 };
11 },
12
aff192e6
DM
13 initComponent : function() {
14 var me = this;
15
16 me.column1 = [
17 {
18 xtype: 'numberfield',
19 name: 'sockets',
20 minValue: 1,
21 maxValue: 4,
22 value: '1',
0070ee37 23 fieldLabel: gettext('Sockets'),
aff192e6
DM
24 allowBlank: false,
25 listeners: {
26 change: function(f, value) {
27 var sockets = me.down('field[name=sockets]').getValue();
28 var cores = me.down('field[name=cores]').getValue();
29 me.down('field[name=totalcores]').setValue(sockets*cores);
30 }
31 }
32 },
33 {
34 xtype: 'numberfield',
35 name: 'cores',
36 minValue: 1,
d0efa75d 37 maxValue: 128,
aff192e6 38 value: '1',
0070ee37 39 fieldLabel: gettext('Cores'),
aff192e6
DM
40 allowBlank: false,
41 listeners: {
42 change: function(f, value) {
43 var sockets = me.down('field[name=sockets]').getValue();
44 var cores = me.down('field[name=cores]').getValue();
45 me.down('field[name=totalcores]').setValue(sockets*cores);
46 }
47 }
919b9c1f
AD
48 },
49 {
50 xtype: 'pvecheckbox',
51 fieldLabel: gettext('Enable numa'),
52 name: 'numa',
53 uncheckedValue: 0,
54 },
55
aff192e6
DM
56 ];
57
58
59 me.column2 = [
60 {
61 xtype: 'CPUModelSelector',
0f2c29ad 62 name: 'cputype',
aff192e6 63 value: '',
4af2c66c 64 fieldLabel: gettext('Type')
aff192e6
DM
65 },
66 {
67 xtype: 'displayfield',
0070ee37 68 fieldLabel: gettext('Total cores'),
aff192e6
DM
69 name: 'totalcores',
70 value: '1'
71 }
72
73 ];
74
75 me.callParent();
76 }
77});
78
79Ext.define('PVE.qemu.ProcessorEdit', {
80 extend: 'PVE.window.Edit',
81
82 initComponent : function() {
83 var me = this;
84
0f2c29ad
WB
85 var ipanel = Ext.create('PVE.qemu.ProcessorInputPanel')
86
aff192e6 87 Ext.apply(me, {
6b21ab95 88 subject: gettext('Processors'),
0f2c29ad 89 items: ipanel
aff192e6
DM
90 });
91
92 me.callParent();
93
0f2c29ad
WB
94 me.load({
95 success: function(response, options) {
96 var value = response.result.data['cpu'];
97 var cpu = PVE.Parser.parseQemuCpu(value);
98 ipanel.cpu = cpu;
99 me.setValues({ cputype: cpu.cputype });
100 }
101 });
aff192e6 102 }
0070ee37 103});