diff --git a/js/SpamScoreDistribution.js b/js/SpamScoreDistribution.js new file mode 100644 index 0000000..cca840e --- /dev/null +++ b/js/SpamScoreDistribution.js @@ -0,0 +1,53 @@ +Ext.define('PMG.SpamScoreDistribution', { + extend: 'Ext.grid.GridPanel', + xtype: 'pmgSpamScoreDistribution', + + disableSelection: true, + + title: 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; + } + } + } + ], + }, + + 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")}%' ] + }, + } + ] +}); diff --git a/js/Utils.js b/js/Utils.js index fde77aa..4569ce7 100644 --- a/js/Utils.js +++ b/js/Utils.js @@ -10,6 +10,7 @@ Ext.define('PMG.Utils', { senderText: gettext('Sender'), receiverText: gettext('Receiver'), + scoreText: gettext('Score'), oclass_text: { who: gettext('Who Objects'),