* [pmg-devel] [PATCH pmg-api/pmg-gui 0/2] spam quarantine: show split positive/negative scores in list @ 2025-09-22 8:04 Dominik Csapak 2025-09-22 8:05 ` [pmg-devel] [PATCH pmg-api 1/1] api: quarantine: include positive and negative spam score sum " Dominik Csapak 2025-09-22 8:05 ` [pmg-devel] [PATCH pmg-gui 1/1] spam quarantine: add columsn for positive/negative spam score matches Dominik Csapak 0 siblings, 2 replies; 4+ messages in thread From: Dominik Csapak @ 2025-09-22 8:04 UTC (permalink / raw) To: pmg-devel adds the split scores to the api, so we can show them in the spam list Note: this is only one possible approach, we could also send the complete score list over the api and let the gui split and sum the scores instead. I opted for doing it in the api, since we already do quite some parsing, so it didn't seem to be much overhead. If we'd favor doing it in the frontend instead, just let me know then I'll prepare a new version that does that instead. pmg-api: Dominik Csapak (1): api: quarantine: include positive and negative spam score sum in list src/PMG/API2/Quarantine.pm | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) pmg-gui: Dominik Csapak (1): spam quarantine: add columsn for positive/negative spam score matches js/SpamQuarantine.js | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) Summary over all repositories: 2 files changed, 49 insertions(+), 1 deletions(-) -- Generated by git-murpp 0.8.1 _______________________________________________ pmg-devel mailing list pmg-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pmg-devel ^ permalink raw reply [flat|nested] 4+ messages in thread
* [pmg-devel] [PATCH pmg-api 1/1] api: quarantine: include positive and negative spam score sum in list 2025-09-22 8:04 [pmg-devel] [PATCH pmg-api/pmg-gui 0/2] spam quarantine: show split positive/negative scores in list Dominik Csapak @ 2025-09-22 8:05 ` Dominik Csapak 2025-09-22 8:05 ` [pmg-devel] [PATCH pmg-gui 1/1] spam quarantine: add columsn for positive/negative spam score matches Dominik Csapak 1 sibling, 0 replies; 4+ messages in thread From: Dominik Csapak @ 2025-09-22 8:05 UTC (permalink / raw) To: pmg-devel This can be useful information, so to show it in the web ui, we have to return it in the api here. Signed-off-by: Dominik Csapak <d.csapak@proxmox.com> --- src/PMG/API2/Quarantine.pm | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/src/PMG/API2/Quarantine.pm b/src/PMG/API2/Quarantine.pm index 3887a74..2464ee7 100644 --- a/src/PMG/API2/Quarantine.pm +++ b/src/PMG/API2/Quarantine.pm @@ -91,6 +91,29 @@ sub decode_spaminfo { return $res; } +# parses and returns the sum of the positive and negative spam rule matches, so +# we can show them individually +sub get_spamscores { my ($info) = @_; + + return (0, 0) if !defined($info); + + my $positive = 0; + my $negative = 0; + + foreach my $test (split(',', $info)) { + my ($name, $score) = split(':', $test); + + $score = $score + 0; + if ($score > 0) { + $positive += $score; + } else { + $negative += $score; + } + } + + return ($positive, $negative); +} + my $extract_email = sub { my $data = shift; @@ -149,6 +172,9 @@ my $parse_header_info = sub { $res->{id} = 'C' . $ref->{cid} . 'R' . $ref->{rid} . 'T' . $ref->{ticketid}; $res->{time} = $ref->{time}; $res->{bytes} = $ref->{bytes}; + my ($positive, $negative) = get_spamscores($ref->{info}); + $res->{'score-positive'} = $positive; + $res->{'score-negative'} = $negative; my $qtype = $ref->{qtype}; @@ -880,6 +906,14 @@ __PACKAGE__->register_method({ description => "Spam score.", type => 'number', }, + 'score-positive' => { + description => "Sum of positive spam score matches.", + type => 'number', + }, + 'score-negative' => { + description => "Sum of negative spam score matches.", + type => 'number', + }, }, }, }, -- 2.47.3 _______________________________________________ pmg-devel mailing list pmg-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pmg-devel ^ permalink raw reply [flat|nested] 4+ messages in thread
* [pmg-devel] [PATCH pmg-gui 1/1] spam quarantine: add columsn for positive/negative spam score matches 2025-09-22 8:04 [pmg-devel] [PATCH pmg-api/pmg-gui 0/2] spam quarantine: show split positive/negative scores in list Dominik Csapak 2025-09-22 8:05 ` [pmg-devel] [PATCH pmg-api 1/1] api: quarantine: include positive and negative spam score sum " Dominik Csapak @ 2025-09-22 8:05 ` Dominik Csapak 2025-09-29 13:42 ` Thomas Lamprecht 1 sibling, 1 reply; 4+ messages in thread From: Dominik Csapak @ 2025-09-22 8:05 UTC (permalink / raw) To: pmg-devel The api returns the sum of spam matches individually for positive and negative ones, so add two new columns that show them. They each take up 50 pixels, so increase the width of the list by 100 pixel so we have the same space for the other columns here. Signed-off-by: Dominik Csapak <d.csapak@proxmox.com> --- js/SpamQuarantine.js | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/js/SpamQuarantine.js b/js/SpamQuarantine.js index 1844022..93c411d 100644 --- a/js/SpamQuarantine.js +++ b/js/SpamQuarantine.js @@ -153,7 +153,7 @@ Ext.define('PMG.SpamQuarantine', { selModel: 'checkboxmodel', reference: 'list', region: 'west', - width: 500, + width: 600, split: true, collapsible: false, store: { @@ -181,6 +181,20 @@ Ext.define('PMG.SpamQuarantine', { align: 'right', width: 70, }, + { + header: '+', + dataIndex: 'score-positive', + align: 'right', + renderer: (value) => (value ?? 0).toFixed(2), + width: 50, + }, + { + header: '-', + dataIndex: 'score-negative', + align: 'right', + renderer: (value) => (value ?? 0).toFixed(2), + width: 50, + }, { header: gettext('Size') + ' (KB)', renderer: (v) => Ext.Number.toFixed(v / 1024, 0), -- 2.47.3 _______________________________________________ pmg-devel mailing list pmg-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pmg-devel ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [pmg-devel] [PATCH pmg-gui 1/1] spam quarantine: add columsn for positive/negative spam score matches 2025-09-22 8:05 ` [pmg-devel] [PATCH pmg-gui 1/1] spam quarantine: add columsn for positive/negative spam score matches Dominik Csapak @ 2025-09-29 13:42 ` Thomas Lamprecht 0 siblings, 0 replies; 4+ messages in thread From: Thomas Lamprecht @ 2025-09-29 13:42 UTC (permalink / raw) To: Dominik Csapak, pmg-devel Am 22.09.25 um 10:05 schrieb Dominik Csapak: > The api returns the sum of spam matches individually for positive and > negative ones, so add two new columns that show them. They each take up > 50 pixels, so increase the width of the list by 100 pixel so we have the > same space for the other columns here. > > Signed-off-by: Dominik Csapak <d.csapak@proxmox.com> > --- > js/SpamQuarantine.js | 16 +++++++++++++++- > 1 file changed, 15 insertions(+), 1 deletion(-) > > diff --git a/js/SpamQuarantine.js b/js/SpamQuarantine.js > index 1844022..93c411d 100644 > --- a/js/SpamQuarantine.js > +++ b/js/SpamQuarantine.js > @@ -153,7 +153,7 @@ Ext.define('PMG.SpamQuarantine', { > selModel: 'checkboxmodel', > reference: 'list', > region: 'west', > - width: 500, > + width: 600, The quarantine needs a relatively big viewport already as is, due to navigation taking up a lot of unused space and the quarantine list also needing space to show most useful info. While the layout of the navigation might be something to reconsider in the future, I'd probably not touch that now. But as each row in the list spans over two rows anyway, we potentially could keep using a single row column and put the +/- info both into a second row instead. But IMO there is no pressure to look into that now, as due to lack of feedback from others until now and PMG progressing towards a release soonish at least I won't apply this now, there's always a next release. _______________________________________________ pmg-devel mailing list pmg-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pmg-devel ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-09-29 13:43 UTC | newest] Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2025-09-22 8:04 [pmg-devel] [PATCH pmg-api/pmg-gui 0/2] spam quarantine: show split positive/negative scores in list Dominik Csapak 2025-09-22 8:05 ` [pmg-devel] [PATCH pmg-api 1/1] api: quarantine: include positive and negative spam score sum " Dominik Csapak 2025-09-22 8:05 ` [pmg-devel] [PATCH pmg-gui 1/1] spam quarantine: add columsn for positive/negative spam score matches Dominik Csapak 2025-09-29 13:42 ` Thomas Lamprecht
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.