|
|
@ -6,7 +6,7 @@ import { |
|
|
ModalComponent, |
|
|
ModalComponent, |
|
|
ToasterService, |
|
|
ToasterService, |
|
|
} from '@abp/ng.theme.shared'; |
|
|
} from '@abp/ng.theme.shared'; |
|
|
import { Component, inject, makeStateKey, OnInit, TransferState } from '@angular/core'; |
|
|
import { Component, inject, OnInit } from '@angular/core'; |
|
|
import { toSignal } from '@angular/core/rxjs-interop'; |
|
|
import { toSignal } from '@angular/core/rxjs-interop'; |
|
|
import { |
|
|
import { |
|
|
ReactiveFormsModule, |
|
|
ReactiveFormsModule, |
|
|
@ -22,8 +22,7 @@ import { |
|
|
ConfigStateService, |
|
|
ConfigStateService, |
|
|
LocalizationPipe, |
|
|
LocalizationPipe, |
|
|
LocalizationService, |
|
|
LocalizationService, |
|
|
PermissionDirective, |
|
|
PermissionDirective |
|
|
SSRService, |
|
|
|
|
|
} from '@abp/ng.core'; |
|
|
} from '@abp/ng.core'; |
|
|
import { NgxValidateCoreModule } from '@ngx-validate/core'; |
|
|
import { NgxValidateCoreModule } from '@ngx-validate/core'; |
|
|
import { CommonModule } from '@angular/common'; |
|
|
import { CommonModule } from '@angular/common'; |
|
|
@ -52,7 +51,6 @@ export class EmailSettingGroupComponent implements OnInit { |
|
|
|
|
|
|
|
|
protected readonly localizationService = inject(LocalizationService); |
|
|
protected readonly localizationService = inject(LocalizationService); |
|
|
protected readonly configStateSevice = inject(ConfigStateService); |
|
|
protected readonly configStateSevice = inject(ConfigStateService); |
|
|
protected readonly ssrService = inject(SSRService); |
|
|
|
|
|
protected readonly currentUserEmail = toSignal( |
|
|
protected readonly currentUserEmail = toSignal( |
|
|
this.configStateSevice.getDeep$(['currentUser', 'email']), |
|
|
this.configStateSevice.getDeep$(['currentUser', 'email']), |
|
|
); |
|
|
); |
|
|
@ -63,29 +61,17 @@ export class EmailSettingGroupComponent implements OnInit { |
|
|
emailingPolicy = SettingManagementPolicyNames.Emailing; |
|
|
emailingPolicy = SettingManagementPolicyNames.Emailing; |
|
|
isEmailTestModalOpen = false; |
|
|
isEmailTestModalOpen = false; |
|
|
modalSize: NgbModalOptions = { size: 'lg' }; |
|
|
modalSize: NgbModalOptions = { size: 'lg' }; |
|
|
EMAIL_SETTINGS_KEY = makeStateKey<any>('emailSettings'); |
|
|
|
|
|
|
|
|
|
|
|
constructor( |
|
|
constructor() {} |
|
|
private transferState: TransferState, |
|
|
|
|
|
) {} |
|
|
|
|
|
|
|
|
|
|
|
ngOnInit() { |
|
|
ngOnInit() { |
|
|
this.getData(); |
|
|
this.getData(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private getData() { |
|
|
private getData() { |
|
|
if (this.transferState.hasKey(this.EMAIL_SETTINGS_KEY)) { |
|
|
this.emailSettingsService.get().subscribe(res => { |
|
|
const emailSettings = this.transferState.get<EmailSettingsDto>(this.EMAIL_SETTINGS_KEY, null); |
|
|
this.buildForm(res); |
|
|
this.buildForm(emailSettings); |
|
|
}); |
|
|
this.transferState.remove(this.EMAIL_SETTINGS_KEY); |
|
|
|
|
|
} else { |
|
|
|
|
|
this.emailSettingsService.get().subscribe(res => { |
|
|
|
|
|
this.buildForm(res); |
|
|
|
|
|
if (this.ssrService.isServer) { |
|
|
|
|
|
this.transferState.set(this.EMAIL_SETTINGS_KEY, res); |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private buildForm(emailSettings: EmailSettingsDto) { |
|
|
private buildForm(emailSettings: EmailSettingsDto) { |
|
|
|