]> git.proxmox.com Git - pmg-gui.git/blobdiff - js/SpamDetectorCustom.js
spam detector: custom rules: consitent add/edit/remove button & modernization
[pmg-gui.git] / js / SpamDetectorCustom.js
index 72bf224c500b316cf1b13e9a2863f47cd54aa797..4ccf3ace695a1bcbd6d77d4ede09923261d7b0b7 100644 (file)
@@ -106,7 +106,8 @@ Ext.define('PMG.SpamDetectorCustomScores', {
            var me = this;
            var vm = this.getViewModel();
 
-           var win = Ext.createWidget('proxmoxWindowEdit', {
+           Ext.createWidget('proxmoxWindowEdit', {
+               autoShow: true,
                method: 'POST',
                url: "/api2/extjs/config/customscores",
                isCreate: true,
@@ -137,22 +138,24 @@ Ext.define('PMG.SpamDetectorCustomScores', {
                        value: vm.get('digest'),
                    },
                ],
+               listeners: {
+                   destroy: () => me.reload(),
+               },
            });
-
-           win.on('destroy', me.reload, me);
-           win.show();
        },
 
        run_editor: function() {
-           var me = this;
-           var vm = this.getViewModel();
-           var grid = me.lookup('grid');
-           var rec = grid.getSelection()[0];
+           let me = this;
+           let vm = me.getViewModel();
+           let grid = me.lookup('grid');
+           let rec = grid.getSelection()[0];
            if (!rec) {
                return;
            }
 
-           var win = Ext.createWidget('proxmoxWindowEdit', {
+           Ext.createWidget('proxmoxWindowEdit', {
+               autoShow: true,
+               autoLoad: true,
                url: "/api2/extjs/config/customscores/" + rec.data.name,
                method: 'PUT',
                subject: gettext("Custom Rule Score"),
@@ -181,11 +184,10 @@ Ext.define('PMG.SpamDetectorCustomScores', {
                        value: vm.get('digest'),
                    },
                ],
+               listeners: {
+                   destroy: () => me.reload(),
+               },
            });
-
-           win.load();
-           win.on('destroy', me.reload, me);
-           win.show();
        },
     },
 
@@ -215,16 +217,17 @@ Ext.define('PMG.SpamDetectorCustomScores', {
            },
 
            tbar: [
+               {
+                   text: gettext('Create'),
+                   handler: 'create_custom',
+               },
+               '-',
                {
                    xtype: 'proxmoxButton',
                    text: gettext('Edit'),
                    disabled: true,
                    handler: 'run_editor',
                },
-               {
-                   text: gettext('Create'),
-                   handler: 'create_custom',
-               },
                {
                    xtype: 'proxmoxStdRemoveButton',
                    getUrl: function(rec) {