mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-04-02 13:45:10 -05:00
Dynamically load mail rules / accounts settings
This commit is contained in:
parent
4cb4d6adcd
commit
52d3a8703c
@ -227,7 +227,7 @@
|
|||||||
</ng-template>
|
</ng-template>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li [ngbNavItem]="4">
|
<li [ngbNavItem]="SettingsNavIDs.Mail" (mouseover)="maybeInitializeTab(SettingsNavIDs.Mail)" (focusin)="maybeInitializeTab(SettingsNavIDs.Mail)">
|
||||||
<a ngbNavLink i18n>Mail</a>
|
<a ngbNavLink i18n>Mail</a>
|
||||||
<ng-template ngbNavContent>
|
<ng-template ngbNavContent>
|
||||||
|
|
||||||
@ -257,7 +257,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<div *ngIf="mailAccounts.length == 0" i18n>No mail accounts defined.</div>
|
<div *ngIf="mailAccounts.length == 0" i18n>No mail accounts defined.</div>
|
||||||
@ -288,11 +287,16 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<div *ngIf="mailRules.length == 0" i18n>No mail rules defined.</div>
|
<div *ngIf="mailRules.length == 0" i18n>No mail rules defined.</div>
|
||||||
</ul>
|
</ul>
|
||||||
|
</ng-container>
|
||||||
|
|
||||||
|
<div *ngIf="!mailAccounts || !mailRules">
|
||||||
|
<div class="spinner-border spinner-border-sm fw-normal ms-2 me-auto" role="status"></div>
|
||||||
|
<div class="visually-hidden" i18n>Loading...</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
</ng-template>
|
</ng-template>
|
||||||
</li>
|
</li>
|
||||||
|
@ -196,6 +196,18 @@ export class SettingsComponent
|
|||||||
this.savedViews = r.results
|
this.savedViews = r.results
|
||||||
this.initialize()
|
this.initialize()
|
||||||
})
|
})
|
||||||
|
} else if (
|
||||||
|
(navID == SettingsNavIDs.Mail && !this.mailAccounts) ||
|
||||||
|
!this.mailRules
|
||||||
|
) {
|
||||||
|
this.mailAccountService.listAll().subscribe((r) => {
|
||||||
|
this.mailAccounts = r.results
|
||||||
|
|
||||||
|
this.mailRuleService.listAll().subscribe((r) => {
|
||||||
|
this.mailRules = r.results
|
||||||
|
this.initialize()
|
||||||
|
})
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -224,6 +236,7 @@ export class SettingsComponent
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.mailAccounts && this.mailRules) {
|
||||||
for (let account of this.mailAccounts) {
|
for (let account of this.mailAccounts) {
|
||||||
storeData.mailAccounts[account.id.toString()] = {
|
storeData.mailAccounts[account.id.toString()] = {
|
||||||
id: account.id,
|
id: account.id,
|
||||||
@ -293,6 +306,7 @@ export class SettingsComponent
|
|||||||
})
|
})
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
this.store = new BehaviorSubject(storeData)
|
this.store = new BehaviorSubject(storeData)
|
||||||
|
|
||||||
|
@ -13,7 +13,6 @@ export class MailAccountService extends AbstractPaperlessService<PaperlessMailAc
|
|||||||
|
|
||||||
constructor(http: HttpClient) {
|
constructor(http: HttpClient) {
|
||||||
super(http, 'mail_accounts')
|
super(http, 'mail_accounts')
|
||||||
this.reload()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private reload() {
|
private reload() {
|
||||||
|
@ -13,7 +13,6 @@ export class MailRuleService extends AbstractPaperlessService<PaperlessMailRule>
|
|||||||
|
|
||||||
constructor(http: HttpClient) {
|
constructor(http: HttpClient) {
|
||||||
super(http, 'mail_rules')
|
super(http, 'mail_rules')
|
||||||
this.reload()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private reload() {
|
private reload() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user