]>
Commit | Line | Data |
---|---|---|
ab2fac2f DM |
1 | var labelWidth = 120; |
2 | ||
3 | Ext.define('PVE.lxc.MemoryEdit', { | |
9fccc702 | 4 | extend: 'Proxmox.window.Edit', |
ab2fac2f | 5 | |
8058410f | 6 | initComponent: function() { |
ab2fac2f DM |
7 | var me = this; |
8 | ||
9 | Ext.apply(me, { | |
10 | subject: gettext('Memory'), | |
f6710aac | 11 | items: Ext.create('PVE.lxc.MemoryInputPanel'), |
ab2fac2f DM |
12 | }); |
13 | ||
14 | me.callParent(); | |
15 | ||
16 | me.load(); | |
f6710aac | 17 | }, |
ab2fac2f DM |
18 | }); |
19 | ||
20 | ||
21 | Ext.define('PVE.lxc.CPUEdit', { | |
9fccc702 | 22 | extend: 'Proxmox.window.Edit', |
ab2fac2f | 23 | |
8058410f | 24 | initComponent: function() { |
ab2fac2f DM |
25 | var me = this; |
26 | ||
27 | Ext.apply(me, { | |
28 | subject: gettext('CPU'), | |
f6710aac | 29 | items: Ext.create('PVE.lxc.CPUInputPanel'), |
ab2fac2f DM |
30 | }); |
31 | ||
32 | me.callParent(); | |
33 | ||
34 | me.load(); | |
f6710aac | 35 | }, |
ab2fac2f DM |
36 | }); |
37 | ||
ab2fac2f | 38 | Ext.define('PVE.lxc.CPUInputPanel', { |
ef4ef788 | 39 | extend: 'Proxmox.panel.InputPanel', |
ab2fac2f DM |
40 | alias: 'widget.pveLxcCPUInputPanel', |
41 | ||
cb38d277 DC |
42 | onlineHelp: 'pct_cpu', |
43 | ||
ab2fac2f DM |
44 | insideWizard: false, |
45 | ||
92b5029f DM |
46 | onGetValues: function(values) { |
47 | var me = this; | |
48 | ||
fe4f00ad TL |
49 | PVE.Utils.delete_if_default(values, 'cores', '', me.insideWizard); |
50 | // cpu{limit,unit} aren't in the wizard so create is always false | |
51 | PVE.Utils.delete_if_default(values, 'cpulimit', '0', 0); | |
52 | PVE.Utils.delete_if_default(values, 'cpuunits', '1024', 0); | |
92b5029f DM |
53 | |
54 | return values; | |
55 | }, | |
56 | ||
53395db1 DC |
57 | advancedColumn1: [ |
58 | { | |
59 | xtype: 'numberfield', | |
60 | name: 'cpulimit', | |
61 | minValue: 0, | |
62 | value: '', | |
63 | step: 1, | |
64 | fieldLabel: gettext('CPU limit'), | |
65 | allowBlank: true, | |
f6710aac TL |
66 | emptyText: gettext('unlimited'), |
67 | }, | |
53395db1 DC |
68 | ], |
69 | ||
70 | advancedColumn2: [ | |
71 | { | |
72 | xtype: 'proxmoxintegerfield', | |
73 | name: 'cpuunits', | |
74 | fieldLabel: gettext('CPU units'), | |
75 | value: 1024, | |
76 | minValue: 8, | |
77 | maxValue: 500000, | |
78 | labelWidth: labelWidth, | |
f6710aac TL |
79 | allowBlank: false, |
80 | }, | |
53395db1 DC |
81 | ], |
82 | ||
83 | initComponent: function() { | |
ab2fac2f DM |
84 | var me = this; |
85 | ||
53395db1 DC |
86 | me.column1 = [ |
87 | { | |
88 | xtype: 'proxmoxintegerfield', | |
89 | name: 'cores', | |
92b5029f | 90 | minValue: 1, |
641da26d | 91 | maxValue: 8192, |
92b5029f DM |
92 | value: me.insideWizard ? 1 : '', |
93 | fieldLabel: gettext('Cores'), | |
94 | allowBlank: true, | |
bf96f60d | 95 | deleteEmpty: true, |
f6710aac TL |
96 | emptyText: gettext('unlimited'), |
97 | }, | |
ab2fac2f DM |
98 | ]; |
99 | ||
ab2fac2f | 100 | me.callParent(); |
f6710aac | 101 | }, |
ab2fac2f DM |
102 | }); |
103 | ||
104 | Ext.define('PVE.lxc.MemoryInputPanel', { | |
ef4ef788 | 105 | extend: 'Proxmox.panel.InputPanel', |
ab2fac2f DM |
106 | alias: 'widget.pveLxcMemoryInputPanel', |
107 | ||
cb38d277 DC |
108 | onlineHelp: 'pct_memory', |
109 | ||
ab2fac2f DM |
110 | insideWizard: false, |
111 | ||
8058410f | 112 | initComponent: function() { |
ab2fac2f DM |
113 | var me = this; |
114 | ||
115 | var items = [ | |
116 | { | |
bf96f60d | 117 | xtype: 'proxmoxintegerfield', |
ab2fac2f | 118 | name: 'memory', |
18401445 | 119 | minValue: 16, |
ab2fac2f DM |
120 | value: '512', |
121 | step: 32, | |
07de0118 | 122 | fieldLabel: gettext('Memory') + ' (MiB)', |
ab2fac2f | 123 | labelWidth: labelWidth, |
f6710aac | 124 | allowBlank: false, |
ab2fac2f DM |
125 | }, |
126 | { | |
bf96f60d | 127 | xtype: 'proxmoxintegerfield', |
ab2fac2f DM |
128 | name: 'swap', |
129 | minValue: 0, | |
ab2fac2f DM |
130 | value: '512', |
131 | step: 32, | |
07de0118 | 132 | fieldLabel: gettext('Swap') + ' (MiB)', |
ab2fac2f | 133 | labelWidth: labelWidth, |
f6710aac TL |
134 | allowBlank: false, |
135 | }, | |
ab2fac2f DM |
136 | ]; |
137 | ||
138 | if (me.insideWizard) { | |
139 | me.column1 = items; | |
140 | } else { | |
141 | me.items = items; | |
142 | } | |
2a4971d8 | 143 | |
ab2fac2f | 144 | me.callParent(); |
f6710aac | 145 | }, |
ab2fac2f | 146 | }); |