]> git.proxmox.com Git - pve-manager.git/blame - www/manager6/ceph/CephInstallWizard.js
fixup: remove allowBlank and ensure interworking of size is correct
[pve-manager.git] / www / manager6 / ceph / CephInstallWizard.js
CommitLineData
4616a55b
TM
1Ext.define('PVE.ceph.CephInstallWizard', {
2 extend: 'PVE.window.Wizard',
3 alias: 'widget.pveCephInstallWizard',
4 mixins: ['Proxmox.Mixin.CBind'],
5 resizable: false,
6 nodename: undefined,
7 viewModel: {
8 data: {
9 nodename: ''
10 }
11 },
12 cbindData: {
13 nodename: undefined
14 },
15 title: gettext('Installation'),
16 items: [
17 {
18 title: gettext('Info'),
19 xtype: 'panel',
20 border: false,
21 bodyBorder: false,
22 onlineHelp: 'chapter_pveceph',
23 html: '<h3>Ceph?</h3>'+
24 '<blockquote cite="https://ceph.com/"><p>"<b>Ceph</b> is a unified, distributed storage system designed for excellent performance, reliability and scalability."</p></blockquote>'+
25 '<p><b>Ceph</b> is currently <b>not installed</b> on this node, click on the next button below to start the installation.'+
26 ' This wizard will guide you through the necessary steps, after the initial installation you will be offered to create a initial configuration.'+
27 ' The configuration step is only needed once per cluster and will be skipped if a config is already present.</p>'+
28 '<p>Please take a look at our documentation, by clicking the help button below, before starting the installation, if you want to gain deeper knowledge about Ceph visit <a href="http://docs.ceph.com/docs/master/">ceph.com</a>.</p>',
29 listeners: {
30 activate: function() {
31 // notify owning container that it should display a help button
32 if (this.onlineHelp) {
33 Ext.GlobalEvents.fireEvent('proxmoxShowHelp', this.onlineHelp);
34 }
35 this.up('pveCephInstallWizard').down('#back').hide(true);
fc360d85 36 this.up('pveCephInstallWizard').down('#next').setText(gettext('Start installation'));
4616a55b
TM
37 },
38 deactivate: function() {
39 if (this.onlineHelp) {
40 Ext.GlobalEvents.fireEvent('proxmoxHideHelp', this.onlineHelp);
41 }
fc360d85 42 this.up('pveCephInstallWizard').down('#next').setText(gettext('Next'));
4616a55b
TM
43 }
44 }
45 },
46 {
47 title: gettext('Installation'),
48 xtype: 'panel',
49 layout: 'fit',
50 cbind:{
51 nodename: '{nodename}'
52 },
53 listeners: {
54 afterrender: function() {
55 var me = this;
56 me.down('pveNoVncConsole').fireEvent('activate');
57 },
58 activate: function() {
59 var me = this;
60 var nodename = me.nodename;
61 me.updateStore = Ext.create('Proxmox.data.UpdateStore', {
62 storeid: 'ceph-status-' + nodename,
63 interval: 1000,
64 proxy: {
65 type: 'proxmox',
66 url: '/api2/json/nodes/' + nodename + '/ceph/status'
67 },
68 listeners: {
69 load: function(rec, response, success, operation) {
70 var wizard = me.up('#wizcontent');
71 var tabs = wizard.items;
72 var lastTab = tabs.items[tabs.length-1];
73 if (success) {
74 me.updateStore.stopUpdate();
75 lastTab.enable();
76 wizard.setActiveTab(lastTab);
77 } else if (operation.error.statusText.match("not initialized", "i")) {
78 me.updateStore.stopUpdate();
79 me.down('textfield').setValue('success');
80 } else if (operation.error.statusText.match("rados_connect failed", "i")) {
81 me.updateStore.stopUpdate();
82 lastTab.enable();
83 wizard.setActiveTab(lastTab);
84 } else if (!operation.error.statusText.match("not installed", "i")) {
85 Proxmox.Utils.setErrorMask(me, operation.error.statusText);
86 }
87 }
88 }
89 });
90 me.updateStore.startUpdate();
91 },
92 destroy: function() {
93 var me = this;
94 if (me.updateStore) {
95 me.updateStore.stopUpdate();
96 }
97 }
98 },
99 items: [
100 {
101 itemId: 'jsconsole',
102 consoleType: 'cmd',
103 xtermjs: true,
104 xtype: 'pveNoVncConsole',
105 cbind:{
106 nodename: '{nodename}'
107 },
108 cmd: 'ceph_install'
109 },
110 {
111 xtype: 'textfield',
112 name: 'installSuccess',
113 value: '',
114 allowBlank: false,
115 submitValue: false,
116 hidden: true
117 }
118 ]
119 },
120 {
121 xtype: 'inputpanel',
122 title: gettext('Configuration'),
123 onlineHelp: 'chapter_pveceph',
124 cbind: {
125 nodename: '{nodename}'
126 },
836d66f7
TM
127 viewModel: {
128 data: {
129 replicas: undefined,
130 minreplicas: undefined
131 }
132 },
4616a55b
TM
133 listeners: {
134 activate: function() {
135 this.up('pveCephInstallWizard').down('#submit').setText(gettext('Next'));
136 },
137 deactivate: function() {
138 this.up('pveCephInstallWizard').down('#submit').setText(gettext('Finish'));
139 }
140 },
141 column1: [
142 {
143 xtype: 'displayfield',
144 name: 'nodename',
145 fieldLabel: gettext('Node'),
146 cbind: {
147 value: '{nodename}'
148 },
149 padding: 5
150 },
151 {
152 xtype: 'textfield',
153 name: 'network',
154 vtype: 'IPCIDRAddress',
155 value: '',
2248c6c8 156 fieldLabel: 'Public Network IP/CIDR',
4616a55b
TM
157 allowBlank: false
158 },
159 {
160 xtype: 'textfield',
161 name: 'cluster-network',
162 vtype: 'IPCIDRAddress',
2248c6c8 163 fieldLabel: 'Cluster Network IP/CIDR',
4616a55b 164 allowBlank: true,
2248c6c8 165 emptyText: gettext('Same as Public Network')
4616a55b
TM
166 }
167 ],
168 advancedColumn1: [
169 {
170 xtype: 'numberfield',
171 name: 'size',
0b985d6f 172 fieldLabel: 'Number of replicas',
836d66f7 173 bind: {
8134b6b7 174 value: '{replicas}'
836d66f7 175 },
4616a55b 176 maxValue: 7,
8134b6b7
TL
177 minValue: 2,
178 emptyText: '3'
4616a55b
TM
179 },
180 {
181 xtype: 'numberfield',
182 name: 'min_size',
0b985d6f 183 fieldLabel: 'Minimum replicas',
836d66f7
TM
184 bind: {
185 maxValue: '{replicas}',
8134b6b7 186 value: '{minreplicas}'
836d66f7 187 },
8134b6b7
TL
188 minValue: 2,
189 maxValue: 3,
190 setMaxValue: function(value) {
191 this.maxValue = Ext.Number.from(value, 2);
192 // allow enough to avoid split brains with max 'size', but more makes simply no sense
193 if (this.maxValue > 4) {
194 this.maxValue = 4;
195 }
196 this.toggleSpinners();
836d66f7 197 this.validate();
8134b6b7
TL
198 },
199 emptyText: '2'
4616a55b
TM
200 },
201 {
202 xtype: 'numberfield',
203 name: 'pg_bits',
204 fieldLabel: 'Placement group bits',
205 value: '',
206 maxValue: 14,
207 minValue: 6,
208 allowBlank: true,
fc360d85 209 emptyText: '6'
4616a55b
TM
210 }
211 ],
212 onGetValues: function(values) {
213 ['cluster-network', 'size', 'min_size', 'pg_bits'].forEach(function(field) {
214 if (!values[field]) {
215 delete values[field];
216 }
217 });
218 return values;
219 },
220 onSubmit: function() {
221 var me = this;
222 var wizard = me.up('window');
223 var kv = wizard.getValues();
224 delete kv['delete'];
225 var nodename = me.nodename;
226 delete kv.nodename;
227 Proxmox.Utils.API2Request({
228 url: '/nodes/'+nodename+'/ceph/init',
229 waitMsgTarget: wizard,
230 method: 'POST',
231 params: kv,
232 success: function() {
233 var tp = me.up('#wizcontent');
234 var atab = tp.getActiveTab();
235
236 var next = tp.items.indexOf(atab) + 1;
237 var ntab = tp.items.getAt(next);
238 if (ntab) {
239 ntab.enable();
240 tp.setActiveTab(ntab);
241 }
242 },
243 failure: function(response, opts) {
244 Ext.Msg.alert(gettext('Error'), response.htmlStatus);
245 }
246 });
247 }
248 },
249 {
250 title: gettext('Success'),
251 xtype: 'panel',
252 border: false,
253 bodyBorder: false,
254 onlineHelp: 'pve_ceph_install',
255 html: '<h3>Installation successful!</h3>'+
256 '<p>The basic installation and configuration is completed, depending on your setup some of the following steps are required to start using Ceph:</p>'+
443cb6d7 257 '<ol><li>Create additional Ceph Monitors</li><li>Create Ceph OSDs</li><li>Create Ceph Pools</li></ol>'+
4616a55b
TM
258 '<p>To learn more click on the help button below.</p>',
259 listeners: {
260 activate: function() {
261 // notify owning container that it should display a help button
262 if (this.onlineHelp) {
263 Ext.GlobalEvents.fireEvent('proxmoxShowHelp', this.onlineHelp);
264 }
265
266 var tp = this.up('#wizcontent');
267 var idx = tp.items.indexOf(this)-1;
268 for(;idx >= 0;idx--) {
269 var nc = tp.items.getAt(idx);
270 if (nc) {
271 nc.disable();
272 }
273 }
274 },
275 deactivate: function() {
276 if (this.onlineHelp) {
277 Ext.GlobalEvents.fireEvent('proxmoxHideHelp', this.onlineHelp);
278 }
279 }
280 },
281 onSubmit: function() {
282 var wizard = this.up('pveCephInstallWizard');
283 wizard.close();
284 }
285 }
286 ]
2248c6c8 287 });