]> git.proxmox.com Git - pmg-gui.git/blame - js/HourlyMailDistribution.js
regex tester: make textfield flex to take all remaining space
[pmg-gui.git] / js / HourlyMailDistribution.js
CommitLineData
b02ccf09
DM
1Ext.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,
c87d46fb 14 minimum: 0,
b02ccf09
DM
15 }, {
16 type: 'category',
17 position: 'bottom',
c87d46fb 18 fields: ['index'],
b02ccf09
DM
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;
de0ebd99
DC
44 tooltip.setHtml('Time: ' + start.toString() +
45 ' - ' + end.toString() + '<br>' +
b02ccf09 46 'Count: ' + record.get(item.field));
c87d46fb
TL
47 },
48 },
b02ccf09 49 });
c87d46fb 50 },
b02ccf09
DM
51});
52
53Ext.define('PMG.HourlyMailDistribution', {
54 extend: 'Ext.panel.Panel',
55 xtype: 'pmgHourlyMailDistribution',
56
57 scrollable: true,
50531ef9 58 border: false,
b02ccf09 59
8051d921 60 bodyPadding: '10 0 0 0',
b02ccf09 61 defaults: {
8051d921 62 width: 700,
c87d46fb 63 padding: '0 0 10 10',
b02ccf09
DM
64 },
65
8051d921
DM
66 layout: 'column',
67
3755c9e0 68 title: gettext('Statistics') + ': ' + gettext('Hourly Distribution'),
b02ccf09 69
c87d46fb 70 tbar: [{ xtype: 'pmgStatTimeSelector' }],
b02ccf09
DM
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' },
c87d46fb
TL
87 { type: 'integer', name: 'bounces_out' },
88 ],
b02ccf09
DM
89 });
90
91 me.items = [
92 {
93 xtype: 'pmgMailDistChart',
94 title: gettext('Incoming Mails'),
95 field: 'count_in',
c87d46fb 96 store: store,
b02ccf09
DM
97 },
98 {
99 xtype: 'pmgMailDistChart',
100 title: gettext('Outgoing Mails'),
101 field: 'count_out',
c87d46fb
TL
102 store: store,
103 },
b02ccf09
DM
104 ];
105
106 me.callParent();
107
108 me.on('destroy', store.destroy, store);
c87d46fb 109 },
b02ccf09 110});