[pve-devel] [PATCH manager] fix lxc hostname input window

Emmanuel Kasper e.kasper at proxmox.com
Mon Jun 26 13:38:45 CEST 2017



On 06/23/2017 11:36 AM, Dominik Csapak wrote:
> we used a static emptytext at creation, which is wrong after editing
> now copied from qemu/Options.js (the name), but instead of deleting the
> hostname on the backend on an empty field, we set it to CT<VMID>
> (this is also the default in the wizard)
> 
> Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
> ---
>  www/manager6/lxc/DNS.js | 25 ++++++++++++++++++-------
>  1 file changed, 18 insertions(+), 7 deletions(-)
> 
> diff --git a/www/manager6/lxc/DNS.js b/www/manager6/lxc/DNS.js
> index cf7d4609..2c087ae7 100644
> --- a/www/manager6/lxc/DNS.js
> +++ b/www/manager6/lxc/DNS.js
> @@ -164,13 +164,23 @@ Ext.define('PVE.lxc.DNS', {
>  		    xtype: 'pveWindowEdit',
>  		    subject: gettext('Hostname'),
>  		    items: {
> -			xtype: 'textfield',
> -			name: 'hostname',
> -			vtype: 'DnsName',
> -			value: '',
> -			fieldLabel: gettext('Hostname'),
> -			allowBlank: true,
> -			emptyText: me.pveSelNode.data.name
> +			xtype: 'inputpanel',
> +			items:{
> +			    fieldLabel: gettext('Hostname'),
> +			    xtype: 'textfield',
> +			    name: 'hostname',
> +			    vtype: 'DnsName',
> +			    allowBlank: true
> +			},
> +			onGetValues: function(values) {
> +			    var params = values;
> +			    if (values.hostname === undefined ||
> +				values.hostname === null ||
> +				values.hostname === '') {
> +				params = { hostname: 'CT'+vmid.toString()};
> +			    }
> +			    return params;
> +			}


if we set a default hostname to 'CT'+vmid.toString()' when the field is
empty then it would make sense to set emptyText to 'CT'+vmid.toString()'
too so we are not automagically generating hostnames without giving a
clue to what will happen.
I will send a patch for this.






More information about the pve-devel mailing list