]>
Commit | Line | Data |
---|---|---|
2ba22ee4 DM |
1 | Ext.define('PVE.node.Config', { |
2 | extend: 'PVE.panel.Config', | |
3 | alias: 'widget.PVE.node.Config', | |
4 | ||
c8802a60 | 5 | onlineHelp: 'chapter_system_administration', |
0f9347a6 | 6 | |
2ba22ee4 DM |
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 | ||
9cb193cf | 17 | me.statusStore = Ext.create('Proxmox.data.ObjectStore', { |
2ba22ee4 | 18 | url: "/api2/json/nodes/" + nodename + "/status", |
e51cd02b | 19 | interval: 5000, |
2ba22ee4 DM |
20 | }); |
21 | ||
22 | var node_command = function(cmd) { | |
e7ade592 | 23 | Proxmox.Utils.API2Request({ |
2ba22ee4 DM |
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); | |
e51cd02b | 30 | }, |
2ba22ee4 DM |
31 | }); |
32 | }; | |
c474314e | 33 | |
2ba22ee4 | 34 | var actionBtn = Ext.create('Ext.Button', { |
6a4edbd1 | 35 | text: gettext('Bulk Actions'), |
9a132f4a | 36 | iconCls: 'fa fa-fw fa-ellipsis-v', |
0d06378c | 37 | disabled: !caps.vms['VM.PowerMgmt'] && !caps.vms['VM.Migrate'], |
2ba22ee4 DM |
38 | menu: new Ext.menu.Menu({ |
39 | items: [ | |
40 | { | |
6a4edbd1 | 41 | text: gettext('Bulk Start'), |
d4333933 | 42 | iconCls: 'fa fa-fw fa-play', |
0d06378c | 43 | disabled: !caps.vms['VM.PowerMgmt'], |
2ba22ee4 | 44 | handler: function() { |
dd604328 TL |
45 | Ext.create('PVE.window.BulkAction', { |
46 | autoShow: true, | |
6a4edbd1 DC |
47 | nodename: nodename, |
48 | title: gettext('Bulk Start'), | |
49 | btnText: gettext('Start'), | |
e51cd02b | 50 | action: 'startall', |
2ba22ee4 | 51 | }); |
e51cd02b | 52 | }, |
2ba22ee4 DM |
53 | }, |
54 | { | |
31fcdc1e | 55 | text: gettext('Bulk Shutdown'), |
6a4edbd1 | 56 | iconCls: 'fa fa-fw fa-stop', |
0d06378c | 57 | disabled: !caps.vms['VM.PowerMgmt'], |
2ba22ee4 | 58 | handler: function() { |
dd604328 TL |
59 | Ext.create('PVE.window.BulkAction', { |
60 | autoShow: true, | |
6a4edbd1 | 61 | nodename: nodename, |
31fcdc1e TL |
62 | title: gettext('Bulk Shutdown'), |
63 | btnText: gettext('Shutdown'), | |
e51cd02b | 64 | action: 'stopall', |
2ba22ee4 | 65 | }); |
e51cd02b | 66 | }, |
2ba22ee4 | 67 | }, |
9ed1408b HL |
68 | { |
69 | text: gettext('Bulk Suspend'), | |
70 | iconCls: 'fa fa-fw fa-download', | |
71 | disabled: !caps.vms['VM.PowerMgmt'], | |
72 | handler: function() { | |
73 | Ext.create('PVE.window.BulkAction', { | |
74 | autoShow: true, | |
75 | nodename: nodename, | |
76 | title: gettext('Bulk Suspend'), | |
77 | btnText: gettext('Suspend'), | |
78 | action: 'suspendall', | |
79 | }); | |
80 | }, | |
81 | }, | |
2ba22ee4 | 82 | { |
6a4edbd1 | 83 | text: gettext('Bulk Migrate'), |
d4333933 | 84 | iconCls: 'fa fa-fw fa-send-o', |
44705bf6 | 85 | disabled: !caps.vms['VM.Migrate'], |
ed38c56b | 86 | hidden: PVE.Utils.isStandaloneNode(), |
2ba22ee4 | 87 | handler: function() { |
dd604328 TL |
88 | Ext.create('PVE.window.BulkAction', { |
89 | autoShow: true, | |
6a4edbd1 DC |
90 | nodename: nodename, |
91 | title: gettext('Bulk Migrate'), | |
92 | btnText: gettext('Migrate'), | |
e51cd02b | 93 | action: 'migrateall', |
2ba22ee4 | 94 | }); |
e51cd02b TL |
95 | }, |
96 | }, | |
97 | ], | |
98 | }), | |
c474314e | 99 | }); |
2ba22ee4 | 100 | |
23f14fd9 | 101 | let restartBtn = Ext.create('Proxmox.button.Button', { |
b2487c5c | 102 | text: gettext('Reboot'), |
2ba22ee4 | 103 | disabled: !caps.nodes['Sys.PowerMgmt'], |
31cb3622 | 104 | dangerous: true, |
b2487c5c | 105 | confirmMsg: Ext.String.format(gettext("Reboot node '{0}'?"), nodename), |
c474314e | 106 | handler: function() { |
2ba22ee4 | 107 | node_command('reboot'); |
d4333933 | 108 | }, |
e51cd02b | 109 | iconCls: 'fa fa-undo', |
2ba22ee4 DM |
110 | }); |
111 | ||
5720fafa | 112 | var shutdownBtn = Ext.create('Proxmox.button.Button', { |
2ba22ee4 DM |
113 | text: gettext('Shutdown'), |
114 | disabled: !caps.nodes['Sys.PowerMgmt'], | |
31cb3622 | 115 | dangerous: true, |
b2487c5c | 116 | confirmMsg: Ext.String.format(gettext("Shutdown node '{0}'?"), nodename), |
c474314e | 117 | handler: function() { |
2ba22ee4 | 118 | node_command('shutdown'); |
d4333933 | 119 | }, |
e51cd02b | 120 | iconCls: 'fa fa-power-off', |
2ba22ee4 DM |
121 | }); |
122 | ||
123 | var shellBtn = Ext.create('PVE.button.ConsoleButton', { | |
124 | disabled: !caps.nodes['Sys.Console'], | |
125 | text: gettext('Shell'), | |
126 | consoleType: 'shell', | |
e51cd02b | 127 | nodename: nodename, |
2ba22ee4 DM |
128 | }); |
129 | ||
130 | me.items = []; | |
131 | ||
132 | Ext.apply(me, { | |
133 | title: gettext('Node') + " '" + nodename + "'", | |
134 | hstateid: 'nodetab', | |
23f14fd9 | 135 | defaults: { |
e51cd02b | 136 | statusStore: me.statusStore, |
23f14fd9 | 137 | }, |
e51cd02b | 138 | tbar: [restartBtn, shutdownBtn, shellBtn, actionBtn], |
2ba22ee4 DM |
139 | }); |
140 | ||
141 | if (caps.nodes['Sys.Audit']) { | |
7621bfbf | 142 | me.items.push( |
2ba22ee4 | 143 | { |
e51cd02b | 144 | xtype: 'pveNodeSummary', |
2ba22ee4 | 145 | title: gettext('Summary'), |
332581a8 | 146 | iconCls: 'fa fa-book', |
a14b3223 | 147 | itemId: 'summary', |
799ea12f DC |
148 | }, |
149 | { | |
742de03d | 150 | xtype: 'pmxNotesView', |
799ea12f DC |
151 | title: gettext('Notes'), |
152 | iconCls: 'fa fa-sticky-note-o', | |
153 | itemId: 'notes', | |
e51cd02b | 154 | }, |
a14b3223 DC |
155 | ); |
156 | } | |
157 | ||
158 | if (caps.nodes['Sys.Console']) { | |
159 | me.items.push( | |
160 | { | |
e51cd02b | 161 | xtype: 'pveNoVncConsole', |
a14b3223 DC |
162 | title: gettext('Shell'), |
163 | iconCls: 'fa fa-terminal', | |
d345d7ad | 164 | itemId: 'jsconsole', |
d345d7ad DC |
165 | consoleType: 'shell', |
166 | xtermjs: true, | |
e51cd02b TL |
167 | nodename: nodename, |
168 | }, | |
a14b3223 DC |
169 | ); |
170 | } | |
171 | ||
172 | if (caps.nodes['Sys.Audit']) { | |
173 | me.items.push( | |
2ba22ee4 | 174 | { |
e51cd02b | 175 | xtype: 'proxmoxNodeServiceView', |
a14b3223 | 176 | title: gettext('System'), |
332581a8 | 177 | iconCls: 'fa fa-cogs', |
2ba22ee4 | 178 | itemId: 'services', |
a14b3223 | 179 | expandedOnInit: true, |
d49b5128 | 180 | restartCommand: 'reload', // avoid disruptions |
4178b82a DC |
181 | startOnlyServices: { |
182 | 'pveproxy': true, | |
183 | 'pvedaemon': true, | |
e51cd02b | 184 | 'pve-cluster': true, |
4178b82a DC |
185 | }, |
186 | nodename: nodename, | |
187 | onlineHelp: 'pve_service_daemons', | |
2ba22ee4 | 188 | }, |
a14b3223 | 189 | { |
e51cd02b | 190 | xtype: 'proxmoxNodeNetworkView', |
a14b3223 DC |
191 | title: gettext('Network'), |
192 | iconCls: 'fa fa-exchange', | |
193 | itemId: 'network', | |
009d20a8 | 194 | showApplyBtn: true, |
a14b3223 | 195 | groups: ['services'], |
13ff8209 DC |
196 | nodename: nodename, |
197 | onlineHelp: 'sysadmin_network_configuration', | |
a14b3223 | 198 | }, |
c287e233 | 199 | { |
e51cd02b | 200 | xtype: 'pveCertificatesView', |
c287e233 DC |
201 | title: gettext('Certificates'), |
202 | iconCls: 'fa fa-certificate', | |
203 | itemId: 'certificates', | |
204 | groups: ['services'], | |
205 | nodename: nodename, | |
c287e233 | 206 | }, |
a14b3223 | 207 | { |
e51cd02b | 208 | xtype: 'proxmoxNodeDNSView', |
a14b3223 DC |
209 | title: gettext('DNS'), |
210 | iconCls: 'fa fa-globe', | |
211 | groups: ['services'], | |
212 | itemId: 'dns', | |
66ce20fd DC |
213 | nodename: nodename, |
214 | onlineHelp: 'sysadmin_network_configuration', | |
a14b3223 | 215 | }, |
c88170a4 | 216 | { |
e51cd02b | 217 | xtype: 'proxmoxNodeHostsView', |
c88170a4 DC |
218 | title: gettext('Hosts'), |
219 | iconCls: 'fa fa-globe', | |
220 | groups: ['services'], | |
221 | itemId: 'hosts', | |
222 | nodename: nodename, | |
223 | onlineHelp: 'sysadmin_network_configuration', | |
c88170a4 | 224 | }, |
1992003e TL |
225 | { |
226 | xtype: 'proxmoxNodeOptionsView', | |
227 | title: gettext('Options'), | |
228 | iconCls: 'fa fa-gear', | |
229 | groups: ['services'], | |
230 | itemId: 'options', | |
231 | nodename: nodename, | |
232 | onlineHelp: 'proxmox_node_management', | |
233 | }, | |
332581a8 | 234 | { |
e51cd02b | 235 | xtype: 'proxmoxNodeTimeView', |
332581a8 DC |
236 | title: gettext('Time'), |
237 | itemId: 'time', | |
a14b3223 | 238 | groups: ['services'], |
939edd73 | 239 | nodename: nodename, |
e51cd02b | 240 | iconCls: 'fa fa-clock-o', |
332581a8 DC |
241 | }); |
242 | } | |
243 | ||
244 | if (caps.nodes['Sys.Syslog']) { | |
245 | me.items.push({ | |
e51cd02b | 246 | xtype: 'proxmoxJournalView', |
332581a8 DC |
247 | title: 'Syslog', |
248 | iconCls: 'fa fa-list', | |
a14b3223 | 249 | groups: ['services'], |
332581a8 DC |
250 | disabled: !caps.nodes['Sys.Syslog'], |
251 | itemId: 'syslog', | |
e51cd02b | 252 | url: "/api2/extjs/nodes/" + nodename + "/journal", |
332581a8 DC |
253 | }); |
254 | ||
255 | if (caps.nodes['Sys.Modify']) { | |
256 | me.items.push({ | |
e51cd02b | 257 | xtype: 'proxmoxNodeAPT', |
332581a8 DC |
258 | title: gettext('Updates'), |
259 | iconCls: 'fa fa-refresh', | |
02c634bc | 260 | expandedOnInit: true, |
332581a8 | 261 | disabled: !caps.nodes['Sys.Console'], |
0f9347a6 | 262 | // do we want to link to system updates instead? |
332581a8 | 263 | itemId: 'apt', |
371d39ef DC |
264 | upgradeBtn: { |
265 | xtype: 'pveConsoleButton', | |
35a04562 | 266 | disabled: Proxmox.UserName !== 'root@pam', |
371d39ef DC |
267 | text: gettext('Upgrade'), |
268 | consoleType: 'upgrade', | |
e51cd02b | 269 | nodename: nodename, |
371d39ef | 270 | }, |
e51cd02b | 271 | nodename: nodename, |
332581a8 | 272 | }); |
2292a196 FE |
273 | |
274 | me.items.push({ | |
275 | xtype: 'proxmoxNodeAPTRepositories', | |
02c634bc | 276 | title: gettext('Repositories'), |
2292a196 FE |
277 | iconCls: 'fa fa-files-o', |
278 | itemId: 'aptrepositories', | |
279 | nodename: nodename, | |
fac49b9a | 280 | onlineHelp: 'sysadmin_package_repositories', |
2292a196 FE |
281 | groups: ['apt'], |
282 | }); | |
332581a8 DC |
283 | } |
284 | } | |
285 | ||
286 | if (caps.nodes['Sys.Audit']) { | |
287 | me.items.push( | |
2ba22ee4 | 288 | { |
332581a8 DC |
289 | xtype: 'pveFirewallRules', |
290 | iconCls: 'fa fa-shield', | |
332581a8 DC |
291 | title: gettext('Firewall'), |
292 | allow_iface: true, | |
293 | base_url: '/nodes/' + nodename + '/firewall/rules', | |
294 | list_refs_url: '/cluster/firewall/refs', | |
e51cd02b | 295 | itemId: 'firewall', |
332581a8 DC |
296 | }, |
297 | { | |
298 | xtype: 'pveFirewallOptions', | |
299 | title: gettext('Options'), | |
300 | iconCls: 'fa fa-gear', | |
c8802a60 | 301 | onlineHelp: 'pve_firewall_host_specific_configuration', |
a14b3223 | 302 | groups: ['firewall'], |
332581a8 DC |
303 | base_url: '/nodes/' + nodename + '/firewall/options', |
304 | fwtype: 'node', | |
e51cd02b | 305 | itemId: 'firewall-options', |
332581a8 | 306 | }); |
2ba22ee4 DM |
307 | } |
308 | ||
332581a8 DC |
309 | |
310 | if (caps.nodes['Sys.Audit']) { | |
7621bfbf | 311 | me.items.push( |
fc2916c1 | 312 | { |
e51cd02b | 313 | xtype: 'pmxDiskList', |
fc2916c1 DC |
314 | title: gettext('Disks'), |
315 | itemId: 'storage', | |
316 | expandedOnInit: true, | |
317 | iconCls: 'fa fa-hdd-o', | |
4554fe77 | 318 | nodename: nodename, |
9bfcb161 | 319 | includePartitions: true, |
be375fee | 320 | supportsWipeDisk: true, |
fc2916c1 | 321 | }, |
d660ba8a | 322 | { |
e51cd02b | 323 | xtype: 'pveLVMList', |
d660ba8a DC |
324 | title: 'LVM', |
325 | itemId: 'lvm', | |
705edf41 | 326 | onlineHelp: 'chapter_lvm', |
d660ba8a DC |
327 | iconCls: 'fa fa-square', |
328 | groups: ['storage'], | |
d660ba8a | 329 | }, |
64f9c6d6 | 330 | { |
e51cd02b | 331 | xtype: 'pveLVMThinList', |
64f9c6d6 DC |
332 | title: 'LVM-Thin', |
333 | itemId: 'lvmthin', | |
705edf41 | 334 | onlineHelp: 'chapter_lvm', |
64f9c6d6 DC |
335 | iconCls: 'fa fa-square-o', |
336 | groups: ['storage'], | |
64f9c6d6 | 337 | }, |
6ac46211 | 338 | { |
e51cd02b | 339 | xtype: 'pveDirectoryList', |
6ac46211 DC |
340 | title: Proxmox.Utils.directoryText, |
341 | itemId: 'directory', | |
705edf41 | 342 | onlineHelp: 'chapter_storage', |
6ac46211 DC |
343 | iconCls: 'fa fa-folder', |
344 | groups: ['storage'], | |
6ac46211 | 345 | }, |
fee716d3 DC |
346 | { |
347 | title: 'ZFS', | |
348 | itemId: 'zfs', | |
349 | onlineHelp: 'chapter_zfs', | |
350 | iconCls: 'fa fa-th-large', | |
351 | groups: ['storage'], | |
e51cd02b | 352 | xtype: 'pveZFSList', |
fee716d3 | 353 | }, |
2ba22ee4 | 354 | { |
e51cd02b | 355 | xtype: 'pveNodeCephStatus', |
332581a8 DC |
356 | title: 'Ceph', |
357 | itemId: 'ceph', | |
358 | iconCls: 'fa fa-ceph', | |
332581a8 | 359 | }, |
332581a8 | 360 | { |
7247077d | 361 | xtype: 'pveNodeCephConfigCrush', |
ec99b1c3 | 362 | title: gettext('Configuration'), |
332581a8 DC |
363 | iconCls: 'fa fa-gear', |
364 | groups: ['ceph'], | |
e51cd02b | 365 | itemId: 'ceph-config', |
332581a8 DC |
366 | }, |
367 | { | |
a6c60aed | 368 | xtype: 'pveNodeCephMonMgr', |
332581a8 DC |
369 | title: gettext('Monitor'), |
370 | iconCls: 'fa fa-tv', | |
371 | groups: ['ceph'], | |
e51cd02b | 372 | itemId: 'ceph-monlist', |
332581a8 DC |
373 | }, |
374 | { | |
375 | xtype: 'pveNodeCephOsdTree', | |
376 | title: 'OSD', | |
377 | iconCls: 'fa fa-hdd-o', | |
378 | groups: ['ceph'], | |
e51cd02b | 379 | itemId: 'ceph-osdtree', |
332581a8 | 380 | }, |
563ed5ee TL |
381 | { |
382 | xtype: 'pveNodeCephFSPanel', | |
383 | title: 'CephFS', | |
384 | iconCls: 'fa fa-folder', | |
385 | groups: ['ceph'], | |
386 | nodename: nodename, | |
e51cd02b | 387 | itemId: 'ceph-cephfspanel', |
563ed5ee | 388 | }, |
332581a8 DC |
389 | { |
390 | xtype: 'pveNodeCephPoolList', | |
0d1108b2 | 391 | title: gettext('Pools'), |
332581a8 DC |
392 | iconCls: 'fa fa-sitemap', |
393 | groups: ['ceph'], | |
e51cd02b TL |
394 | itemId: 'ceph-pools', |
395 | }, | |
3eaf3881 TL |
396 | { |
397 | xtype: 'pveReplicaView', | |
398 | iconCls: 'fa fa-retweet', | |
399 | title: gettext('Replication'), | |
400 | itemId: 'replication', | |
401 | }, | |
7621bfbf | 402 | ); |
2ba22ee4 DM |
403 | } |
404 | ||
332581a8 | 405 | if (caps.nodes['Sys.Syslog']) { |
7621bfbf | 406 | me.items.push( |
2ba22ee4 | 407 | { |
0ee5a21e | 408 | xtype: 'proxmoxLogView', |
332581a8 DC |
409 | title: gettext('Log'), |
410 | iconCls: 'fa fa-list', | |
a14b3223 | 411 | groups: ['firewall'], |
c8802a60 | 412 | onlineHelp: 'chapter_pve_firewall', |
332581a8 | 413 | url: '/api2/extjs/nodes/' + nodename + '/firewall/log', |
e51cd02b | 414 | itemId: 'firewall-fwlog', |
038e94bb CE |
415 | log_select_timespan: true, |
416 | submitFormat: 'U', | |
2ba22ee4 DM |
417 | }, |
418 | { | |
e51cd02b | 419 | xtype: 'cephLogView', |
332581a8 DC |
420 | title: gettext('Log'), |
421 | itemId: 'ceph-log', | |
422 | iconCls: 'fa fa-list', | |
423 | groups: ['ceph'], | |
c8802a60 | 424 | onlineHelp: 'chapter_pveceph', |
4616a55b | 425 | url: "/api2/extjs/nodes/" + nodename + "/ceph/log", |
e51cd02b | 426 | nodename: nodename, |
332581a8 DC |
427 | }); |
428 | } | |
429 | ||
7621bfbf | 430 | me.items.push( |
332581a8 DC |
431 | { |
432 | title: gettext('Task History'), | |
56bc50b8 | 433 | iconCls: 'fa fa-list-alt', |
332581a8 | 434 | itemId: 'tasks', |
6c60ab5e | 435 | nodename: nodename, |
e51cd02b | 436 | xtype: 'proxmoxNodeTasks', |
e24567ac DC |
437 | extraFilter: [ |
438 | { | |
439 | xtype: 'pveGuestIDSelector', | |
440 | fieldLabel: gettext('VMID'), | |
441 | allowBlank: true, | |
442 | name: 'vmid', | |
443 | }, | |
444 | ], | |
332581a8 | 445 | }, |
2ba22ee4 DM |
446 | { |
447 | title: gettext('Subscription'), | |
332581a8 | 448 | iconCls: 'fa fa-support', |
2ba22ee4 | 449 | itemId: 'support', |
a1460d8d | 450 | xtype: 'pveNodeSubscription', |
e51cd02b TL |
451 | nodename: nodename, |
452 | }, | |
7621bfbf | 453 | ); |
2ba22ee4 DM |
454 | |
455 | me.callParent(); | |
456 | ||
23f14fd9 TL |
457 | me.mon(me.statusStore, 'load', function(store, records, success) { |
458 | let uptimerec = store.data.get('uptime'); | |
5643ac47 TL |
459 | let powermgmt = caps.nodes['Sys.PowerMgmt'] && uptimerec && uptimerec.data.value; |
460 | ||
2ba22ee4 DM |
461 | restartBtn.setDisabled(!powermgmt); |
462 | shutdownBtn.setDisabled(!powermgmt); | |
463 | shellBtn.setDisabled(!powermgmt); | |
464 | }); | |
465 | ||
466 | me.on('afterrender', function() { | |
467 | me.statusStore.startUpdate(); | |
468 | }); | |
469 | ||
470 | me.on('destroy', function() { | |
471 | me.statusStore.stopUpdate(); | |
472 | }); | |
e51cd02b | 473 | }, |
2ba22ee4 | 474 | }); |