[pve-devel] [PATCH manager v2 4/8] gui: add system panel to the vm creation wizard

Dominik Csapak d.csapak at proxmox.com
Thu Mar 28 16:25:07 CET 2019


for this we have to adapt the scsiController logic slightly, so that
the ostype change sets the viewmodel, which in turn changes the
bound fields (one one the system tab, and the displayfield on the hd tab)

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
changes from v1:
* add binding conditionally (only in wizard)
* remove comment
 www/manager6/qemu/CreateWizard.js | 19 ++++++++++---------
 www/manager6/qemu/HDEdit.js       | 11 ++++-------
 www/manager6/qemu/OSTypeEdit.js   |  3 ++-
 3 files changed, 16 insertions(+), 17 deletions(-)

diff --git a/www/manager6/qemu/CreateWizard.js b/www/manager6/qemu/CreateWizard.js
index e0e2e128..79e31504 100644
--- a/www/manager6/qemu/CreateWizard.js
+++ b/www/manager6/qemu/CreateWizard.js
@@ -6,7 +6,10 @@ Ext.define('PVE.qemu.CreateWizard', {
 
     viewModel: {
 	data: {
-	    nodename: ''
+	    nodename: '',
+	    current: {
+		scsihw: ''
+	    }
 	}
     },
 
@@ -70,14 +73,6 @@ Ext.define('PVE.qemu.CreateWizard', {
 		    defaultValue: 0,
 		    deleteDefaultValue: true,
 		    fieldLabel: gettext('Start at boot')
-		},
-		{
-		    xtype: 'proxmoxcheckbox',
-		    name: 'agent',
-		    uncheckedValue: 0,
-		    defaultValue: 0,
-		    deleteDefaultValue: true,
-		    fieldLabel: gettext('Qemu Agent')
 		}
 	    ],
 	    advancedColumn2: [
@@ -155,6 +150,12 @@ Ext.define('PVE.qemu.CreateWizard', {
 	    ]
 	},
 	{
+	    xtype: 'pveQemuSystemPanel',
+	    title: gettext('System'),
+	    isCreate: true,
+	    insideWizard: true
+	},
+	{
 	    xtype: 'pveQemuHDInputPanel',
 	    bind: {
 		nodename: '{nodename}'
diff --git a/www/manager6/qemu/HDEdit.js b/www/manager6/qemu/HDEdit.js
index 84a80b2c..0cabb598 100644
--- a/www/manager6/qemu/HDEdit.js
+++ b/www/manager6/qemu/HDEdit.js
@@ -106,10 +106,6 @@ Ext.define('PVE.qemu.HDInputPanel', {
 	    delete me.drive.cache;
 	}
 
-	if (values.scsihw) {
-	    params.scsihw = values.scsihw;
-	}
-
         var names = ['mbps_rd', 'mbps_wr', 'iops_rd', 'iops_wr'];
         Ext.Array.each(names, function(name) {
             if (values[name]) {
@@ -210,12 +206,13 @@ Ext.define('PVE.qemu.HDInputPanel', {
 	    me.column1.push(me.bussel);
 
 	    me.scsiController = Ext.create('Ext.form.field.Display', {
-		name: 'scsihw',
 		fieldLabel: gettext('SCSI Controller'),
 		reference: 'scsiController',
+		bind: me.insideWizard ? {
+		    value: '{current.scsihw}'
+		} : undefined,
 		renderer: PVE.Utils.render_scsihw,
-		// do not change a VM wide option after creation
-		submitValue: me.insideWizard,
+		submitValue: false,
 		hidden: true
 	    });
 	    me.column1.push(me.scsiController);
diff --git a/www/manager6/qemu/OSTypeEdit.js b/www/manager6/qemu/OSTypeEdit.js
index b0901704..d43d2aad 100644
--- a/www/manager6/qemu/OSTypeEdit.js
+++ b/www/manager6/qemu/OSTypeEdit.js
@@ -27,7 +27,8 @@ Ext.define('PVE.qemu.OSTypeInputPanel', {
 
 	    me.setWidget('pveBusSelector', targetValues.busType);
 	    me.setWidget('pveNetworkCardSelector', targetValues.networkCard);
-	    me.setWidget('field[name=scsihw]', targetValues.scsihw);
+	    var scsihw = targetValues.scsihw || '__default__';
+	    this.getViewModel().set('current.scsihw', scsihw);
 	},
 	setWidget: function(widget, newValue) {
 	    // changing a widget is safe only if ComponentQuery.query returns us
-- 
2.11.0




More information about the pve-devel mailing list