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