|
|
@ -6,7 +6,7 @@ import { |
|
|
ModalComponent, |
|
|
ModalComponent, |
|
|
ToasterService, |
|
|
ToasterService, |
|
|
} from '@abp/ng.theme.shared'; |
|
|
} from '@abp/ng.theme.shared'; |
|
|
import { Component, inject, OnInit } from '@angular/core'; |
|
|
import { Component, inject, makeStateKey, OnInit, TransferState } from '@angular/core'; |
|
|
import { toSignal } from '@angular/core/rxjs-interop'; |
|
|
import { toSignal } from '@angular/core/rxjs-interop'; |
|
|
import { |
|
|
import { |
|
|
ReactiveFormsModule, |
|
|
ReactiveFormsModule, |
|
|
@ -23,6 +23,7 @@ import { |
|
|
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'; |
|
|
@ -47,6 +48,7 @@ const { required, email } = Validators; |
|
|
export class EmailSettingGroupComponent implements OnInit { |
|
|
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']), |
|
|
); |
|
|
); |
|
|
@ -57,11 +59,13 @@ 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 emailSettingsService: EmailSettingsService, |
|
|
private emailSettingsService: EmailSettingsService, |
|
|
private fb: UntypedFormBuilder, |
|
|
private fb: UntypedFormBuilder, |
|
|
private toasterService: ToasterService, |
|
|
private toasterService: ToasterService, |
|
|
|
|
|
private transferState: TransferState, |
|
|
) {} |
|
|
) {} |
|
|
|
|
|
|
|
|
ngOnInit() { |
|
|
ngOnInit() { |
|
|
@ -69,9 +73,18 @@ export class EmailSettingGroupComponent implements OnInit { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private getData() { |
|
|
private getData() { |
|
|
this.emailSettingsService.get().subscribe(res => { |
|
|
if (this.transferState.hasKey(this.EMAIL_SETTINGS_KEY)) { |
|
|
this.buildForm(res); |
|
|
const emailSettings = this.transferState.get<EmailSettingsDto>(this.EMAIL_SETTINGS_KEY, null); |
|
|
}); |
|
|
this.buildForm(emailSettings); |
|
|
|
|
|
this.transferState.remove(this.EMAIL_SETTINGS_KEY); |
|
|
|
|
|
} else { |
|
|
|
|
|
this.emailSettingsService.get().subscribe(res => { |
|
|
|
|
|
this.buildForm(res); |
|
|
|
|
|
if (this.ssrService.isSsr) { |
|
|
|
|
|
this.transferState.set(this.EMAIL_SETTINGS_KEY, res); |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private buildForm(emailSettings: EmailSettingsDto) { |
|
|
private buildForm(emailSettings: EmailSettingsDto) { |
|
|
|