]> git.proxmox.com Git - pmg-gui.git/commitdiff
add SpamScoreDistribution class
authorDietmar Maurer <dietmar@proxmox.com>
Thu, 31 Aug 2017 05:57:05 +0000 (07:57 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Thu, 31 Aug 2017 05:57:05 +0000 (07:57 +0200)
js/SpamScoreDistribution.js [new file with mode: 0644]
js/Utils.js

diff --git a/js/SpamScoreDistribution.js b/js/SpamScoreDistribution.js
new file mode 100644 (file)
index 0000000..cca840e
--- /dev/null
@@ -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")}%' ]
+           },
+       }
+    ]
+});
index fde77aabca0b9670362e82b75ebb34e6ed2cb72f..4569ce752dd837dd81d277e694a9bd511e291dd3 100644 (file)
@@ -10,6 +10,7 @@ Ext.define('PMG.Utils', {
 
     senderText: gettext('Sender'),
     receiverText: gettext('Receiver'),
+    scoreText: gettext('Score'),
 
     oclass_text: {
        who: gettext('Who Objects'),