]>
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
: '10 0 0 0',
16 title
: gettext('Statistics') + ': ' + gettext('Mail'),
18 tbar
: [{ xtype
: 'pmgStatTimeSelector' }],
20 getInData: function(data
) {
24 name
: gettext("Incoming Mails"),
30 name
: gettext("Junk Mails"),
32 percentage
: data
.junk_in
/data
.count_in
,
36 name
: gettext("Greylisted Mails"),
38 percentage
: data
.glcount
/data
.count_in
,
42 name
: gettext("Spam Mails"),
43 value
: data
.spamcount_in
,
44 percentage
: data
.spamcount_in
/data
.count_in
,
48 name
: gettext("SPF rejects"),
50 percentage
: data
.spfcount
/data
.count_in
,
54 name
: gettext("Bounces"),
55 value
: data
.bounces_in
,
56 percentage
: data
.bounces_in
/data
.count_in
,
60 name
: gettext("Virus Mails"),
61 value
: data
.viruscount_in
,
62 percentage
: data
.viruscount_in
/data
.count_in
,
68 getOutData: function(data
) {
72 name
: gettext("Outgoing Mails"),
73 value
: data
.count_out
,
78 name
: gettext("Bounces"),
79 value
: data
.bounces_out
,
80 percentage
: data
.bounces_out
/data
.count_out
,
84 name
: gettext("Virus Mails"),
85 value
: data
.viruscount_out
,
86 percentage
: data
.viruscount_out
/data
.count_out
,
92 getGeneralData: function(data
) {
96 name
: gettext("Total Mails"),
102 name
: gettext("Incoming Mails"),
103 value
: data
.count_in
,
104 percentage
: data
.count_in
/data
.count
,
108 name
: gettext("Outgoing Mails"),
109 value
: data
.count_out
,
110 percentage
: data
.count_out
/data
.count
,
114 name
: gettext("Virus Outbreaks"),
115 value
: data
.viruscount_out
,
119 name
: gettext("Avg. Mail Processing Time"),
120 value
: Ext
.String
.format(gettext("{0} seconds"),
121 Ext
.Number
.toFixed(data
.avptime
, 2)),
125 name
: gettext("Incoming Mail Traffic"),
126 value
: Ext
.Number
.toFixed(data
.bytes_in
/(1024*1024), 2) + ' MiB',
130 name
: gettext("Outgoing Mail Traffic"),
131 value
: Ext
.Number
.toFixed(data
.bytes_out
/(1024*1024), 2) + ' MiB',
136 initComponent: function() {
139 var countstore
= Ext
.create('PMG.data.StatStore', {
140 includeTimeSpan
: true,
141 staturl
: '/api2/json/statistics/mailcount',
143 { type
: 'integer', name
: 'count' },
144 { type
: 'integer', name
: 'count_in' },
145 { type
: 'integer', name
: 'count_out' },
146 { type
: 'integer', name
: 'spamcount_in' },
147 { type
: 'integer', name
: 'spamcount_out' },
148 { type
: 'integer', name
: 'viruscount_in' },
149 { type
: 'integer', name
: 'viruscount_out' },
150 { type
: 'integer', name
: 'bounces_in' },
151 { type
: 'integer', name
: 'bounces_out' },
152 { type
: 'date', dateFormat
: 'timestamp', name
: 'time' },
156 var totalgrid
= Ext
.createWidget('pmgMailStatGrid', {
160 title
: gettext("Total Mail Count"),
161 xtype
: 'proxmoxRRDChart',
162 fields
: ['count', 'count_in', 'count_out'],
164 gettext('Total Mail Count'),
165 gettext('Incoming Mails'), gettext('Outgoing Mails')],
171 var ingrid
= Ext
.createWidget('pmgMailStatGrid', {
175 title
: gettext("Incoming Mails"),
176 xtype
: 'proxmoxRRDChart',
177 fields
: ['count_in', 'spamcount_in', 'viruscount_in', 'bounces_in'],
179 gettext('Incoming Mails'), gettext('Junk Mails'),
180 gettext('Virus Mails'), gettext('Bounces')],
186 var outgrid
= Ext
.createWidget('pmgMailStatGrid', {
190 title
: gettext("Outgoing Mails"),
191 xtype
: 'proxmoxRRDChart',
192 fields
: ['count_out', 'viruscount_out', 'bounces_out'],
194 gettext('Outgoing Mails'),
195 gettext('Virus Mails'), gettext('Bounces')],
201 var infostore
= Ext
.create('PMG.data.StatStore', {
202 staturl
: "/api2/json/statistics/mail",
203 fields
: ['name', 'value', 'percentage'],
205 load: function(store
, records
, success
) {
206 if (!success
|| records
.length
<= 0) {
209 var data
= me
.getGeneralData(records
[0].data
);
210 totalgrid
.store
.setData(data
);
211 data
= me
.getInData(records
[0].data
);
212 ingrid
.store
.setData(data
);
213 data
= me
.getOutData(records
[0].data
);
214 outgrid
.store
.setData(data
);
219 me
.items
= [totalgrid
, ingrid
, outgrid
];
223 me
.on('destroy', infostore
.destroy
, infostore
);
224 me
.on('destroy', countstore
.destroy
, countstore
);