]>
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', | |
233 | disabled: !caps.nodes['Sys.Console'], | |
0f9347a6 | 234 | // do we want to link to system updates instead? |
332581a8 | 235 | itemId: 'apt', |
371d39ef DC |
236 | upgradeBtn: { |
237 | xtype: 'pveConsoleButton', | |
35a04562 | 238 | disabled: Proxmox.UserName !== 'root@pam', |
371d39ef DC |
239 | text: gettext('Upgrade'), |
240 | consoleType: 'upgrade', | |
e51cd02b | 241 | nodename: nodename, |
371d39ef | 242 | }, |
e51cd02b | 243 | nodename: nodename, |
332581a8 DC |
244 | }); |
245 | } | |
246 | } | |
247 | ||
248 | if (caps.nodes['Sys.Audit']) { | |
249 | me.items.push( | |
2ba22ee4 | 250 | { |
332581a8 DC |
251 | xtype: 'pveFirewallRules', |
252 | iconCls: 'fa fa-shield', | |
332581a8 DC |
253 | title: gettext('Firewall'), |
254 | allow_iface: true, | |
255 | base_url: '/nodes/' + nodename + '/firewall/rules', | |
256 | list_refs_url: '/cluster/firewall/refs', | |
e51cd02b | 257 | itemId: 'firewall', |
332581a8 DC |
258 | }, |
259 | { | |
260 | xtype: 'pveFirewallOptions', | |
261 | title: gettext('Options'), | |
262 | iconCls: 'fa fa-gear', | |
c8802a60 | 263 | onlineHelp: 'pve_firewall_host_specific_configuration', |
a14b3223 | 264 | groups: ['firewall'], |
332581a8 DC |
265 | base_url: '/nodes/' + nodename + '/firewall/options', |
266 | fwtype: 'node', | |
e51cd02b | 267 | itemId: 'firewall-options', |
332581a8 | 268 | }); |
2ba22ee4 DM |
269 | } |
270 | ||
332581a8 DC |
271 | |
272 | if (caps.nodes['Sys.Audit']) { | |
7621bfbf | 273 | me.items.push( |
fc2916c1 | 274 | { |
e51cd02b | 275 | xtype: 'pmxDiskList', |
fc2916c1 DC |
276 | title: gettext('Disks'), |
277 | itemId: 'storage', | |
278 | expandedOnInit: true, | |
279 | iconCls: 'fa fa-hdd-o', | |
4554fe77 | 280 | nodename: nodename, |
fc2916c1 | 281 | }, |
d660ba8a | 282 | { |
e51cd02b | 283 | xtype: 'pveLVMList', |
d660ba8a DC |
284 | title: 'LVM', |
285 | itemId: 'lvm', | |
705edf41 | 286 | onlineHelp: 'chapter_lvm', |
d660ba8a DC |
287 | iconCls: 'fa fa-square', |
288 | groups: ['storage'], | |
d660ba8a | 289 | }, |
64f9c6d6 | 290 | { |
e51cd02b | 291 | xtype: 'pveLVMThinList', |
64f9c6d6 DC |
292 | title: 'LVM-Thin', |
293 | itemId: 'lvmthin', | |
705edf41 | 294 | onlineHelp: 'chapter_lvm', |
64f9c6d6 DC |
295 | iconCls: 'fa fa-square-o', |
296 | groups: ['storage'], | |
64f9c6d6 | 297 | }, |
6ac46211 | 298 | { |
e51cd02b | 299 | xtype: 'pveDirectoryList', |
6ac46211 DC |
300 | title: Proxmox.Utils.directoryText, |
301 | itemId: 'directory', | |
705edf41 | 302 | onlineHelp: 'chapter_storage', |
6ac46211 DC |
303 | iconCls: 'fa fa-folder', |
304 | groups: ['storage'], | |
6ac46211 | 305 | }, |
fee716d3 DC |
306 | { |
307 | title: 'ZFS', | |
308 | itemId: 'zfs', | |
309 | onlineHelp: 'chapter_zfs', | |
310 | iconCls: 'fa fa-th-large', | |
311 | groups: ['storage'], | |
e51cd02b | 312 | xtype: 'pveZFSList', |
fee716d3 | 313 | }, |
2ba22ee4 | 314 | { |
e51cd02b | 315 | xtype: 'pveNodeCephStatus', |
332581a8 DC |
316 | title: 'Ceph', |
317 | itemId: 'ceph', | |
318 | iconCls: 'fa fa-ceph', | |
332581a8 | 319 | }, |
cb6df20c DC |
320 | { |
321 | xtype: 'pveReplicaView', | |
322 | iconCls: 'fa fa-retweet', | |
323 | title: gettext('Replication'), | |
e51cd02b | 324 | itemId: 'replication', |
cb6df20c | 325 | }, |
332581a8 | 326 | { |
7247077d | 327 | xtype: 'pveNodeCephConfigCrush', |
ec99b1c3 | 328 | title: gettext('Configuration'), |
332581a8 DC |
329 | iconCls: 'fa fa-gear', |
330 | groups: ['ceph'], | |
e51cd02b | 331 | itemId: 'ceph-config', |
332581a8 DC |
332 | }, |
333 | { | |
a6c60aed | 334 | xtype: 'pveNodeCephMonMgr', |
332581a8 DC |
335 | title: gettext('Monitor'), |
336 | iconCls: 'fa fa-tv', | |
337 | groups: ['ceph'], | |
e51cd02b | 338 | itemId: 'ceph-monlist', |
332581a8 DC |
339 | }, |
340 | { | |
341 | xtype: 'pveNodeCephOsdTree', | |
342 | title: 'OSD', | |
343 | iconCls: 'fa fa-hdd-o', | |
344 | groups: ['ceph'], | |
e51cd02b | 345 | itemId: 'ceph-osdtree', |
332581a8 | 346 | }, |
563ed5ee TL |
347 | { |
348 | xtype: 'pveNodeCephFSPanel', | |
349 | title: 'CephFS', | |
350 | iconCls: 'fa fa-folder', | |
351 | groups: ['ceph'], | |
352 | nodename: nodename, | |
e51cd02b | 353 | itemId: 'ceph-cephfspanel', |
563ed5ee | 354 | }, |
332581a8 DC |
355 | { |
356 | xtype: 'pveNodeCephPoolList', | |
4d02b4fe | 357 | title: 'Pools', |
332581a8 DC |
358 | iconCls: 'fa fa-sitemap', |
359 | groups: ['ceph'], | |
e51cd02b TL |
360 | itemId: 'ceph-pools', |
361 | }, | |
7621bfbf | 362 | ); |
2ba22ee4 DM |
363 | } |
364 | ||
332581a8 | 365 | if (caps.nodes['Sys.Syslog']) { |
7621bfbf | 366 | me.items.push( |
2ba22ee4 | 367 | { |
0ee5a21e | 368 | xtype: 'proxmoxLogView', |
332581a8 DC |
369 | title: gettext('Log'), |
370 | iconCls: 'fa fa-list', | |
a14b3223 | 371 | groups: ['firewall'], |
c8802a60 | 372 | onlineHelp: 'chapter_pve_firewall', |
332581a8 | 373 | url: '/api2/extjs/nodes/' + nodename + '/firewall/log', |
e51cd02b | 374 | itemId: 'firewall-fwlog', |
2ba22ee4 DM |
375 | }, |
376 | { | |
e51cd02b | 377 | xtype: 'cephLogView', |
332581a8 DC |
378 | title: gettext('Log'), |
379 | itemId: 'ceph-log', | |
380 | iconCls: 'fa fa-list', | |
381 | groups: ['ceph'], | |
c8802a60 | 382 | onlineHelp: 'chapter_pveceph', |
4616a55b | 383 | url: "/api2/extjs/nodes/" + nodename + "/ceph/log", |
e51cd02b | 384 | nodename: nodename, |
332581a8 DC |
385 | }); |
386 | } | |
387 | ||
7621bfbf | 388 | me.items.push( |
332581a8 DC |
389 | { |
390 | title: gettext('Task History'), | |
391 | iconCls: 'fa fa-list', | |
392 | itemId: 'tasks', | |
6c60ab5e | 393 | nodename: nodename, |
e51cd02b | 394 | xtype: 'proxmoxNodeTasks', |
332581a8 | 395 | }, |
2ba22ee4 DM |
396 | { |
397 | title: gettext('Subscription'), | |
332581a8 | 398 | iconCls: 'fa fa-support', |
2ba22ee4 | 399 | itemId: 'support', |
a1460d8d | 400 | xtype: 'pveNodeSubscription', |
e51cd02b TL |
401 | nodename: nodename, |
402 | }, | |
7621bfbf | 403 | ); |
2ba22ee4 DM |
404 | |
405 | me.callParent(); | |
406 | ||
23f14fd9 TL |
407 | me.mon(me.statusStore, 'load', function(store, records, success) { |
408 | let uptimerec = store.data.get('uptime'); | |
5643ac47 TL |
409 | let powermgmt = caps.nodes['Sys.PowerMgmt'] && uptimerec && uptimerec.data.value; |
410 | ||
2ba22ee4 DM |
411 | restartBtn.setDisabled(!powermgmt); |
412 | shutdownBtn.setDisabled(!powermgmt); | |
413 | shellBtn.setDisabled(!powermgmt); | |
414 | }); | |
415 | ||
416 | me.on('afterrender', function() { | |
417 | me.statusStore.startUpdate(); | |
418 | }); | |
419 | ||
420 | me.on('destroy', function() { | |
421 | me.statusStore.stopUpdate(); | |
422 | }); | |
e51cd02b | 423 | }, |
2ba22ee4 | 424 | }); |