]> git.proxmox.com Git - pmg-gui.git/blob - js/HourlyMailDistribution.js
add virusfilter
[pmg-gui.git] / js / HourlyMailDistribution.js
1 Ext.define('PMG.MailDistChart', {
2 extend: 'Ext.chart.CartesianChart',
3 xtype: 'pmgMailDistChart',
4
5 width: 770,
6 height: 300,
7 animation: false,
8
9 axes: [{
10 type: 'numeric',
11 title: gettext('Count'),
12 position: 'left',
13 grid: true,
14 minimum: 0
15 }, {
16 type: 'category',
17 position: 'bottom',
18 fields: ['index']
19 }],
20
21 initComponent: function() {
22 var me = this;
23
24
25 if (!me.store) {
26 throw "cannot work without store";
27 }
28
29 if (!me.field) {
30 throw "cannot work without a field";
31 }
32
33 me.callParent();
34
35 me.addSeries({
36 type: 'bar',
37 xField: 'index',
38 yField: me.field,
39 tooltip: {
40 trackMouse: true,
41 renderer: function(tooltip, record, item) {
42 var start = record.get('index');
43 var end = start+1;
44 tooltip.setHtml('Time: ' + start + ' - ' + end + '<br>' +
45 'Count: ' + record.get(item.field));
46 }
47 }
48 });
49 }
50 });
51
52 Ext.define('PMG.HourlyMailDistribution', {
53 extend: 'Ext.panel.Panel',
54 xtype: 'pmgHourlyMailDistribution',
55
56 scrollable: true,
57 border: false,
58
59 bodyPadding: '10 0 0 0',
60 defaults: {
61 width: 700,
62 padding: '0 0 10 10'
63 },
64
65 layout: 'column',
66
67 title: gettext('Statistics') + ': ' + gettext('Hourly Distribution'),
68
69 tbar: [ { xtype: 'pmgStatTimeSelector' } ],
70
71 initComponent: function() {
72 var me = this;
73
74 var store = Ext.create('PMG.data.StatStore', {
75 staturl: '/api2/json/statistics/maildistribution',
76 fields: [
77 { type: 'integer', name: 'index' },
78 { type: 'integer', name: 'count' },
79 { type: 'integer', name: 'count_in' },
80 { type: 'integer', name: 'count_out' },
81 { type: 'integer', name: 'spamcount_in' },
82 { type: 'integer', name: 'spamcount_out' },
83 { type: 'integer', name: 'viruscount_in' },
84 { type: 'integer', name: 'viruscount_ou' },
85 { type: 'integer', name: 'bounces_in' },
86 { type: 'integer', name: 'bounces_out' },
87 ]
88 });
89
90 me.items = [
91 {
92 xtype: 'pmgMailDistChart',
93 title: gettext('Incoming Mails'),
94 field: 'count_in',
95 store: store
96 },
97 {
98 xtype: 'pmgMailDistChart',
99 title: gettext('Outgoing Mails'),
100 field: 'count_out',
101 store: store
102 }
103 ];
104
105 me.callParent();
106
107 me.on('destroy', store.destroy, store);
108 }
109 });