[pve-devel] [PATCH v10 manager 18/19] ui: qemu: memory edit: allow passing explicit value

Fabian Ebner f.ebner at proxmox.com
Wed Apr 6 10:04:15 CEST 2022


Will be used by the import functionality in the wizard.

Signed-off-by: Fabian Ebner <f.ebner at proxmox.com>
---
 www/manager6/qemu/MemoryEdit.js | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/www/manager6/qemu/MemoryEdit.js b/www/manager6/qemu/MemoryEdit.js
index 0d2cd8b0..ad018ecf 100644
--- a/www/manager6/qemu/MemoryEdit.js
+++ b/www/manager6/qemu/MemoryEdit.js
@@ -5,6 +5,8 @@ Ext.define('PVE.qemu.MemoryInputPanel', {
 
     insideWizard: false,
 
+    memoryInitialized: false,
+
     viewModel: {}, // inherit data from createWizard if insideWizard
 
     controller: {
@@ -21,12 +23,14 @@ Ext.define('PVE.qemu.MemoryInputPanel', {
 	},
     },
 
-    setMemory: function() {
+    setMemory: function(value) {
 	let me = this;
 	let viewModel = me.getViewModel();
+	let memory = me.down('pveMemoryField[name=memory]');
 
-	if (me.insideWizard) {
-	    let memory = me.down('pveMemoryField[name=memory]');
+	if (value) {
+	    memory.setValue(value);
+	} else if (!me.memoryInitialized && me.insideWizard) {
 	    // NOTE: we only set memory but that then sets balloon in its change handler
 	    if (viewModel.get('current.ostype') === 'win11') {
 		memory.setValue('4096');
@@ -34,6 +38,8 @@ Ext.define('PVE.qemu.MemoryInputPanel', {
 		memory.setValue('2048');
 	    }
 	}
+
+	me.memoryInitialized = true;
     },
 
     onGetValues: function(values) {
-- 
2.30.2






More information about the pve-devel mailing list