[Web] Add domain statistics

master
andryyy 2020-04-06 08:52:27 +02:00
parent f4905ccc32
commit 92f8b4a091
No known key found for this signature in database
GPG Key ID: 8EC34FF2794E25EF
4 changed files with 27 additions and 5 deletions

View File

@ -3238,8 +3238,18 @@ function mailbox($_action, $_type, $_data = null, $_extra = null) {
$domaindata['def_new_mailbox_quota'] = ($row['defquota'] * 1048576); $domaindata['def_new_mailbox_quota'] = ($row['defquota'] * 1048576);
} }
$domaindata['quota_used_in_domain'] = $MailboxDataDomain['in_use']; $domaindata['quota_used_in_domain'] = $MailboxDataDomain['in_use'];
if (!empty($SumQuotaInUse['bytes_total'])) {
$domaindata['bytes_total'] = $SumQuotaInUse['bytes_total']; $domaindata['bytes_total'] = $SumQuotaInUse['bytes_total'];
}
else {
$domaindata['bytes_total'] = 0;
}
if (!empty($SumQuotaInUse['msgs_total'])) {
$domaindata['msgs_total'] = $SumQuotaInUse['msgs_total']; $domaindata['msgs_total'] = $SumQuotaInUse['msgs_total'];
}
else {
$domaindata['msgs_total'] = 0;
}
$domaindata['mboxes_in_domain'] = $MailboxDataDomain['count']; $domaindata['mboxes_in_domain'] = $MailboxDataDomain['count'];
$domaindata['mboxes_left'] = $row['mailboxes'] - $MailboxDataDomain['count']; $domaindata['mboxes_left'] = $row['mailboxes'] - $MailboxDataDomain['count'];
$domaindata['domain_name'] = $row['domain']; $domaindata['domain_name'] = $row['domain'];

View File

@ -247,6 +247,15 @@ jQuery(function($){
return Number(res[0]); return Number(res[0]);
}, },
}, },
{"name":"stats","style":{"whiteSpace":"nowrap"},"title":lang.stats,"formatter": function(value){
res = value.split("/");
return '<span class="glyphicon glyphicon-file" aria-hidden="true"></span> ' + res[0] + ' / ' + humanFileSize(res[1]);
},
"sortValue": function(value){
res = value.split("/");
return Number(res[0]);
},
},
{"name":"def_quota_for_mbox","title":lang.mailbox_defquota,"breakpoints":"xs sm md","style":{"width":"125px"}}, {"name":"def_quota_for_mbox","title":lang.mailbox_defquota,"breakpoints":"xs sm md","style":{"width":"125px"}},
{"name":"max_quota_for_mbox","title":lang.mailbox_quota,"breakpoints":"xs sm","style":{"width":"125px"}}, {"name":"max_quota_for_mbox","title":lang.mailbox_quota,"breakpoints":"xs sm","style":{"width":"125px"}},
{"name":"rl","title":"RL","breakpoints":"xs sm md lg","style":{"maxWidth":"100px","width":"100px"}}, {"name":"rl","title":"RL","breakpoints":"xs sm md lg","style":{"maxWidth":"100px","width":"100px"}},
@ -266,7 +275,8 @@ jQuery(function($){
$.each(data, function (i, item) { $.each(data, function (i, item) {
item.aliases = item.aliases_in_domain + " / " + item.max_num_aliases_for_domain; item.aliases = item.aliases_in_domain + " / " + item.max_num_aliases_for_domain;
item.mailboxes = item.mboxes_in_domain + " / " + item.max_num_mboxes_for_domain; item.mailboxes = item.mboxes_in_domain + " / " + item.max_num_mboxes_for_domain;
item.quota = item.quota_used_in_domain + "/" + item.max_quota_for_domain; item.quota = item.quota_used_in_domain + "/" + item.max_quota_for_domain + "/" + item.bytes_total;
item.stats = item.msgs_total + "/" + item.bytes_total;
if (!item.rl) { if (!item.rl) {
item.rl = '∞'; item.rl = '∞';
} else { } else {
@ -354,7 +364,7 @@ jQuery(function($){
{"name":"last_mail_login","breakpoints":"xs sm","formatter":function unix_time_format(tm) { if (tm == '') { return lang.no; } else { var date = new Date(tm ? tm * 1000 : 0); return date.toLocaleString(); }},"title":lang.last_mail_login,"style":{"width":"170px"}}, {"name":"last_mail_login","breakpoints":"xs sm","formatter":function unix_time_format(tm) { if (tm == '') { return lang.no; } else { var date = new Date(tm ? tm * 1000 : 0); return date.toLocaleString(); }},"title":lang.last_mail_login,"style":{"width":"170px"}},
{"name":"quarantine_notification","filterable": false,"title":lang.quarantine_notification,"breakpoints":"all"}, {"name":"quarantine_notification","filterable": false,"title":lang.quarantine_notification,"breakpoints":"all"},
{"name":"in_use","filterable": false,"type":"html","title":lang.in_use,"sortValue": function(value){ {"name":"in_use","filterable": false,"type":"html","title":lang.in_use,"sortValue": function(value){
return Number($(value).find(".progress-bar").attr('aria-valuenow')); return Number($(value).find(".progress-bar-mailbox").attr('aria-valuenow'));
}, },
}, },
{"name":"messages","filterable": false,"title":lang.msg_num,"breakpoints":"xs sm md"}, {"name":"messages","filterable": false,"title":lang.msg_num,"breakpoints":"xs sm md"},
@ -413,7 +423,7 @@ jQuery(function($){
'</div>'; '</div>';
} }
item.in_use = '<div class="progress">' + item.in_use = '<div class="progress">' +
'<div class="progress-bar progress-bar-' + item.percent_class + ' role="progressbar" aria-valuenow="' + item.percent_in_use + '" aria-valuemin="0" aria-valuemax="100" ' + '<div class="progress-bar-mailbox progress-bar progress-bar-' + item.percent_class + '" role="progressbar" aria-valuenow="' + item.percent_in_use + '" aria-valuemin="0" aria-valuemax="100" ' +
'style="min-width:2em;width:' + item.percent_in_use + '%">' + item.percent_in_use + '%' + '</div></div>'; 'style="min-width:2em;width:' + item.percent_in_use + '%">' + item.percent_in_use + '%' + '</div></div>';
item.username = escapeHtml(item.username); item.username = escapeHtml(item.username);
}); });

View File

@ -572,6 +572,7 @@
"notified": "Benachrichtigt" "notified": "Benachrichtigt"
}, },
"mailbox": { "mailbox": {
"stats": "Statistik",
"last_mail_login": "Letzter Mail-Login", "last_mail_login": "Letzter Mail-Login",
"table_size": "Tabellengröße", "table_size": "Tabellengröße",
"table_size_show_n": "Zeige %s Einträge", "table_size_show_n": "Zeige %s Einträge",

View File

@ -571,6 +571,7 @@
"notified": "Notified" "notified": "Notified"
}, },
"mailbox": { "mailbox": {
"stats": "Statistics",
"last_mail_login": "Last mail login", "last_mail_login": "Last mail login",
"table_size": "Table size", "table_size": "Table size",
"table_size_show_n": "Show %s items", "table_size_show_n": "Show %s items",