]> git.proxmox.com Git - pve-manager.git/blame - www/manager6/lxc/ResourceEdit.js
ui: qemu/lxc: cpu edit: fix 'create' parameter for delete_if_default()
[pve-manager.git] / www / manager6 / lxc / ResourceEdit.js
CommitLineData
ab2fac2f
DM
1var labelWidth = 120;
2
3Ext.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
21Ext.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 38Ext.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
61c03387
FE
49 PVE.Utils.delete_if_default(values, 'cpulimit', '0', me.insideWizard);
50 PVE.Utils.delete_if_default(values, 'cpuunits', '1024', me.insideWizard);
92b5029f
DM
51
52 return values;
53 },
54
53395db1
DC
55 advancedColumn1: [
56 {
57 xtype: 'numberfield',
58 name: 'cpulimit',
59 minValue: 0,
60 value: '',
61 step: 1,
62 fieldLabel: gettext('CPU limit'),
63 allowBlank: true,
f6710aac
TL
64 emptyText: gettext('unlimited'),
65 },
53395db1
DC
66 ],
67
68 advancedColumn2: [
69 {
70 xtype: 'proxmoxintegerfield',
71 name: 'cpuunits',
72 fieldLabel: gettext('CPU units'),
73 value: 1024,
74 minValue: 8,
75 maxValue: 500000,
76 labelWidth: labelWidth,
f6710aac
TL
77 allowBlank: false,
78 },
53395db1
DC
79 ],
80
81 initComponent: function() {
ab2fac2f
DM
82 var me = this;
83
53395db1
DC
84 me.column1 = [
85 {
86 xtype: 'proxmoxintegerfield',
87 name: 'cores',
92b5029f 88 minValue: 1,
641da26d 89 maxValue: 8192,
92b5029f
DM
90 value: me.insideWizard ? 1 : '',
91 fieldLabel: gettext('Cores'),
92 allowBlank: true,
bf96f60d 93 deleteEmpty: true,
f6710aac
TL
94 emptyText: gettext('unlimited'),
95 },
ab2fac2f
DM
96 ];
97
ab2fac2f 98 me.callParent();
f6710aac 99 },
ab2fac2f
DM
100});
101
102Ext.define('PVE.lxc.MemoryInputPanel', {
ef4ef788 103 extend: 'Proxmox.panel.InputPanel',
ab2fac2f
DM
104 alias: 'widget.pveLxcMemoryInputPanel',
105
cb38d277
DC
106 onlineHelp: 'pct_memory',
107
ab2fac2f
DM
108 insideWizard: false,
109
8058410f 110 initComponent: function() {
ab2fac2f
DM
111 var me = this;
112
113 var items = [
114 {
bf96f60d 115 xtype: 'proxmoxintegerfield',
ab2fac2f 116 name: 'memory',
18401445 117 minValue: 16,
ab2fac2f
DM
118 value: '512',
119 step: 32,
07de0118 120 fieldLabel: gettext('Memory') + ' (MiB)',
ab2fac2f 121 labelWidth: labelWidth,
f6710aac 122 allowBlank: false,
ab2fac2f
DM
123 },
124 {
bf96f60d 125 xtype: 'proxmoxintegerfield',
ab2fac2f
DM
126 name: 'swap',
127 minValue: 0,
ab2fac2f
DM
128 value: '512',
129 step: 32,
07de0118 130 fieldLabel: gettext('Swap') + ' (MiB)',
ab2fac2f 131 labelWidth: labelWidth,
f6710aac
TL
132 allowBlank: false,
133 },
ab2fac2f
DM
134 ];
135
136 if (me.insideWizard) {
137 me.column1 = items;
138 } else {
139 me.items = items;
140 }
2a4971d8 141
ab2fac2f 142 me.callParent();
f6710aac 143 },
ab2fac2f 144});