No affiliations found
diff --git a/ui/src/app/affiliation/affiliations.component.spec.ts b/ui/src/app/affiliation/affiliations.component.spec.ts
index dbc1d4c19..ca5290df0 100644
--- a/ui/src/app/affiliation/affiliations.component.spec.ts
+++ b/ui/src/app/affiliation/affiliations.component.spec.ts
@@ -1,18 +1,11 @@
import { ComponentFixture, TestBed, tick, fakeAsync } from '@angular/core/testing'
import { FormsModule, ReactiveFormsModule } from '@angular/forms'
-import { RouterTestingModule } from '@angular/router/testing'
-import { EMPTY, of, throwError } from 'rxjs'
-import { MemberService } from 'src/app/member/service/member.service'
-import { AccountService, LoginService } from 'src/app/account'
-import { By } from '@angular/platform-browser'
+import { EMPTY, of } from 'rxjs'
+import { AccountService } from 'src/app/account'
import { HasAnyAuthorityDirective } from 'src/app/shared/directive/has-any-authority.directive'
-import { HttpHeaders, HttpResponse } from '@angular/common/http'
-import { Member } from 'src/app/member/model/member.model'
import { AlertService } from '../shared/service/alert.service'
import { EventService } from '../shared/service/event.service'
import { LocalizePipe } from '../shared/pipe/localize'
-import { EventType } from 'src/app/app.constants'
-import { Event } from '../shared/model/event.model'
import { RouterModule } from '@angular/router'
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'
import { AffiliationsComponent } from './affiliations.component'
diff --git a/ui/src/app/affiliation/affiliations.component.ts b/ui/src/app/affiliation/affiliations.component.ts
index 5eddaee12..cbbd95ae4 100644
--- a/ui/src/app/affiliation/affiliations.component.ts
+++ b/ui/src/app/affiliation/affiliations.component.ts
@@ -2,7 +2,7 @@ import { Component, OnDestroy, OnInit } from '@angular/core'
import { IAffiliation, IAffiliationPage } from './model/affiliation.model'
import { AFFILIATION_STATUS } from '../shared/constants/orcid-api.constants'
import { Subscription, delay, tap } from 'rxjs'
-import { EventType, ITEMS_PER_PAGE, ORCID_BASE_URL } from '../app.constants'
+import { AlertType, EventType, ITEMS_PER_PAGE, ORCID_BASE_URL } from '../app.constants'
import {
faChartBar,
faFileDownload,
@@ -34,7 +34,6 @@ export class AffiliationsComponent implements OnInit, OnDestroy {
errorDeletingInOrcid: string = AFFILIATION_STATUS.ERROR_DELETING_IN_ORCID
currentAccount: any
affiliations: IAffiliation[] | null | undefined
- error: any
success: any
eventSubscriber: Subscription | undefined
importEventSubscriber: Subscription | undefined
@@ -87,7 +86,6 @@ export class AffiliationsComponent implements OnInit, OnDestroy {
this.searchTerm = ''
this.submittedSearchTerm = ''
this.loadAll()
- console.log('test')
})
this.importEventSubscriber = this.eventService.on(EventType.IMPORT_AFFILIATIONS).subscribe(() => {
this.loadAll()
@@ -228,10 +226,6 @@ export class AffiliationsComponent implements OnInit, OnDestroy {
this.itemCount = $localize`:@@global.item-count.string:Showing ${first} - ${second} of ${this.totalItems} items.`
}
- protected onError(errorMessage: string) {
- this.alertService.broadcast(errorMessage)
- }
-
ngOnDestroy() {
if (this.notificationSubscription) {
this.notificationSubscription.unsubscribe()
diff --git a/ui/src/app/affiliation/send-notifications-dialog.component.ts b/ui/src/app/affiliation/send-notifications-dialog.component.ts
index 7d8d4d84e..bc7b34f71 100644
--- a/ui/src/app/affiliation/send-notifications-dialog.component.ts
+++ b/ui/src/app/affiliation/send-notifications-dialog.component.ts
@@ -8,7 +8,7 @@ import { faPaperPlane } from '@fortawesome/free-solid-svg-icons'
import { MemberService } from '../member/service/member.service'
import { LanguageService } from '../shared/service/language.service'
import { AccountService } from '../account'
-import { AlertType, EventType } from '../app.constants'
+import { AlertMessage, AlertType, EventType } from '../app.constants'
import { ActivatedRoute, Router } from '@angular/router'
@Component({
@@ -60,7 +60,7 @@ export class SendNotificationsDialogComponent implements OnInit {
this.requestAlreadyInProgress = true
} else {
this.notificationService.updateStatuses(this.language).subscribe(() => {
- this.alertService.broadcast(AlertType.NOTIFICATION_IN_PROGRESS)
+ this.alertService.broadcast(AlertType.TOAST, AlertMessage.NOTIFICATION_IN_PROGRESS)
this.close()
})
}
diff --git a/ui/src/app/app.component.spec.ts b/ui/src/app/app.component.spec.ts
index 4de7a53d4..107a4c1b6 100644
--- a/ui/src/app/app.component.spec.ts
+++ b/ui/src/app/app.component.spec.ts
@@ -18,10 +18,4 @@ describe('AppComponent', () => {
const app = fixture.componentInstance
expect(app).toBeTruthy()
})
-
- it(`should have as title 'ui'`, () => {
- const fixture = TestBed.createComponent(AppComponent)
- const app = fixture.componentInstance
- expect(app.title).toEqual('ui')
- })
})
diff --git a/ui/src/app/app.component.ts b/ui/src/app/app.component.ts
index d30ceb763..926d932a7 100644
--- a/ui/src/app/app.component.ts
+++ b/ui/src/app/app.component.ts
@@ -6,7 +6,4 @@ import { HttpClient } from '@angular/common/http'
templateUrl: './app.component.html',
styleUrls: ['./app.component.scss'],
})
-export class AppComponent {
- title = 'ui';
- constructor(private http: HttpClient) {}
-}
+export class AppComponent {}
diff --git a/ui/src/app/app.constants.ts b/ui/src/app/app.constants.ts
index ca18715e8..7e5e75c72 100644
--- a/ui/src/app/app.constants.ts
+++ b/ui/src/app/app.constants.ts
@@ -11,7 +11,7 @@ export enum EventType {
MEMBER_LIST_MODIFICATION,
}
-export enum AlertType {
+export enum AlertMessage {
SEND_ACTIVATION_SUCCESS = 'Invite sent.',
SEND_ACTIVATION_FAILURE = 'Invite email couldn`t be sent.',
USER_CREATED = 'User created. Invite sent.',
@@ -26,6 +26,13 @@ export enum AlertType {
AFFILIATION_DELETE_FAILURE = 'There was a problem deleting the affiliation',
}
+export enum AlertType {
+ CONTACT_UPDATED,
+ CONSORTIUM_MEMBER_ADDED,
+ CONSORTIUM_MEMBER_REMOVED,
+ TOAST,
+}
+
export const EMAIL_NOT_FOUND_TYPE = 'https://www.jhipster.tech/problem/email-not-found'
export const DATE_FORMAT = 'YYYY-MM-DD'
diff --git a/ui/src/app/error/error-alert.component.ts b/ui/src/app/error/error-alert.component.ts
index d009990f6..43c551a35 100644
--- a/ui/src/app/error/error-alert.component.ts
+++ b/ui/src/app/error/error-alert.component.ts
@@ -4,7 +4,7 @@ import { Subscription } from 'rxjs'
import { AppError, ErrorAlert } from './model/error.model'
@Component({
- selector: 'app-error-alert',
+ selector: 'app-alert-error',
templateUrl: './error-alert.component.html',
})
export class ErrorAlertComponent implements OnInit {
@@ -18,6 +18,8 @@ export class ErrorAlertComponent implements OnInit {
ngOnInit(): void {
this.sub = this.errorService.on().subscribe((err: AppError) => {
+ console.log(err)
+
const alert: ErrorAlert = {
type: 'danger',
msg: err.message,
diff --git a/ui/src/app/error/service/error.service.ts b/ui/src/app/error/service/error.service.ts
index 8cbd48a6e..a00ce914c 100644
--- a/ui/src/app/error/service/error.service.ts
+++ b/ui/src/app/error/service/error.service.ts
@@ -11,8 +11,10 @@ export class ErrorService implements ErrorHandler {
private errors: Subject
= new Subject()
handleError(error: any) {
+ console.log(error)
+
if (error instanceof HttpErrorResponse) {
- this.errors.next(new AppError(error.status, error.error.title))
+ this.errors.next(new AppError(error.status, error.error.title || error.message))
} else {
console.error('Unknown error occurred', error)
}
diff --git a/ui/src/app/home/home.component.html b/ui/src/app/home/home.component.html
index 8261061be..3541e3439 100644
--- a/ui/src/app/home/home.component.html
+++ b/ui/src/app/home/home.component.html
@@ -4,3 +4,6 @@