]> git.proxmox.com Git - pve-manager.git/blob - www/manager6/node/Config.js
added basic ability to install ceph via gui
[pve-manager.git] / www / manager6 / node / Config.js
1 Ext.define('PVE.node.Config', {
2 extend: 'PVE.panel.Config',
3 alias: 'widget.PVE.node.Config',
4
5 onlineHelp: 'chapter_system_administration',
6
7 initComponent: function() {
8 var me = this;
9
10 var nodename = me.pveSelNode.data.node;
11 if (!nodename) {
12 throw "no node name specified";
13 }
14
15 var caps = Ext.state.Manager.get('GuiCap');
16
17 me.statusStore = Ext.create('Proxmox.data.ObjectStore', {
18 url: "/api2/json/nodes/" + nodename + "/status",
19 interval: 1000
20 });
21
22 var node_command = function(cmd) {
23 Proxmox.Utils.API2Request({
24 params: { command: cmd },
25 url: '/nodes/' + nodename + '/status',
26 method: 'POST',
27 waitMsgTarget: me,
28 failure: function(response, opts) {
29 Ext.Msg.alert(gettext('Error'), response.htmlStatus);
30 }
31 });
32 };
33
34 var actionBtn = Ext.create('Ext.Button', {
35 text: gettext('Bulk Actions'),
36 iconCls: 'fa fa-fw fa-ellipsis-v',
37 disabled: !caps.nodes['Sys.PowerMgmt'],
38 menu: new Ext.menu.Menu({
39 items: [
40 {
41 text: gettext('Bulk Start'),
42 iconCls: 'fa fa-fw fa-play',
43 handler: function() {
44 var win = Ext.create('PVE.window.BulkAction', {
45 nodename: nodename,
46 title: gettext('Bulk Start'),
47 btnText: gettext('Start'),
48 action: 'startall'
49 });
50 win.show();
51 }
52 },
53 {
54 text: gettext('Bulk Stop'),
55 iconCls: 'fa fa-fw fa-stop',
56 handler: function() {
57 var win = Ext.create('PVE.window.BulkAction', {
58 nodename: nodename,
59 title: gettext('Bulk Stop'),
60 btnText: gettext('Stop'),
61 action: 'stopall'
62 });
63 win.show();
64 }
65 },
66 {
67 text: gettext('Bulk Migrate'),
68 iconCls: 'fa fa-fw fa-send-o',
69 handler: function() {
70 var win = Ext.create('PVE.window.BulkAction', {
71 nodename: nodename,
72 title: gettext('Bulk Migrate'),
73 btnText: gettext('Migrate'),
74 action: 'migrateall'
75 });
76 win.show();
77 }
78 }
79 ]
80 })
81 });
82
83 var restartBtn = Ext.create('Proxmox.button.Button', {
84 text: gettext('Reboot'),
85 disabled: !caps.nodes['Sys.PowerMgmt'],
86 dangerous: true,
87 confirmMsg: Ext.String.format(gettext("Reboot node '{0}'?"), nodename),
88 handler: function() {
89 node_command('reboot');
90 },
91 iconCls: 'fa fa-undo'
92 });
93
94 var shutdownBtn = Ext.create('Proxmox.button.Button', {
95 text: gettext('Shutdown'),
96 disabled: !caps.nodes['Sys.PowerMgmt'],
97 dangerous: true,
98 confirmMsg: Ext.String.format(gettext("Shutdown node '{0}'?"), nodename),
99 handler: function() {
100 node_command('shutdown');
101 },
102 iconCls: 'fa fa-power-off'
103 });
104
105 var shellBtn = Ext.create('PVE.button.ConsoleButton', {
106 disabled: !caps.nodes['Sys.Console'],
107 text: gettext('Shell'),
108 consoleType: 'shell',
109 nodename: nodename
110 });
111
112 me.items = [];
113
114 Ext.apply(me, {
115 title: gettext('Node') + " '" + nodename + "'",
116 hstateid: 'nodetab',
117 defaults: { statusStore: me.statusStore },
118 tbar: [ restartBtn, shutdownBtn, shellBtn, actionBtn]
119 });
120
121 if (caps.nodes['Sys.Audit']) {
122 me.items.push(
123 {
124 title: gettext('Summary'),
125 iconCls: 'fa fa-book',
126 itemId: 'summary',
127 xtype: 'pveNodeSummary'
128 },
129 {
130 title: gettext('Notes'),
131 iconCls: 'fa fa-sticky-note-o',
132 itemId: 'notes',
133 xtype: 'pveNotesView'
134 }
135 );
136 }
137
138 if (caps.nodes['Sys.Console']) {
139 me.items.push(
140 {
141 title: gettext('Shell'),
142 iconCls: 'fa fa-terminal',
143 itemId: 'jsconsole',
144 xtype: 'pveNoVncConsole',
145 consoleType: 'shell',
146 xtermjs: true,
147 nodename: nodename
148 }
149 );
150 }
151
152 if (caps.nodes['Sys.Audit']) {
153 me.items.push(
154 {
155 title: gettext('System'),
156 iconCls: 'fa fa-cogs',
157 itemId: 'services',
158 expandedOnInit: true,
159 startOnlyServices: {
160 'pveproxy': true,
161 'pvedaemon': true,
162 'pve-cluster': true
163 },
164 nodename: nodename,
165 onlineHelp: 'pve_service_daemons',
166 xtype: 'proxmoxNodeServiceView'
167 },
168 {
169 title: gettext('Network'),
170 iconCls: 'fa fa-exchange',
171 itemId: 'network',
172 groups: ['services'],
173 nodename: nodename,
174 onlineHelp: 'sysadmin_network_configuration',
175 xtype: 'proxmoxNodeNetworkView'
176 },
177 {
178 title: gettext('Certificates'),
179 iconCls: 'fa fa-certificate',
180 itemId: 'certificates',
181 groups: ['services'],
182 nodename: nodename,
183 xtype: 'pveCertificatesView'
184 },
185 {
186 title: gettext('DNS'),
187 iconCls: 'fa fa-globe',
188 groups: ['services'],
189 itemId: 'dns',
190 nodename: nodename,
191 onlineHelp: 'sysadmin_network_configuration',
192 xtype: 'proxmoxNodeDNSView'
193 },
194 {
195 title: gettext('Hosts'),
196 iconCls: 'fa fa-globe',
197 groups: ['services'],
198 itemId: 'hosts',
199 nodename: nodename,
200 onlineHelp: 'sysadmin_network_configuration',
201 xtype: 'proxmoxNodeHostsView'
202 },
203 {
204 title: gettext('Time'),
205 itemId: 'time',
206 groups: ['services'],
207 nodename: nodename,
208 xtype: 'proxmoxNodeTimeView',
209 iconCls: 'fa fa-clock-o'
210 });
211 }
212
213 if (caps.nodes['Sys.Syslog']) {
214 me.items.push({
215 title: 'Syslog',
216 iconCls: 'fa fa-list',
217 groups: ['services'],
218 disabled: !caps.nodes['Sys.Syslog'],
219 itemId: 'syslog',
220 xtype: 'proxmoxLogView',
221 url: "/api2/extjs/nodes/" + nodename + "/syslog",
222 log_select_timespan: 1
223 });
224
225 if (caps.nodes['Sys.Modify']) {
226 me.items.push({
227 title: gettext('Updates'),
228 iconCls: 'fa fa-refresh',
229 disabled: !caps.nodes['Sys.Console'],
230 // do we want to link to system updates instead?
231 itemId: 'apt',
232 xtype: 'proxmoxNodeAPT',
233 upgradeBtn: {
234 xtype: 'pveConsoleButton',
235 disabled: Proxmox.UserName !== 'root@pam',
236 text: gettext('Upgrade'),
237 consoleType: 'upgrade',
238 nodename: nodename
239 },
240 nodename: nodename
241 });
242 }
243 }
244
245 if (caps.nodes['Sys.Audit']) {
246 me.items.push(
247 {
248 xtype: 'pveFirewallRules',
249 iconCls: 'fa fa-shield',
250 title: gettext('Firewall'),
251 allow_iface: true,
252 base_url: '/nodes/' + nodename + '/firewall/rules',
253 list_refs_url: '/cluster/firewall/refs',
254 itemId: 'firewall'
255 },
256 {
257 xtype: 'pveFirewallOptions',
258 title: gettext('Options'),
259 iconCls: 'fa fa-gear',
260 onlineHelp: 'pve_firewall_host_specific_configuration',
261 groups: ['firewall'],
262 base_url: '/nodes/' + nodename + '/firewall/options',
263 fwtype: 'node',
264 itemId: 'firewall-options'
265 });
266 }
267
268
269 if (caps.nodes['Sys.Audit']) {
270 me.items.push(
271 {
272 title: gettext('Disks'),
273 itemId: 'storage',
274 expandedOnInit: true,
275 iconCls: 'fa fa-hdd-o',
276 xtype: 'pveNodeDiskList'
277 },
278 {
279 title: 'LVM',
280 itemId: 'lvm',
281 onlineHelp: 'chapter_lvm',
282 iconCls: 'fa fa-square',
283 groups: ['storage'],
284 xtype: 'pveLVMList'
285 },
286 {
287 title: 'LVM-Thin',
288 itemId: 'lvmthin',
289 onlineHelp: 'chapter_lvm',
290 iconCls: 'fa fa-square-o',
291 groups: ['storage'],
292 xtype: 'pveLVMThinList'
293 },
294 {
295 title: Proxmox.Utils.directoryText,
296 itemId: 'directory',
297 onlineHelp: 'chapter_storage',
298 iconCls: 'fa fa-folder',
299 groups: ['storage'],
300 xtype: 'pveDirectoryList'
301 },
302 {
303 title: 'ZFS',
304 itemId: 'zfs',
305 onlineHelp: 'chapter_zfs',
306 iconCls: 'fa fa-th-large',
307 groups: ['storage'],
308 xtype: 'pveZFSList'
309 },
310 {
311 title: 'Ceph',
312 itemId: 'ceph',
313 iconCls: 'fa fa-ceph',
314 xtype: 'pveNodeCephStatus'
315 },
316 {
317 xtype: 'pveReplicaView',
318 iconCls: 'fa fa-retweet',
319 title: gettext('Replication'),
320 itemId: 'replication'
321 },
322 {
323 xtype: 'pveNodeCephConfigCrush',
324 title: gettext('Configuration'),
325 iconCls: 'fa fa-gear',
326 groups: ['ceph'],
327 itemId: 'ceph-config'
328 },
329 {
330 xtype: 'pveNodeCephMonList',
331 title: gettext('Monitor'),
332 iconCls: 'fa fa-tv',
333 groups: ['ceph'],
334 itemId: 'ceph-monlist'
335 },
336 {
337 xtype: 'pveNodeCephOsdTree',
338 title: 'OSD',
339 iconCls: 'fa fa-hdd-o',
340 groups: ['ceph'],
341 itemId: 'ceph-osdtree'
342 },
343 {
344 xtype: 'pveNodeCephFSPanel',
345 title: 'CephFS',
346 iconCls: 'fa fa-folder',
347 groups: ['ceph'],
348 nodename: nodename,
349 itemId: 'ceph-cephfspanel'
350 },
351 {
352 xtype: 'pveNodeCephPoolList',
353 title: 'Pools',
354 iconCls: 'fa fa-sitemap',
355 groups: ['ceph'],
356 itemId: 'ceph-pools'
357 }
358 );
359 }
360
361 if (caps.nodes['Sys.Syslog']) {
362 me.items.push(
363 {
364 xtype: 'proxmoxLogView',
365 title: gettext('Log'),
366 iconCls: 'fa fa-list',
367 groups: ['firewall'],
368 onlineHelp: 'chapter_pve_firewall',
369 url: '/api2/extjs/nodes/' + nodename + '/firewall/log',
370 itemId: 'firewall-fwlog'
371 },
372 {
373 title: gettext('Log'),
374 itemId: 'ceph-log',
375 iconCls: 'fa fa-list',
376 groups: ['ceph'],
377 onlineHelp: 'chapter_pveceph',
378 xtype: 'cephLogView',
379 url: "/api2/extjs/nodes/" + nodename + "/ceph/log",
380 nodename: nodename
381 });
382 }
383
384 me.items.push(
385 {
386 title: gettext('Task History'),
387 iconCls: 'fa fa-list',
388 itemId: 'tasks',
389 nodename: nodename,
390 xtype: 'proxmoxNodeTasks'
391 },
392 {
393 title: gettext('Subscription'),
394 iconCls: 'fa fa-support',
395 itemId: 'support',
396 xtype: 'pveNodeSubscription',
397 nodename: nodename
398 }
399 );
400
401 me.callParent();
402
403 me.mon(me.statusStore, 'load', function(s, records, success) {
404 var uptimerec = s.data.get('uptime');
405 var powermgmt = uptimerec ? uptimerec.data.value : false;
406 if (!caps.nodes['Sys.PowerMgmt']) {
407 powermgmt = false;
408 }
409 restartBtn.setDisabled(!powermgmt);
410 shutdownBtn.setDisabled(!powermgmt);
411 shellBtn.setDisabled(!powermgmt);
412 });
413
414 me.on('afterrender', function() {
415 me.statusStore.startUpdate();
416 });
417
418 me.on('destroy', function() {
419 me.statusStore.stopUpdate();
420 });
421 }
422 });