email: rewrite loading of email status using async

we start a bunch of requests in the background for each domain. when
we switch views immediately, to say the eventlog, these requests are
still active in the background.

canceling the requests will require a much bigger refactor.

https://forum.cloudron.io/topic/10434/email-event-log-loading-very-slowly-seems-tied-to-overall-email-domain-list-health-checks
This commit is contained in:
Girish Ramakrishnan
2024-01-09 14:59:29 +01:00
parent ca31dc8d78
commit 7a5e990ad4
3 changed files with 84 additions and 31 deletions

View File

@@ -195,10 +195,20 @@
</td>
<td class="elide-table-cell no-padding">
<a href="/#/email/{{ domain.domain }}" class="email-domain-list-item">
<span ng-show="domain.inbound && domain.outbound && domain.usage === null">{{ 'main.loadingPlaceholder' | tr }} ...</span>
<span ng-show="domain.inbound && domain.outbound && domain.usage !== null">{{ 'emails.domains.stats' | tr:{ mailboxCount: domain.mailboxCount, usage: (domain.usage | prettyDecimalSize) } }}</span>
<span ng-show="!domain.inbound && domain.outbound">{{ 'emails.domains.outbound' | tr }}</span>
<span ng-show="!domain.inbound && !domain.outbound">{{ 'emails.domains.disabled' | tr }}</span>
<span ng-switch on="domain.loading">
<span ng-switch-when="true">{{ 'main.loadingPlaceholder' | tr }} ...</span>
<span ng-switch-default>
<span ng-switch on="domain.inbound">
<span ng-switch-when="true">
<span ng-show="domain.loadingUsage">{{ 'emails.domains.stats' | tr:{ mailboxCount: domain.mailboxCount } }} {{ 'main.loadingPlaceholder' | tr }} ... </span>
<span ng-show="!domain.loadingUsage">{{ 'emails.domains.stats' | tr:{ mailboxCount: domain.mailboxCount, usage: (domain.usage | prettyDecimalSize) } }}</span>
</span>
<span ng-switch-default>
<span ng-show="domain.outbound">{{ 'emails.domains.outbound' | tr }}</span>
<span ng-show="!domain.outbound">{{ 'emails.domains.disabled' | tr }}</span>
</span>
</span>
</span>
</a>
</td>
<td class="text-right no-wrap">