[pmg-devel] [PATCH pmg-gui] fix #1701: add port option for smarthost

Dietmar Maurer dietmar at proxmox.com
Wed Sep 12 06:40:49 CEST 2018


What about relay/relayport? Should we use multiKey for that too?

> On September 11, 2018 at 11:25 AM Dominik Csapak <d.csapak at proxmox.com> wrote:
> 
> 
> allows editing/showing the smarthost and -port
> 
> Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
> ---
>  js/MailProxyRelaying.js | 54 +++++++++++++++++++++++++++++++++++++++++++++++--
>  1 file changed, 52 insertions(+), 2 deletions(-)
> 
> diff --git a/js/MailProxyRelaying.js b/js/MailProxyRelaying.js
> index 1fca392..041b8a3 100644
> --- a/js/MailProxyRelaying.js
> +++ b/js/MailProxyRelaying.js
> @@ -17,8 +17,58 @@ Ext.define('PMG.MailProxyRelaying', {
>  
>  	me.add_boolean_row('relaynomx', gettext('Disable MX lookup'));
>  
> -	me.add_text_row('smarthost', gettext('Smarthost'),
> -			{ deleteEmpty: true, defaultValue: Proxmox.Utils.noneText });
> +	me.rows.smarthost = {
> +	    required: true,
> +	    multiKey: ['smarthost', 'smarthostport'],
> +	    header: gettext('Smarthost'),
> +	    renderer: function() {
> +		var host = me.getObjectValue('smarthost', undefined);
> +		var port = me.getObjectValue('smarthostport', undefined);
> +		var result = '';
> +		if (host) {
> +		    if (port) {
> +			if (host.match(Proxmox.Utils.IP6_match)) {
> +			    result = "[" + host + "]:" + port;
> +			} else {
> +			    result = host + ':' + port;
> +			}
> +		    } else {
> +			result = host;
> +		    }
> +		}
> +		if (result === '') {
> +		    result = Proxmox.Utils.noneText;
> +		}
> +		return result;
> +	    },
> +	    editor: {
> +		xtype: 'proxmoxWindowEdit',
> +		subject: gettext('Smarthost'),
> +		fieldDefaults: {
> +		    labelWidth: 100
> +		},
> +		items: [
> +		    {
> +			xtype: 'proxmoxtextfield',
> +			name: 'smarthost',
> +			deleteEmpty: true,
> +			emptyText: Proxmox.Utils.noneText,
> +			fieldLabel: gettext('Smarthost')
> +		    },
> +		    {
> +			xtype: 'proxmoxintegerfield',
> +			name: 'smarthostport',
> +			deleteEmpty: true,
> +			minValue: 1,
> +			maxValue: 65535,
> +			emptyText: Proxmox.Utils.defaultText,
> +			fieldLabel: gettext('Port')
> +		    }
> +		]
> +	    }
> +	};
> +
> +	me.rows.smarthostport = { visible: false };
>  
>  	var baseurl = '/config/mail';
>  
> -- 
> 2.11.0
> 
> 
> _______________________________________________
> pmg-devel mailing list
> pmg-devel at pve.proxmox.com
> https://pve.proxmox.com/cgi-bin/mailman/listinfo/pmg-devel



More information about the pmg-devel mailing list