]> git.proxmox.com Git - pve-manager.git/blame - www/manager6/node/Config.js
add onlineHelp links to Datacenter
[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
5 initComponent: function() {
6 var me = this;
7
8 var nodename = me.pveSelNode.data.node;
9 if (!nodename) {
10 throw "no node name specified";
11 }
12
13 var caps = Ext.state.Manager.get('GuiCap');
14
15 me.statusStore = Ext.create('PVE.data.ObjectStore', {
16 url: "/api2/json/nodes/" + nodename + "/status",
17 interval: 1000
18 });
19
20 var node_command = function(cmd) {
21 PVE.Utils.API2Request({
22 params: { command: cmd },
23 url: '/nodes/' + nodename + '/status',
24 method: 'POST',
25 waitMsgTarget: me,
26 failure: function(response, opts) {
27 Ext.Msg.alert(gettext('Error'), response.htmlStatus);
28 }
29 });
30 };
c474314e 31
2ba22ee4
DM
32 var actionBtn = Ext.create('Ext.Button', {
33 text: gettext('More'),
9a132f4a 34 iconCls: 'fa fa-fw fa-ellipsis-v',
2ba22ee4
DM
35 disabled: !caps.nodes['Sys.PowerMgmt'],
36 menu: new Ext.menu.Menu({
37 items: [
38 {
16152937 39 text: gettext('Start all VMs and Containers'),
d4333933 40 iconCls: 'fa fa-fw fa-play',
2ba22ee4 41 handler: function() {
16152937 42 var msg = gettext('Start all VMs and Containers') + ' (' + gettext('Node') + " '" + nodename + "')";
2ba22ee4
DM
43 Ext.Msg.confirm(gettext('Confirm'), msg, function(btn) {
44 if (btn !== 'yes') {
45 return;
46 }
47 PVE.Utils.API2Request({
48 params: { force: 1 },
49 url: '/nodes/' + nodename + '/startall',
50 method: 'POST',
51 waitMsgTarget: me,
52 failure: function(response, opts) {
53 Ext.Msg.alert('Error', response.htmlStatus);
54 }
55 });
56 });
57 }
58 },
59 {
16152937 60 text: gettext('Stop all VMs and Containers'),
d4333933 61 iconCls: 'fa fa-fw fa-stop fa-red',
2ba22ee4 62 handler: function() {
16152937 63 var msg = gettext('Stop all VMs and Containers') + ' (' + gettext('Node') + " '" + nodename + "')";
2ba22ee4
DM
64 Ext.Msg.confirm(gettext('Confirm'), msg, function(btn) {
65 if (btn !== 'yes') {
66 return;
67 }
c474314e 68
2ba22ee4
DM
69 PVE.Utils.API2Request({
70 url: '/nodes/' + nodename + '/stopall',
71 method: 'POST',
72 waitMsgTarget: me,
73 failure: function(response, opts) {
74 Ext.Msg.alert('Error', response.htmlStatus);
75 }
76 });
77 });
78 }
79 },
80 {
16152937 81 text: gettext('Migrate all VMs and Containers'),
d4333933 82 iconCls: 'fa fa-fw fa-send-o',
2ba22ee4
DM
83 handler: function() {
84 var win = Ext.create('PVE.window.MigrateAll', {
22f2f9d6 85 nodename: nodename
2ba22ee4
DM
86 });
87 win.show();
88 }
89 }
90 ]
91 })
c474314e 92 });
2ba22ee4
DM
93
94 var restartBtn = Ext.create('PVE.button.Button', {
95 text: gettext('Restart'),
96 disabled: !caps.nodes['Sys.PowerMgmt'],
16152937 97 confirmMsg: gettext('Node') + " '" + nodename + "' - " + gettext('Restart'),
c474314e 98 handler: function() {
2ba22ee4 99 node_command('reboot');
d4333933
DC
100 },
101 iconCls: 'fa fa-undo'
2ba22ee4
DM
102 });
103
104 var shutdownBtn = Ext.create('PVE.button.Button', {
105 text: gettext('Shutdown'),
106 disabled: !caps.nodes['Sys.PowerMgmt'],
16152937 107 confirmMsg: gettext('Node') + " '" + nodename + "' - " + gettext('Shutdown'),
c474314e 108 handler: function() {
2ba22ee4 109 node_command('shutdown');
d4333933
DC
110 },
111 iconCls: 'fa fa-power-off'
2ba22ee4
DM
112 });
113
114 var shellBtn = Ext.create('PVE.button.ConsoleButton', {
115 disabled: !caps.nodes['Sys.Console'],
116 text: gettext('Shell'),
117 consoleType: 'shell',
d4333933
DC
118 nodename: nodename,
119 iconCls: 'fa fa-terminal'
2ba22ee4
DM
120 });
121
122 me.items = [];
123
124 Ext.apply(me, {
125 title: gettext('Node') + " '" + nodename + "'",
126 hstateid: 'nodetab',
127 defaults: { statusStore: me.statusStore },
128 tbar: [ restartBtn, shutdownBtn, shellBtn, actionBtn]
129 });
130
131 if (caps.nodes['Sys.Audit']) {
7621bfbf 132 me.items.push(
2ba22ee4
DM
133 {
134 title: gettext('Summary'),
332581a8 135 iconCls: 'fa fa-book',
a14b3223 136 itemId: 'summary',
2ba22ee4 137 xtype: 'pveNodeSummary'
a14b3223
DC
138 }
139 );
140 }
141
142 if (caps.nodes['Sys.Console']) {
143 me.items.push(
144 {
145 title: gettext('Shell'),
146 iconCls: 'fa fa-terminal',
147 itemId: 'console',
148 xtype: 'pveNoVncConsole',
149 consoleType: 'shell',
150 nodename: nodename
151 }
152 );
153 }
154
155 if (caps.nodes['Sys.Audit']) {
156 me.items.push(
2ba22ee4 157 {
a14b3223 158 title: gettext('System'),
332581a8 159 iconCls: 'fa fa-cogs',
2ba22ee4 160 itemId: 'services',
a14b3223 161 expandedOnInit: true,
22f2f9d6 162 xtype: 'pveNodeServiceView'
2ba22ee4 163 },
a14b3223
DC
164 {
165 title: gettext('Network'),
166 iconCls: 'fa fa-exchange',
167 itemId: 'network',
168 groups: ['services'],
169 xtype: 'pveNodeNetworkView'
170 },
171 {
172 title: gettext('DNS'),
173 iconCls: 'fa fa-globe',
174 groups: ['services'],
175 itemId: 'dns',
176 xtype: 'pveNodeDNSView'
177 },
332581a8
DC
178 {
179 title: gettext('Time'),
180 itemId: 'time',
a14b3223 181 groups: ['services'],
332581a8
DC
182 xtype: 'pveNodeTimeView',
183 iconCls: 'fa fa-clock-o'
184 });
185 }
186
187 if (caps.nodes['Sys.Syslog']) {
188 me.items.push({
189 title: 'Syslog',
190 iconCls: 'fa fa-list',
a14b3223 191 groups: ['services'],
332581a8
DC
192 disabled: !caps.nodes['Sys.Syslog'],
193 itemId: 'syslog',
194 xtype: 'pveLogView',
195 url: "/api2/extjs/nodes/" + nodename + "/syslog",
196 log_select_timespan: 1
197 });
198
199 if (caps.nodes['Sys.Modify']) {
200 me.items.push({
201 title: gettext('Updates'),
202 iconCls: 'fa fa-refresh',
203 disabled: !caps.nodes['Sys.Console'],
204 itemId: 'apt',
205 xtype: 'pveNodeAPT',
206 nodename: nodename
207 });
208 }
209 }
210
211 if (caps.nodes['Sys.Audit']) {
212 me.items.push(
2ba22ee4 213 {
332581a8
DC
214 xtype: 'pveFirewallRules',
215 iconCls: 'fa fa-shield',
332581a8
DC
216 title: gettext('Firewall'),
217 allow_iface: true,
218 base_url: '/nodes/' + nodename + '/firewall/rules',
219 list_refs_url: '/cluster/firewall/refs',
220 itemId: 'firewall'
221 },
222 {
223 xtype: 'pveFirewallOptions',
224 title: gettext('Options'),
225 iconCls: 'fa fa-gear',
a14b3223 226 groups: ['firewall'],
332581a8
DC
227 base_url: '/nodes/' + nodename + '/firewall/options',
228 fwtype: 'node',
229 itemId: 'firewall-options'
230 });
2ba22ee4
DM
231 }
232
332581a8
DC
233
234 if (caps.nodes['Sys.Audit']) {
7621bfbf 235 me.items.push(
fc2916c1
DC
236 {
237 title: gettext('Disks'),
238 itemId: 'storage',
239 expandedOnInit: true,
240 iconCls: 'fa fa-hdd-o',
241 xtype: 'pveNodeDiskList'
242 },
2ba22ee4 243 {
332581a8
DC
244 title: 'Ceph',
245 itemId: 'ceph',
246 iconCls: 'fa fa-ceph',
247 xtype: 'pveNodeCephStatus'
248 },
332581a8 249 {
7247077d 250 xtype: 'pveNodeCephConfigCrush',
332581a8
DC
251 title: gettext('Config'),
252 iconCls: 'fa fa-gear',
253 groups: ['ceph'],
254 itemId: 'ceph-config'
255 },
256 {
257 xtype: 'pveNodeCephMonList',
258 title: gettext('Monitor'),
259 iconCls: 'fa fa-tv',
260 groups: ['ceph'],
261 itemId: 'ceph-monlist'
262 },
263 {
264 xtype: 'pveNodeCephOsdTree',
265 title: 'OSD',
266 iconCls: 'fa fa-hdd-o',
267 groups: ['ceph'],
268 itemId: 'ceph-osdtree'
269 },
270 {
271 xtype: 'pveNodeCephPoolList',
272 title: gettext('Pools'),
273 iconCls: 'fa fa-sitemap',
274 groups: ['ceph'],
275 itemId: 'ceph-pools'
2ba22ee4 276 }
7621bfbf 277 );
2ba22ee4
DM
278 }
279
332581a8 280 if (caps.nodes['Sys.Syslog']) {
7621bfbf 281 me.items.push(
2ba22ee4 282 {
332581a8
DC
283 xtype: 'pveLogView',
284 title: gettext('Log'),
285 iconCls: 'fa fa-list',
a14b3223 286 groups: ['firewall'],
332581a8
DC
287 url: '/api2/extjs/nodes/' + nodename + '/firewall/log',
288 itemId: 'firewall-fwlog'
2ba22ee4
DM
289 },
290 {
332581a8
DC
291 title: gettext('Log'),
292 itemId: 'ceph-log',
293 iconCls: 'fa fa-list',
294 groups: ['ceph'],
295 xtype: 'pveLogView',
296 url: "/api2/extjs/nodes/" + nodename + "/ceph/log"
297 });
298 }
299
7621bfbf 300 me.items.push(
332581a8
DC
301 {
302 title: gettext('Task History'),
303 iconCls: 'fa fa-list',
304 itemId: 'tasks',
305 xtype: 'pveNodeTasks'
306 },
2ba22ee4
DM
307 {
308 title: gettext('Subscription'),
332581a8 309 iconCls: 'fa fa-support',
2ba22ee4 310 itemId: 'support',
a1460d8d 311 xtype: 'pveNodeSubscription',
2ba22ee4
DM
312 nodename: nodename
313 }
7621bfbf 314 );
2ba22ee4
DM
315
316 me.callParent();
317
540fdc8b 318 me.mon(me.statusStore, 'load', function(s, records, success) {
2ba22ee4
DM
319 var uptimerec = s.data.get('uptime');
320 var powermgmt = uptimerec ? uptimerec.data.value : false;
321 if (!caps.nodes['Sys.PowerMgmt']) {
322 powermgmt = false;
323 }
324 restartBtn.setDisabled(!powermgmt);
325 shutdownBtn.setDisabled(!powermgmt);
326 shellBtn.setDisabled(!powermgmt);
327 });
328
329 me.on('afterrender', function() {
330 me.statusStore.startUpdate();
331 });
332
333 me.on('destroy', function() {
334 me.statusStore.stopUpdate();
335 });
336 }
337});