]>
git.proxmox.com Git - pmg-gui.git/blob - js/GeneralMailStatistics.js
1 Ext
.define('PMG.GeneralMailStatistics', {
2 extend
: 'Ext.panel.Panel',
3 xtype
: 'pmgGeneralMailStatistics',
7 bodyPadding
: '0 0 10 0',
12 title
: gettext('Statistics') + ': ' + gettext('Mail'),
14 tbar
: [ { xtype
: 'pmgStatTimeSelector' } ],
16 getInData: function(data
) {
20 name
: gettext("Incoming Mails"),
26 name
: gettext("Junk Mails"),
28 percentage
: data
.junk_in
/data
.count_in
32 name
: gettext("Greylisted Mails"),
34 percentage
: data
.glcount
/data
.count_in
38 name
: gettext("Spam Mails"),
39 value
: data
.spamcount_in
,
40 percentage
: data
.spamcount_in
/data
.count_in
44 name
: gettext("SPF rejects"),
46 percentage
: data
.spfcount
/data
.count_in
50 name
: gettext("Bounces"),
51 value
: data
.bounces_in
,
52 percentage
: data
.bounces_in
/data
.count_in
56 name
: gettext("Virus Mails"),
57 value
: data
.viruscount_in
,
58 percentage
: data
.viruscount_in
/data
.count_in
64 getOutData: function(data
) {
68 name
: gettext("Outgoing Mails"),
69 value
: data
.count_out
,
74 name
: gettext("Bounces"),
75 value
: data
.bounces_out
,
76 percentage
: data
.bounces_out
/data
.count_out
80 name
: gettext("Virus Mails"),
81 value
: data
.viruscount_out
,
82 percentage
: data
.viruscount_out
/data
.count_out
88 getGeneralData: function(data
) {
92 name
: gettext("Total Mails"),
98 name
: gettext("Incoming Mails"),
100 percentage
: data
.count_in
/data
.count
104 name
: gettext("Outgoing Mails"),
105 value
: data
.count_out
,
106 percentage
: data
.count_out
/data
.count
110 name
: gettext("Virus Outbreaks"),
111 value
: data
.viruscount_out
115 name
: gettext("Avg. Mail Precessing Time"),
116 value
: Ext
.String
.format(gettext("{0} seconds"),
117 Ext
.Number
.toFixed(data
.avptime
, 2))
121 name
: gettext("Incoming Mail Traffic"),
122 value
: Ext
.Number
.toFixed(data
.bytes_in
/(1024*1024), 2) + ' MByte'
126 name
: gettext("Outgoing Mail Traffic"),
127 value
: Ext
.Number
.toFixed(data
.bytes_out
/(1024*1024), 2) + ' MByte'
132 initComponent: function() {
135 var countstore
= Ext
.create('PMG.data.StatStore', {
136 includeTimeSpan
: true,
137 staturl
: '/api2/json/statistics/mailcount',
139 { type
: 'integer', name
: 'count' },
140 { type
: 'integer', name
: 'count_in' },
141 { type
: 'integer', name
: 'count_out' },
142 { type
: 'integer', name
: 'spamcount_in' },
143 { type
: 'integer', name
: 'spamcount_out' },
144 { type
: 'integer', name
: 'viruscount_in' },
145 { type
: 'integer', name
: 'viruscount_out' },
146 { type
: 'integer', name
: 'bounces_in' },
147 { type
: 'integer', name
: 'bounces_out' },
148 { type
: 'date', dateFormat
: 'timestamp', name
: 'time' }
152 var totalgrid
= Ext
.createWidget('pmgMailStatGrid', {
156 title
: gettext("Total Mail Count"),
157 xtype
: 'proxmoxRRDChart',
158 fields
: ['count', 'count_in', 'count_out'],
160 gettext('Total Mail Count'),
161 gettext('Incoming Mails'), gettext('Outgoing Mails')],
167 var ingrid
= Ext
.createWidget('pmgMailStatGrid', {
171 title
: gettext("Incoming Mails"),
172 xtype
: 'proxmoxRRDChart',
173 fields
: ['count_in', 'spamcount_in', 'viruscount_in', 'bounces_in'],
175 gettext('Incoming Mails'), gettext('Spam Mails'),
176 gettext('Virus Mails'), gettext('Bounces')],
182 var outgrid
= Ext
.createWidget('pmgMailStatGrid', {
186 title
: gettext("Outgoing Mails"),
187 xtype
: 'proxmoxRRDChart',
188 fields
: ['count_out', 'viruscount_out', 'bounces_out'],
190 gettext('Outgoing Mails'),
191 gettext('Virus Mails'), gettext('Bounces')],
197 var infostore
= Ext
.create('PMG.data.StatStore', {
198 staturl
: "/api2/json/statistics/mail",
199 fields
: [ 'name', 'value', 'percentage' ],
201 load: function(store
, records
) {
202 var data
= me
.getGeneralData(records
[0].data
);
203 totalgrid
.store
.setData(data
);
204 data
= me
.getInData(records
[0].data
);
205 ingrid
.store
.setData(data
);
206 data
= me
.getOutData(records
[0].data
);
207 outgrid
.store
.setData(data
);
212 me
.items
= [ totalgrid
, ingrid
, outgrid
];
216 me
.on('destroy', infostore
.destroy
, infostore
);
217 me
.on('destroy', countstore
.destroy
, countstore
);