[pve-devel] r5979 - in pve-manager/pve2/www: css new new/grid new/node new/panel new/qemu
svn-commits at proxmox.com
svn-commits at proxmox.com
Fri May 13 14:05:43 CEST 2011
Author: dietmar
Date: 2011-05-13 14:05:43 +0200 (Fri, 13 May 2011)
New Revision: 5979
Modified:
pve-manager/pve2/www/css/ext-pve.css
pve-manager/pve2/www/new/PVEUtils.js
pve-manager/pve2/www/new/grid/ObjectGrid.js
pve-manager/pve2/www/new/node/Config.js
pve-manager/pve2/www/new/panel/ConfigPanel.js
pve-manager/pve2/www/new/qemu/Config.js
Log:
cleanups
Modified: pve-manager/pve2/www/css/ext-pve.css
===================================================================
--- pve-manager/pve2/www/css/ext-pve.css 2011-05-13 10:51:29 UTC (rev 5978)
+++ pve-manager/pve2/www/css/ext-pve.css 2011-05-13 12:05:43 UTC (rev 5979)
@@ -1,6 +1,6 @@
/* force same grid cell heigh */
.x-grid-cell-inner {
- line-height: 15px;
+ line-height: 13px;
}
.pve-itype-icon-display,
Modified: pve-manager/pve2/www/new/PVEUtils.js
===================================================================
--- pve-manager/pve2/www/new/PVEUtils.js 2011-05-13 10:51:29 UTC (rev 5978)
+++ pve-manager/pve2/www/new/PVEUtils.js 2011-05-13 12:05:43 UTC (rev 5979)
@@ -48,7 +48,7 @@
// fixme: remove - not needed?
gridLineHeigh: function() {
- return 23;
+ return 21;
//if (Ext.isGecko)
//return 23;
@@ -273,7 +273,6 @@
render_cpu: function(value, metaData, record, rowIndex, colIndex, store) {
- var cpu = value;
var maxcpu = record.data.maxcpu;
if (!record.data.uptime)
@@ -282,12 +281,9 @@
if (!(Ext.isNumeric(value) && Ext.isNumeric(maxcpu) && (maxcpu >= 1)))
return ''
- var per = (cpu * 100) / maxcpu;
+ var per = (value * 100) / maxcpu;
return per.toFixed(1) + '% of ' + maxcpu + (maxcpu > 1 ? 'CPUs' : 'CPU');
-
- return PVE.Utils.format_html_bar(per, per.toFixed(0) + '% of ' +
- maxcpu + (maxcpu > 1 ? 'CPUs' : 'CPU'));
},
render_size: function(value, metaData, record, rowIndex, colIndex, store) {
Modified: pve-manager/pve2/www/new/grid/ObjectGrid.js
===================================================================
--- pve-manager/pve2/www/new/grid/ObjectGrid.js 2011-05-13 10:51:29 UTC (rev 5978)
+++ pve-manager/pve2/www/new/grid/ObjectGrid.js 2011-05-13 12:05:43 UTC (rev 5979)
@@ -6,6 +6,14 @@
],
alias: ['widget.pveObjectGrid'],
+ getObjectValue: function(key, defaultValue) {
+ var me = this;
+ var rec = (me.store.snapshot || me.store.data).get(key);
+ if (rec)
+ return rec.data.value;
+ return defaultValue;
+ },
+
renderKey: function(key, metaData, record, rowIndex, colIndex, store) {
var me = this;
var rows = me.rows;
Modified: pve-manager/pve2/www/new/node/Config.js
===================================================================
--- pve-manager/pve2/www/new/node/Config.js 2011-05-13 10:51:29 UTC (rev 5978)
+++ pve-manager/pve2/www/new/node/Config.js 2011-05-13 12:05:43 UTC (rev 5979)
@@ -38,23 +38,6 @@
kversion: { header: 'Kernel version', required: true,}
};
-
- 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",
cwidth1: 150,
Modified: pve-manager/pve2/www/new/panel/ConfigPanel.js
===================================================================
--- pve-manager/pve2/www/new/panel/ConfigPanel.js 2011-05-13 10:51:29 UTC (rev 5978)
+++ pve-manager/pve2/www/new/panel/ConfigPanel.js 2011-05-13 12:05:43 UTC (rev 5979)
@@ -63,6 +63,8 @@
me.callParent();
+ me.items.get(0).fireEvent('show', me.items.get(0));
+
var statechange = function(sp, key, state) {
if (stateid && key === stateid) {
var atab = me.getActiveTab().itemId;
Modified: pve-manager/pve2/www/new/qemu/Config.js
===================================================================
--- pve-manager/pve2/www/new/qemu/Config.js 2011-05-13 10:51:29 UTC (rev 5978)
+++ pve-manager/pve2/www/new/qemu/Config.js 2011-05-13 12:05:43 UTC (rev 5979)
@@ -1,3 +1,117 @@
+Ext.define('PVE.qemu.StatusView', {
+ extend: 'PVE.grid.ObjectGrid',
+ alias: ['widget.pveQemuStatusView'],
+
+ initComponent : function() {
+ var me = this;
+
+ var nodename = me.pveSelNode.data.node;
+ if (!nodename)
+ throw "no node name specified";
+
+ var vmid = me.pveSelNode.data.vmid;
+ if (!vmid)
+ throw "no VM ID specified";
+
+ var render_cpu = function(value, metaData, record, rowIndex, colIndex, store) {
+ if (!me.getObjectValue('uptime'))
+ return '-';
+
+ var maxcpu = me.getObjectValue('cpus', 1);
+ var uptime = me.getObjectValue('uptime');
+
+ if (!(Ext.isNumeric(value) && Ext.isNumeric(maxcpu) && (maxcpu >= 1)))
+ return '-'
+
+ var per = (value * 100) / maxcpu;
+
+ return per.toFixed(1) + '% of ' + maxcpu + (maxcpu > 1 ? 'CPUs' : 'CPU');
+ };
+
+ var render_mem = function(value, metaData, record, rowIndex, colIndex, store) {
+ var maxmem = me.getObjectValue('maxmem', 0);
+ var per = (value / maxmem)*100;
+ var text = "<div>Total: " + PVE.Utils.format_size(maxmem) + "</div>" +
+ "<div>Used: " + PVE.Utils.format_size(value) + "</div>";
+ return text;
+ };
+
+ var rows = {
+ name: { header: 'Name', defaultValue: 'no name specified' },
+ status: { header: 'Status', defaultValue: 'unknown' },
+ cpu: { header: 'CPU usage', required: true, renderer: render_cpu },
+ cpus: { visible: false },
+ mem: { header: 'Memory usage', required: true, renderer: render_mem },
+ maxmem: { visible: false },
+ uptime: { header: 'Uptime', required: true, renderer: PVE.Utils.render_uptime }
+ };
+
+ Ext.applyIf(me, {
+ url: "/api2/json/nodes/" + nodename + "/qemu/" + vmid + "/status",
+ cwidth1: 150,
+ interval: 1000,
+ rows: rows
+ });
+
+ me.callParent();
+ }
+});
+
+Ext.define('PVE.qemu.Summary', {
+ extend: 'Ext.panel.Panel',
+ alias: 'widget.pveQemuSummary',
+
+ initComponent: function() {
+ var me = this;
+
+ //var rrdurl = "/api2/png/nodes/" + nodename + "/rrd";
+
+ Ext.apply(me, {
+ layout: {
+ type: 'table',
+ columns: 2
+ },
+ autoScroll: true,
+ bodyStyle: 'padding:10px',
+ defaults: {
+ pveSelNode: me.pveSelNode,
+ 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); });
+ }
+ },
+ items: [
+ {
+ title: 'Status',
+ xtype: 'pveQemuStatusView',
+ width: 400
+ },
+ {
+ title: 'Comments',
+ style: 'padding-left:10px',
+ html: "test",
+ width: 400,
+ autoHeight: true
+ }
+
+ /*{
+ xtype: 'pveRRDView',
+ title: "CPU usage %",
+ datasource: 'cpu,iowait',
+ rrdurl: rrdurl
+ }*/
+ ]
+ });
+
+ me.callParent();
+ }
+});
+
Ext.define('PVE.qemu.Config', {
extend: 'PVE.panel.Config',
alias: 'widget.PVE.qemu.Config',
@@ -38,6 +152,7 @@
items: [
{
title: 'Summary',
+ xtype: 'pveQemuSummary',
itemId: 'summary',
tbar: [
{
@@ -115,8 +230,7 @@
nw.focus();
}
}
- ],
- html: 'summary ' + vmid
+ ]
},
{
title: 'Hardware',
More information about the pve-devel
mailing list