[pve-devel] [PATCH manager] gui: lxc/Network: add 'None' EmptyText for static mode

Thomas Lamprecht t.lamprecht at proxmox.com
Mon Feb 10 16:46:53 CET 2020


On 2/10/20 1:54 PM, Dominik Csapak wrote:
> this way it is more clear that leaving that field empty results in
> no configured ip for that interface, this may help prevent
> users to select 'dhcp' for e.g. ipv6 when they do not want an ipv6
> and do not have a dhcp6 server in the network (which would result
> in a long boot time of the container, because of the dhcp timeout)
> 
> Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
> ---
>  www/manager6/lxc/Network.js | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/www/manager6/lxc/Network.js b/www/manager6/lxc/Network.js
> index b20ddb66..e41753ea 100644
> --- a/www/manager6/lxc/Network.js
> +++ b/www/manager6/lxc/Network.js
> @@ -191,6 +191,9 @@ Ext.define('PVE.lxc.NetworkInputPanel', {
>  			margin: '0 0 0 10',
>  			listeners: {
>  			    change: function(cb, value) {
> +				me.down('field[name=ip]').setEmptyText(
> +				    !!value ? Proxmox.Utils.NoneText : ""
> +				);
>  				me.down('field[name=ip]').setDisabled(!value);
>  				me.down('field[name=gw]').setDisabled(!value);
>  			    }
> @@ -211,6 +214,7 @@ Ext.define('PVE.lxc.NetworkInputPanel', {
>  		name: 'ip',
>  		vtype: 'IPCIDRAddress',
>  		value: cdata.ip,
> +		emptyText: Proxmox.Utils.NoneText,
>  		disabled: dhcp4,
>  		fieldLabel: 'IPv4/CIDR' // do not localize
>  	    },
> @@ -249,6 +253,9 @@ Ext.define('PVE.lxc.NetworkInputPanel', {
>  			margin: '0 0 0 10',
>  			listeners: {
>  			    change: function(cb, value) {
> +				me.down('field[name=ip6]').setEmptyText(
> +				    !!value ? Proxmox.Utils.NoneText : ""
> +				);
>  				me.down('field[name=ip6]').setDisabled(!value);
>  				me.down('field[name=gw6]').setDisabled(!value);
>  			    }
> @@ -276,6 +283,7 @@ Ext.define('PVE.lxc.NetworkInputPanel', {
>  		xtype: 'textfield',
>  		name: 'ip6',
>  		value: cdata.ip6,
> +		emptyText: Proxmox.Utils.NoneText,
>  		vtype: 'IP6CIDRAddress',
>  		disabled: (dhcp6 || auto6),
>  		fieldLabel: 'IPv6/CIDR' // do not localize
> 

applied, with small followup:

----8<----
commit 6513e2c49b76a17efa7259832b1eeb7ff1c8312d
Author: Thomas Lamprecht <t.lamprecht at proxmox.com>
Date:   Mon Feb 10 16:34:43 2020 +0100

    ui: lxc/network: fix initial empty text on edit
    
    Editing an existing interface with DHCP set showed the emptyText
    "None", which is confusing (and wrong)
    
    Signed-off-by: Thomas Lamprecht <t.lamprecht at proxmox.com>

diff --git a/www/manager6/lxc/Network.js b/www/manager6/lxc/Network.js
index e41753ea..1eac1585 100644
--- a/www/manager6/lxc/Network.js
+++ b/www/manager6/lxc/Network.js
@@ -214,7 +214,7 @@ Ext.define('PVE.lxc.NetworkInputPanel', {
                name: 'ip',
                vtype: 'IPCIDRAddress',
                value: cdata.ip,
-               emptyText: Proxmox.Utils.NoneText,
+               emptyText: dhcp4 ? '' : Proxmox.Utils.NoneText,
                disabled: dhcp4,
                fieldLabel: 'IPv4/CIDR' // do not localize
            },
@@ -283,7 +283,7 @@ Ext.define('PVE.lxc.NetworkInputPanel', {
                xtype: 'textfield',
                name: 'ip6',
                value: cdata.ip6,
-               emptyText: Proxmox.Utils.NoneText,
+               emptyText: dhcp6 || auto6 ? '' : Proxmox.Utils.NoneText,
                vtype: 'IP6CIDRAddress',
                disabled: (dhcp6 || auto6),
                fieldLabel: 'IPv6/CIDR' // do not localize



More information about the pve-devel mailing list