Commit Graph

61 Commits

Author SHA1 Message Date
Stefan Sterz
e950ec7202 quarantines: use a check mark for the dark mode filter
...instead of a toggle button. also adjusts the wording and adds a
separator.

Signed-off-by: Stefan Sterz <s.sterz@proxmox.com>
2023-03-23 17:19:12 +01:00
Stefan Sterz
9bcb553cfb quarantines: add support for a theme toggle
this allows toggling the presentation of the email previews depending
on the current theme. in the default "light" mode the toggle is hidden
to avoid clutter. enable the toggle in other themes to allow switching
back to the original way the email was rendered.

this requires a bump of the widget toolkit. the toolkit provides the
styles necessary for the toggle to work.

Signed-off-by: Stefan Sterz <s.sterz@proxmox.com>
Reviewed-by: Dominik Csapak <d.csapak@proxmox.com>
Tested-by:  Dominik Csapak <d.csapak@proxmox.com>
2023-03-15 15:38:54 +01:00
Dominik Csapak
c03e51ed3a fix #3287: add recipient filter for virus & attachment quarantines
So that users can filter these quarantine views, e.g. useful if they
have many mails there.

Replaced the emailSelection config with a quarantineType configs
since we want to have different behaviour for different quaratine
types. E.g., we want to show 'all' mails by default for the
virus/attachment quarantine, but not for the spam one.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2022-11-25 13:31:19 +01:00
Thomas Lamprecht
ba1a55b775 spam quarantine controller: fix args when calling the parent multiSelect
arguments needs to be an array, often we call with all of ours, iow.
using `arguments` which itself is an array already.

Both, manual construction and just a passing `arguments` have their
advantage and disadvantage, e.g., if either the inheriting or
bequesting class becomes more specialized, but most of the time using
`arguments` is more future proof.

Fixes: e66c888 ("quarantine: refactor spamquarantine controller")
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2022-11-07 13:16:51 +01:00
Thomas Lamprecht
38229fc877 quarantines: dock attachement grid to bottom, avoid toggle button
A separate header and docked at the bottom reduces crowding at the
top and make the whole view(s) a bit clearer.

This also better mirrors where most mail clients show attachments
(e.g., thunderbird) and allows to avoid the extra button (UX benefits
most of the time from reduced inputs, if it doesn't takes away
features).

Make the panel collapsible for the spam and virus quarantine, and
hide the download button there; note that this isn't done for
security purpose but just wasn't requested and some users may do
better if they only decide deliver/delete here and let their MUA
handle attachements.

Disable collapsing in the Attachement quarantine, it doesn't really
makes sense there and we got a maxHeight already anyway.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2022-11-07 13:16:51 +01:00
Thomas Lamprecht
ecab0d0e3e attachement grid: set configs used on all use-sites as defaults
avoid overly repetition, we can still override them if we get a use
site that really requires different values here.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2022-11-07 09:46:31 +01:00
Dominik Csapak
1a96ec322b quarantines: add attachment grid to spam and virus quarantine
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>
2022-11-07 09:46:31 +01:00
Dominik Csapak
991d5ec23d fix #2533: quarantine: add overflowHandler to the preview panel
so that the menu can be used even on narrower screens

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2022-11-07 09:46:31 +01:00
Dominik Csapak
4e356bcded quarantine: improve borders for docked items
one cannot set the different borders seperately in panels/grids and
docked items don't have a bottom border in extjs, but we want to remove
all borders except the ones between the toolbar and the grids/content
below that.

to achieve that, set a custom 'border-bottom-width' with '!important'
(extjs has a rule with !important as well) for the toolbar, and
everywhere else remove the border.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2022-11-07 09:46:31 +01:00
Dominik Csapak
c7a679755e quarantine controller: drop specialized classes, check at runtime instead
By making use of the optional chaining operator, we don't need to
override the 'onSelectMail' in both the attachment quarantine and the
spam quarantine. Instead, we opportunistically call lookup(id)?.setID
in the common handler for both, the attachments and the spaminfo
references.

As that was the single change from the parent class we can now drop
the specialized controller classes.

While at it, remove the stray 'xtype' property of the quarantine
controller, which make only sense for component derived classes.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
 [T: fix typos and reword message a bit]
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2022-11-05 16:33:28 +01:00
Stoiko Ivanov
e66c888b86 quarantine: refactor spamquarantine controller
over the time the spam quarantine has gained quite a few nice
usability improvments and features, which would be useful in
the virus and attachment quarantines as well - e.g.:

* multi-mail selection
* keyboard actions
* context menu
* download mail as .eml

