[UI] Increase Mailadmin loading performance
Merge pull request #4562 from marcojarjour/unblock_mailadmin_upstream
This commit is contained in:
commit
353df6413f
@ -99,37 +99,6 @@ $(document).ready(function() {
|
|||||||
});
|
});
|
||||||
auto_fill_quota($('#addSelectDomain').val());
|
auto_fill_quota($('#addSelectDomain').val());
|
||||||
|
|
||||||
// Read bcc local dests
|
|
||||||
// Using ajax to not be a blocking moo
|
|
||||||
$.get("/api/v1/get/bcc-destination-options", function(data){
|
|
||||||
// Domains
|
|
||||||
var optgroup = "<optgroup label='" + lang.domains + "'>";
|
|
||||||
$.each(data.domains, function(index, domain){
|
|
||||||
optgroup += "<option value='" + domain + "'>" + domain + "</option>"
|
|
||||||
});
|
|
||||||
optgroup += "</optgroup>"
|
|
||||||
$('#bcc-local-dest').append(optgroup);
|
|
||||||
// Alias domains
|
|
||||||
var optgroup = "<optgroup label='" + lang.domain_aliases + "'>";
|
|
||||||
$.each(data.alias_domains, function(index, alias_domain){
|
|
||||||
optgroup += "<option value='" + alias_domain + "'>" + alias_domain + "</option>"
|
|
||||||
});
|
|
||||||
optgroup += "</optgroup>"
|
|
||||||
$('#bcc-local-dest').append(optgroup);
|
|
||||||
// Mailboxes and aliases
|
|
||||||
$.each(data.mailboxes, function(mailbox, aliases){
|
|
||||||
var optgroup = "<optgroup label='" + mailbox + "'>";
|
|
||||||
$.each(aliases, function(index, alias){
|
|
||||||
optgroup += "<option value='" + alias + "'>" + alias + "</option>"
|
|
||||||
});
|
|
||||||
optgroup += "</optgroup>"
|
|
||||||
$('#bcc-local-dest').append(optgroup);
|
|
||||||
});
|
|
||||||
// Finish
|
|
||||||
$('#bcc-local-dest').find('option:selected').remove();
|
|
||||||
$('#bcc-local-dest').selectpicker('refresh');
|
|
||||||
});
|
|
||||||
|
|
||||||
$(".goto_checkbox").click(function( event ) {
|
$(".goto_checkbox").click(function( event ) {
|
||||||
$("form[data-id='add_alias'] .goto_checkbox").not(this).prop('checked', false);
|
$("form[data-id='add_alias'] .goto_checkbox").not(this).prop('checked', false);
|
||||||
if ($("form[data-id='add_alias'] .goto_checkbox:checked").length > 0) {
|
if ($("form[data-id='add_alias'] .goto_checkbox:checked").length > 0) {
|
||||||
@ -623,6 +592,37 @@ jQuery(function($){
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
function draw_bcc_table() {
|
function draw_bcc_table() {
|
||||||
|
// Read bcc local dests
|
||||||
|
// Using ajax to not be a blocking moo
|
||||||
|
$.get("/api/v1/get/bcc-destination-options", function(data){
|
||||||
|
// Domains
|
||||||
|
var optgroup = "<optgroup label='" + lang.domains + "'>";
|
||||||
|
$.each(data.domains, function(index, domain){
|
||||||
|
optgroup += "<option value='" + domain + "'>" + domain + "</option>"
|
||||||
|
});
|
||||||
|
optgroup += "</optgroup>"
|
||||||
|
$('#bcc-local-dest').append(optgroup);
|
||||||
|
// Alias domains
|
||||||
|
var optgroup = "<optgroup label='" + lang.domain_aliases + "'>";
|
||||||
|
$.each(data.alias_domains, function(index, alias_domain){
|
||||||
|
optgroup += "<option value='" + alias_domain + "'>" + alias_domain + "</option>"
|
||||||
|
});
|
||||||
|
optgroup += "</optgroup>"
|
||||||
|
$('#bcc-local-dest').append(optgroup);
|
||||||
|
// Mailboxes and aliases
|
||||||
|
$.each(data.mailboxes, function(mailbox, aliases){
|
||||||
|
var optgroup = "<optgroup label='" + mailbox + "'>";
|
||||||
|
$.each(aliases, function(index, alias){
|
||||||
|
optgroup += "<option value='" + alias + "'>" + alias + "</option>"
|
||||||
|
});
|
||||||
|
optgroup += "</optgroup>"
|
||||||
|
$('#bcc-local-dest').append(optgroup);
|
||||||
|
});
|
||||||
|
// Finish
|
||||||
|
$('#bcc-local-dest').find('option:selected').remove();
|
||||||
|
$('#bcc-local-dest').selectpicker('refresh');
|
||||||
|
});
|
||||||
|
|
||||||
ft_bcc_table = FooTable.init('#bcc_table', {
|
ft_bcc_table = FooTable.init('#bcc_table', {
|
||||||
"columns": [
|
"columns": [
|
||||||
{"name":"chkbox","title":"","style":{"min-width":"60px","width":"60px"},"filterable": false,"sortable": false,"type":"html"},
|
{"name":"chkbox","title":"","style":{"min-width":"60px","width":"60px"},"filterable": false,"sortable": false,"type":"html"},
|
||||||
@ -1160,15 +1160,33 @@ jQuery(function($){
|
|||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
})
|
})
|
||||||
|
|
||||||
draw_domain_table();
|
// detect element visibility changes
|
||||||
draw_mailbox_table();
|
function onVisible(element, callback) {
|
||||||
draw_resource_table();
|
$(element).ready(function() {
|
||||||
draw_alias_table();
|
element_object = document.querySelector(element)
|
||||||
draw_aliasdomain_table();
|
new IntersectionObserver((entries, observer) => {
|
||||||
draw_sync_job_table();
|
entries.forEach(entry => {
|
||||||
draw_filter_table();
|
if(entry.intersectionRatio > 0) {
|
||||||
draw_bcc_table();
|
callback(element_object);
|
||||||
draw_recipient_map_table();
|
observer.disconnect();
|
||||||
draw_tls_policy_table();
|
}
|
||||||
|
});
|
||||||
|
}).observe(element_object);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Load only if the tab is visible
|
||||||
|
onVisible("[id^=tab-domains]", () => draw_domain_table());
|
||||||
|
onVisible("[id^=tab-mailboxes]", () => draw_mailbox_table());
|
||||||
|
onVisible("[id^=tab-resources]", () => draw_resource_table());
|
||||||
|
onVisible("[id^=tab-mbox-aliases]", () => draw_alias_table());
|
||||||
|
onVisible("[id^=tab-domain-aliases]", () => draw_aliasdomain_table());
|
||||||
|
onVisible("[id^=tab-syncjobs]", () => draw_sync_job_table());
|
||||||
|
onVisible("[id^=tab-filters]", () => draw_filter_table());
|
||||||
|
onVisible("[id^=tab-bcc]", () => {
|
||||||
|
draw_bcc_table();
|
||||||
|
draw_recipient_map_table();
|
||||||
|
});
|
||||||
|
onVisible("[id^=tab-tls-policy]", () => draw_tls_policy_table());
|
||||||
|
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user