[pve-devel] [PATCH manager] use correct multiKey and getObjectValue calls for memory line

Dominik Csapak d.csapak at proxmox.com
Tue Apr 10 16:36:17 CEST 2018


also show shares and if ballooning is off

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 www/manager6/qemu/HardwareView.js | 32 +++++++++++++++++++++++---------
 1 file changed, 23 insertions(+), 9 deletions(-)

diff --git a/www/manager6/qemu/HardwareView.js b/www/manager6/qemu/HardwareView.js
index 8017f84a..17e755a8 100644
--- a/www/manager6/qemu/HardwareView.js
+++ b/www/manager6/qemu/HardwareView.js
@@ -50,14 +50,26 @@ Ext.define('PVE.qemu.HardwareView', {
 		never_delete: true,
 		defaultValue: '512',
 		tdCls: 'pve-itype-icon-memory',
-		renderer: function(value, metaData, record) {
-		    var balloon =  me.getObjectValue('balloon');
-		    if (balloon) {
-			return Proxmox.Utils.format_size(balloon*1024*1024) + "/" + 
-			    Proxmox.Utils.format_size(value*1024*1024);
-
-		    } 
-		    return Proxmox.Utils.format_size(value*1024*1024);
+		multiKey: ['memory', 'balloon', 'shares'],
+		renderer: function(value, metaData, record, ri, ci, store, pending) {
+		    var res = '';
+
+		    var max = me.getObjectValue('memory', 512, pending);
+		    var balloon =  me.getObjectValue('balloon', undefined, pending);
+		    var shares = me.getObjectValue('shares', undefined, pending);
+
+		    res  = Proxmox.Utils.format_size(max*1024*1024);
+
+		    if (balloon !== undefined && balloon > 0) {
+			res = Proxmox.Utils.format_size(balloon*1024*1024) + "/" + res;
+
+			if (shares) {
+			    res += ' [shares=' + shares +']';
+			}
+		    } else if (balloon === 0) {
+			res += ' [balloon=0]';
+		    }
+		    return res;
 		}
 	    },
 	    sockets: {
@@ -146,8 +158,10 @@ Ext.define('PVE.qemu.HardwareView', {
 	    },
 	    bios: {
 		visible: false
+	    },
+	    shares: {
+		visible: false
 	    }
-
 	};
 
 	PVE.Utils.forEachBus(undefined, function(type, id) {
-- 
2.11.0





More information about the pve-devel mailing list