diff --git a/dmp-frontend/src/app/dmps/editor/dmp-editor.component.html b/dmp-frontend/src/app/dmps/editor/dmp-editor.component.html index f2ed12c21..3efcfbe34 100644 --- a/dmp-frontend/src/app/dmps/editor/dmp-editor.component.html +++ b/dmp-frontend/src/app/dmps/editor/dmp-editor.component.html @@ -67,7 +67,7 @@ - +

Associated Users

person diff --git a/dmp-frontend/src/app/invitation/invitation.component.ts b/dmp-frontend/src/app/invitation/invitation.component.ts index 32527c36f..5e98b9935 100644 --- a/dmp-frontend/src/app/invitation/invitation.component.ts +++ b/dmp-frontend/src/app/invitation/invitation.component.ts @@ -7,7 +7,7 @@ import { User } from '../models/invitation/User'; import { Component, OnInit, Inject } from "@angular/core"; import { FormGroup } from '@angular/forms'; import { Params, ActivatedRoute, Router } from '@angular/router'; -import { MAT_DIALOG_DATA } from '@angular/material'; +import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material'; @Component({ selector: 'app-invitation-component', @@ -27,6 +27,7 @@ export class InvitationComponent implements OnInit { private invitationService: InvitationService, private route: ActivatedRoute, public router: Router, + public dialogRef: MatDialogRef, @Inject(MAT_DIALOG_DATA) public data: any ) { } @@ -38,7 +39,9 @@ export class InvitationComponent implements OnInit { send(value: any) { - this.invitationService.inviteUsers(this.formGroup.value).subscribe(); + this.invitationService.inviteUsers(this.formGroup.value).subscribe( + null,null,()=>this.dialogRef.close() + ); } filterUsers(value: string): void { diff --git a/dmp-frontend/src/app/utilities/cite-http-service-module/base-http.service.ts b/dmp-frontend/src/app/utilities/cite-http-service-module/base-http.service.ts index 588a1698e..31ca4bf26 100644 --- a/dmp-frontend/src/app/utilities/cite-http-service-module/base-http.service.ts +++ b/dmp-frontend/src/app/utilities/cite-http-service-module/base-http.service.ts @@ -1,3 +1,4 @@ +import { Message } from '@angular/compiler/src/i18n/i18n_ast'; import { ApiMessageCode } from '../types/ApiMessageCode'; import { Injectable } from '@angular/core'; import { Http, RequestOptions, Response, Headers } from '@angular/http'; @@ -80,11 +81,27 @@ export class BaseHttpService { //this.notification.httpError(error); return Observable.of(); } else { - return Observable.throw(errorResponse); + let error:any = errorResponse.error + if(error.statusCode == ApiMessageCode.ERROR_MESSAGE){ + this.snackBar.openFromComponent(SnackBarNotificationComponent, { + data: { message: error.message, language: null }, + duration: 3000, + extraClasses: ['snackbar-warning'] + }) + return Observable.throw(errorResponse); + } + else{ + this.snackBar.openFromComponent(SnackBarNotificationComponent, { + data: { message: 'GENERAL.ERRORS.HTTP-REQUEST-ERROR', language: this.language }, + duration: 3000, + extraClasses: ['snackbar-warning'] + }) + return Observable.throw(errorResponse); + } } }) .map(response => { - if (response.statusCode = ApiMessageCode.SUCCESS_MESSAGE) { + if (response.statusCode == ApiMessageCode.SUCCESS_MESSAGE) { //throw new Error('Request failed'); this.snackBar.openFromComponent(SnackBarNotificationComponent, { data: { message: response.message, language: null }, @@ -94,7 +111,10 @@ export class BaseHttpService { return response.payload; } - else { + else if(response.statusCode == ApiMessageCode.NO_MESSAGE){ + return response.payload; + } + else{ return response.payload; } }); diff --git a/dmp-frontend/src/assets/lang/en.json b/dmp-frontend/src/assets/lang/en.json index 6111b9e86..c6b290fa4 100644 --- a/dmp-frontend/src/assets/lang/en.json +++ b/dmp-frontend/src/assets/lang/en.json @@ -16,6 +16,9 @@ "SUCCESSFUL-LOGOUT": "Successful Logout", "UNSUCCESSFUL-LOGOUT": "Unsuccessful Logout", "UNSUCCESSFUL-LOGIN": "Unsuccessful Login" + }, + "ERROR":{ + "HTTP-REQUEST-ERROR":"AN Unexpected Error Has Occured" } }, "NAV-BAR": {