]> git.proxmox.com Git - pve-manager-legacy.git/blame - www/manager6/node/Config.js
ui: enable gettext localisation for more user exposed strings
[pve-manager-legacy.git] / www / manager6 / node / Config.js
CommitLineData
62df569c
DM
1Ext.define('PVE.node.Config', {
2 extend: 'PVE.panel.Config',
3 alias: 'widget.PVE.node.Config',
4
2963616a 5 onlineHelp: 'chapter_system_administration',
21419533 6
62df569c
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
74c82e07 17 me.statusStore = Ext.create('Proxmox.data.ObjectStore', {
62df569c 18 url: "/api2/json/nodes/" + nodename + "/status",
5c928231 19 interval: 5000,
62df569c
DM
20 });
21
22 var node_command = function(cmd) {
42ec1872 23 Proxmox.Utils.API2Request({
62df569c
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);
5c928231 30 },
62df569c
DM
31 });
32 };
f0af778a 33
62df569c 34 var actionBtn = Ext.create('Ext.Button', {
f6b31faf 35 text: gettext('Bulk Actions'),
4a7eeaa9 36 iconCls: 'fa fa-fw fa-ellipsis-v',
77eb667f 37 disabled: !caps.vms['VM.PowerMgmt'] && !caps.vms['VM.Migrate'],
62df569c
DM
38 menu: new Ext.menu.Menu({
39 items: [
40 {
f6b31faf 41 text: gettext('Bulk Start'),
e39f20d0 42 iconCls: 'fa fa-fw fa-play',
77eb667f 43 disabled: !caps.vms['VM.PowerMgmt'],
62df569c 44 handler: function() {
9d0d9f2d
TL
45 Ext.create('PVE.window.BulkAction', {
46 autoShow: true,
f6b31faf
DC
47 nodename: nodename,
48 title: gettext('Bulk Start'),
49 btnText: gettext('Start'),
5c928231 50 action: 'startall',
62df569c 51 });
5c928231 52 },
62df569c
DM
53 },
54 {
a3e585be 55 text: gettext('Bulk Shutdown'),
f6b31faf 56 iconCls: 'fa fa-fw fa-stop',
77eb667f 57 disabled: !caps.vms['VM.PowerMgmt'],
62df569c 58 handler: function() {
9d0d9f2d
TL
59 Ext.create('PVE.window.BulkAction', {
60 autoShow: true,
f6b31faf 61 nodename: nodename,
a3e585be
TL
62 title: gettext('Bulk Shutdown'),
63 btnText: gettext('Shutdown'),
5c928231 64 action: 'stopall',
62df569c 65 });
5c928231 66 },
62df569c
DM
67 },
68 {
f6b31faf 69 text: gettext('Bulk Migrate'),
e39f20d0 70 iconCls: 'fa fa-fw fa-send-o',
c258668f 71 disabled: !caps.vms['VM.Migrate'],
62df569c 72 handler: function() {
9d0d9f2d
TL
73 Ext.create('PVE.window.BulkAction', {
74 autoShow: true,
f6b31faf
DC
75 nodename: nodename,
76 title: gettext('Bulk Migrate'),
77 btnText: gettext('Migrate'),
5c928231 78 action: 'migrateall',
62df569c 79 });
5c928231
TL
80 },
81 },
82 ],
83 }),
f0af778a 84 });
62df569c 85
a1a73865 86 let restartBtn = Ext.create('Proxmox.button.Button', {
464efe28 87 text: gettext('Reboot'),
62df569c 88 disabled: !caps.nodes['Sys.PowerMgmt'],
80b36fbb 89 dangerous: true,
464efe28 90 confirmMsg: Ext.String.format(gettext("Reboot node '{0}'?"), nodename),
f0af778a 91 handler: function() {
62df569c 92 node_command('reboot');
e39f20d0 93 },
5c928231 94 iconCls: 'fa fa-undo',
62df569c
DM
95 });
96
55dd3245 97 var shutdownBtn = Ext.create('Proxmox.button.Button', {
62df569c
DM
98 text: gettext('Shutdown'),
99 disabled: !caps.nodes['Sys.PowerMgmt'],
80b36fbb 100 dangerous: true,
464efe28 101 confirmMsg: Ext.String.format(gettext("Shutdown node '{0}'?"), nodename),
f0af778a 102 handler: function() {
62df569c 103 node_command('shutdown');
e39f20d0 104 },
5c928231 105 iconCls: 'fa fa-power-off',
62df569c
DM
106 });
107
108 var shellBtn = Ext.create('PVE.button.ConsoleButton', {
109 disabled: !caps.nodes['Sys.Console'],
110 text: gettext('Shell'),
111 consoleType: 'shell',
5c928231 112 nodename: nodename,
62df569c
DM
113 });
114
115 me.items = [];
116
117 Ext.apply(me, {
118 title: gettext('Node') + " '" + nodename + "'",
119 hstateid: 'nodetab',
a1a73865 120 defaults: {
5c928231 121 statusStore: me.statusStore,
a1a73865 122 },
5c928231 123 tbar: [restartBtn, shutdownBtn, shellBtn, actionBtn],
62df569c
DM
124 });
125
126 if (caps.nodes['Sys.Audit']) {
044dd937 127 me.items.push(
62df569c 128 {
5c928231 129 xtype: 'pveNodeSummary',
62df569c 130 title: gettext('Summary'),
5a0dc87f 131 iconCls: 'fa fa-book',
a204b705 132 itemId: 'summary',
5d917db1
DC
133 },
134 {
740542a6 135 xtype: 'pmxNotesView',
5d917db1
DC
136 title: gettext('Notes'),
137 iconCls: 'fa fa-sticky-note-o',
138 itemId: 'notes',
5c928231 139 },
a204b705
DC
140 );
141 }
142
143 if (caps.nodes['Sys.Console']) {
144 me.items.push(
145 {
5c928231 146 xtype: 'pveNoVncConsole',
a204b705
DC
147 title: gettext('Shell'),
148 iconCls: 'fa fa-terminal',
986f6aa7 149 itemId: 'jsconsole',
986f6aa7
DC
150 consoleType: 'shell',
151 xtermjs: true,
5c928231
TL
152 nodename: nodename,
153 },
a204b705
DC
154 );
155 }
156
157 if (caps.nodes['Sys.Audit']) {
158 me.items.push(
62df569c 159 {
5c928231 160 xtype: 'proxmoxNodeServiceView',
a204b705 161 title: gettext('System'),
5a0dc87f 162 iconCls: 'fa fa-cogs',
62df569c 163 itemId: 'services',
a204b705 164 expandedOnInit: true,
884ba424 165 restartCommand: 'reload', // avoid disruptions
47fc31fa
DC
166 startOnlyServices: {
167 'pveproxy': true,
168 'pvedaemon': true,
5c928231 169 'pve-cluster': true,
47fc31fa
DC
170 },
171 nodename: nodename,
172 onlineHelp: 'pve_service_daemons',
62df569c 173 },
a204b705 174 {
5c928231 175 xtype: 'proxmoxNodeNetworkView',
a204b705
DC
176 title: gettext('Network'),
177 iconCls: 'fa fa-exchange',
178 itemId: 'network',
2aec108d 179 showApplyBtn: true,
a204b705 180 groups: ['services'],
87271dca
DC
181 nodename: nodename,
182 onlineHelp: 'sysadmin_network_configuration',
a204b705 183 },
80d50f89 184 {
5c928231 185 xtype: 'pveCertificatesView',
80d50f89
DC
186 title: gettext('Certificates'),
187 iconCls: 'fa fa-certificate',
188 itemId: 'certificates',
189 groups: ['services'],
190 nodename: nodename,
80d50f89 191 },
a204b705 192 {
5c928231 193 xtype: 'proxmoxNodeDNSView',
a204b705
DC
194 title: gettext('DNS'),
195 iconCls: 'fa fa-globe',
196 groups: ['services'],
197 itemId: 'dns',
43ac01df
DC
198 nodename: nodename,
199 onlineHelp: 'sysadmin_network_configuration',
a204b705 200 },
c740b319 201 {
5c928231 202 xtype: 'proxmoxNodeHostsView',
c740b319
DC
203 title: gettext('Hosts'),
204 iconCls: 'fa fa-globe',
205 groups: ['services'],
206 itemId: 'hosts',
207 nodename: nodename,
208 onlineHelp: 'sysadmin_network_configuration',
c740b319 209 },
e280f5c7
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 },
5a0dc87f 219 {
5c928231 220 xtype: 'proxmoxNodeTimeView',
5a0dc87f
DC
221 title: gettext('Time'),
222 itemId: 'time',
a204b705 223 groups: ['services'],
16288be4 224 nodename: nodename,
5c928231 225 iconCls: 'fa fa-clock-o',
5a0dc87f
DC
226 });
227 }
228
229 if (caps.nodes['Sys.Syslog']) {
230 me.items.push({
5c928231 231 xtype: 'proxmoxJournalView',
5a0dc87f
DC
232 title: 'Syslog',
233 iconCls: 'fa fa-list',
a204b705 234 groups: ['services'],
5a0dc87f
DC
235 disabled: !caps.nodes['Sys.Syslog'],
236 itemId: 'syslog',
5c928231 237 url: "/api2/extjs/nodes/" + nodename + "/journal",
5a0dc87f
DC
238 });
239
240 if (caps.nodes['Sys.Modify']) {
241 me.items.push({
5c928231 242 xtype: 'proxmoxNodeAPT',
5a0dc87f
DC
243 title: gettext('Updates'),
244 iconCls: 'fa fa-refresh',
89a00a73 245 expandedOnInit: true,
5a0dc87f 246 disabled: !caps.nodes['Sys.Console'],
21419533 247 // do we want to link to system updates instead?
5a0dc87f 248 itemId: 'apt',
b57316b6
DC
249 upgradeBtn: {
250 xtype: 'pveConsoleButton',
0bdf8370 251 disabled: Proxmox.UserName !== 'root@pam',
b57316b6
DC
252 text: gettext('Upgrade'),
253 consoleType: 'upgrade',
5c928231 254 nodename: nodename,
b57316b6 255 },
5c928231 256 nodename: nodename,
5a0dc87f 257 });
ac5bc321
FE
258
259 me.items.push({
260 xtype: 'proxmoxNodeAPTRepositories',
89a00a73 261 title: gettext('Repositories'),
ac5bc321
FE
262 iconCls: 'fa fa-files-o',
263 itemId: 'aptrepositories',
264 nodename: nodename,
166057e1 265 onlineHelp: 'sysadmin_package_repositories',
ac5bc321
FE
266 groups: ['apt'],
267 });
5a0dc87f
DC
268 }
269 }
270
271 if (caps.nodes['Sys.Audit']) {
272 me.items.push(
62df569c 273 {
5a0dc87f
DC
274 xtype: 'pveFirewallRules',
275 iconCls: 'fa fa-shield',
5a0dc87f
DC
276 title: gettext('Firewall'),
277 allow_iface: true,
278 base_url: '/nodes/' + nodename + '/firewall/rules',
279 list_refs_url: '/cluster/firewall/refs',
5c928231 280 itemId: 'firewall',
5a0dc87f
DC
281 },
282 {
283 xtype: 'pveFirewallOptions',
284 title: gettext('Options'),
285 iconCls: 'fa fa-gear',
2963616a 286 onlineHelp: 'pve_firewall_host_specific_configuration',
a204b705 287 groups: ['firewall'],
5a0dc87f
DC
288 base_url: '/nodes/' + nodename + '/firewall/options',
289 fwtype: 'node',
5c928231 290 itemId: 'firewall-options',
5a0dc87f 291 });
62df569c
DM
292 }
293
5a0dc87f
DC
294
295 if (caps.nodes['Sys.Audit']) {
044dd937 296 me.items.push(
07931024 297 {
5c928231 298 xtype: 'pmxDiskList',
07931024
DC
299 title: gettext('Disks'),
300 itemId: 'storage',
301 expandedOnInit: true,
302 iconCls: 'fa fa-hdd-o',
7e2bd6a9 303 nodename: nodename,
33ee06dd 304 includePartitions: true,
2be20309 305 supportsWipeDisk: true,
07931024 306 },
6c4c85d0 307 {
5c928231 308 xtype: 'pveLVMList',
6c4c85d0
DC
309 title: 'LVM',
310 itemId: 'lvm',
118f3f88 311 onlineHelp: 'chapter_lvm',
6c4c85d0
DC
312 iconCls: 'fa fa-square',
313 groups: ['storage'],
6c4c85d0 314 },
7f794dcb 315 {
5c928231 316 xtype: 'pveLVMThinList',
7f794dcb
DC
317 title: 'LVM-Thin',
318 itemId: 'lvmthin',
118f3f88 319 onlineHelp: 'chapter_lvm',
7f794dcb
DC
320 iconCls: 'fa fa-square-o',
321 groups: ['storage'],
7f794dcb 322 },
5cae151d 323 {
5c928231 324 xtype: 'pveDirectoryList',
5cae151d
DC
325 title: Proxmox.Utils.directoryText,
326 itemId: 'directory',
118f3f88 327 onlineHelp: 'chapter_storage',
5cae151d
DC
328 iconCls: 'fa fa-folder',
329 groups: ['storage'],
5cae151d 330 },
fc331011
DC
331 {
332 title: 'ZFS',
333 itemId: 'zfs',
334 onlineHelp: 'chapter_zfs',
335 iconCls: 'fa fa-th-large',
336 groups: ['storage'],
5c928231 337 xtype: 'pveZFSList',
fc331011 338 },
62df569c 339 {
5c928231 340 xtype: 'pveNodeCephStatus',
5a0dc87f
DC
341 title: 'Ceph',
342 itemId: 'ceph',
343 iconCls: 'fa fa-ceph',
5a0dc87f 344 },
5a0dc87f 345 {
d3ae0367 346 xtype: 'pveNodeCephConfigCrush',
206d9640 347 title: gettext('Configuration'),
5a0dc87f
DC
348 iconCls: 'fa fa-gear',
349 groups: ['ceph'],
5c928231 350 itemId: 'ceph-config',
5a0dc87f
DC
351 },
352 {
c1814e61 353 xtype: 'pveNodeCephMonMgr',
5a0dc87f
DC
354 title: gettext('Monitor'),
355 iconCls: 'fa fa-tv',
356 groups: ['ceph'],
5c928231 357 itemId: 'ceph-monlist',
5a0dc87f
DC
358 },
359 {
360 xtype: 'pveNodeCephOsdTree',
361 title: 'OSD',
362 iconCls: 'fa fa-hdd-o',
363 groups: ['ceph'],
5c928231 364 itemId: 'ceph-osdtree',
5a0dc87f 365 },
845956cc
TL
366 {
367 xtype: 'pveNodeCephFSPanel',
368 title: 'CephFS',
369 iconCls: 'fa fa-folder',
370 groups: ['ceph'],
371 nodename: nodename,
5c928231 372 itemId: 'ceph-cephfspanel',
845956cc 373 },
5a0dc87f
DC
374 {
375 xtype: 'pveNodeCephPoolList',
f8fe74da 376 title: gettext('Pools'),
5a0dc87f
DC
377 iconCls: 'fa fa-sitemap',
378 groups: ['ceph'],
5c928231
TL
379 itemId: 'ceph-pools',
380 },
35935191
TL
381 {
382 xtype: 'pveReplicaView',
383 iconCls: 'fa fa-retweet',
384 title: gettext('Replication'),
385 itemId: 'replication',
386 },
044dd937 387 );
62df569c
DM
388 }
389
5a0dc87f 390 if (caps.nodes['Sys.Syslog']) {
044dd937 391 me.items.push(
62df569c 392 {
e54f7d0a 393 xtype: 'proxmoxLogView',
5a0dc87f
DC
394 title: gettext('Log'),
395 iconCls: 'fa fa-list',
a204b705 396 groups: ['firewall'],
2963616a 397 onlineHelp: 'chapter_pve_firewall',
5a0dc87f 398 url: '/api2/extjs/nodes/' + nodename + '/firewall/log',
5c928231 399 itemId: 'firewall-fwlog',
62df569c
DM
400 },
401 {
5c928231 402 xtype: 'cephLogView',
5a0dc87f
DC
403 title: gettext('Log'),
404 itemId: 'ceph-log',
405 iconCls: 'fa fa-list',
406 groups: ['ceph'],
2963616a 407 onlineHelp: 'chapter_pveceph',
e7a89682 408 url: "/api2/extjs/nodes/" + nodename + "/ceph/log",
5c928231 409 nodename: nodename,
5a0dc87f
DC
410 });
411 }
412
044dd937 413 me.items.push(
5a0dc87f
DC
414 {
415 title: gettext('Task History'),
4b477753 416 iconCls: 'fa fa-list-alt',
5a0dc87f 417 itemId: 'tasks',
84544b87 418 nodename: nodename,
5c928231 419 xtype: 'proxmoxNodeTasks',
ded0e8d3
DC
420 extraFilter: [
421 {
422 xtype: 'pveGuestIDSelector',
423 fieldLabel: gettext('VMID'),
424 allowBlank: true,
425 name: 'vmid',
426 },
427 ],
5a0dc87f 428 },
62df569c
DM
429 {
430 title: gettext('Subscription'),
5a0dc87f 431 iconCls: 'fa fa-support',
62df569c 432 itemId: 'support',
1aad83a3 433 xtype: 'pveNodeSubscription',
5c928231
TL
434 nodename: nodename,
435 },
044dd937 436 );
62df569c
DM
437
438 me.callParent();
439
a1a73865
TL
440 me.mon(me.statusStore, 'load', function(store, records, success) {
441 let uptimerec = store.data.get('uptime');
6d27374f
TL
442 let powermgmt = caps.nodes['Sys.PowerMgmt'] && uptimerec && uptimerec.data.value;
443
62df569c
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 });
5c928231 456 },
62df569c 457});