[pve-devel] [PATCH 5/5] fix pending cpu rendering

Alexandre Derumier aderumier at odiso.com
Mon Dec 29 14:33:11 CET 2014


Signed-off-by: Alexandre Derumier <aderumier at odiso.com>
---
 www/manager/grid/ObjectGrid2.js  |   14 ++++++++++----
 www/manager/qemu/HardwareView.js |   13 ++++++++-----
 2 files changed, 18 insertions(+), 9 deletions(-)

diff --git a/www/manager/grid/ObjectGrid2.js b/www/manager/grid/ObjectGrid2.js
index 76589da..5eb37e3 100644
--- a/www/manager/grid/ObjectGrid2.js
+++ b/www/manager/grid/ObjectGrid2.js
@@ -2,11 +2,17 @@ Ext.define('PVE.grid.ObjectGrid2', {
     extend: 'Ext.grid.GridPanel',
     alias: ['widget.pveObjectGrid2'],
 
-    getObjectValue: function(key, defaultValue) {
+    getObjectValue: function(key, defaultValue, pending) {
 	var me = this;
 	var rec = me.store.getById(key);
 	if (rec) {
-	    return rec.data.value;
+	    if (pending && rec.data['pending']) {
+		return rec.data['pending'];
+	    }else if (rec.data.value) {
+		return rec.data.value;
+	    }else {
+		return defaultValue;
+	    }
 	}
 	return defaultValue;
     },
@@ -30,8 +36,8 @@ Ext.define('PVE.grid.ObjectGrid2', {
 
 	if (renderer) {
 	    current = renderer(value, metaData, record, rowIndex, colIndex, store);
-	    if(record.data['pending']){
-		pending = renderer(record.data['pending'], metaData, record, rowIndex, colIndex, store);
+	    if(record.data['pending'] || rowdef.multiValues){
+		pending = renderer(record.data['pending'], metaData, record, rowIndex, colIndex, store, 1);
 	    }
 	}else{
 	    current = value;
diff --git a/www/manager/qemu/HardwareView.js b/www/manager/qemu/HardwareView.js
index 7b7aae2..52ef129 100644
--- a/www/manager/qemu/HardwareView.js
+++ b/www/manager/qemu/HardwareView.js
@@ -61,14 +61,17 @@ Ext.define('PVE.qemu.HardwareView', {
 		    'PVE.qemu.ProcessorEdit' : undefined,
 		tdCls: 'pve-itype-icon-processor',
 		defaultValue: 1,
-		renderer: function(value, metaData, record, rowIndex, colIndex, store) {
-		    var model = me.getObjectValue('cpu');
-		    var cores = me.getObjectValue('cores');
+		multiValues: 1,
+		renderer: function(value, metaData, record, rowIndex, colIndex, store, pending) {
+
+		    var sockets = me.getObjectValue('sockets', undefined, pending);
+		    var model = me.getObjectValue('cpu', undefined, pending);
+		    var cores = me.getObjectValue('cores', undefined, pending);
 		    var res = '';
 		    if (!cores || (cores <= 1)) {
-			res = value;
+			res = sockets;
 		    } else {
-			res = (value*cores) + ' (' + value + ' sockets, ' + cores + ' cores)';
+			res = (sockets*cores) + ' (' + sockets + ' sockets, ' + cores + ' cores)';
 		    }
 		    if (model) {
 			res += ' [' + model + ']';
-- 
1.7.10.4




More information about the pve-devel mailing list