From b7df19b790ae2de161d2dc6b1e03cd301ccea9e2 Mon Sep 17 00:00:00 2001 From: Dan Percic Date: Mon, 7 Jun 2021 15:54:48 +0300 Subject: [PATCH 1/3] wip, waiting for backend endpoint --- .../smtp-config-screen.component.html | 32 ++++++++++++++++++- .../smtp-config-screen.component.scss | 20 +++++++++++- .../smtp-config-screen.component.ts | 11 +++++++ .../file-preview-screen.component.scss | 4 --- apps/red-ui/src/assets/i18n/en.json | 7 ++++ .../src/assets/styles/red-page-layout.scss | 6 +++- 6 files changed, 73 insertions(+), 7 deletions(-) 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 0f0bd198d..7b0c4e0f1 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 @@ -21,7 +21,37 @@
-
+
+
+
+
+
+
+
+ + +
+
+
+ +
+
+ +
diff --git a/apps/red-ui/src/app/modules/admin/screens/smtp-config/smtp-config-screen.component.scss b/apps/red-ui/src/app/modules/admin/screens/smtp-config/smtp-config-screen.component.scss index 84d3d1473..9f8fb3eed 100644 --- a/apps/red-ui/src/app/modules/admin/screens/smtp-config/smtp-config-screen.component.scss +++ b/apps/red-ui/src/app/modules/admin/screens/smtp-config/smtp-config-screen.component.scss @@ -4,7 +4,25 @@ .content-container { background-color: $grey-2; display: flex; - justify-content: center; + flex-direction: column; + align-items: center; @include scroll-bar; overflow: auto; } + +.w-100 { + min-width: 100px; + width: 100px; +} + +.inline-input-group { + background-color: rgba($grey-6, 0.8); + width: 100%; + height: 38px; + border-radius: 4px; + padding: 1px 11px; +} + +.dialog { + width: 100%; +} diff --git a/apps/red-ui/src/app/modules/admin/screens/smtp-config/smtp-config-screen.component.ts b/apps/red-ui/src/app/modules/admin/screens/smtp-config/smtp-config-screen.component.ts index 774714b83..bba8c6480 100644 --- a/apps/red-ui/src/app/modules/admin/screens/smtp-config/smtp-config-screen.component.ts +++ b/apps/red-ui/src/app/modules/admin/screens/smtp-config/smtp-config-screen.component.ts @@ -14,6 +14,7 @@ import { TranslateService } from '@ngx-translate/core'; export class SmtpConfigScreenComponent implements OnInit { viewReady = false; configForm: FormGroup; + showForgotPassword = false; private _initialValue: SMTPConfigurationModel; @@ -59,6 +60,10 @@ export class SmtpConfigScreenComponent implements OnInit { return false; } + get generalConfigChanged(): boolean { + return true; + } + async ngOnInit() { await this._loadData(); } @@ -72,6 +77,12 @@ export class SmtpConfigScreenComponent implements OnInit { this.viewReady = true; } + async saveGeneralConfig() { + this.viewReady = false; + console.log('Saving general configuration...'); + this.viewReady = true; + } + openAuthConfigDialog(skipDisableOnCancel?: boolean) { this._dialogService.openSMTPAuthConfigDialog(this.configForm.getRawValue(), authConfig => { if (authConfig) { diff --git a/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/file-preview-screen.component.scss b/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/file-preview-screen.component.scss index 3b84f926d..2ba7f35a8 100644 --- a/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/file-preview-screen.component.scss +++ b/apps/red-ui/src/app/modules/dossier/screens/file-preview-screen/file-preview-screen.component.scss @@ -68,10 +68,6 @@ margin-right: 8px; } -.ml-8 { - margin-left: 8px; -} - .ml-2 { margin-left: 2px; } diff --git a/apps/red-ui/src/assets/i18n/en.json b/apps/red-ui/src/assets/i18n/en.json index ff8d62a9d..faf709953 100644 --- a/apps/red-ui/src/assets/i18n/en.json +++ b/apps/red-ui/src/assets/i18n/en.json @@ -1088,6 +1088,13 @@ }, "configurations": "Configurations", "smtp-config-screen": { + "general": { + "title": "General Configurations", + "subtitle": "", + "form": { + "forgot-password": "Show Forgot password link on Login screen" + } + }, "title": "Configure SMTP Account", "subtitle": "SMTP (Simple Mail Transfer Protocol) enables you to send your emails through the specified server settings.", "actions": { diff --git a/apps/red-ui/src/assets/styles/red-page-layout.scss b/apps/red-ui/src/assets/styles/red-page-layout.scss index a1237d801..afb6047f7 100644 --- a/apps/red-ui/src/assets/styles/red-page-layout.scss +++ b/apps/red-ui/src/assets/styles/red-page-layout.scss @@ -234,7 +234,7 @@ section.settings { } .mt-16 { - margin-top: 16px; + margin-top: 16px !important; } .mt-20 { @@ -253,6 +253,10 @@ section.settings { margin-bottom: 8px !important; } +.ml-8 { + margin-left: 8px; +} + .ml-14 { margin-left: 14px; } From 3fff841463c641ac5dbc21f600a05ae883fe32e0 Mon Sep 17 00:00:00 2001 From: Dan Percic Date: Wed, 16 Jun 2021 18:34:00 +0300 Subject: [PATCH 2/3] fix dialogs on small screens --- .../admin/screens/smtp-config/smtp-config-screen.component.scss | 1 + 1 file changed, 1 insertion(+) diff --git a/apps/red-ui/src/app/modules/admin/screens/smtp-config/smtp-config-screen.component.scss b/apps/red-ui/src/app/modules/admin/screens/smtp-config/smtp-config-screen.component.scss index 9f8fb3eed..71129224b 100644 --- a/apps/red-ui/src/app/modules/admin/screens/smtp-config/smtp-config-screen.component.scss +++ b/apps/red-ui/src/app/modules/admin/screens/smtp-config/smtp-config-screen.component.scss @@ -25,4 +25,5 @@ .dialog { width: 100%; + min-height: unset; } From 915d6d62f69dfc6d4c4c72e9d04ef4e1126c0c69 Mon Sep 17 00:00:00 2001 From: Dan Percic Date: Thu, 24 Jun 2021 13:47:43 +0300 Subject: [PATCH 3/3] link general config with controller service --- .../smtp-config-screen.component.html | 2 +- .../smtp-config-screen.component.ts | 29 +++++++++++++++---- libs/red-ui-http/src/lib/api/api.ts | 6 +++- 3 files changed, 30 insertions(+), 7 deletions(-) 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 ];