this patch splits the controller part into a file of its own, while changing
'var' to 'let' and removing the parts only relevant for the spamquarantine
and adapts the current SpamQuarantine.js to use it.

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
2022-10-28 11:30:23 +02:00
Thomas Lamprecht
365f84c19b quarantines: color code deliver and delete buttons
In some languages, e.g. widely used English, "Delete" and "Deliver"
are looking rather similar without too much eye squinting required.

Add an accent on their icons using for, at least in the western
hemisphere, the respective associated color, like red for trash can.
To 1) avoid to much messing with those cultures that got it switched
and 2) some more common color blindness use blue for the delivery
button, just to make it stand out.

Keep the white/black list as is, as such accents work best if not
everything uses them, i.e., so that they more common options actually
stand out.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2022-10-22 16:16:41 +02:00
Thomas Lamprecht
2cc13fbc8a quarantine grids: use arrow function for size renderer
quicker to read and avoids "violating" style guide due to on-line
normal functions

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2022-10-22 16:14:23 +02:00
Thomas Lamprecht
cd15075876 quarantine: subject/sender: refactor/code-style-fix render functions
extends on the improvements from the previous commit, reduces code
lines while (hopefully, as slightly subjective) not reducing
readability

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2022-10-22 16:12:25 +02:00
Thomas Lamprecht
980e88a9dd spam quarantine: avoid resetting saved position when removing single element
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2021-07-19 18:24:48 +02:00
Dominik Csapak
60a9d6fdbc {Attachment, Spam, Virus}Quarantine: fix layout for iframe
in extjs 7.0 the css changed slightly so that we need to define
the 'fit' layout explicitely to maintain the full width/height

otherwise it can happen that the iframe gets cut off

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2021-06-08 13:13:54 +00:00
Stoiko Ivanov
a2293354c5 quarantineview: unify url generation
this patch adds the cleanup for the attachment quarantine from
0e26e20aa5 to the virus- and
spamquarantine.

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
2021-05-11 16:17:05 +02:00
Thomas Lamprecht
642aba90ed quarantine: restore behavior of selecting next in list after action
This fixes a UX regression stemming from the recently introduced
commit 9aed379a70
"spam quarantine: avoid full store reload on single-element actions"

A load restored the saved selection after load complete, with the
neat and very useful feature to jump to the next in line if the old
one did not exist anymore.

Call this now factored out code part ourself in the fast-path.

This was reported in the forum:
https://forum.proxmox.com/threads/proxmox-mail-gateway-6-4-released.86760/#post-380971

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2021-04-01 13:42:53 +02:00
Thomas Lamprecht
0affcba58e spam quarantine: code cleanup
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2021-03-30 17:06:45 +02:00
Thomas Lamprecht
9aed379a70 spam quarantine: avoid full store reload on single-element actions
A store load may require several seconds to complete, which can get
frustrating fast.

For single actions we have a callback which gets only executed on a
successful API call, so we can just remove the entry there directly
from the in-memory store.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2021-03-23 12:26:03 +01:00
Thomas Lamprecht
3168b7f780 spam quarantine: batch actions into 2500-sized chunks
With ~20 bytes per message-id and separator we get over the current
HTTP post size limit of 64 KiB with ~ 3200 messages.

As 2500 is a relatively nice number for humans to deal with rather go
for that one, that leaves also some room for potential longer IDs in
the future.

Send the batches of async in pairs, as with that the pmgproxy can
still cope well and is not overloaded.

Mask the whole list panel with a 'Processing...' loading-mask during
sending of requests affecting multiple messages, so that the user
gets some instant visible feedback that something is actually
happening (the api calls may return only after a few seconds).

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2021-03-23 12:26:03 +01:00
Thomas Lamprecht
b61e38d711 spam quarantine: shorter mapping from selected to id list
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2021-03-23 11:49:29 +01:00
Thomas Lamprecht
f057ca9085 drop jslint hints
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-10-23 14:08:50 +02:00
Thomas Lamprecht
a36756b058 drop jslint hint for Proxmox global
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-10-23 14:03:17 +02:00
Thomas Lamprecht
c87d46fbe8 tree wide: eslint --fix
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-10-23 13:17:15 +02:00
Thomas Lamprecht
b9a5e7079d quarantine: display how many mails are selected
Mostly taken from a bigger patch of Dominik, for now lets just show
the count (release is near) and add some padding

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-04-24 16:16:37 +02:00
Dominik Csapak
72d8403cb6 Quarantine: set mailinfo visible only on html preview
We did already hide it when toggling raw/html, but when choosing raw
and changing the mail, it was again set to visible.
This patch fixes that by always taking 'me.raw' into account.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2020-04-15 14:06:43 +02:00
Thomas Lamprecht
4935e8fb22 qurantine: hide mailinfo in raw mode
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-04-15 12:59:38 +02:00
Dominik Csapak
ac6c1fb818 fix #2676: add MailInfo box on Quarantine Views
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2020-04-14 15:00:33 +02:00
Thomas Lamprecht
07a9b44595 quarantine: set mail-dowanload link's download attribute again
to ensure the browser sets the download filename we need to set the
link elements download attribute[0].

