* [pmg-devel] [PATCH 1/2] quarantine: spam info: make text selectable
@ 2025-09-19 12:54 Dominik Csapak
2025-09-19 12:54 ` [pmg-devel] [PATCH 2/2] quarantine: spam info grid: group good and bad scores Dominik Csapak
2025-09-19 15:32 ` [pmg-devel] applied: [PATCH 1/2] quarantine: spam info: make text selectable Thomas Lamprecht
0 siblings, 2 replies; 4+ messages in thread
From: Dominik Csapak @ 2025-09-19 12:54 UTC (permalink / raw)
To: pmg-devel
theoretically one could enable selecting only for a single column, but
this does not work, since extjs sets 'x-unselectable' class on the whole
table, regardless of the column setting.
With the viewConfig, we can enable the selection on the whole grid at
least.
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
js/SpamInfoGrid.js | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/js/SpamInfoGrid.js b/js/SpamInfoGrid.js
index e3b5cdc..7bce0f4 100644
--- a/js/SpamInfoGrid.js
+++ b/js/SpamInfoGrid.js
@@ -32,6 +32,10 @@ Ext.define('PMG.grid.SpamInfoGrid', {
},
],
+ viewConfig: {
+ enableTextSelection: true,
+ },
+
columns: [
{
text: gettext('Test Name'),
--
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 2/2] quarantine: spam info grid: group good and bad scores
2025-09-19 12:54 [pmg-devel] [PATCH 1/2] quarantine: spam info: make text selectable Dominik Csapak
@ 2025-09-19 12:54 ` Dominik Csapak
2025-09-19 15:36 ` Thomas Lamprecht
2025-09-19 15:32 ` [pmg-devel] applied: [PATCH 1/2] quarantine: spam info: make text selectable Thomas Lamprecht
1 sibling, 1 reply; 4+ messages in thread
From: Dominik Csapak @ 2025-09-19 12:54 UTC (permalink / raw)
To: pmg-devel
So there is a category for the bad and good scores separately, with
separate sums to show.
With this one can more easily see the negative scores compare vs the
positive scores.
One weird quirk I didn't found a solution to exists: If there are only
positive or negative scores for a mail, we can't differentiate the group
summary and the overall summary, so both currently would show 'Overall
Spamscore'. This seems to be a limitation of how extjs calls the
grouping renderer since there is no indication which one it is.
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
js/SpamInfoGrid.js | 53 +++++++++++++++++++++++++++++++++++++++++++---
1 file changed, 50 insertions(+), 3 deletions(-)
diff --git a/js/SpamInfoGrid.js b/js/SpamInfoGrid.js
index 7bce0f4..9d91d36 100644
--- a/js/SpamInfoGrid.js
+++ b/js/SpamInfoGrid.js
@@ -4,7 +4,19 @@ Ext.define('PMG.grid.SpamInfoGrid', {
store: {
autoDestroy: true,
- fields: ['desc', 'name', { type: 'number', name: 'score' }],
+ fields: [
+ 'desc',
+ 'name',
+ { type: 'number', name: 'score' },
+ {
+ type: 'bool',
+ name: 'good',
+ calculate: function (data) {
+ return data.score <= 0;
+ },
+ },
+ ],
+ groupField: 'good',
proxy: {
type: 'proxmox',
root: 'data.spaminfo',
@@ -27,6 +39,23 @@ Ext.define('PMG.grid.SpamInfoGrid', {
hidden: true,
features: [
+ {
+ ftype: 'grouping',
+ enableGroupingMenu: false,
+ groupHeaderTpl: [
+ '{groupValue:this.formatGroup}',
+ {
+ formatGroup: function (groupValue) {
+ if (groupValue) {
+ return gettext('Good Scores');
+ } else {
+ return gettext('Bad Scores');
+ }
+ },
+ },
+ ],
+ showSummaryRow: true,
+ },
{
ftype: 'summary',
},
@@ -41,8 +70,26 @@ Ext.define('PMG.grid.SpamInfoGrid', {
text: gettext('Test Name'),
dataIndex: 'name',
flex: 1,
- summaryType: 'count',
- summaryRenderer: (_v) => gettext('Spamscore'),
+ summaryType: function (records) {
+ let sum = records.reduce((acc, cur) => acc + cur.data.score, 0);
+ return [sum, records.length];
+ },
+ summaryRenderer: function (value, _summaryData, _field, metaData) {
+ let me = this;
+ let overallcount = me.up('grid').getStore().count();
+ let [sum, count] = value;
+ console.log(value);
+
+ if (count === overallcount) {
+ return gettext('Overall Spamscore');
+ }
+
+ if (sum <= 0) {
+ return gettext('Good Scores Sum');
+ } else {
+ return gettext('Bad Scores Sum');
+ }
+ },
tdCls: 'txt-monospace',
},
{
--
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] applied: [PATCH 1/2] quarantine: spam info: make text selectable
2025-09-19 12:54 [pmg-devel] [PATCH 1/2] quarantine: spam info: make text selectable Dominik Csapak
2025-09-19 12:54 ` [pmg-devel] [PATCH 2/2] quarantine: spam info grid: group good and bad scores Dominik Csapak
@ 2025-09-19 15:32 ` Thomas Lamprecht
1 sibling, 0 replies; 4+ messages in thread
From: Thomas Lamprecht @ 2025-09-19 15:32 UTC (permalink / raw)
To: Dominik Csapak, pmg-devel
Am 19.09.25 um 14:54 schrieb Dominik Csapak:
> theoretically one could enable selecting only for a single column, but
> this does not work, since extjs sets 'x-unselectable' class on the whole
> table, regardless of the column setting.
>
> With the viewConfig, we can enable the selection on the whole grid at
> least.
>
> Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
> ---
> js/SpamInfoGrid.js | 4 ++++
> 1 file changed, 4 insertions(+)
>
>
applied this one, thanks!
_______________________________________________
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 2/2] quarantine: spam info grid: group good and bad scores
2025-09-19 12:54 ` [pmg-devel] [PATCH 2/2] quarantine: spam info grid: group good and bad scores Dominik Csapak
@ 2025-09-19 15:36 ` Thomas Lamprecht
0 siblings, 0 replies; 4+ messages in thread
From: Thomas Lamprecht @ 2025-09-19 15:36 UTC (permalink / raw)
To: Dominik Csapak, pmg-devel
Am 19.09.25 um 14:54 schrieb Dominik Csapak:
> So there is a category for the bad and good scores separately, with
> separate sums to show.
>
> With this one can more easily see the negative scores compare vs the
> positive scores.
>
> One weird quirk I didn't found a solution to exists: If there are only
> positive or negative scores for a mail, we can't differentiate the group
> summary and the overall summary, so both currently would show 'Overall
> Spamscore'. This seems to be a limitation of how extjs calls the
> grouping renderer since there is no indication which one it is.
As mentioned offlist, I meant doing this in the spam quarantines mail
selection list on the left, not the spam info grid of a specific mail.
That said, it works OK from quick testing and it might help someone,
maybe with fine-tuning it to only show these sums if there are more
than (rolls dice) three scores in a category?
Or inline the per-category core sum in the single score line, like
+X - Y = Z Total
just as idea. But no pressure from my side for any of this, just some
thoughts for if others think this could be nice too.
_______________________________________________
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-19 15:36 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-09-19 12:54 [pmg-devel] [PATCH 1/2] quarantine: spam info: make text selectable Dominik Csapak
2025-09-19 12:54 ` [pmg-devel] [PATCH 2/2] quarantine: spam info grid: group good and bad scores Dominik Csapak
2025-09-19 15:36 ` Thomas Lamprecht
2025-09-19 15:32 ` [pmg-devel] applied: [PATCH 1/2] quarantine: spam info: make text selectable Thomas Lamprecht
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox