From: Thomas Lamprecht <t.lamprecht@proxmox.com>
To: pmg-devel@lists.proxmox.com
Subject: [pmg-devel] [PATCH] fix #3164: allow one to display all quarantined spam mails
Date: Mon, 22 Mar 2021 10:00:46 +0100 [thread overview]
Message-ID: <20210322090046.26278-3-t.lamprecht@proxmox.com> (raw)
In-Reply-To: <20210322090046.26278-1-t.lamprecht@proxmox.com>
If the API call returned more than one pmail entry, inject an "all"
entry which, if selected, drops the user parameter and loads the
quarantine mails of all users from the backend.
The webinterface has only some issues regarding deselection (all in
the grid header or if we need to deselect due to the search filtering
out some elements) - for that the underlying issue was found and a
widget toolkit patch was provided.
The rest seems now pretty performant, albeit more than a few 100k
mails may become a problem here. But, in such big setups the mail
admin won't tinker to much whith the users mail anyway, if they are
even alowed to do so depending on their jurisdictions privacy laws
and companies privacy policy.
So, basically this is more for evaluation or for smaller setups but
got quite often requested, and as there's not more data
exposed/returned then already available I see no real argument
against it.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
---
js/QuarantineList.js | 26 +++++++++++++++++++++++---
1 file changed, 23 insertions(+), 3 deletions(-)
diff --git a/js/QuarantineList.js b/js/QuarantineList.js
index c5cab6e..9280489 100644
--- a/js/QuarantineList.js
+++ b/js/QuarantineList.js
@@ -76,6 +76,10 @@ Ext.define('PMG.QuarantineList', {
}
me.setEmptyText();
}
+ // deselect all first, else ExtJS does some funky O(n^3) comparissions as it tries
+ // to keep the selection, but we do not care for that on a new load anyway
+ view.getSelectionModel().deselectAll();
+
store.load(function() {
if (me.savedPosition !== undefined) {
if (store.getCount() - 1 < me.savedPosition) {
@@ -112,7 +116,11 @@ Ext.define('PMG.QuarantineList', {
setUser: function(user) {
let view = this.getView();
let params = view.getStore().getProxy().getExtraParams();
- params.pmail = user;
+ if (user === null) {
+ delete params.pmail;
+ } else {
+ params.pmail = user;
+ }
view.getStore().getProxy().setExtraParams(params);
view.user = user;
},
@@ -164,7 +172,11 @@ Ext.define('PMG.QuarantineList', {
let me = this;
me.savedPosition = undefined;
me.allowPositionSave = false;
- me.setUser(value);
+ if (value === 'all') {
+ me.setUser(null);
+ } else {
+ me.setUser(value);
+ }
me.load();
},
@@ -214,7 +226,8 @@ Ext.define('PMG.QuarantineList', {
return match;
});
if (toDeselect.length > 0) {
- sm.deselect(toDeselect);
+ sm.deselect(toDeselect, true);
+ sm.maybeFireSelectionChange(true);
}
return selectedRecordId !== null && clearSelectedMail;
},
@@ -313,6 +326,13 @@ Ext.define('PMG.QuarantineList', {
renderer: Ext.htmlEncode,
},
],
+ listeners: {
+ load: function(store, records, successfull) {
+ if (successfull && records.length > 1) {
+ store.insert(0, { mail: 'all' });
+ }
+ },
+ },
},
queryMode: 'local',
editable: true,
--
2.20.1
next prev parent reply other threads:[~2021-03-22 9:01 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-22 9:00 [pmg-devel] [PATCH] fix #3164: api: quarantine: allow to return spam from all users Thomas Lamprecht
2021-03-22 9:00 ` [pmg-devel] [PATCH] override deselection in CheckboxModel to improve performance Thomas Lamprecht
2021-03-22 9:00 ` Thomas Lamprecht [this message]
2021-03-22 15:46 ` [pmg-devel] [PATCH] fix #3164: allow one to display all quarantined spam mails Dominik Csapak
2021-03-22 14:06 ` [pmg-devel] [PATCH] fix #3164: api: quarantine: allow to return spam from all users Stoiko Ivanov
2021-03-22 14:12 ` Fuhrmann, Markus
2021-03-22 16:38 ` 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=20210322090046.26278-3-t.lamprecht@proxmox.com \
--to=t.lamprecht@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