monitoring notifications

This commit is contained in:
Peter Maquiran
2024-06-20 15:40:08 +01:00
parent 2d6d5a9492
commit 9ea120bfcd
17 changed files with 279 additions and 347 deletions
+89 -129
View File
@@ -13,6 +13,7 @@ import { environment } from 'src/environments/environment';
import { ProcessesService } from 'src/app/services/processes.service';
import { EventsService } from 'src/app/services/events.service';
import { NotificationHolderService } from 'src/app/store/notification-holder.service';
import { TracingType, XTracer } from 'src/app/services/monitoring/opentelemetry/tracer';
@Component({
selector: 'app-profile',
@@ -211,167 +212,126 @@ export class ProfilePage implements OnInit {
return time;
}
notificatinsRoutes = (index, Service, Object, IdObject, FolderId, i) => {
@XTracer({name:'profile/notificatinsRoutes', bugPrint: true, module:'notification'})
notificatinsRoutes (index, Service, Object, IdObject, FolderId, i, tracing?: TracingType) {
console.log(index, i)
if (Service === "agenda") {
this.isloading = true
if (Service === "agenda" && IdObject.length > 10) {
this.eventsService.getEvent(IdObject).subscribe((task) => {
try {
if (Service === "agenda") {
this.isloading = true
if (Service === "agenda" && IdObject.length > 10) {
this.eventsService.getEvent(IdObject).subscribe((task) => {
this.zone.run(() => this.router.navigate(['/home/agenda', IdObject, 'agenda']));
this.deleteNotification(index);
this.isloading = false
this.zone.run(() => this.router.navigate(['/home/agenda', IdObject, 'agenda']));
this.deleteNotification(index);
this.isloading = false
}, (error) => {
this.NotificationHolderService.notificationList[i].read = true;
this.isloading = false
})
}
}, (error) => {
this.NotificationHolderService.notificationList[i].read = true;
this.isloading = false
})
}
if (Service === "agenda" && Object === "event-list") {
if (Service === "agenda" && Object === "event-list") {
this.isloading = true
this.processesService.GetTask(IdObject).subscribe((task) => {
console.log('evento exist')
this.zone.run(() => this.router.navigate(['/home/agenda/event-list/approve-event', IdObject, 'agenda']));
this.deleteNotification(index);
this.isloading = false
}, (error) => {
console.log('evento não existe')
this.NotificationHolderService.notificationList[i].read = true;
this.isloading = false
})
}
} else if (Service === "gabinete-digital") {
this.isloading = true
this.processesService.GetTask(IdObject).subscribe((task) => {
console.log('evento exist')
this.zone.run(() => this.router.navigate(['/home/agenda/event-list/approve-event', IdObject, 'agenda']));
if (Service === "gabinete-digital" && Object === "expedientes") {
this.zone.run(() => this.router.navigate(['/home/gabinete-digital/expediente', IdObject, 'gabinete-digital']));
} else if (Service === "gabinete-digital" && Object === "despachos") {
this.zone.run(() => this.router.navigate(['/home/gabinete-digital/despachos', IdObject, 'gabinete-digital'], { replaceUrl: true }));
} else if (Service === "gabinete-digital" && Object === "parecer") {
this.zone.run(() => this.router.navigate(['/home/gabinete-digital/pedidos', IdObject, 'gabinete-digital']));
}
else if (Service === "gabinete-digital" && Object === "deferimento") {
this.zone.run(() => this.router.navigate(['/home/gabinete-digital/pedidos', IdObject, 'gabinete-digital']));
}
else if (Service === "gabinete-digital" && Object === "despachos-pr") {
this.zone.run(() => this.router.navigate(['/home/gabinete-digital/despachos-pr', IdObject, 'gabinete-digital']));
}else if (Service === "gabinete-digital" && Object === "diplomas") {
this.zone.run(() => this.router.navigate(['/home/gabinete-digital/diplomas', IdObject, 'gabinete-digital']));
}
else if (Service === "gabinete-digital" && Object === "diplomas-assinar") {
this.zone.run(() => this.router.navigate(['/home/gabinete-digital/diplomas-assinar', IdObject, 'gabinete-digital']));
}
else if (Service === "gabinete-digital" && Object === "diploma-revisao") {
this.zone.run(() => this.router.navigate(['/home/gabinete-digital/diplomas', IdObject, 'gabinete-digital']));
}
else if (Service === "gabinete-digital" && Object === "expedientes-pr") {
this.zone.run(() => this.router.navigate(['/home/gabinete-digital/expedientes-pr', IdObject, 'gabinete-digital']));
}
this.deleteNotification(index);
this.isloading = false
}, (error) => {
console.log('evento não existe')
this.NotificationHolderService.notificationList[i].read = true;
this.isloading = false
})
}
} else if (Service === "gabinete-digital") {
this.isloading = true
this.processesService.GetTask(IdObject).subscribe((task) => {
if (Service === "gabinete-digital" && Object === "expedientes") {
this.zone.run(() => this.router.navigate(['/home/gabinete-digital/expediente', IdObject, 'gabinete-digital']));
} else if (Service === "gabinete-digital" && Object === "despachos") {
this.zone.run(() => this.router.navigate(['/home/gabinete-digital/despachos', IdObject, 'gabinete-digital'], { replaceUrl: true }));
} else if (Service === "gabinete-digital" && Object === "parecer") {
this.zone.run(() => this.router.navigate(['/home/gabinete-digital/pedidos', IdObject, 'gabinete-digital']));
} else if (Service === "accoes") {
if (Service === "accoes" && Object === "accao") {
this.zone.run(() => this.router.navigate(['/home/publications', IdObject]));
this.deleteNotification(index);
}
else if (Service === "accoes" && Object === "publicacao") {
this.zone.run(() => this.router.navigate(['/home/publications/view-publications', FolderId, IdObject]));
this.deleteNotification(index);
}
else if (Service === "gabinete-digital" && Object === "deferimento") {
this.zone.run(() => this.router.navigate(['/home/gabinete-digital/pedidos', IdObject, 'gabinete-digital']));
}
else if (Service === "gabinete-digital" && Object === "despachos-pr") {
} else if (Service === "chat") {
this.zone.run(() => this.router.navigate(['/home/gabinete-digital/despachos-pr', IdObject, 'gabinete-digital']));
}else if (Service === "gabinete-digital" && Object === "diplomas") {
this.zone.run(() => this.router.navigate(['/home/gabinete-digital/diplomas', IdObject, 'gabinete-digital']));
}
else if (Service === "gabinete-digital" && Object === "diplomas-assinar") {
let navigationExtras: NavigationExtras = { queryParams: { "roomId": IdObject, } };
this.zone.run(() => this.router.navigate(['/home/gabinete-digital/diplomas-assinar', IdObject, 'gabinete-digital']));
}
else if (Service === "gabinete-digital" && Object === "diploma-revisao") {
this.zone.run(() => this.router.navigate(['/home/chat']));
setTimeout(() => {
this.zone.run(() => this.router.navigate(['/home/chat'], navigationExtras));
}, 200);
this.zone.run(() => this.router.navigate(['/home/gabinete-digital/diplomas', IdObject, 'gabinete-digital']));
}
else if (Service === "gabinete-digital" && Object === "expedientes-pr") {
this.zone.run(() => this.router.navigate(['/home/gabinete-digital/expedientes-pr', IdObject, 'gabinete-digital']));
}
this.deleteNotification(index);
this.isloading = false
} else {
}, (error) => {
this.NotificationHolderService.notificationList[i].read = true;
this.isloading = false
})
console.log({Service, Object, IdObject, FolderId})
} else if (Service === "accoes") {
if (Service === "accoes" && Object === "accao") {
this.zone.run(() => this.router.navigate(['/home/publications', IdObject]));
this.deleteNotification(index);
}
else if (Service === "accoes" && Object === "publicacao") {
this.zone.run(() => this.router.navigate(['/home/publications/view-publications', FolderId, IdObject]));
this.deleteNotification(index);
tracing.setAttribute('notification.route', 'false')
tracing.setAttribute('outcome', 'failed')
tracing.setAttribute('parameters', JSON.stringify({Service, Object, IdObject, FolderId}))
}
} else if (Service === "chat") {
} catch(error) {
console.log({Service, Object, IdObject, FolderId})
let navigationExtras: NavigationExtras = { queryParams: { "roomId": IdObject, } };
this.zone.run(() => this.router.navigate(['/home/chat']));
setTimeout(() => {
this.zone.run(() => this.router.navigate(['/home/chat'], navigationExtras));
}, 200);
this.deleteNotification(index);
tracing.setAttribute('outcome', 'failed')
tracing.setAttribute('parameters', JSON.stringify({Service, Object, IdObject, FolderId}))
tracing.setAttribute('error', JSON.stringify(error))
}
/* if (Service === "agenda" && IdObject.length > 10) {
this.zone.run(() => this.router.navigate(['/home/agenda', IdObject, 'agenda']));
}
else if (Service === "gabinete-digital" && Object === "expedientes") {
this.processesService.GetTask(IdObject).subscribe((task) => {
this.zone.run(() => this.router.navigate(['/home/gabinete-digital/expediente', IdObject, 'gabinete-digital']));
}, (error) => {
this.notificationdata[i].read = true;
})
}
else if (Service === "agenda" && Object === "event-list") {
//this.zone.run(() => this.router.navigate(['/home/gabinete-digital/event-list/approve-event',IdObject, 'agenda']));
this.zone.run(() => this.router.navigate(['/home/agenda/event-list/approve-event', IdObject, 'agenda']));
} else if (Service === "gabinete-digital" && Object === "despachos") {
this.processesService.GetTask(IdObject).subscribe((task) => {
this.zone.run(() => this.router.navigate(['/home/gabinete-digital/despachos', IdObject, 'gabinete-digital'], { replaceUrl: true }));
}, (error) => {
this.notificationdata[i].read = true;
})
}
else if (Service === "gabinete-digital" && Object === "parecer") {
this.zone.run(() => this.router.navigate(['/home/gabinete-digital/pedidos', IdObject, 'gabinete-digital']));
}
else if (Service === "gabinete-digital" && Object === "deferimento") {
this.zone.run(() => this.router.navigate(['/home/gabinete-digital/pedidos', IdObject, 'gabinete-digital']));
}
else if (Service === "gabinete-digital" && Object === "despachos-pr") {
this.zone.run(() => this.router.navigate(['/home/gabinete-digital/despachos-pr', IdObject, 'gabinete-digital']));
}
else if (Service === "accoes" && Object === "accao") {
this.zone.run(() => this.router.navigate(['/home/publications', IdObject]));
}
else if (Service === "accoes" && Object === "publicacao") {
this.zone.run(() => this.router.navigate(['/home/publications/view-publications', FolderId, IdObject]));
}
else if (Service === "gabinete-digital" && Object === "diplomas") {
this.zone.run(() => this.router.navigate(['/home/gabinete-digital/diplomas', IdObject, 'gabinete-digital']));
}
else if (Service === "gabinete-digital" && Object === "diplomas-assinar") {
this.zone.run(() => this.router.navigate(['/home/gabinete-digital/diplomas-assinar', IdObject, 'gabinete-digital']));
}
else if (Service === "gabinete-digital" && Object === "expedientes-pr") {
this.zone.run(() => this.router.navigate(['/home/gabinete-digital/expedientes-pr', IdObject, 'gabinete-digital']));
} else if (Service === "chat") {
let navigationExtras: NavigationExtras = { queryParams: { "roomId": IdObject, } };
this.zone.run(() => this.router.navigate(['/home/chat'], navigationExtras));
} */
// this.notificationservice.tempClearArray();
}