[pve-devel] [PATCH manager 1/1] gui: let users edit the vga memory

Dominik Csapak d.csapak at proxmox.com
Thu Nov 8 15:48:21 CET 2018


Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 www/manager6/Utils.js            |  6 ++++-
 www/manager6/qemu/DisplayEdit.js | 47 +++++++++++++++++++++++++++++++++-------
 2 files changed, 44 insertions(+), 9 deletions(-)

diff --git a/www/manager6/Utils.js b/www/manager6/Utils.js
index 568ceb7b..a659b093 100644
--- a/www/manager6/Utils.js
+++ b/www/manager6/Utils.js
@@ -350,7 +350,11 @@ Ext.define('PVE.Utils', { utilities: {
 	if (!value) {
 	    return Proxmox.Utils.defaultText;
 	}
-	var text = PVE.Utils.kvm_vga_drivers[value];
+	var vga = PVE.Parser.parsePropertyString(value, 'type');
+	var text = PVE.Utils.kvm_vga_drivers[vga.type];
+	if (!vga.type) {
+	    text = Proxmox.Utils.defaultText;
+	}
 	if (text) {
 	    return text + ' (' + value + ')';
 	}
diff --git a/www/manager6/qemu/DisplayEdit.js b/www/manager6/qemu/DisplayEdit.js
index 936521ae..d1b60cc8 100644
--- a/www/manager6/qemu/DisplayEdit.js
+++ b/www/manager6/qemu/DisplayEdit.js
@@ -1,15 +1,24 @@
-Ext.define('PVE.qemu.DisplayEdit', {
-    extend: 'Proxmox.window.Edit',
+Ext.define('PVE.qemu.DisplayInputPanel', {
+    extend: 'Proxmox.panel.InputPanel',
+    xtype: 'pveDisplayInputPanel',
 
-    vmconfig: undefined,
-
-    subject: gettext('Display'),
-    width: 350,
+    onGetValues: function(values) {
+	var ret = PVE.Parser.printPropertyString(values, 'type');
+	if (ret === '') {
+	    return {
+		'delete': 'vga'
+	    };
+	}
+	return {
+	    vga: ret
+	};
+    },
 
     items: [{
-	name: 'vga',
+	name: 'type',
 	xtype: 'proxmoxKVComboBox',
 	value: '__default__',
+	deleteEmpty: false,
 	fieldLabel: gettext('Graphic card'),
 	comboItems: PVE.Utils.kvm_vga_driver_array(),
 	validator: function() {
@@ -22,6 +31,27 @@ Ext.define('PVE.qemu.DisplayEdit', {
 	    }
 	    return true;
 	}
+    },{
+	xtype: 'proxmoxintegerfield',
+	emptyText: Proxmox.Utils.defaultText,
+	fieldLabel: gettext('Memory') + ' (MiB)',
+	minValue: 4,
+	maxValue: 512,
+	step: 4,
+	name: 'memory'
+    }]
+});
+
+Ext.define('PVE.qemu.DisplayEdit', {
+    extend: 'Proxmox.window.Edit',
+
+    vmconfig: undefined,
+
+    subject: gettext('Display'),
+    width: 350,
+
+    items: [{
+	xtype: 'pveDisplayInputPanel'
     }],
 
     initComponent : function() {
@@ -32,7 +62,8 @@ Ext.define('PVE.qemu.DisplayEdit', {
 	me.load({
 	    success: function(response) {
 		me.vmconfig = response.result.data;
-		me.setValues(me.vmconfig);
+		var vga = me.vmconfig.vga || '__default__';
+		me.setValues(PVE.Parser.parsePropertyString(vga, 'type'));
 	    }
 	});
     }
-- 
2.11.0





More information about the pve-devel mailing list