]> git.proxmox.com Git - pve-manager.git/blame - www/manager6/node/Config.js
use TimezoneStore from widget toolkit
[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
17 me.statusStore = Ext.create('PVE.data.ObjectStore', {
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', {
2ba22ee4
DM
84 text: gettext('Restart'),
85 disabled: !caps.nodes['Sys.PowerMgmt'],
31cb3622 86 dangerous: true,
16152937 87 confirmMsg: gettext('Node') + " '" + nodename + "' - " + gettext('Restart'),
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,
16152937 98 confirmMsg: gettext('Node') + " '" + nodename + "' - " + gettext('Shutdown'),
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'
a14b3223
DC
128 }
129 );
130 }
131
132 if (caps.nodes['Sys.Console']) {
133 me.items.push(
134 {
135 title: gettext('Shell'),
136 iconCls: 'fa fa-terminal',
137 itemId: 'console',
138 xtype: 'pveNoVncConsole',
139 consoleType: 'shell',
140 nodename: nodename
d345d7ad
DC
141 },
142 {
143 title: gettext('Shell (JS)'),
144 iconCls: 'fa fa-terminal',
145 itemId: 'jsconsole',
146 xtype: 'pveNoVncConsole',
147 consoleType: 'shell',
148 xtermjs: true,
149 nodename: nodename
a14b3223
DC
150 }
151 );
152 }
153
154 if (caps.nodes['Sys.Audit']) {
155 me.items.push(
2ba22ee4 156 {
a14b3223 157 title: gettext('System'),
332581a8 158 iconCls: 'fa fa-cogs',
2ba22ee4 159 itemId: 'services',
a14b3223 160 expandedOnInit: true,
4178b82a
DC
161 startOnlyServices: {
162 'pveproxy': true,
163 'pvedaemon': true,
164 'pve-cluster': true
165 },
166 nodename: nodename,
167 onlineHelp: 'pve_service_daemons',
168 xtype: 'proxmoxNodeServiceView'
2ba22ee4 169 },
a14b3223
DC
170 {
171 title: gettext('Network'),
172 iconCls: 'fa fa-exchange',
173 itemId: 'network',
174 groups: ['services'],
13ff8209
DC
175 nodename: nodename,
176 onlineHelp: 'sysadmin_network_configuration',
177 xtype: 'proxmoxNodeNetworkView'
a14b3223
DC
178 },
179 {
180 title: gettext('DNS'),
181 iconCls: 'fa fa-globe',
182 groups: ['services'],
183 itemId: 'dns',
66ce20fd
DC
184 nodename: nodename,
185 onlineHelp: 'sysadmin_network_configuration',
186 xtype: 'proxmoxNodeDNSView'
a14b3223 187 },
332581a8
DC
188 {
189 title: gettext('Time'),
190 itemId: 'time',
a14b3223 191 groups: ['services'],
939edd73
DC
192 nodename: nodename,
193 xtype: 'proxmoxNodeTimeView',
332581a8
DC
194 iconCls: 'fa fa-clock-o'
195 });
196 }
197
198 if (caps.nodes['Sys.Syslog']) {
199 me.items.push({
200 title: 'Syslog',
201 iconCls: 'fa fa-list',
a14b3223 202 groups: ['services'],
332581a8
DC
203 disabled: !caps.nodes['Sys.Syslog'],
204 itemId: 'syslog',
205 xtype: 'pveLogView',
206 url: "/api2/extjs/nodes/" + nodename + "/syslog",
207 log_select_timespan: 1
208 });
209
210 if (caps.nodes['Sys.Modify']) {
211 me.items.push({
212 title: gettext('Updates'),
213 iconCls: 'fa fa-refresh',
214 disabled: !caps.nodes['Sys.Console'],
0f9347a6 215 // do we want to link to system updates instead?
332581a8 216 itemId: 'apt',
371d39ef
DC
217 xtype: 'proxmoxNodeAPT',
218 upgradeBtn: {
219 xtype: 'pveConsoleButton',
220 disabled: PVE.UserName !== 'root@pam',
221 text: gettext('Upgrade'),
222 consoleType: 'upgrade',
223 nodename: nodename
224 },
332581a8
DC
225 nodename: nodename
226 });
227 }
228 }
229
230 if (caps.nodes['Sys.Audit']) {
231 me.items.push(
2ba22ee4 232 {
332581a8
DC
233 xtype: 'pveFirewallRules',
234 iconCls: 'fa fa-shield',
332581a8
DC
235 title: gettext('Firewall'),
236 allow_iface: true,
237 base_url: '/nodes/' + nodename + '/firewall/rules',
238 list_refs_url: '/cluster/firewall/refs',
239 itemId: 'firewall'
240 },
241 {
242 xtype: 'pveFirewallOptions',
243 title: gettext('Options'),
244 iconCls: 'fa fa-gear',
c8802a60 245 onlineHelp: 'pve_firewall_host_specific_configuration',
a14b3223 246 groups: ['firewall'],
332581a8
DC
247 base_url: '/nodes/' + nodename + '/firewall/options',
248 fwtype: 'node',
249 itemId: 'firewall-options'
250 });
2ba22ee4
DM
251 }
252
332581a8
DC
253
254 if (caps.nodes['Sys.Audit']) {
7621bfbf 255 me.items.push(
fc2916c1
DC
256 {
257 title: gettext('Disks'),
258 itemId: 'storage',
259 expandedOnInit: true,
260 iconCls: 'fa fa-hdd-o',
261 xtype: 'pveNodeDiskList'
262 },
2ba22ee4 263 {
332581a8
DC
264 title: 'Ceph',
265 itemId: 'ceph',
266 iconCls: 'fa fa-ceph',
267 xtype: 'pveNodeCephStatus'
268 },
cb6df20c
DC
269 {
270 xtype: 'pveReplicaView',
271 iconCls: 'fa fa-retweet',
272 title: gettext('Replication'),
273 itemId: 'replication'
274 },
332581a8 275 {
7247077d 276 xtype: 'pveNodeCephConfigCrush',
ec99b1c3 277 title: gettext('Configuration'),
332581a8
DC
278 iconCls: 'fa fa-gear',
279 groups: ['ceph'],
280 itemId: 'ceph-config'
281 },
282 {
283 xtype: 'pveNodeCephMonList',
284 title: gettext('Monitor'),
285 iconCls: 'fa fa-tv',
286 groups: ['ceph'],
287 itemId: 'ceph-monlist'
288 },
289 {
290 xtype: 'pveNodeCephOsdTree',
291 title: 'OSD',
292 iconCls: 'fa fa-hdd-o',
293 groups: ['ceph'],
294 itemId: 'ceph-osdtree'
295 },
296 {
297 xtype: 'pveNodeCephPoolList',
4d02b4fe 298 title: 'Pools',
332581a8
DC
299 iconCls: 'fa fa-sitemap',
300 groups: ['ceph'],
301 itemId: 'ceph-pools'
2ba22ee4 302 }
7621bfbf 303 );
2ba22ee4
DM
304 }
305
332581a8 306 if (caps.nodes['Sys.Syslog']) {
7621bfbf 307 me.items.push(
2ba22ee4 308 {
332581a8
DC
309 xtype: 'pveLogView',
310 title: gettext('Log'),
311 iconCls: 'fa fa-list',
a14b3223 312 groups: ['firewall'],
c8802a60 313 onlineHelp: 'chapter_pve_firewall',
332581a8
DC
314 url: '/api2/extjs/nodes/' + nodename + '/firewall/log',
315 itemId: 'firewall-fwlog'
2ba22ee4
DM
316 },
317 {
332581a8
DC
318 title: gettext('Log'),
319 itemId: 'ceph-log',
320 iconCls: 'fa fa-list',
321 groups: ['ceph'],
c8802a60 322 onlineHelp: 'chapter_pveceph',
332581a8
DC
323 xtype: 'pveLogView',
324 url: "/api2/extjs/nodes/" + nodename + "/ceph/log"
325 });
326 }
327
7621bfbf 328 me.items.push(
332581a8
DC
329 {
330 title: gettext('Task History'),
331 iconCls: 'fa fa-list',
332 itemId: 'tasks',
6c60ab5e
DC
333 nodename: nodename,
334 xtype: 'proxmoxNodeTasks'
332581a8 335 },
2ba22ee4
DM
336 {
337 title: gettext('Subscription'),
332581a8 338 iconCls: 'fa fa-support',
2ba22ee4 339 itemId: 'support',
a1460d8d 340 xtype: 'pveNodeSubscription',
2ba22ee4
DM
341 nodename: nodename
342 }
7621bfbf 343 );
2ba22ee4
DM
344
345 me.callParent();
346
540fdc8b 347 me.mon(me.statusStore, 'load', function(s, records, success) {
2ba22ee4
DM
348 var uptimerec = s.data.get('uptime');
349 var powermgmt = uptimerec ? uptimerec.data.value : false;
350 if (!caps.nodes['Sys.PowerMgmt']) {
351 powermgmt = false;
352 }
353 restartBtn.setDisabled(!powermgmt);
354 shutdownBtn.setDisabled(!powermgmt);
355 shellBtn.setDisabled(!powermgmt);
356 });
357
358 me.on('afterrender', function() {
359 me.statusStore.startUpdate();
360 });
361
362 me.on('destroy', function() {
363 me.statusStore.stopUpdate();
364 });
365 }
366});