]> git.proxmox.com Git - pmg-gui.git/commitdiff
fix #1701: add port option for smarthost
authorDominik Csapak <d.csapak@proxmox.com>
Tue, 11 Sep 2018 09:25:45 +0000 (11:25 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Wed, 12 Sep 2018 04:39:30 +0000 (06:39 +0200)
allows editing/showing the smarthost and -port

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
js/MailProxyRelaying.js

index 1fca392ef7672516475b916912aeaf67a2cdacf5..041b8a375f737050409fdaa4ad92174ebfad74ea 100644 (file)
@@ -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';