[pve-devel] [PATCH v10 manager 17/19] ui: qemu: memory edit: expose setMemory outside the controller

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


In preparation to add a 'value' argument, because when the controller
calls the function, the panel is passed as the first argument.

And for convenience when calling from outside the class.

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

diff --git a/www/manager6/qemu/MemoryEdit.js b/www/manager6/qemu/MemoryEdit.js
index 5e91dc9b..0d2cd8b0 100644
--- a/www/manager6/qemu/MemoryEdit.js
+++ b/www/manager6/qemu/MemoryEdit.js
@@ -17,20 +17,25 @@ Ext.define('PVE.qemu.MemoryInputPanel', {
 	},
 
 	setMemory: function() {
-	    let me = this;
-	    let view = me.getView(), viewModel = me.getViewModel();
-	    if (view.insideWizard) {
-		let memory = view.down('pveMemoryField[name=memory]');
-		// NOTE: we only set memory but that then sets balloon in its change handler
-		if (viewModel.get('current.ostype') === 'win11') {
-		    memory.setValue('4096');
-		} else {
-		    memory.setValue('2048');
-		}
-	    }
+	    this.getView().setMemory();
 	},
     },
 
+    setMemory: function() {
+	let me = this;
+	let viewModel = me.getViewModel();
+
+	if (me.insideWizard) {
+	    let memory = me.down('pveMemoryField[name=memory]');
+	    // NOTE: we only set memory but that then sets balloon in its change handler
+	    if (viewModel.get('current.ostype') === 'win11') {
+		memory.setValue('4096');
+	    } else {
+		memory.setValue('2048');
+	    }
+	}
+    },
+
     onGetValues: function(values) {
 	var me = this;
 
-- 
2.30.2






More information about the pve-devel mailing list