diff --git a/apps/red-ui/src/app/modules/admin/screens/smtp-config/smtp-config-screen.component.html b/apps/red-ui/src/app/modules/admin/screens/smtp-config/smtp-config-screen.component.html index 7b0c4e0f1..dc30c3055 100644 --- a/apps/red-ui/src/app/modules/admin/screens/smtp-config/smtp-config-screen.component.html +++ b/apps/red-ui/src/app/modules/admin/screens/smtp-config/smtp-config-screen.component.html @@ -29,7 +29,7 @@
this.generalSettings[key] !== this._initialGeneralSettings[key]; + const changes = Object.keys(this.generalSettings).map(toBool); + return changes.filter(value => value).length > 0; } async ngOnInit() { await this._loadData(); + this.generalSettings = await this._generalSettingsControllerService + .getGeneralConfigurations() + .toPromise(); + this._initialGeneralSettings = Object.assign({}, this.generalSettings); } async save() { @@ -79,7 +96,9 @@ export class SmtpConfigScreenComponent implements OnInit { async saveGeneralConfig() { this.viewReady = false; - console.log('Saving general configuration...'); + await this._generalSettingsControllerService + .updateGeneralConfigurations(this.generalSettings) + .toPromise(); this.viewReady = true; } diff --git a/libs/red-ui-http/src/lib/api/api.ts b/libs/red-ui-http/src/lib/api/api.ts index bd27628a0..a72d3672b 100644 --- a/libs/red-ui-http/src/lib/api/api.ts +++ b/libs/red-ui-http/src/lib/api/api.ts @@ -23,6 +23,7 @@ import { FileAttributesControllerService } from './fileAttributesController.serv import { SmtpConfigurationControllerService } from './smtpConfigurationController.service'; import { ReportTemplateControllerService } from './reportTemplateController.service'; import { UploadControllerService } from './uploadController.service'; +import { GeneralSettingsControllerService } from './generalSettingsController.service'; export * from './auditController.service'; @@ -74,6 +75,8 @@ export * from './reportTemplateController.service'; export * from './uploadController.service'; +export * from './generalSettingsController.service'; + export const APIS = [ AuditControllerService, DebugControllerService, @@ -99,5 +102,6 @@ export const APIS = [ FileAttributesControllerService, SmtpConfigurationControllerService, ReportTemplateControllerService, - UploadControllerService + UploadControllerService, + GeneralSettingsControllerService ];