]>
git.proxmox.com Git - pve-manager.git/blob - www/mobile/NodeSummary.js
1 Ext
.define('PVE.NodeInfo', {
2 extend
: 'Ext.Component',
3 alias
: 'widget.pveNodeInfo',
6 style
: 'background-color: white;',
7 styleHtmlContent
: true,
10 '<table style="margin-bottom:0px;">',
11 '<tr><td>Version:</td><td>{pveversion}</td></tr>',
12 '<tr><td>Memory:</td><td>{[this.meminfo(values)]}</td></tr>',
13 '<tr><td>CPU:</td><td>{[this.cpuinfo(values)]}</td></tr>',
14 '<tr><td>Uptime:</td><td>{[PVE.Utils.format_duration_long(values.uptime)]}</td></tr>',
17 meminfo: function(values
) {
18 var d
= values
.memory
;
22 return PVE
.Utils
.format_size(d
.used
|| 0) + " of " + PVE
.Utils
.format_size(d
.total
);
24 cpuinfo: function(values
) {
25 if (!values
.cpuinfo
) {
28 var per
= values
.cpu
* 100;
29 return per
.toFixed(2) + "% (" + values
.cpuinfo
.cpus
+ " CPUs)";
36 Ext
.define('PVE.NodeSummary', {
38 alias
: 'widget.pveNodeSummary',
41 pathMatch: function(loc
) {
42 return loc
.match(/^nodes\/([^\s\/]+)$/);
60 html
: gettext('Virtual machines')
65 disableSelection
: true,
67 itemsingletap: function(list
, index
, target
, record
) {
68 PVE
.Workspace
.gotoPage('nodes/' + record
.get('nodename') + '/' +
69 record
.get('type') + '/' + record
.get('vmid'));
78 'cpu: {[this.cpuinfo(values)]} ',
79 'mem: {[this.meminfo(values)]} ',
83 meminfo: function(values
) {
87 return PVE
.Utils
.format_size(values
.mem
);
89 cpuinfo: function(values
) {
93 return (values
.cpu
*100).toFixed(1) + '%';
104 var ni
= me
.down('pveNodeInfo');
106 PVE
.Utils
.API2Request({
107 url
: '/nodes/' + me
.nodename
+ '/status',
109 success: function(response
) {
110 var d
= response
.result
.data
;
112 d
.pveversion
= d
.pveversion
.replace(/pve\-manager\//, '');
119 var list
= me
.down('list');
121 list
.setMasked(false);
123 var error_handler = function(response
) {
124 list
.setMasked({ xtype
: 'loadmask', message
: response
.htmlStatus
} );
127 PVE
.Utils
.API2Request({
128 url
: '/nodes/' + me
.nodename
+ '/lxc',
130 success: function(response
) {
131 var d
= response
.result
.data
;
132 d
.nodename
= me
.nodename
;
133 d
.forEach(function(el
) { el
.type
= 'lxc'; el
.nodename
= me
.nodename
});
134 me
.store
.each(function(rec
) {
135 if (rec
.get('type') === 'lxc') {
141 failure
: error_handler
144 PVE
.Utils
.API2Request({
145 url
: '/nodes/' + me
.nodename
+ '/qemu',
147 success: function(response
) {
148 var d
= response
.result
.data
;
149 d
.forEach(function(el
) { el
.type
= 'qemu'; el
.nodename
= me
.nodename
});
150 me
.store
.each(function(rec
) {
151 if (rec
.get('type') === 'qemu') {
157 failure
: error_handler
162 initialize: function() {
165 var match
= me
.self
.pathMatch(me
.getAppUrl());
167 throw "pathMatch failed";
170 me
.nodename
= match
[1];
172 me
.down('titlebar').setTitle(gettext('Node') + ': ' + me
.nodename
);
174 me
.down('pveMenuButton').setMenuItems([
176 text
: gettext('Tasks'),
177 handler: function() {
178 PVE
.Workspace
.gotoPage('nodes/' + me
.nodename
+ '/tasks');
183 me
.store
= Ext
.create('Ext.data.Store', {
184 fields
: [ 'name', 'vmid', 'nodename', 'type', 'memory', 'uptime', 'mem', 'maxmem', 'cpu', 'cpus'],
187 groupFn: function(record
) {
188 return record
.get('type');
193 var list
= me
.down('list');
194 list
.setStore(me
.store
);