]>
git.proxmox.com Git - pve-manager.git/blob - www/manager6/node/Config.js
6d60bfcf80798eeff7f23abf0b08ee10a74abdfc
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 actionBtn
= Ext
.create('Ext.Button', {
33 text
: gettext('More'),
34 disabled
: !caps
.nodes
['Sys.PowerMgmt'],
35 menu
: new Ext
.menu
.Menu({
38 text
: gettext('Start All VMs'),
39 icon
: '/pve2/images/start.png',
41 var msg
= Ext
.String
.format(gettext("Do you really want to start all Vms on node {0}?"), nodename
);
42 Ext
.Msg
.confirm(gettext('Confirm'), msg
, function(btn
) {
46 PVE
.Utils
.API2Request({
48 url
: '/nodes/' + nodename
+ '/startall',
51 failure: function(response
, opts
) {
52 Ext
.Msg
.alert('Error', response
.htmlStatus
);
59 text
: gettext('Stop All VMs'),
60 icon
: '/pve2/images/gtk-stop.png',
62 var msg
= Ext
.String
.format(gettext("Do you really want to stop all Vms on node {0}?"), nodename
);
63 Ext
.Msg
.confirm(gettext('Confirm'), msg
, function(btn
) {
68 PVE
.Utils
.API2Request({
69 url
: '/nodes/' + nodename
+ '/stopall',
72 failure: function(response
, opts
) {
73 Ext
.Msg
.alert('Error', response
.htmlStatus
);
80 text
: gettext('Migrate All VMs'),
81 icon
: '/pve2/images/forward.png',
83 var win
= Ext
.create('PVE.window.MigrateAll', {
93 var restartBtn
= Ext
.create('PVE.button.Button', {
94 text
: gettext('Restart'),
95 disabled
: !caps
.nodes
['Sys.PowerMgmt'],
96 confirmMsg
: Ext
.String
.format(gettext("Do you really want to restart node {0}?"), nodename
),
98 node_command('reboot');
102 var shutdownBtn
= Ext
.create('PVE.button.Button', {
103 text
: gettext('Shutdown'),
104 disabled
: !caps
.nodes
['Sys.PowerMgmt'],
105 confirmMsg
: Ext
.String
.format(gettext("Do you really want to shutdown node {0}?"), nodename
),
106 handler: function() {
107 node_command('shutdown');
111 var shellBtn
= Ext
.create('PVE.button.ConsoleButton', {
112 disabled
: !caps
.nodes
['Sys.Console'],
113 text
: gettext('Shell'),
114 consoleType
: 'shell',
121 title
: gettext('Node') + " '" + nodename
+ "'",
123 defaults
: { statusStore
: me
.statusStore
},
124 tbar
: [ restartBtn
, shutdownBtn
, shellBtn
, actionBtn
]
127 if (caps
.nodes
['Sys.Audit']) {
130 title
: gettext('Summary'),
132 xtype
: 'pveNodeSummary'
135 title
: gettext('Services'),
137 xtype
: 'pveNodeServiceView',
140 title
: gettext('Network'),
142 xtype
: 'pveNodeNetworkView'
145 title
: gettext('DNS'),
147 xtype
: 'pveNodeDNSView'
150 title
: gettext('Time'),
152 xtype
: 'pveNodeTimeView'
157 if (caps
.nodes
['Sys.Syslog']) {
163 url
: "/api2/extjs/nodes/" + nodename
+ "/syslog",
164 log_select_timespan
: 1
171 title
: gettext('Task History'),
173 xtype
: 'pveNodeTasks'
177 if (caps
.nodes
['Sys.Console']) {
180 xtype
: 'pveFirewallPanel',
181 title
: gettext('Firewall'),
182 base_url
: '/nodes/' + nodename
+ '/firewall',
184 phstateid
: me
.hstateid
,
188 title
: gettext('Updates'),
194 title
: gettext('Console'),
196 xtype
: 'pveNoVncConsole',
197 consoleType
: 'shell',
203 xtype
: 'pveNodeCeph',
204 phstateid
: me
.hstateid
,
212 title
: gettext('Subscription'),
214 xtype
: 'pveNodeSubscription',
221 me
.mon(me
.statusStore
, 'load', function(s
, records
, success
) {
222 var uptimerec
= s
.data
.get('uptime');
223 var powermgmt
= uptimerec
? uptimerec
.data
.value
: false;
224 if (!caps
.nodes
['Sys.PowerMgmt']) {
227 restartBtn
.setDisabled(!powermgmt
);
228 shutdownBtn
.setDisabled(!powermgmt
);
229 shellBtn
.setDisabled(!powermgmt
);
232 me
.on('afterrender', function() {
233 me
.statusStore
.startUpdate();
236 me
.on('destroy', function() {
237 me
.statusStore
.stopUpdate();