]>
git.proxmox.com Git - pmg-gui.git/blob - js/SpamInfoGrid.js
1 Ext
.define('PMG.grid.SpamInfoGrid', {
2 extend
: 'Ext.grid.GridPanel',
3 xtype
: 'pmgSpamInfoGrid',
7 fields
: ['desc', 'name', { type
: 'number', name
: 'score' }],
10 root
: 'data.spaminfo',
15 setID: function(rec
) {
17 let id
= rec
?.data
?.id
;
19 me
.getStore().removeAll();
22 me
.store
.proxy
.setUrl(`/api2/json/quarantine/content?id=${id}`);
26 emptyText
: gettext('No Spam Info'),
35 text
: gettext('Test Name'),
39 summaryRenderer
: _v
=> gettext('Spamscore'),
40 tdCls
: 'txt-monospace',
43 text
: gettext('Score'),
46 tdCls
: 'txt-monospace',
47 renderer: function(score
, meta
) {
52 let absScore
= Math
.abs(score
), fontWeight
= '400';
53 let background
= score
< 0 ? "--pmg-spam-mid-neg" : "--pmg-spam-mid-pos";
57 background
= score
< 0 ? "--pmg-spam-high-neg" : "--pmg-spam-high-pos";
58 } else if (absScore
>= 1.5) {
60 } else if (absScore
<= 0.1) {
62 background
= score
< 0 ? "--pmg-spam-low-neg" : "--pmg-spam-low-pos";
65 meta
.tdStyle
= `font-weight: ${fontWeight};background-color: var(${background});`;
69 summaryRenderer
: value
=> Ext
.util
.Format
.round(value
, 5),
72 text
: gettext('Description'),