|
|
|
@ -63,7 +63,6 @@ export class IanCenterService { |
|
|
|
|
this.actions$.dispatch( |
|
|
|
|
markNotificationsAsRead({ origin: this.id, notifications }), |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
markAllAsRead():void { |
|
|
|
@ -125,15 +124,14 @@ export class IanCenterService { |
|
|
|
|
if (window.location.href.indexOf('details') <= -1) { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
this.query.notifications$.pipe(take(1)).subscribe((elemenets)=> {
|
|
|
|
|
if (elemenets.length <= 0) |
|
|
|
|
{ |
|
|
|
|
this.query.notifications$.pipe(take(1)).subscribe((notifications) => { |
|
|
|
|
if (notifications.length <= 0) { |
|
|
|
|
void this.state.go( |
|
|
|
|
`${(this.state.current.data as BackRouteOptions).baseRoute}` |
|
|
|
|
`${(this.state.current.data as BackRouteOptions).baseRoute}`, |
|
|
|
|
); |
|
|
|
|
} else { |
|
|
|
|
var index = notificationIndex > elemenets.length ? 0 : notificationIndex - 1; |
|
|
|
|
const href = elemenets[index][0]._links.resource?.href; |
|
|
|
|
const index = notificationIndex > notifications.length ? 0 : notificationIndex - 1; |
|
|
|
|
const href = notifications[index][0]._links.resource?.href; |
|
|
|
|
const id = href && HalResource.matchFromLink(href, 'work_packages'); |
|
|
|
|
if (id) { |
|
|
|
|
const wp = this |
|
|
|
@ -143,10 +141,10 @@ export class IanCenterService { |
|
|
|
|
.requireAndStream(); |
|
|
|
|
|
|
|
|
|
wp.pipe(take(1)) |
|
|
|
|
.subscribe((wp) => { |
|
|
|
|
.subscribe((workPackage) => { |
|
|
|
|
void this.state.go( |
|
|
|
|
`${(this.state.current.data as BackRouteOptions).baseRoute}.details.tabs`, |
|
|
|
|
{ workPackageId: wp.id, tabIdentifier: 'activity' }, |
|
|
|
|
{ workPackageId: workPackage.id, tabIdentifier: 'activity' }, |
|
|
|
|
); |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
@ -157,11 +155,12 @@ export class IanCenterService { |
|
|
|
|
private beforeReloadNotifications(notificationID:string | number) { |
|
|
|
|
this.query.notifications$.pipe().subscribe((wpNotifications) => { |
|
|
|
|
let counter = 0; |
|
|
|
|
wpNotifications.forEach(elment => { |
|
|
|
|
counter ++; |
|
|
|
|
elment.forEach(notification => { |
|
|
|
|
if (notification.id == notificationID) |
|
|
|
|
wpNotifications.forEach((wpNotification) => { |
|
|
|
|
counter = counter + 1; |
|
|
|
|
wpNotification.forEach((notification) => { |
|
|
|
|
if (notification.id === notificationID) { |
|
|
|
|
this.selectedNotificationIndex = counter; |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|