]> git.proxmox.com Git - pve-manager.git/blob - www/manager/qemu/ProcessorEdit.js
bec77d9eb26cb0974503b3136179632800ac3355
[pve-manager.git] / www / manager / qemu / ProcessorEdit.js
1 Ext.define('PVE.qemu.ProcessorInputPanel', {
2 extend: 'PVE.panel.InputPanel',
3 alias: 'widget.PVE.qemu.ProcessorInputPanel',
4
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
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',
23 fieldLabel: gettext('Sockets'),
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,
37 maxValue: 128,
38 value: '1',
39 fieldLabel: gettext('Cores'),
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 }
48 },
49 {
50 xtype: 'pvecheckbox',
51 fieldLabel: gettext('Enable numa'),
52 name: 'numa',
53 uncheckedValue: 0,
54 },
55
56 ];
57
58
59 me.column2 = [
60 {
61 xtype: 'CPUModelSelector',
62 name: 'cputype',
63 value: '',
64 fieldLabel: gettext('Type')
65 },
66 {
67 xtype: 'displayfield',
68 fieldLabel: gettext('Total cores'),
69 name: 'totalcores',
70 value: '1'
71 }
72
73 ];
74
75 me.callParent();
76 }
77 });
78
79 Ext.define('PVE.qemu.ProcessorEdit', {
80 extend: 'PVE.window.Edit',
81
82 initComponent : function() {
83 var me = this;
84
85 var ipanel = Ext.create('PVE.qemu.ProcessorInputPanel')
86
87 Ext.apply(me, {
88 subject: gettext('Processors'),
89 items: ipanel
90 });
91
92 me.callParent();
93
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 });
102 }
103 });