From 73d776cdc3c4766d45259d84173afd92bdb26b6b Mon Sep 17 00:00:00 2001 From: apapachristou Date: Fri, 23 Aug 2019 18:27:58 +0300 Subject: [PATCH] Adds error notification on failure email sent, removes funderFormGroup input and get it through grantFormGroup --- .../ui/dmp/editor/dmp-editor.component.html | 2 +- .../editor/grant-tab/grant-tab.component.html | 10 +++++----- .../editor/grant-tab/grant-tab.component.ts | 18 +++++++++--------- .../sidebar-footer/sidebar-footer.component.ts | 1 + dmp-frontend/src/assets/i18n/en.json | 3 ++- 5 files changed, 18 insertions(+), 16 deletions(-) diff --git a/dmp-frontend/src/app/ui/dmp/editor/dmp-editor.component.html b/dmp-frontend/src/app/ui/dmp/editor/dmp-editor.component.html index 29a3a648c..883c157f6 100644 --- a/dmp-frontend/src/app/ui/dmp/editor/dmp-editor.component.html +++ b/dmp-frontend/src/app/ui/dmp/editor/dmp-editor.component.html @@ -49,7 +49,7 @@ work_outline {{ 'DMP-LISTING.COLUMNS.GRANT' | translate }} - + diff --git a/dmp-frontend/src/app/ui/dmp/editor/grant-tab/grant-tab.component.html b/dmp-frontend/src/app/ui/dmp/editor/grant-tab/grant-tab.component.html index 2c11660f4..299520274 100644 --- a/dmp-frontend/src/app/ui/dmp/editor/grant-tab/grant-tab.component.html +++ b/dmp-frontend/src/app/ui/dmp/editor/grant-tab/grant-tab.component.html @@ -5,7 +5,7 @@
- +
@@ -13,10 +13,10 @@
- - - {{funderFormGroup.get('label').getError('backendError').message}} - + + + {{formGroup.get('funder').get('label').getError('backendError').message}} + {{'GENERAL.VALIDATION.REQUIRED' | translate}}
diff --git a/dmp-frontend/src/app/ui/dmp/editor/grant-tab/grant-tab.component.ts b/dmp-frontend/src/app/ui/dmp/editor/grant-tab/grant-tab.component.ts index a86d1fc7d..62821dc85 100644 --- a/dmp-frontend/src/app/ui/dmp/editor/grant-tab/grant-tab.component.ts +++ b/dmp-frontend/src/app/ui/dmp/editor/grant-tab/grant-tab.component.ts @@ -20,7 +20,7 @@ export class GrantTabComponent implements OnInit { @Input() formGroup: FormGroup; @Input() projectFormGroup: FormGroup; - @Input() funderFormGroup: FormGroup; + // @Input() funderFormGroup: FormGroup; @Input() isNew: boolean; @Input() isFinalized: boolean; isCreateNew = false; @@ -67,7 +67,7 @@ export class GrantTabComponent implements OnInit { this.isCreateNew = (this.formGroup.get('label').value != null && this.formGroup.get('label').value.length > 0); this.isCreateNewProject = (this.projectFormGroup.get('label').value != null && this.projectFormGroup.get('label').value.length > 0); - this.isCreateNewFunder = (this.funderFormGroup.get('label').value != null && this.funderFormGroup.get('label').value.length > 0); + this.isCreateNewFunder = (this.formGroup.get('funder').get('label').value != null && this.formGroup.get('funder').get('label').value.length > 0); this.setValidators(); this.setProjectValidators(); this.setFunderValidators(); @@ -149,16 +149,16 @@ export class GrantTabComponent implements OnInit { setFunderValidators() { if (this.isCreateNewFunder) { - this.funderFormGroup.get('existFunder').disable(); - this.funderFormGroup.get('label').enable(); + this.formGroup.get('funder').get('existFunder').disable(); + this.formGroup.get('funder').get('label').enable(); } else if (this.isFinalized) { - this.funderFormGroup.get('existFunder').disable(); - this.funderFormGroup.get('label').disable(); + this.formGroup.get('funder').get('existFunder').disable(); + this.formGroup.get('funder').get('label').disable(); } else { - this.funderFormGroup.get('existFunder').enable(); - this.funderFormGroup.get('label').disable(); - this.funderFormGroup.get('label').reset(); + this.formGroup.get('funder').enable(); + this.formGroup.get('funder').get('label').disable(); + this.formGroup.get('funder').get('label').reset(); } } diff --git a/dmp-frontend/src/app/ui/sidebar/sidebar-footer/sidebar-footer.component.ts b/dmp-frontend/src/app/ui/sidebar/sidebar-footer/sidebar-footer.component.ts index 5cd6689d9..d5edaafc4 100644 --- a/dmp-frontend/src/app/ui/sidebar/sidebar-footer/sidebar-footer.component.ts +++ b/dmp-frontend/src/app/ui/sidebar/sidebar-footer/sidebar-footer.component.ts @@ -68,6 +68,7 @@ export class SidebarFooterComponent extends BaseComponent implements OnInit { onCallbackError(errorResponse: any) { this.setErrorModel(errorResponse.error); this.validateAllFormFields(this.formGroup); + this.uiNotificationService.snackBarNotification(this.language.instant('GENERAL.SNACK-BAR.UNSUCCESSFUL-EMAIL-SEND'), SnackBarNotificationLevel.Error); } public setErrorModel(validationErrorModel: ValidationErrorModel) { diff --git a/dmp-frontend/src/assets/i18n/en.json b/dmp-frontend/src/assets/i18n/en.json index 7f6d4a192..a725a36e3 100644 --- a/dmp-frontend/src/assets/i18n/en.json +++ b/dmp-frontend/src/assets/i18n/en.json @@ -21,7 +21,8 @@ "UNSUCCESSFUL-LOGIN": "Unsuccessful Login", "SUCCESSFUL-DATASET-PROFILE-DELETE": "Successful Delete", "UNSUCCESSFUL-DATASET-PROFILE-DELETE": "This template can not deleted, because Dataset Descriptions are associated with it", - "UNSUCCESSFUL-DELETE": "Unsuccessful Delete" + "UNSUCCESSFUL-DELETE": "Unsuccessful Delete", + "UNSUCCESSFUL-EMAIL-SEND": "Failed sending email" }, "ERRORS": { "HTTP-REQUEST-ERROR": "An Unexpected Error Has Occurred"