public inbox for pmg-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Dominik Csapak <d.csapak@proxmox.com>
To: pmg-devel@lists.proxmox.com
Subject: [pmg-devel] [PATCH pmg-gui 2/5] quarantines: add attachment grid to spam and virus quarantine
Date: Fri,  4 Nov 2022 16:04:22 +0100	[thread overview]
Message-ID: <20221104150425.124194-4-d.csapak@proxmox.com> (raw)
In-Reply-To: <20221104150425.124194-1-d.csapak@proxmox.com>

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                  |  6 ++++++
 js/SpamQuarantine.js                  | 17 +++++++++++++++++
 js/VirusQuarantine.js                 | 17 +++++++++++++++++
 js/controller/QuarantineController.js |  8 ++++++++
 4 files changed, 48 insertions(+)

diff --git a/js/AttachmentGrid.js b/js/AttachmentGrid.js
index 7e630de..8943f09 100644
--- a/js/AttachmentGrid.js
+++ b/js/AttachmentGrid.js
@@ -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}`;
diff --git a/js/SpamQuarantine.js b/js/SpamQuarantine.js
index c86ce79..d3afcc5 100644
--- a/js/SpamQuarantine.js
+++ b/js/SpamQuarantine.js
@@ -219,6 +219,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',
@@ -265,6 +273,15 @@ Ext.define('PMG.SpamQuarantine', {
 		    border: false,
 		    reference: 'spaminfo',
 		},
+		{
+		    xtype: 'pmgAttachmentGrid',
+		    minHeight: 50,
+		    maxHeight: 250,
+		    scrollable: true,
+		    reference: 'attachmentlist',
+		    showDownloads: false,
+		    border: false,
+		},
 		{
 		    xtype: 'pmgMailInfo',
 		    hidden: true,
diff --git a/js/VirusQuarantine.js b/js/VirusQuarantine.js
index 47e055c..8580e7a 100644
--- a/js/VirusQuarantine.js
+++ b/js/VirusQuarantine.js
@@ -114,6 +114,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',
@@ -142,6 +150,15 @@ Ext.define('PMG.VirusQuarantine', {
 			},
 		    ],
 		},
+		{
+		    xtype: 'pmgAttachmentGrid',
+		    minHeight: 50,
+		    maxHeight: 250,
+		    scrollable: true,
+		    reference: 'attachmentlist',
+		    showDownloads: false,
+		    border: false,
+		},
 		{
 		    xtype: 'pmgMailInfo',
 		    hidden: true,
diff --git a/js/controller/QuarantineController.js b/js/controller/QuarantineController.js
index d47af6a..afc04be 100644
--- a/js/controller/QuarantineController.js
+++ b/js/controller/QuarantineController.js
@@ -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',
-- 
2.30.2





  parent reply	other threads:[~2022-11-04 15:05 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-04 15:04 [pmg-devel] [PATCH pmg-api/pmg-gui] improvements to the quarantine interface Dominik Csapak
2022-11-04 15:04 ` [pmg-devel] [PATCH pmg-api 1/1] api/quarantine: allow 'listattachments' for quarantine users Dominik Csapak
2022-11-07  8:47   ` [pmg-devel] applied: " Thomas Lamprecht
2022-11-04 15:04 ` [pmg-devel] [PATCH pmg-gui 1/5] simply quarantine controllers a bit Dominik Csapak
2022-11-07  8:47   ` [pmg-devel] applied: " Thomas Lamprecht
2022-11-04 15:04 ` Dominik Csapak [this message]
2022-11-07 12:21   ` [pmg-devel] applied: [PATCH pmg-gui 2/5] quarantines: add attachment grid to spam and virus quarantine Thomas Lamprecht
2022-11-04 15:04 ` [pmg-devel] [PATCH pmg-gui 3/5] fix #4238: SpamInfoGrid: enable sorting & add colors for spam score Dominik Csapak
2022-11-07  9:56   ` [pmg-devel] applied: " Thomas Lamprecht
2022-11-04 15:04 ` [pmg-devel] [PATCH pmg-gui 4/5] quarantine: improve borders for docked items Dominik Csapak
2022-11-07  9:57   ` [pmg-devel] applied: " Thomas Lamprecht
2022-11-04 15:04 ` [pmg-devel] [PATCH pmg-gui 5/5] fix #2533: quarantine: add overflowHandler to the preview panel Dominik Csapak
2022-11-07  9:57   ` [pmg-devel] applied: " Thomas Lamprecht

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221104150425.124194-4-d.csapak@proxmox.com \
    --to=d.csapak@proxmox.com \
    --cc=pmg-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal