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