]>
Commit | Line | Data |
---|---|---|
bbace04b DM |
1 | Ext.define('PVE.qemu.CPUOptionsInputPanel', { |
2 | extend: 'PVE.panel.InputPanel', | |
3 | alias: 'widget.PVE.qemu.CPUOptionsInputPanel', | |
4 | ||
5 | onGetValues: function(values) { | |
6 | var me = this; | |
7 | ||
8 | var delete_array = []; | |
9 | ||
10 | if (values.vcpus === '') { | |
11 | delete_array.push('vcpus'); | |
12 | delete values.vcpus; | |
13 | } | |
ec0bd652 | 14 | if (values.cpulimit === '' || values.cpulimit == '0') { |
bbace04b DM |
15 | delete_array.push('cpulimit'); |
16 | delete values.cpulimit; | |
17 | } | |
ec0bd652 | 18 | if (values.cpuunits === '' || values.cpuunits == '1024') { |
bbace04b DM |
19 | delete_array.push('cpuunits'); |
20 | delete values.cpuunits; | |
21 | } | |
22 | ||
23 | if (delete_array.length) { | |
24 | values['delete'] = delete_array.join(','); | |
25 | } | |
26 | ||
27 | return values; | |
28 | }, | |
29 | ||
30 | initComponent : function() { | |
31 | var me = this; | |
32 | ||
33 | var items = [ | |
34 | { | |
35 | xtype: 'numberfield', | |
36 | name: 'vcpus', | |
37 | minValue: 1, | |
38 | maxValue: me.maxvcpus, | |
39 | value: '', | |
185a77e5 | 40 | fieldLabel: gettext('VCPUs'), |
bbace04b DM |
41 | allowBlank: true, |
42 | emptyText: me.maxvcpus | |
43 | }, | |
44 | { | |
45 | xtype: 'numberfield', | |
46 | name: 'cpulimit', | |
47 | minValue: 0, | |
48 | maxValue: me.maxvcpus, | |
49 | value: '', | |
50 | step: 1, | |
51 | fieldLabel: gettext('CPU limit'), | |
52 | allowBlank: true, | |
53 | emptyText: gettext('unlimited') | |
54 | }, | |
55 | { | |
56 | xtype: 'numberfield', | |
57 | name: 'cpuunits', | |
58 | fieldLabel: gettext('CPU units'), | |
59 | minValue: 8, | |
60 | maxValue: 500000, | |
ec0bd652 | 61 | value: '1024', |
bbace04b DM |
62 | allowBlank: true |
63 | } | |
64 | ]; | |
65 | ||
66 | me.items = items; | |
67 | ||
68 | me.callParent(); | |
69 | } | |
70 | }); | |
71 | ||
72 | Ext.define('PVE.qemu.CPUOptions', { | |
73 | extend: 'PVE.window.Edit', | |
74 | ||
75 | initComponent : function() { | |
76 | var me = this; | |
77 | ||
78 | var ipanel = Ext.create('PVE.qemu.CPUOptionsInputPanel', { | |
22f2f9d6 | 79 | maxvcpus: me.maxvcpus |
bbace04b DM |
80 | }); |
81 | ||
82 | Ext.apply(me, { | |
83 | subject: gettext('CPU options'), | |
ec0bd652 | 84 | items: [ ipanel ] |
bbace04b DM |
85 | }); |
86 | ||
87 | me.callParent(); | |
88 | ||
89 | me.load(); | |
90 | } | |
91 | }); |