]> git.proxmox.com Git - pve-manager.git/blame - www/manager6/node/Config.js
ui: ceph/ServiceList: do not autoLoad the rstore
[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
DM
18 url: "/api2/json/nodes/" + nodename + "/status",
19 interval: 1000
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);
30 }
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'),
48 action: 'startall'
2ba22ee4 49 });
6a4edbd1 50 win.show();
2ba22ee4
DM
51 }
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'),
61 action: 'stopall'
2ba22ee4 62 });
6a4edbd1 63 win.show();
2ba22ee4
DM
64 }
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'),
74 action: 'migrateall'
2ba22ee4
DM
75 });
76 win.show();
77 }
78 }
79 ]
80 })
c474314e 81 });
2ba22ee4 82
5720fafa 83 var 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
DC
90 },
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
DC
101 },
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',
ea541321 109 nodename: nodename
2ba22ee4
DM
110 });
111
112 me.items = [];
113
114 Ext.apply(me, {
115 title: gettext('Node') + " '" + nodename + "'",
116 hstateid: 'nodetab',
117 defaults: { statusStore: me.statusStore },
118 tbar: [ restartBtn, shutdownBtn, shellBtn, actionBtn]
119 });
120
121 if (caps.nodes['Sys.Audit']) {
7621bfbf 122 me.items.push(
2ba22ee4
DM
123 {
124 title: gettext('Summary'),
332581a8 125 iconCls: 'fa fa-book',
a14b3223 126 itemId: 'summary',
2ba22ee4 127 xtype: 'pveNodeSummary'
799ea12f
DC
128 },
129 {
130 title: gettext('Notes'),
131 iconCls: 'fa fa-sticky-note-o',
132 itemId: 'notes',
133 xtype: 'pveNotesView'
a14b3223
DC
134 }
135 );
136 }
137
138 if (caps.nodes['Sys.Console']) {
139 me.items.push(
140 {
141 title: gettext('Shell'),
142 iconCls: 'fa fa-terminal',
d345d7ad
DC
143 itemId: 'jsconsole',
144 xtype: 'pveNoVncConsole',
145 consoleType: 'shell',
146 xtermjs: true,
147 nodename: nodename
a14b3223
DC
148 }
149 );
150 }
151
152 if (caps.nodes['Sys.Audit']) {
153 me.items.push(
2ba22ee4 154 {
a14b3223 155 title: gettext('System'),
332581a8 156 iconCls: 'fa fa-cogs',
2ba22ee4 157 itemId: 'services',
a14b3223 158 expandedOnInit: true,
4178b82a
DC
159 startOnlyServices: {
160 'pveproxy': true,
161 'pvedaemon': true,
162 'pve-cluster': true
163 },
164 nodename: nodename,
165 onlineHelp: 'pve_service_daemons',
166 xtype: 'proxmoxNodeServiceView'
2ba22ee4 167 },
a14b3223
DC
168 {
169 title: gettext('Network'),
170 iconCls: 'fa fa-exchange',
171 itemId: 'network',
009d20a8 172 showApplyBtn: true,
a14b3223 173 groups: ['services'],
13ff8209
DC
174 nodename: nodename,
175 onlineHelp: 'sysadmin_network_configuration',
176 xtype: 'proxmoxNodeNetworkView'
a14b3223 177 },
c287e233
DC
178 {
179 title: gettext('Certificates'),
180 iconCls: 'fa fa-certificate',
181 itemId: 'certificates',
182 groups: ['services'],
183 nodename: nodename,
184 xtype: 'pveCertificatesView'
185 },
a14b3223
DC
186 {
187 title: gettext('DNS'),
188 iconCls: 'fa fa-globe',
189 groups: ['services'],
190 itemId: 'dns',
66ce20fd
DC
191 nodename: nodename,
192 onlineHelp: 'sysadmin_network_configuration',
193 xtype: 'proxmoxNodeDNSView'
a14b3223 194 },
c88170a4
DC
195 {
196 title: gettext('Hosts'),
197 iconCls: 'fa fa-globe',
198 groups: ['services'],
199 itemId: 'hosts',
200 nodename: nodename,
201 onlineHelp: 'sysadmin_network_configuration',
202 xtype: 'proxmoxNodeHostsView'
203 },
332581a8
DC
204 {
205 title: gettext('Time'),
206 itemId: 'time',
a14b3223 207 groups: ['services'],
939edd73
DC
208 nodename: nodename,
209 xtype: 'proxmoxNodeTimeView',
332581a8
DC
210 iconCls: 'fa fa-clock-o'
211 });
212 }
213
214 if (caps.nodes['Sys.Syslog']) {
215 me.items.push({
216 title: 'Syslog',
217 iconCls: 'fa fa-list',
a14b3223 218 groups: ['services'],
332581a8
DC
219 disabled: !caps.nodes['Sys.Syslog'],
220 itemId: 'syslog',
e4027559
DC
221 xtype: 'proxmoxJournalView',
222 url: "/api2/extjs/nodes/" + nodename + "/journal"
332581a8
DC
223 });
224
225 if (caps.nodes['Sys.Modify']) {
226 me.items.push({
227 title: gettext('Updates'),
228 iconCls: 'fa fa-refresh',
229 disabled: !caps.nodes['Sys.Console'],
0f9347a6 230 // do we want to link to system updates instead?
332581a8 231 itemId: 'apt',
371d39ef
DC
232 xtype: 'proxmoxNodeAPT',
233 upgradeBtn: {
234 xtype: 'pveConsoleButton',
35a04562 235 disabled: Proxmox.UserName !== 'root@pam',
371d39ef
DC
236 text: gettext('Upgrade'),
237 consoleType: 'upgrade',
238 nodename: nodename
239 },
332581a8
DC
240 nodename: nodename
241 });
242 }
243 }
244
245 if (caps.nodes['Sys.Audit']) {
246 me.items.push(
2ba22ee4 247 {
332581a8
DC
248 xtype: 'pveFirewallRules',
249 iconCls: 'fa fa-shield',
332581a8
DC
250 title: gettext('Firewall'),
251 allow_iface: true,
252 base_url: '/nodes/' + nodename + '/firewall/rules',
253 list_refs_url: '/cluster/firewall/refs',
254 itemId: 'firewall'
255 },
256 {
257 xtype: 'pveFirewallOptions',
258 title: gettext('Options'),
259 iconCls: 'fa fa-gear',
c8802a60 260 onlineHelp: 'pve_firewall_host_specific_configuration',
a14b3223 261 groups: ['firewall'],
332581a8
DC
262 base_url: '/nodes/' + nodename + '/firewall/options',
263 fwtype: 'node',
264 itemId: 'firewall-options'
265 });
2ba22ee4
DM
266 }
267
332581a8
DC
268
269 if (caps.nodes['Sys.Audit']) {
7621bfbf 270 me.items.push(
fc2916c1
DC
271 {
272 title: gettext('Disks'),
273 itemId: 'storage',
274 expandedOnInit: true,
275 iconCls: 'fa fa-hdd-o',
276 xtype: 'pveNodeDiskList'
277 },
d660ba8a
DC
278 {
279 title: 'LVM',
280 itemId: 'lvm',
705edf41 281 onlineHelp: 'chapter_lvm',
d660ba8a
DC
282 iconCls: 'fa fa-square',
283 groups: ['storage'],
284 xtype: 'pveLVMList'
285 },
64f9c6d6
DC
286 {
287 title: 'LVM-Thin',
288 itemId: 'lvmthin',
705edf41 289 onlineHelp: 'chapter_lvm',
64f9c6d6
DC
290 iconCls: 'fa fa-square-o',
291 groups: ['storage'],
292 xtype: 'pveLVMThinList'
293 },
6ac46211
DC
294 {
295 title: Proxmox.Utils.directoryText,
296 itemId: 'directory',
705edf41 297 onlineHelp: 'chapter_storage',
6ac46211
DC
298 iconCls: 'fa fa-folder',
299 groups: ['storage'],
300 xtype: 'pveDirectoryList'
301 },
fee716d3
DC
302 {
303 title: 'ZFS',
304 itemId: 'zfs',
305 onlineHelp: 'chapter_zfs',
306 iconCls: 'fa fa-th-large',
307 groups: ['storage'],
308 xtype: 'pveZFSList'
309 },
2ba22ee4 310 {
332581a8
DC
311 title: 'Ceph',
312 itemId: 'ceph',
313 iconCls: 'fa fa-ceph',
314 xtype: 'pveNodeCephStatus'
315 },
cb6df20c
DC
316 {
317 xtype: 'pveReplicaView',
318 iconCls: 'fa fa-retweet',
319 title: gettext('Replication'),
320 itemId: 'replication'
321 },
332581a8 322 {
7247077d 323 xtype: 'pveNodeCephConfigCrush',
ec99b1c3 324 title: gettext('Configuration'),
332581a8
DC
325 iconCls: 'fa fa-gear',
326 groups: ['ceph'],
327 itemId: 'ceph-config'
328 },
329 {
a6c60aed 330 xtype: 'pveNodeCephMonMgr',
332581a8
DC
331 title: gettext('Monitor'),
332 iconCls: 'fa fa-tv',
333 groups: ['ceph'],
334 itemId: 'ceph-monlist'
335 },
336 {
337 xtype: 'pveNodeCephOsdTree',
338 title: 'OSD',
339 iconCls: 'fa fa-hdd-o',
340 groups: ['ceph'],
341 itemId: 'ceph-osdtree'
342 },
563ed5ee
TL
343 {
344 xtype: 'pveNodeCephFSPanel',
345 title: 'CephFS',
346 iconCls: 'fa fa-folder',
347 groups: ['ceph'],
348 nodename: nodename,
349 itemId: 'ceph-cephfspanel'
350 },
332581a8
DC
351 {
352 xtype: 'pveNodeCephPoolList',
4d02b4fe 353 title: 'Pools',
332581a8
DC
354 iconCls: 'fa fa-sitemap',
355 groups: ['ceph'],
356 itemId: 'ceph-pools'
2ba22ee4 357 }
7621bfbf 358 );
2ba22ee4
DM
359 }
360
332581a8 361 if (caps.nodes['Sys.Syslog']) {
7621bfbf 362 me.items.push(
2ba22ee4 363 {
0ee5a21e 364 xtype: 'proxmoxLogView',
332581a8
DC
365 title: gettext('Log'),
366 iconCls: 'fa fa-list',
a14b3223 367 groups: ['firewall'],
c8802a60 368 onlineHelp: 'chapter_pve_firewall',
332581a8
DC
369 url: '/api2/extjs/nodes/' + nodename + '/firewall/log',
370 itemId: 'firewall-fwlog'
2ba22ee4
DM
371 },
372 {
332581a8
DC
373 title: gettext('Log'),
374 itemId: 'ceph-log',
375 iconCls: 'fa fa-list',
376 groups: ['ceph'],
c8802a60 377 onlineHelp: 'chapter_pveceph',
4616a55b
TM
378 xtype: 'cephLogView',
379 url: "/api2/extjs/nodes/" + nodename + "/ceph/log",
380 nodename: nodename
332581a8
DC
381 });
382 }
383
7621bfbf 384 me.items.push(
332581a8
DC
385 {
386 title: gettext('Task History'),
387 iconCls: 'fa fa-list',
388 itemId: 'tasks',
6c60ab5e
DC
389 nodename: nodename,
390 xtype: 'proxmoxNodeTasks'
332581a8 391 },
2ba22ee4
DM
392 {
393 title: gettext('Subscription'),
332581a8 394 iconCls: 'fa fa-support',
2ba22ee4 395 itemId: 'support',
a1460d8d 396 xtype: 'pveNodeSubscription',
2ba22ee4
DM
397 nodename: nodename
398 }
7621bfbf 399 );
2ba22ee4
DM
400
401 me.callParent();
402
540fdc8b 403 me.mon(me.statusStore, 'load', function(s, records, success) {
2ba22ee4
DM
404 var uptimerec = s.data.get('uptime');
405 var powermgmt = uptimerec ? uptimerec.data.value : false;
406 if (!caps.nodes['Sys.PowerMgmt']) {
407 powermgmt = false;
408 }
409 restartBtn.setDisabled(!powermgmt);
410 shutdownBtn.setDisabled(!powermgmt);
411 shellBtn.setDisabled(!powermgmt);
412 });
413
414 me.on('afterrender', function() {
415 me.statusStore.startUpdate();
416 });
417
418 me.on('destroy', function() {
419 me.statusStore.stopUpdate();
420 });
421 }
422});