fixes commit 41a290e3f0

[0]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-11-22 12:21:41 +01:00
Dominik Csapak
38771d946b fix broken maillist when deleting last mail in list
on deleting the last mail in the list, the selection is empty and
the access below to 'rec.data.id' breaks, leaving the maillist broken
(until the user changed the panel or reloaded)

so give rec an empty fallback object and check if there is a 'data'
property and use that, otherwise set the id to the empty string

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Tested-By: Stoiko Ivanov <s.ivanov@proxmox.com>
Reviewed-By: Stoiko Ivanov <s.ivanov@proxmox.com>
2019-11-14 13:34:56 +01:00
Thomas Lamprecht
550a2c5b7c SpamQuarantine: onSelectMail: re-use queried selection
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-10-25 12:37:05 +02:00
Thomas Lamprecht
41a290e3f0 SpamQuarantine: simplify download button by binding its href config
This avoids all the strange click event hack. We already have a
button where the users needs to click on, so just use that.

A viewModel with a downloadMailURL formula to assemble the href
allows us to just bind the "href" config from the Download button,
and be done with it..

refactors commit 7ad0de10d6

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-10-25 12:23:43 +02:00
Dominik Csapak
8b1d19f3a1 SpamQuarantine: fix download of large emails
since datauri downloads are size limited (2MB in chrome), we have
to use another method, and instead of working around in the gui
(e.g. by using URL.createObjectURL) make use of the existing download
code in the api, which should have better compatibility
(and omits the whole raw -> json -> raw -> base64 conversion chain from
file to download)

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Tested-By: Stoiko Ivanov <s.ivanov@proxmox.com>
Reviewed-By: Stoiko Ivanov <s.ivanov@proxmox.com>
2019-10-25 09:19:05 +02:00
Dominik Csapak
7ad0de10d6 add download button to spam quarantine preview
so that users can download the file directly

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2019-02-26 10:46:29 +01:00
Dietmar Maurer
6265117277 cleanup: set selModel only where we need it 2018-03-29 14:40:32 +02:00
Dominik Csapak
0b9c052824 SpamQuarantine: add keyboard shortcuts for actions
d/D: deliver
delete: delete
w/W: whitelist
b/B: blacklist

the delete key registers differently depending on browser,
so we have to check for event.DELETE and '127'

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2018-03-29 14:33:45 +02:00
Dominik Csapak
c627f092b8 SpamQuarantine: add context menu
with the actions: deliver,delete,whitelist,blacklist

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2018-03-29 14:31:58 +02:00
Dominik Csapak
7f0619ff3b quarantine: refactor action logic
so that it can be reused

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2018-03-29 14:31:29 +02:00
Dominik Csapak
d42f85b806 implement multiselection of spamquarantine mails
and allow the actions to be sent for all simultaniously

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2018-03-29 14:22:42 +02:00
Dietmar Maurer
aac17b9be4 Revert "doQuarantineAction: pass pmail parameter"
This reverts commit 794e411a4f.

Not required any longer, because the backend now encode all info inside
the id.
2017-12-28 12:47:11 +01:00
Dietmar Maurer
794e411a4f doQuarantineAction: pass pmail parameter 2017-12-28 08:41:59 +01:00
Dominik Csapak
b76ce2c5f7 jslint: remove unnecessary code, optimize updatePreview
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2017-10-23 17:31:40 +02:00
Dominik Csapak
207471c040 select mail when coming from link in SpamQuarantine mail
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2017-10-06 07:29:58 +02:00
Dietmar Maurer
f34abacac7 SpamInfoGrid.js - avoid border 2017-09-29 07:11:33 +02:00
Dominik Csapak
56b4528f24 add missing titles for quarantines
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2017-09-28 15:16:34 +02:00
Dominik Csapak
2d1f7824e4 make SpamQuarantine use the QuarantineList and SpamInfoGrid
this changes the SpamQuarantine so it uses the refactored version
of the list, and add the function to show the spaminfo
in a table

also it changes from "show html"/"show raw" buttons to
a single button which gets toggled

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2017-09-28 14:46:56 +02:00
Dominik Csapak
ea07c9aa8e jslint: type confusion
fix many type confusions

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2017-09-28 14:42:13 +02:00
Dominik Csapak
749af0601a jslint: trailing commas
fix many trailing commas

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2017-09-28 14:41:43 +02:00
Dominik Csapak
2c1d504e90 jslint: globals
adds the global object proxmox to most files

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2017-09-28 14:41:31 +02:00