]> git.proxmox.com Git - pve-manager.git/blame - www/manager6/node/Config.js
ui: move NotesView panel and NotesEdit window to widget kit
[pve-manager.git] / www / manager6 / node / Config.js
CommitLineData
2ba22ee4
DM
1Ext.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 {
742de03d 132 xtype: 'pmxNotesView',
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,
fac49b9a 253 onlineHelp: 'sysadmin_package_repositories',
2292a196
FE
254 groups: ['apt'],
255 });
332581a8
DC
256 }
257 }
258
259 if (caps.nodes['Sys.Audit']) {
260 me.items.push(
2ba22ee4 261 {
332581a8
DC
262 xtype: 'pveFirewallRules',
263 iconCls: 'fa fa-shield',
332581a8
DC
264 title: gettext('Firewall'),
265 allow_iface: true,
266 base_url: '/nodes/' + nodename + '/firewall/rules',
267 list_refs_url: '/cluster/firewall/refs',
e51cd02b 268 itemId: 'firewall',
332581a8
DC
269 },
270 {
271 xtype: 'pveFirewallOptions',
272 title: gettext('Options'),
273 iconCls: 'fa fa-gear',
c8802a60 274 onlineHelp: 'pve_firewall_host_specific_configuration',
a14b3223 275 groups: ['firewall'],
332581a8
DC
276 base_url: '/nodes/' + nodename + '/firewall/options',
277 fwtype: 'node',
e51cd02b 278 itemId: 'firewall-options',
332581a8 279 });
2ba22ee4
DM
280 }
281
332581a8
DC
282
283 if (caps.nodes['Sys.Audit']) {
7621bfbf 284 me.items.push(
fc2916c1 285 {
e51cd02b 286 xtype: 'pmxDiskList',
fc2916c1
DC
287 title: gettext('Disks'),
288 itemId: 'storage',
289 expandedOnInit: true,
290 iconCls: 'fa fa-hdd-o',
4554fe77 291 nodename: nodename,
9bfcb161 292 includePartitions: true,
be375fee 293 supportsWipeDisk: true,
fc2916c1 294 },
d660ba8a 295 {
e51cd02b 296 xtype: 'pveLVMList',
d660ba8a
DC
297 title: 'LVM',
298 itemId: 'lvm',
705edf41 299 onlineHelp: 'chapter_lvm',
d660ba8a
DC
300 iconCls: 'fa fa-square',
301 groups: ['storage'],
d660ba8a 302 },
64f9c6d6 303 {
e51cd02b 304 xtype: 'pveLVMThinList',
64f9c6d6
DC
305 title: 'LVM-Thin',
306 itemId: 'lvmthin',
705edf41 307 onlineHelp: 'chapter_lvm',
64f9c6d6
DC
308 iconCls: 'fa fa-square-o',
309 groups: ['storage'],
64f9c6d6 310 },
6ac46211 311 {
e51cd02b 312 xtype: 'pveDirectoryList',
6ac46211
DC
313 title: Proxmox.Utils.directoryText,
314 itemId: 'directory',
705edf41 315 onlineHelp: 'chapter_storage',
6ac46211
DC
316 iconCls: 'fa fa-folder',
317 groups: ['storage'],
6ac46211 318 },
fee716d3
DC
319 {
320 title: 'ZFS',
321 itemId: 'zfs',
322 onlineHelp: 'chapter_zfs',
323 iconCls: 'fa fa-th-large',
324 groups: ['storage'],
e51cd02b 325 xtype: 'pveZFSList',
fee716d3 326 },
2ba22ee4 327 {
e51cd02b 328 xtype: 'pveNodeCephStatus',
332581a8
DC
329 title: 'Ceph',
330 itemId: 'ceph',
331 iconCls: 'fa fa-ceph',
332581a8 332 },
332581a8 333 {
7247077d 334 xtype: 'pveNodeCephConfigCrush',
ec99b1c3 335 title: gettext('Configuration'),
332581a8
DC
336 iconCls: 'fa fa-gear',
337 groups: ['ceph'],
e51cd02b 338 itemId: 'ceph-config',
332581a8
DC
339 },
340 {
a6c60aed 341 xtype: 'pveNodeCephMonMgr',
332581a8
DC
342 title: gettext('Monitor'),
343 iconCls: 'fa fa-tv',
344 groups: ['ceph'],
e51cd02b 345 itemId: 'ceph-monlist',
332581a8
DC
346 },
347 {
348 xtype: 'pveNodeCephOsdTree',
349 title: 'OSD',
350 iconCls: 'fa fa-hdd-o',
351 groups: ['ceph'],
e51cd02b 352 itemId: 'ceph-osdtree',
332581a8 353 },
563ed5ee
TL
354 {
355 xtype: 'pveNodeCephFSPanel',
356 title: 'CephFS',
357 iconCls: 'fa fa-folder',
358 groups: ['ceph'],
359 nodename: nodename,
e51cd02b 360 itemId: 'ceph-cephfspanel',
563ed5ee 361 },
332581a8
DC
362 {
363 xtype: 'pveNodeCephPoolList',
4d02b4fe 364 title: 'Pools',
332581a8
DC
365 iconCls: 'fa fa-sitemap',
366 groups: ['ceph'],
e51cd02b
TL
367 itemId: 'ceph-pools',
368 },
3eaf3881
TL
369 {
370 xtype: 'pveReplicaView',
371 iconCls: 'fa fa-retweet',
372 title: gettext('Replication'),
373 itemId: 'replication',
374 },
7621bfbf 375 );
2ba22ee4
DM
376 }
377
332581a8 378 if (caps.nodes['Sys.Syslog']) {
7621bfbf 379 me.items.push(
2ba22ee4 380 {
0ee5a21e 381 xtype: 'proxmoxLogView',
332581a8
DC
382 title: gettext('Log'),
383 iconCls: 'fa fa-list',
a14b3223 384 groups: ['firewall'],
c8802a60 385 onlineHelp: 'chapter_pve_firewall',
332581a8 386 url: '/api2/extjs/nodes/' + nodename + '/firewall/log',
e51cd02b 387 itemId: 'firewall-fwlog',
2ba22ee4
DM
388 },
389 {
e51cd02b 390 xtype: 'cephLogView',
332581a8
DC
391 title: gettext('Log'),
392 itemId: 'ceph-log',
393 iconCls: 'fa fa-list',
394 groups: ['ceph'],
c8802a60 395 onlineHelp: 'chapter_pveceph',
4616a55b 396 url: "/api2/extjs/nodes/" + nodename + "/ceph/log",
e51cd02b 397 nodename: nodename,
332581a8
DC
398 });
399 }
400
7621bfbf 401 me.items.push(
332581a8
DC
402 {
403 title: gettext('Task History'),
56bc50b8 404 iconCls: 'fa fa-list-alt',
332581a8 405 itemId: 'tasks',
6c60ab5e 406 nodename: nodename,
e51cd02b 407 xtype: 'proxmoxNodeTasks',
e24567ac
DC
408 extraFilter: [
409 {
410 xtype: 'pveGuestIDSelector',
411 fieldLabel: gettext('VMID'),
412 allowBlank: true,
413 name: 'vmid',
414 },
415 ],
332581a8 416 },
2ba22ee4
DM
417 {
418 title: gettext('Subscription'),
332581a8 419 iconCls: 'fa fa-support',
2ba22ee4 420 itemId: 'support',
a1460d8d 421 xtype: 'pveNodeSubscription',
e51cd02b
TL
422 nodename: nodename,
423 },
7621bfbf 424 );
2ba22ee4
DM
425
426 me.callParent();
427
23f14fd9
TL
428 me.mon(me.statusStore, 'load', function(store, records, success) {
429 let uptimerec = store.data.get('uptime');
5643ac47
TL
430 let powermgmt = caps.nodes['Sys.PowerMgmt'] && uptimerec && uptimerec.data.value;
431
2ba22ee4
DM
432 restartBtn.setDisabled(!powermgmt);
433 shutdownBtn.setDisabled(!powermgmt);
434 shellBtn.setDisabled(!powermgmt);
435 });
436
437 me.on('afterrender', function() {
438 me.statusStore.startUpdate();
439 });
440
441 me.on('destroy', function() {
442 me.statusStore.stopUpdate();
443 });
e51cd02b 444 },
2ba22ee4 445});