[pve-devel] r5969 - in pve-manager/pve2/www/new: . node
svn-commits at proxmox.com
svn-commits at proxmox.com
Thu May 12 13:24:20 CEST 2011
Author: dietmar
Date: 2011-05-12 13:24:19 +0200 (Thu, 12 May 2011)
New Revision: 5969
Modified:
pve-manager/pve2/www/new/PVEUtils.js
pve-manager/pve2/www/new/Workspace.js
pve-manager/pve2/www/new/node/Config.js
Log:
impl. node status view
Modified: pve-manager/pve2/www/new/PVEUtils.js
===================================================================
--- pve-manager/pve2/www/new/PVEUtils.js 2011-05-12 09:30:59 UTC (rev 5968)
+++ pve-manager/pve2/www/new/PVEUtils.js 2011-05-12 11:24:19 UTC (rev 5969)
@@ -274,6 +274,10 @@
var cpu = value;
var maxcpu = record.data.maxcpu;
+ console.log("TEST1 " + cpu);
+ console.log("TEST2 " + maxcpu);
+ console.dir(record);
+
if (!record.data.uptime)
return '';
Modified: pve-manager/pve2/www/new/Workspace.js
===================================================================
--- pve-manager/pve2/www/new/Workspace.js 2011-05-12 09:30:59 UTC (rev 5968)
+++ pve-manager/pve2/www/new/Workspace.js 2011-05-12 11:24:19 UTC (rev 5969)
@@ -91,7 +91,7 @@
}
});
},
- interval: 15*1000
+ interval: 15*60*1000
});
}
Modified: pve-manager/pve2/www/new/node/Config.js
===================================================================
--- pve-manager/pve2/www/new/node/Config.js 2011-05-12 09:30:59 UTC (rev 5968)
+++ pve-manager/pve2/www/new/node/Config.js 2011-05-12 11:24:19 UTC (rev 5969)
@@ -1,3 +1,86 @@
+Ext.define('PVE.node.StatusView', {
+ extend: 'PVE.grid.ObjectGrid',
+ alias: ['widget.pveNodeStatusView'],
+
+ initComponent : function() {
+ var me = this;
+
+ var render_cpuinfo = function(value) {
+ return value.cpus + " x " + value.model;
+ };
+
+ var render_loadavg = function(value) {
+ return value[0] + ", " + value[1] + ", " + value[2];
+ };
+
+ var render_cpu = function(value) {
+ var per = value * 100;
+ return per.toFixed(2) + "%";
+ };
+
+ var render_meminfo = function(value) {
+ var per = (value.used / value.total)*100;
+ var text = "<div>Total: " + PVE.Utils.format_size(value.total) + "</div>" +
+ "<div>Used: " + PVE.Utils.format_size(value.used) + "</div>";
+ return text;
+ };
+
+ var rows = {
+ uptime: { header: 'Uptime', renderer: PVE.Utils.format_duration_long },
+ loadavg: { header: 'Load average', renderer: render_loadavg },
+ cpuinfo: { header: 'CPUs', renderer: render_cpuinfo },
+ cpu: { header: 'CPU usage', renderer: render_cpu },
+ wait: { header: 'IO delay', renderer: render_cpu },
+ memory: { header: 'RAM usage', renderer: render_meminfo },
+ swap: { header: 'SWAP usage', renderer: render_meminfo },
+ rootfs: { header: 'HD space (root)', renderer: render_meminfo },
+ pveversion: { header: 'PVE Manager version' },
+ kversion: { header: 'Kernel version' }
+ };
+
+
+ var render_key = function(key, metaData, record, rowIndex, colIndex, store) {
+ var rowdef = rows[key] || {};
+ return rowdef.header || key;
+ };
+
+ var render_value = function(value, metaData, record, rowIndex, colIndex, store) {
+ var key = record.data.key;
+ var rowdef = rows[key] || {};
+
+ var renderer = rowdef.renderer;
+ if (renderer)
+ return renderer(value, metaData, record, rowIndex, colIndex, store);
+
+ return value;
+ };
+
+ Ext.applyIf(me, {
+ url: "/api2/json/nodes/" + me.nodename + "/status",
+ //width: '1',
+ interval: 1000,
+ rows: rows,
+ columns: [
+ {
+ header: 'Type',
+ width: 150,
+ dataIndex: 'key',
+ renderer: render_key
+ },
+ {
+ flex: 1,
+ header: 'Value',
+ dataIndex: 'value',
+ renderer: render_value
+ }
+
+ ]
+ });
+
+ me.callParent();
+ }
+});
+
Ext.define('PVE.node.Summary', {
extend: 'Ext.panel.Panel',
alias: 'widget.pveNodeSummary',
@@ -25,14 +108,23 @@
};
Ext.apply(me, {
- layout: 'table',
- layoutConfig: {
- columns: 1
+ layout: {
+ type: 'vbox',
+ align: 'stretch'
},
+ autoScroll: true,
bodyStyle: 'padding:10px',
defaults: {
style: 'padding-bottom:10px'
},
+ listeners: {
+ show: function() {
+ me.items.each(function(item) { item.fireEvent('show', item); });
+ },
+ hide: function() {
+ me.items.each(function(item) { item.fireEvent('hide', item); });
+ }
+ },
tbar: [
{
text: 'Reboot',
@@ -71,6 +163,13 @@
{
xtype: 'pveRRDTypeSelector'
}
+ ],
+ items: [
+ {
+ title: 'Status',
+ xtype: 'pveNodeStatusView',
+ nodename: nodename
+ }
]
});
@@ -96,7 +195,7 @@
{
title: 'Summary',
itemId: 'summary',
- xtype: 'pveNodeSummary',
+ xtype: 'pveNodeSummary'
},
{
title: 'Services',
More information about the pve-devel
mailing list