]> git.proxmox.com Git - pmg-gui.git/commitdiff
fix #2437: proxy: Add 'TLS Inbound Domains' panel
authorChristoph Heiss <c.heiss@proxmox.com>
Mon, 20 Mar 2023 10:35:47 +0000 (11:35 +0100)
committerStoiko Ivanov <s.ivanov@proxmox.com>
Mon, 20 Mar 2023 18:43:40 +0000 (19:43 +0100)
This panel can be used to configure sender domains for which TLS will be
enforced my postfix. As this takes the usual transport domain format,
either a FQDN or .FQDN (for matching subdomains) can be specified.

Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
js/MailProxyTLSInboundDomains.js [new file with mode: 0644]
js/MailProxyTLSPanel.js
js/Makefile

diff --git a/js/MailProxyTLSInboundDomains.js b/js/MailProxyTLSInboundDomains.js
new file mode 100644 (file)
index 0000000..27f8fcd
--- /dev/null
@@ -0,0 +1,93 @@
+Ext.define('pmg-tls-inbound-domains', {
+    extend: 'Ext.data.Model',
+    fields: ['domain'],
+    idProperty: 'domain',
+    proxy: {
+       type: 'proxmox',
+       url: '/api2/json/config/tlsinbounddomains',
+    },
+    sorters: {
+       property: 'domain',
+       direction: 'ASC',
+    },
+});
+
+Ext.define('PMG.TLSInboundDomainsEdit', {
+    extend: 'Proxmox.window.Edit',
+    xtype: 'pmgTLSInboundDomainsEdit',
+    onlineHelp: 'pmgconfig_mailproxy_tls',
+
+    subject: gettext('TLS Inbound domains'),
+    url: '/api2/extjs/config/tlsinbounddomains',
+    method: 'POST',
+
+    items: [
+       {
+           xtype: 'proxmoxtextfield',
+           name: 'domain',
+           fieldLabel: gettext('Domain'),
+       },
+    ],
+});
+
+Ext.define('PMG.MailProxyTLSInboundDomains', {
+    extend: 'Ext.grid.GridPanel',
+    alias: ['widget.pmgMailProxyTLSInboundDomains'],
+
+    viewConfig: {
+       trackOver: false,
+    },
+
+    columns: [
+       {
+           header: gettext('Domain'),
+           flex: 1,
+           sortable: true,
+           dataIndex: 'domain',
+       },
+    ],
+
+    initComponent: function() {
+       const me = this;
+
+       const rstore = Ext.create('Proxmox.data.UpdateStore', {
+           model: 'pmg-tls-inbound-domains',
+           storeid: 'pmg-mailproxy-tls-inbound-domains-store-' + ++Ext.idSeed,
+       });
+
+       const store = Ext.create('Proxmox.data.DiffStore', { rstore: rstore });
+       const reload = () => rstore.load();
+       me.selModel = Ext.create('Ext.selection.RowModel', {});
+       Proxmox.Utils.monStoreErrors(me, store, true);
+
+       Ext.apply(me, {
+           store,
+           tbar: [
+               {
+                   text: gettext('Create'),
+                   handler: () => {
+                       Ext.createWidget('pmgTLSInboundDomainsEdit', {
+                           autoShow: true,
+                           listeners: {
+                               destroy: reload,
+                           },
+                       });
+                   },
+               },
+               {
+                   xtype: 'proxmoxStdRemoveButton',
+                   baseurl: '/config/tlsinbounddomains',
+                   callback: reload,
+                   waitMsgTarget: me,
+               },
+           ],
+           listeners: {
+               activate: rstore.startUpdate,
+               destroy: rstore.stopUpdate,
+               deactivate: rstore.stopUpdate,
+           },
+       });
+
+       me.callParent();
+    },
+});
index 82dc3f8a9b7f03d7ae98a61a4a50ff288ac0a731..96b24deb393ffd0dd4261a4b8cfafbd04d7bff67 100644 (file)
@@ -26,11 +26,17 @@ Ext.define('PMG.MailProxyTLSPanel', {
            flex: 1,
        });
 
-       me.items = [tlsSettings, tlsDestinations];
+       const tlsInboundDomains = Ext.create('PMG.MailProxyTLSInboundDomains', {
+           title: gettext('TLS Inbound Domains'),
+           flex: 1,
+       });
+
+       me.items = [tlsSettings, tlsDestinations, tlsInboundDomains];
 
        me.callParent();
 
        tlsSettings.relayEvents(me, ['activate', 'deactivate', 'destroy']);
        tlsDestinations.relayEvents(me, ['activate', 'deactivate', 'destroy']);
+       tlsInboundDomains.relayEvents(me, ['activate', 'deactivate', 'destroy']);
     },
 });
index 9a2bcf26cb673c7037c51fda31db01a4f7c737c3..fad2bd67ea6cd41c25df9b82168a5551f3453c0b 100644 (file)
@@ -50,6 +50,7 @@ JSSRC=                                                        \
        MailProxyTLS.js                                 \
        MailProxyTLSPanel.js                            \
        MailProxyTLSDestinations.js                     \
+       MailProxyTLSInboundDomains.js                   \
        Transport.js                                    \
        MyNetworks.js                                   \
        RelayDomains.js                                 \