]> git.proxmox.com Git - pmg-gui.git/blob - js/HourlyMailDistribution.js
fix #2533: quarantine: add overflowHandler to the preview panel
[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.toString() +
45 ' - ' + end.toString() + '<br>' +
46 'Count: ' + record.get(item.field));
47 },
48 },
49 });
50 },
51 });
52
53 Ext.define('PMG.HourlyMailDistribution', {
54 extend: 'Ext.panel.Panel',
55 xtype: 'pmgHourlyMailDistribution',
56
57 scrollable: true,
58 border: false,
59
60 bodyPadding: '10 0 0 0',
61 defaults: {
62 width: 700,
63 padding: '0 0 10 10',
64 },
65
66 layout: 'column',
67
68 title: gettext('Statistics') + ': ' + gettext('Hourly Distribution'),
69
70 tbar: [{ xtype: 'pmgStatTimeSelector' }],
71
72 initComponent: function() {
73 var me = this;
74
75 var store = Ext.create('PMG.data.StatStore', {
76 staturl: '/api2/json/statistics/maildistribution',
77 fields: [
78 { type: 'integer', name: 'index' },
79 { type: 'integer', name: 'count' },
80 { type: 'integer', name: 'count_in' },
81 { type: 'integer', name: 'count_out' },
82 { type: 'integer', name: 'spamcount_in' },
83 { type: 'integer', name: 'spamcount_out' },
84 { type: 'integer', name: 'viruscount_in' },
85 { type: 'integer', name: 'viruscount_ou' },
86 { type: 'integer', name: 'bounces_in' },
87 { type: 'integer', name: 'bounces_out' },
88 ],
89 });
90
91 me.items = [
92 {
93 xtype: 'pmgMailDistChart',
94 title: gettext('Incoming Mails'),
95 field: 'count_in',
96 store: store,
97 },
98 {
99 xtype: 'pmgMailDistChart',
100 title: gettext('Outgoing Mails'),
101 field: 'count_out',
102 store: store,
103 },
104 ];
105
106 me.callParent();
107
108 me.on('destroy', store.destroy, store);
109 },
110 });