[pve-devel] [PATCH manager 3/7] gui: add system panel to the vm creation wizard

Thomas Lamprecht t.lamprecht at proxmox.com
Wed Mar 27 16:03:10 CET 2019


On 3/27/19 2:13 PM, Dominik Csapak wrote:
> 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>
> ---
>  www/manager6/qemu/CreateWizard.js | 19 ++++++++++---------
>  www/manager6/qemu/HDEdit.js       | 10 ++++------
>  www/manager6/qemu/OSTypeEdit.js   |  3 ++-
>  3 files changed, 16 insertions(+), 16 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..905560d2 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,14 @@ 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: {
> +		    value: '{current.scsihw}'
> +		},
>  		renderer: PVE.Utils.render_scsihw,
>  		// do not change a VM wide option after creation
> -		submitValue: me.insideWizard,
> +		submitValue: false,

change makes sense, but maybe also change comment above?

>  		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
> 





More information about the pve-devel mailing list