]> git.proxmox.com Git - pmg-gui.git/commitdiff
quarantines: add attachment grid to spam and virus quarantine
authorDominik Csapak <d.csapak@proxmox.com>
Fri, 4 Nov 2022 15:04:22 +0000 (16:04 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Mon, 7 Nov 2022 08:46:31 +0000 (09:46 +0100)
So that admins can easily see which attachments exist for a mail,
without parsing the 'raw' mail content. Disable the download button
for these quarantines though, since it should not be necessary
to download the attachments for these.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
js/AttachmentGrid.js
js/SpamQuarantine.js
js/VirusQuarantine.js
js/controller/QuarantineController.js

index 7e630dee2bcf15268781604536bcd7b6688c7f13..8943f0939466442cff7bd9a57ed7376f5902ccb4 100644 (file)
@@ -1,6 +1,9 @@
 Ext.define('PMG.grid.AttachmentGrid', {
     extend: 'Ext.grid.GridPanel',
     xtype: 'pmgAttachmentGrid',
+    mixins: ['Proxmox.Mixin.CBind'],
+
+    showDownloads: true,
 
     store: {
        autoDestroy: true,
@@ -48,6 +51,9 @@ Ext.define('PMG.grid.AttachmentGrid', {
        },
        {
            header: gettext('Download'),
+           cbind: {
+               hidden: '{!showDownloads}',
+           },
            renderer: function(value, mD, rec) {
                var me = this;
                let url = `/api2/json/quarantine/download?mailid=${me.mailid}&attachmentid=${rec.data.id}`;
index f5fc803d42f8393c73c1f6b0bc717133a94db123..f14f9f2f094c38b9f6e01ddb4fac9b797f591913 100644 (file)
@@ -225,6 +225,14 @@ Ext.define('PMG.SpamQuarantine', {
                            enableToggle: true,
                            iconCls: 'fa fa-bullhorn',
                        },
+                       {
+                           xtype: 'button',
+                           reference: 'attachments',
+                           text: gettext('Toggle Attachments'),
+                           enableToggle: true,
+                           pressed: true,
+                           iconCls: 'fa fa-paperclip',
+                       },
                        '->',
                        {
                            xtype: 'button',
@@ -271,6 +279,15 @@ Ext.define('PMG.SpamQuarantine', {
                    reference: 'spaminfo',
                    border: false,
                },
+               {
+                   xtype: 'pmgAttachmentGrid',
+                   minHeight: 50,
+                   maxHeight: 250,
+                   scrollable: true,
+                   reference: 'attachmentlist',
+                   showDownloads: false,
+                   border: false,
+               },
                {
                    xtype: 'pmgMailInfo',
                    hidden: true,
index af00204d56ddb3d202d122f25a30e0147345b3f8..bd5699d76216ddbb79357225147941c6f6577428 100644 (file)
@@ -120,6 +120,14 @@ Ext.define('PMG.VirusQuarantine', {
                            enableToggle: true,
                            iconCls: 'fa fa-file-code-o',
                        },
+                       {
+                           xtype: 'button',
+                           reference: 'attachments',
+                           text: gettext('Toggle Attachments'),
+                           enableToggle: true,
+                           pressed: true,
+                           iconCls: 'fa fa-paperclip',
+                       },
                        '->',
                        {
                            xtype: 'button',
@@ -148,6 +156,15 @@ Ext.define('PMG.VirusQuarantine', {
                        },
                    ],
                },
+               {
+                   xtype: 'pmgAttachmentGrid',
+                   minHeight: 50,
+                   maxHeight: 250,
+                   scrollable: true,
+                   reference: 'attachmentlist',
+                   showDownloads: false,
+                   border: false,
+               },
                {
                    xtype: 'pmgMailInfo',
                    hidden: true,
index d47af6ab1e0ca1e06fd779dc27081845b514c1eb..afc04be38f751cb70c577268d7e67c8963de9bf6 100644 (file)
@@ -41,6 +41,11 @@ Ext.define('PMG.controller.QuarantineController', {
        me.updatePreview(me.raw, rec);
     },
 
+    toggleAttachments: function(button) {
+       var grid = this.lookup('attachmentlist');
+       grid?.setVisible(!grid?.isVisible());
+    },
+
     btnHandler: function(button, e) {
        let me = this;
        let action = button.reference;
@@ -162,6 +167,9 @@ Ext.define('PMG.controller.QuarantineController', {
        'button[reference=raw]': {
            click: 'toggleRaw',
        },
+       'button[reference=attachments]': {
+           click: 'toggleAttachments',
+       },
        'pmgQuarantineList': {
            selectionChange: 'onSelectMail',
            itemkeypress: 'keyPress',