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

Alexandre Derumier aderumier at odiso.com
Wed Dec 31 14:40:52 CET 2014


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

diff --git a/www/manager/grid/PendingObjectGrid.js b/www/manager/grid/PendingObjectGrid.js
index 40b9bb7..ca330fd 100644
--- a/www/manager/grid/PendingObjectGrid.js
+++ b/www/manager/grid/PendingObjectGrid.js
@@ -2,11 +2,17 @@ Ext.define('PVE.grid.PendingObjectGrid', {
     extend: 'Ext.grid.GridPanel',
     alias: ['widget.pvePendingObjectGrid'],
 
-    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,11 @@ Ext.define('PVE.grid.PendingObjectGrid', {
 
 	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);
+	    }
+	    if(pending == current) {
+		pending = undefined;
 	    }
 	}else{
 	    current = value;
diff --git a/www/manager/qemu/HardwareView.js b/www/manager/qemu/HardwareView.js
index 4abb3f6..2fccf9f 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', 1, 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