Skip to content

Commit 18a4f7e

Browse files
feature: TRACEFOSS-1179 Show sender and receiver bpn number + name in… (#81)
* feature: TRACEFOSS-1179 Show sender and receiver bpn number + name in notification list * feature: TRACEFOSS-1179 Changes after the review
1 parent 2f4c260 commit 18a4f7e

21 files changed

+177
-33
lines changed

frontend/src/app/mocks/services/investigations-mock/investigations.model.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,10 @@ export const buildMockInvestigations = (
5858
status,
5959
severity,
6060
channel,
61-
createdBy: 'OEM A',
62-
sendTo: 'OEM B',
61+
createdBy: 'BPN10000000OEM0A',
62+
createdByName: 'OEM xxxxxxxxxxxxxxx A',
63+
sendTo: 'BPN20000000OEM0B',
64+
sendToName: 'OEM xxxxxxxxxxxxxxx B',
6365
reason: { close, decline, accept },
6466
createdDate: `2022-05-${(index + 1).toString().padStart(2, '0')}T12:34:12`,
6567
targetDate: `2022-05-${(index + 2).toString().padStart(2, '0')}T11:34:12Z`,
@@ -72,8 +74,10 @@ const MockEmptyInvestigation: NotificationResponse = {
7274
description: `Investigation No 000`,
7375
status: NotificationStatus.CREATED,
7476
severity: Severity.MINOR,
75-
createdBy: 'OEM A',
76-
sendTo: 'OEM B',
77+
createdBy: 'BPN10000000OEM0A',
78+
createdByName: 'OEM xxxxxxxxxxxxxxx A',
79+
sendTo: 'BPN20000000OEM0B',
80+
sendToName: 'OEM xxxxxxxxxxxxxxx B',
7781
reason: { close: '', decline: '', accept: '' },
7882
createdDate: `2022-05-01T12:34:12`,
7983
targetDate: `2022-02-01T12:34:12`,

frontend/src/app/mocks/services/investigations-mock/investigations.test.model.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,10 @@ export const buildMockInvestigations = (
4242
status,
4343
severity,
4444
channel,
45-
createdBy: 'OEAM A',
46-
sendTo: 'OEM B',
45+
createdBy: 'BPN10000000OEM0A',
46+
createdByName: 'OEM xxxxxxxxxxxxxxx A',
47+
sendTo: 'BPN20000000OEM0B',
48+
sendToName: 'OEM xxxxxxxxxxxxxxx B',
4749
reason: { close: '', accept: '', decline: '' },
4850
createdDate: `2022-05-${(index + 1).toString().padStart(2, '0')}T12:34:12`,
4951
assetIds: [MOCK_part_1.id, getRandomAsset().id, getRandomAsset().id, getRandomAsset().id],
@@ -55,8 +57,10 @@ const MockEmptyInvestigation: NotificationResponse = {
5557
description: `Investigation No 000`,
5658
status: NotificationStatus.CREATED,
5759
severity: Severity.MINOR,
58-
createdBy: 'OEM A',
59-
sendTo: 'OEAM B',
60+
createdBy: 'BPN10000000OEM0A',
61+
createdByName: 'OEM xxxxxxxxxxxxxxx A',
62+
sendTo: 'BPN20000000OEM0B',
63+
sendToName: 'OEM xxxxxxxxxxxxxxx B',
6064
reason: { close: '', accept: '', decline: '' },
6165
createdDate: `2022-05-01T12:34:12`,
6266
assetIds: [getRandomAsset().id],

frontend/src/app/modules/page/dashboard/presentation/dashboard.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ <h3 class="mb-4 flex items-center">
8888
[translationContext]="'commonInvestigation'"
8989
[labelId]="'dashboard-investigations'"
9090
[hasPagination]="false"
91-
[optionalColumns]="['targetDate', 'severity']"
91+
[optionalColumns]="['targetDate', 'severity', 'createdBy']"
9292
(selected)="onNotificationSelected($event)"
9393
></app-notifications-tab>
9494
</mat-card-content>

frontend/src/app/modules/page/investigations/presentation/investigations.component.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@
5151
[queuedAndRequestedNotifications$]="investigationsQueuedAndRequested$"
5252
[receivedNotifications$]="investigationsReceived$"
5353
[translationContext]="'commonInvestigation'"
54-
[optionalColumns]="['targetDate', 'severity']"
54+
[receivedOptionalColumns]="['targetDate', 'severity', 'createdBy']"
55+
[queuedAndRequestedOptionalColumns]="['targetDate', 'severity', 'sendTo']"
5556
(onReceivedPagination)="onReceivedPagination($event)"
5657
(onQueuedAndRequestedPagination)="onQueuedAndRequestedPagination($event)"
5758
(selected)="openDetailPage($event)"

frontend/src/app/modules/shared/assembler/investigations.assembler.spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,8 @@ describe('InvestigationsAssembler', () => {
8181
severity: Severity.MINOR,
8282
createdDate: new CalendarDateModel('2022-07-26T15:09:39.419Z'),
8383
targetDate: new CalendarDateModel('2022-06-26T15:09:39.419Z'),
84-
createdBy: '',
85-
sendTo: '',
84+
createdBy: { bpn: '', name: '' },
85+
sendTo: { bpn: '', name: '' },
8686
reason: { close: '', accept: '', decline: '' },
8787
isFromSender: true,
8888
assetIds: [],
@@ -94,8 +94,8 @@ describe('InvestigationsAssembler', () => {
9494
severity: Severity.MAJOR,
9595
createdDate: new CalendarDateModel('2022-07-26T15:09:39.419Z'),
9696
targetDate: new CalendarDateModel('2022-06-26T15:09:39.419Z'),
97-
createdBy: '',
98-
sendTo: '',
97+
createdBy: { bpn: '', name: '' },
98+
sendTo: { bpn: '', name: '' },
9999
reason: { close: '', accept: '', decline: '' },
100100
isFromSender: true,
101101
assetIds: [],

frontend/src/app/modules/shared/assembler/investigations.assembler.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,16 @@ export class InvestigationsAssembler {
4040
id,
4141
assetIds,
4242
channel,
43-
sendTo,
4443

4544
reason = { accept: '', close: '', decline: '' },
4645
description = '',
4746
status: _status,
4847
severity: _severity,
4948
createdDate: _createdDate = '',
50-
createdBy = '',
49+
createdBy: _createdBy = '',
50+
createdByName: _createdByName = '',
51+
sendTo: _sendTo = '',
52+
sendToName: _sendToName = '',
5153
targetDate: _targetDate = '',
5254
} = response;
5355

@@ -56,6 +58,8 @@ export class InvestigationsAssembler {
5658
const severity = Object.values(Severity).find(element => element == _severity);
5759
const createdDate = new CalendarDateModel(_createdDate);
5860
const targetDate = new CalendarDateModel(_targetDate);
61+
const createdBy = { bpn: _createdBy, name: _createdByName };
62+
const sendTo = { bpn: _sendTo, name: _sendToName };
5963

6064
return {
6165
id,

frontend/src/app/modules/shared/components/notification-overview/notification-overview.component.html

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,15 @@
4040
</div>
4141
<div>
4242
<span class="detail--text detail--text__bold">{{ 'table.column.createdBy' | i18n }}</span>
43-
<span class="detail--text">{{ notification?.createdBy }}</span>
43+
<span class="detail--text">
44+
<app-notification-user [user]="notification.createdBy"></app-notification-user>
45+
</span>
4446
</div>
4547
<div>
4648
<span class="detail--text detail--text__bold">{{ 'table.column.sendTo' | i18n }}</span>
47-
<span class="detail--text">{{ notification?.sendTo }}</span>
49+
<span class="detail--text">
50+
<app-notification-user [user]="notification.sendTo"></app-notification-user>
51+
</span>
4852
</div>
4953

5054
<div *ngIf="notification?.targetDate">

frontend/src/app/modules/shared/components/notification-reason/notification-reason.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
<ng-template #chatBubble let-message="message">
2828
<ng-container *ngIf="message.reason">
2929
<div class="message--separator"></div>
30-
<p class="message--username__{{ message.direction }}">{{ message.user }}</p>
30+
<p class="message--username__{{ message.direction }}">{{ message.user.bpn }}</p>
3131
<div class="message--text message--text__{{ message.direction }} message--text-arrow__{{ message.direction }}">
3232
<p>{{ message.reason }}</p>
3333
<div class="message--status">

frontend/src/app/modules/shared/components/notification-reason/notification-reason.component.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,12 @@ describe('NotificationReasonComponent', () => {
4747
expect(screen.getByText(reason.accept)).toBeInTheDocument();
4848
expect(screen.getByText('commonInvestigation.status.SENT')).toBeInTheDocument();
4949

50-
expect(screen.getByText(defaultNotification.createdBy)).toBeInTheDocument();
51-
expect(screen.getByText(defaultNotification.sendTo)).toBeInTheDocument();
50+
expect(screen.getByText(defaultNotification.createdBy.bpn)).toBeInTheDocument();
51+
expect(screen.getByText(defaultNotification.sendTo.bpn)).toBeInTheDocument();
5252
});
5353

5454
it('should render username from sender', async () => {
5555
await renderReason();
56-
expect(screen.getByText(defaultNotification.createdBy)).toBeInTheDocument();
56+
expect(screen.getByText(defaultNotification.createdBy.bpn)).toBeInTheDocument();
5757
});
5858
});

frontend/src/app/modules/shared/components/notification-reason/notification-reason.component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@
2121

2222
import { Component, Input } from '@angular/core';
2323
import { CalendarDateModel } from '@core/model/calendar-date.model';
24-
import { Notification, NotificationStatus } from '@shared/model/notification.model';
24+
import { Notification, NotificationUser, NotificationStatus } from '@shared/model/notification.model';
2525

2626
type TextMessageDirection = 'left' | 'right';
2727
interface TextMessage {
2828
reason: string;
2929
direction: TextMessageDirection;
30-
user: string;
30+
user: NotificationUser;
3131
status: NotificationStatus;
3232
date?: CalendarDateModel;
3333
}

0 commit comments

Comments
 (0)