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