]> git.proxmox.com Git - pmg-gui.git/blobdiff - js/SpamDetectorCustom.js
dashboard: implement columns browser setting
[pmg-gui.git] / js / SpamDetectorCustom.js
index 72bf224c500b316cf1b13e9a2863f47cd54aa797..f78a93d3a481348de0a34884f0c91b92b5d1f14d 100644 (file)
@@ -89,7 +89,7 @@ Ext.define('PMG.SpamDetectorCustomScores', {
                    {
                        xtype: 'proxmoxcheckbox',
                        name: 'restart-daemon',
-                       fieldLabel: gettext('Restart pmg-smtp-filter'),
+                       boxLabel: gettext('Restart pmg-smtp-filter to activate changes.'),
                        labelWidth: 150,
                        checked: true,
                    },
@@ -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) {
@@ -237,26 +240,6 @@ Ext.define('PMG.SpamDetectorCustomScores', {
                    },
                    callback: 'reload',
                },
-               ' ',
-               {
-                   text: gettext('Revert'),
-                   reference: 'revert_btn',
-                   handler: 'revert',
-                   disabled: true,
-                   bind: {
-                       disabled: '{applied}',
-                   },
-               },
-               '-',
-               {
-                   text: gettext('Apply Custom Scores'),
-                   reference: 'restart_btn',
-                   disabled: true,
-                   bind: {
-                       disabled: '{applied}',
-                   },
-                   handler: 'restart',
-               },
            ],
 
            viewConfig: {
@@ -302,8 +285,26 @@ Ext.define('PMG.SpamDetectorCustomScores', {
            },
            reference: 'changes',
            tbar: [
-               gettext('Pending changes') + ' (' +
-               gettext('Please restart pmg-smtp-filter to activate changes') + ')',
+               {
+                   text: gettext('Revert'),
+                   handler: 'revert',
+                   disabled: true,
+                   bind: {
+                       disabled: '{applied}',
+                   },
+               },
+               '-',
+               {
+                   text: gettext('Apply Custom Scores'),
+                   handler: 'restart',
+                   disabled: true,
+                   bind: {
+                       disabled: '{applied}',
+                   },
+               },
+               '->',
+               `<b style="font-weight: 600">${gettext('Pending changes')}</b>`,
+               '->',
            ],
            split: true,
        },