]> git.proxmox.com Git - pmg-gui.git/commitdiff
mail proxy: tls destinations: consitent add/edit/remove button
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Tue, 27 Feb 2024 12:47:06 +0000 (13:47 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Tue, 27 Feb 2024 12:47:06 +0000 (13:47 +0100)
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
js/MailProxyTLSDestinations.js

index 04348c9c554c500abb42b6d6cd5c787dbf516f26..942aa3c1a9492ec408100b20b232ab9b11c76f6e 100644 (file)
@@ -87,18 +87,16 @@ Ext.define('PMG.MailProxyTLSDestinations', {
     ],
 
     initComponent: function() {
-       var me = this;
+       let me = this;
 
-       var rstore = Ext.create('Proxmox.data.UpdateStore', {
+       let rstore = Ext.create('Proxmox.data.UpdateStore', {
            model: 'pmg-tls-policy',
            storeid: 'pmg-mailproxy-tls-store-' + ++Ext.idSeed,
        });
 
-       var store = Ext.create('Proxmox.data.DiffStore', { rstore: rstore });
+       let store = Ext.create('Proxmox.data.DiffStore', { rstore: rstore });
 
-        var reload = function() {
-            rstore.load();
-        };
+        let reload = () => rstore.load();
 
        me.selModel = Ext.create('Ext.selection.RowModel', {});
 
@@ -117,23 +115,24 @@ Ext.define('PMG.MailProxyTLSDestinations', {
            win.show();
        };
 
-       var tbar = [
-            {
+       let tbar = [
+           {
+               text: gettext('Create'),
+               handler: () => Ext.createWidget('pmgTLSDestinationEdit', {
+                   autoLoad: true,
+                   autoShow: true,
+                   listeners: {
+                       destroy: () => reload(),
+                   },
+               }),
+           },
+           '-',
+           {
                xtype: 'proxmoxButton',
                disabled: true,
                text: gettext('Edit'),
                handler: run_editor,
             },
-           {
-               text: gettext('Create'),
-               handler: function() {
-                   var win = Ext.createWidget('pmgTLSDestinationEdit');
-
-                   win.load();
-                   win.on('destroy', reload);
-                   win.show();
-               },
-            },
            {
                xtype: 'proxmoxStdRemoveButton',
                baseurl: '/config/tlspolicy',