diff --git a/ui/src/app/account/login/login.component.ts b/ui/src/app/account/login/login.component.ts index 9969e4782..f8b06be60 100644 --- a/ui/src/app/account/login/login.component.ts +++ b/ui/src/app/account/login/login.component.ts @@ -38,7 +38,7 @@ export class LoginComponent implements AfterViewInit, OnDestroy { private ngZone: NgZone ) { this.sub = this.eventService.on(EventType.LOG_IN_SUCCESS).subscribe((e) => { - console.log(e.payload) + console.log('login success') }) } @@ -109,7 +109,7 @@ export class LoginComponent implements AfterViewInit, OnDestroy { this.router.navigate(['']) }) - this.eventService.broadcast(new Event(EventType.LOG_IN_SUCCESS, 'logged in')) + this.eventService.broadcast(new Event(EventType.LOG_IN_SUCCESS)) // previousState was set in the authExpiredInterceptor before being redirected to login modal. // since login is successful, go to stored previousState and clear previousState diff --git a/ui/src/app/affiliation/affiliation-delete.component.spec.ts b/ui/src/app/affiliation/affiliation-delete.component.spec.ts index 53ff733a1..366ed9392 100644 --- a/ui/src/app/affiliation/affiliation-delete.component.spec.ts +++ b/ui/src/app/affiliation/affiliation-delete.component.spec.ts @@ -45,18 +45,14 @@ describe('AffiliationDeleteComponent', () => { affiliationService.delete.and.returnValue(of(true)) component.confirmDelete('id') - expect(eventService.broadcast).toHaveBeenCalledWith( - new Event(EventType.AFFILIATION_LIST_MODIFICATION, 'Deleted an affiliation') - ) + expect(eventService.broadcast).toHaveBeenCalledWith(new Event(EventType.AFFILIATION_LIST_MODIFICATION)) }) it('should fail to delete the affiliation', () => { affiliationService.delete.and.returnValue(of(false)) component.confirmDelete('id') - expect(eventService.broadcast).toHaveBeenCalledWith( - new Event(EventType.AFFILIATION_LIST_MODIFICATION, 'Failed to delete an affiliation') - ) + expect(eventService.broadcast).toHaveBeenCalledWith(new Event(EventType.AFFILIATION_LIST_MODIFICATION)) }) it('should not call the assertion service without an id', () => { diff --git a/ui/src/app/affiliation/affiliation-delete.component.ts b/ui/src/app/affiliation/affiliation-delete.component.ts index 8dcf23cfe..cedb715f0 100644 --- a/ui/src/app/affiliation/affiliation-delete.component.ts +++ b/ui/src/app/affiliation/affiliation-delete.component.ts @@ -45,12 +45,10 @@ export class AffiliationDeleteDialogComponent implements OnInit { if (id) { this.affiliationService.delete(id).subscribe((response) => { if (response) { - this.eventService.broadcast(new Event(EventType.AFFILIATION_LIST_MODIFICATION, 'Deleted an affiliation')) + this.eventService.broadcast(new Event(EventType.AFFILIATION_LIST_MODIFICATION)) this.alertService.broadcast(AlertType.AFFILIATION_DELETED) } else { - this.eventService.broadcast( - new Event(EventType.AFFILIATION_LIST_MODIFICATION, 'Failed to delete an affiliation') - ) + this.eventService.broadcast(new Event(EventType.AFFILIATION_LIST_MODIFICATION)) this.alertService.broadcast(AlertType.AFFILIATION_DELETE_FAILURE) } this.activeModal.dismiss(true) diff --git a/ui/src/app/affiliation/affiliation-import-dialog.component.ts b/ui/src/app/affiliation/affiliation-import-dialog.component.ts index 2daf0db93..4b8a04fe9 100644 --- a/ui/src/app/affiliation/affiliation-import-dialog.component.ts +++ b/ui/src/app/affiliation/affiliation-import-dialog.component.ts @@ -63,7 +63,7 @@ export class AffiliationImportDialogComponent { } close() { - this.eventService.broadcast(new Event(EventType.IMPORT_AFFILIATIONS, '')) + this.eventService.broadcast(new Event(EventType.IMPORT_AFFILIATIONS)) this.activeModal.dismiss(true) } } diff --git a/ui/src/app/affiliation/send-notifications-dialog.component.ts b/ui/src/app/affiliation/send-notifications-dialog.component.ts index 068f7de96..7d8d4d84e 100644 --- a/ui/src/app/affiliation/send-notifications-dialog.component.ts +++ b/ui/src/app/affiliation/send-notifications-dialog.component.ts @@ -70,7 +70,6 @@ export class SendNotificationsDialogComponent implements OnInit { close() { this.eventService.broadcast({ type: EventType.SEND_NOTIFICATIONS, - payload: 'Send notifications', }) this.activeModal.dismiss(true) } diff --git a/ui/src/app/member/member-import-dialog.component.ts b/ui/src/app/member/member-import-dialog.component.ts index a60ac72b6..a7db1aeb2 100644 --- a/ui/src/app/member/member-import-dialog.component.ts +++ b/ui/src/app/member/member-import-dialog.component.ts @@ -50,7 +50,7 @@ export class MemberImportDialogComponent { this.csvErrors = JSON.parse(res) this.loading = false if (this.csvErrors.length === 0) { - this.eventService.broadcast(new Event(EventType.MEMBER_LIST_MODIFICATION, 'New member uploaded')) + this.eventService.broadcast(new Event(EventType.MEMBER_LIST_MODIFICATION)) this.activeModal.dismiss(true) } } diff --git a/ui/src/app/shared/model/event.model.ts b/ui/src/app/shared/model/event.model.ts index 5643c6f10..3fce64cd6 100644 --- a/ui/src/app/shared/model/event.model.ts +++ b/ui/src/app/shared/model/event.model.ts @@ -1,8 +1,5 @@ import { EventType } from 'src/app/app.constants' export class Event { - constructor( - public type: EventType, - public payload: string - ) {} + constructor(public type: EventType) {} } diff --git a/ui/src/app/shared/service/event.service.spec.ts b/ui/src/app/shared/service/event.service.spec.ts index a9e1fdc96..892e98107 100644 --- a/ui/src/app/shared/service/event.service.spec.ts +++ b/ui/src/app/shared/service/event.service.spec.ts @@ -16,7 +16,6 @@ describe('EventService', () => { it('should broadcast events', () => { const event: Event = { type: EventType.LOG_IN_SUCCESS, - payload: 'Login successful', } let receivedEvent: Event | undefined @@ -30,10 +29,9 @@ describe('EventService', () => { }) it('should filter events by type', () => { - const event1: Event = { type: EventType.LOG_IN_SUCCESS, payload: 'data 1' } + const event1: Event = { type: EventType.LOG_IN_SUCCESS } const event2: Event = { type: EventType.AFFILIATION_CREATED, - payload: 'data 2', } let receivedEvent: Event | undefined diff --git a/ui/src/app/user/user-delete.component.spec.ts b/ui/src/app/user/user-delete.component.spec.ts index c945a0272..aaf7a905c 100644 --- a/ui/src/app/user/user-delete.component.spec.ts +++ b/ui/src/app/user/user-delete.component.spec.ts @@ -47,7 +47,7 @@ describe('UserDeleteComponent', () => { userServiceSpy.delete.and.returnValue(of(true)) component.confirmDelete('id') - expect(eventServiceSpy.broadcast).toHaveBeenCalledWith(new Event(EventType.USER_LIST_MODIFIED, 'Deleted a user')) + expect(eventServiceSpy.broadcast).toHaveBeenCalledWith(new Event(EventType.USER_LIST_MODIFIED)) }) it('should not call the userservice without a provided id', () => { diff --git a/ui/src/app/user/user-delete.component.ts b/ui/src/app/user/user-delete.component.ts index 549765efe..1a1e9f8ef 100644 --- a/ui/src/app/user/user-delete.component.ts +++ b/ui/src/app/user/user-delete.component.ts @@ -33,7 +33,7 @@ export class UserDeleteDialogComponent implements OnInit { confirmDelete(id: string | undefined) { if (id) { this.userService.delete(id).subscribe(() => { - this.eventService.broadcast(new Event(EventType.USER_LIST_MODIFIED, 'Deleted a user')) + this.eventService.broadcast(new Event(EventType.USER_LIST_MODIFIED)) this.activeModal.dismiss(true) this.alertService.broadcast(AlertType.USER_DELETED) }) diff --git a/ui/src/app/user/user-import-dialog.component.ts b/ui/src/app/user/user-import-dialog.component.ts index d9ef0ecb7..5c6f2e11f 100644 --- a/ui/src/app/user/user-import-dialog.component.ts +++ b/ui/src/app/user/user-import-dialog.component.ts @@ -52,7 +52,7 @@ export class UserImportDialogComponent { this.csvErrors = JSON.parse(res) this.loading = false if (this.csvErrors.length === 0) { - this.eventService.broadcast(new Event(EventType.USER_LIST_MODIFIED, 'New user settings uploaded')) + this.eventService.broadcast(new Event(EventType.USER_LIST_MODIFIED)) this.activeModal.dismiss(true) } }