]>
git.proxmox.com Git - pve-manager.git/blob - www/manager/node/Config.js
1 Ext
.define('PVE.node.Config', {
2 extend
: 'PVE.panel.Config',
3 alias
: 'widget.PVE.node.Config',
5 initComponent: function() {
8 var nodename
= me
.pveSelNode
.data
.node
;
10 throw "no node name specified";
13 var caps
= Ext
.state
.Manager
.get('GuiCap');
15 me
.statusStore
= Ext
.create('PVE.data.ObjectStore', {
16 url
: "/api2/json/nodes/" + nodename
+ "/status",
20 var node_command = function(cmd
) {
21 PVE
.Utils
.API2Request({
22 params
: { command
: cmd
},
23 url
: '/nodes/' + nodename
+ '/status',
26 failure: function(response
, opts
) {
27 Ext
.Msg
.alert(gettext('Error'), response
.htmlStatus
);
32 var restartBtn
= Ext
.create('PVE.button.Button', {
33 text
: gettext('Restart'),
34 disabled
: !caps
.nodes
['Sys.PowerMgmt'],
35 confirmMsg
: Ext
.String
.format(gettext("Do you really want to restart node {0}?"), nodename
),
37 node_command('reboot');
41 var shutdownBtn
= Ext
.create('PVE.button.Button', {
42 text
: gettext('Shutdown'),
43 disabled
: !caps
.nodes
['Sys.PowerMgmt'],
44 confirmMsg
: Ext
.String
.format(gettext("Do you really want to shutdown node {0}?"), nodename
),
46 node_command('shutdown');
50 var shellBtn
= Ext
.create('Ext.Button', {
51 text
: gettext('Shell'),
52 disabled
: !caps
.nodes
['Sys.Console'],
54 var url
= Ext
.urlEncode({
58 var nw
= window
.open("?" + url
, '_blank',
59 "innerWidth=745,innerheight=427");
67 title
: gettext('Node') + " '" + nodename
+ "'",
69 defaults
: { statusStore
: me
.statusStore
},
70 tbar
: [ restartBtn
, shutdownBtn
, shellBtn
]
73 if (caps
.nodes
['Sys.Audit']) {
76 title
: gettext('Summary'),
78 xtype
: 'pveNodeSummary'
81 title
: gettext('Services'),
83 xtype
: 'pveNodeServiceView'
86 title
: gettext('Network'),
88 xtype
: 'pveNodeNetworkView'
91 title
: gettext('DNS'),
93 xtype
: 'pveNodeDNSView'
96 title
: gettext('Time'),
98 xtype
: 'pveNodeTimeView'
103 if (caps
.nodes
['Sys.Syslog']) {
109 url
: "/api2/extjs/nodes/" + nodename
+ "/syslog"
117 url
: "/api2/extjs/nodes/" + nodename
+ "/bootlog"
124 title
: gettext('Task History'),
126 xtype
: 'pveNodeTasks'
131 if (caps
.nodes
['Sys.Audit']) {
136 xtype
: 'pveNodeBCFailCnt'
143 title
: gettext('Subscription'),
145 xtype
: 'pveNodeSubscription',
150 if (caps
.nodes
['Sys.Console']) {
152 title
: gettext('Updates'),
161 me
.statusStore
.on('load', function(s
, records
, success
) {
162 var uptimerec
= s
.data
.get('uptime');
163 var powermgmt
= uptimerec
? uptimerec
.data
.value
: false;
164 if (!caps
.nodes
['Sys.PowerMgmt']) {
167 restartBtn
.setDisabled(!powermgmt
);
168 shutdownBtn
.setDisabled(!powermgmt
);
169 shellBtn
.setDisabled(!powermgmt
);
172 me
.on('afterrender', function() {
173 me
.statusStore
.startUpdate();
176 me
.on('destroy', function() {
177 me
.statusStore
.stopUpdate();