]> git.proxmox.com Git - pmg-gui.git/commitdiff
spam info grid: code cleanups
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Mon, 7 Nov 2022 08:41:18 +0000 (09:41 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Mon, 7 Nov 2022 08:46:31 +0000 (09:46 +0100)
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
js/SpamInfoGrid.js

index 444b489b9ffc94e60bcad59416b6df575e3cdb9d..6bcf2af3dda786b1b320433da803a256861a14e7 100644 (file)
@@ -13,13 +13,13 @@ Ext.define('PMG.grid.SpamInfoGrid', {
     },
 
     setID: function(rec) {
-       var me = this;
-       if (!rec || !rec.data || !rec.data.id) {
+       let me = this;
+       let id = rec?.data?.id;
+       if (!id) {
            me.getStore().removeAll();
            return;
        }
-       var url = '/api2/json/quarantine/content?id=' + rec.data.id;
-       me.store.proxy.setUrl(url);
+       me.store.proxy.setUrl(`/api2/json/quarantine/content?id=${id}`);
        me.store.load();
     },
 
@@ -36,9 +36,7 @@ Ext.define('PMG.grid.SpamInfoGrid', {
            dataIndex: 'name',
            flex: 2,
            summaryType: 'count',
-           summaryRenderer: function(value, summaryData, dataIndex, metaData) {
-               return gettext('Spamscore');
-           },
+           summaryRenderer: _v => gettext('Spamscore'),
            tdCls: 'txt-monospace',
        },
        {
@@ -65,9 +63,7 @@ Ext.define('PMG.grid.SpamInfoGrid', {
                return score;
            },
            summaryType: 'sum',
-           summaryRenderer: function(value, summaryData, dataIndex, metaData) {
-               return Ext.util.Format.round(value, 5);
-           },
+           summaryRenderer: value => Ext.util.Format.round(value, 5),
        },
        {
            text: gettext('Description'),