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