pmg-gui/js/SpamScoreDistribution.js
Thomas Lamprecht c87d46fbe8 tree wide: eslint --fix
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-10-23 13:17:15 +02:00

55 lines
1.0 KiB
JavaScript

Ext.define('PMG.SpamScoreDistribution', {
extend: 'Ext.grid.GridPanel',
xtype: 'pmgSpamScoreDistribution',
disableSelection: true,
border: false,
title: gettext('Statistics') + ': ' + gettext('Spam Scores'),
tbar: [{ xtype: 'pmgStatTimeSelector' }],
store: {
xclass: 'PMG.data.StatStore',
staturl: "/api2/json/statistics/spamscores",
fields: [
'count', 'ratio',
{
type: 'string',
name: 'label',
convert: function(v, rec) {
if (rec.data.level >= 10) {
return PMG.Utils.scoreText + ' >= 10';
} else {
return PMG.Utils.scoreText + ' ' + rec.data.level.toString();
}
},
},
],
},
columns: [
{
header: PMG.Utils.scoreText,
flex: 1,
dataIndex: 'label',
},
{
header: gettext("Count"),
width: 150,
dataIndex: 'count',
},
{
header: gettext("Percentage"),
width: 300,
xtype: 'widgetcolumn',
dataIndex: 'ratio',
widget: {
xtype: 'progressbarwidget',
textTpl: ['{percent:number("0")}%'],
},
},
],
});