diff --git a/gabinete-digital-fo.code-workspace b/gabinete-digital-fo.code-workspace index c089ef529..c0656f038 100644 --- a/gabinete-digital-fo.code-workspace +++ b/gabinete-digital-fo.code-workspace @@ -5,6 +5,9 @@ }, { "path": "../socket-server" + }, + { + "path": "../logs" } ], "settings": { diff --git a/src/app/interceptors/chatToken.interceptor.ts b/src/app/interceptors/chatToken.interceptor.ts index bb30ca318..317806ac2 100644 --- a/src/app/interceptors/chatToken.interceptor.ts +++ b/src/app/interceptors/chatToken.interceptor.ts @@ -101,17 +101,28 @@ export class ChatTokenInterceptor implements HttpInterceptor { } private addToken(request: HttpRequest, token: string) { - let headers = new HttpHeaders(); + let headers = new HttpHeaders(); - headers = headers.set('X-User-Id', SessionStore.user.ChatData.data.userId); - headers = headers.set('X-Auth-Token', SessionStore.user.ChatData.data.authToken); + try { + + headers = headers.set('X-User-Id', SessionStore?.user?.ChatData?.data?.userId); + headers = headers.set('X-Auth-Token', SessionStore?.user?.ChatData?.data.authToken); return request.clone({ - setHeaders: { - Authorization: `Bearer ${token}`, - ...headers.keys().reduce((acc, key) => ({ ...acc, [key]: headers.get(key) }), {}), - }, - }); + setHeaders: { + Authorization: `Bearer ${token}`, + ...headers.keys().reduce((acc, key) => ({ ...acc, [key]: headers.get(key) }), {}), + }, + }) + } catch (error) { + + + return request.clone({ + setHeaders: { + Authorization: `Bearer ${token}`, + }, + }) + } } /* private addToken(request: HttpRequest, token: string) { diff --git a/src/app/modals/profile/edit-profile/edit-profile.page.html b/src/app/modals/profile/edit-profile/edit-profile.page.html index f9adb6c60..03836e13a 100644 --- a/src/app/modals/profile/edit-profile/edit-profile.page.html +++ b/src/app/modals/profile/edit-profile/edit-profile.page.html @@ -134,6 +134,10 @@ + + diff --git a/src/app/modals/profile/profile.page.ts b/src/app/modals/profile/profile.page.ts index 400ff9b21..1cff7042a 100644 --- a/src/app/modals/profile/profile.page.ts +++ b/src/app/modals/profile/profile.page.ts @@ -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(); - - } diff --git a/src/app/pages/agenda/edit-event/edit-event.page.ts b/src/app/pages/agenda/edit-event/edit-event.page.ts index 5adbd0332..c305ec5b3 100644 --- a/src/app/pages/agenda/edit-event/edit-event.page.ts +++ b/src/app/pages/agenda/edit-event/edit-event.page.ts @@ -675,18 +675,14 @@ export class EditEventPage implements OnInit { } deleteAttachment(attachmentID: string, index) { - console.log(this.loadedEventAttachments) - const id: any = this.loadedEventAttachments[index].docId - let update = this.removeItemById(this.loadedEventAttachments, id) - this.loadedEventAttachments = update - this.deletedAttachmentsList.push(id) + const indexToRemove = index; // Assuming you already know the index you want to remove - /* if (id == 'add') { - this.loadedEventAttachments = this.loadedEventAttachments.filter((e, i) => i != index) - } else { - this.loadedEventAttachments[index]['remove'] = true - } */ + const DocumentId: any = this.loadedEventAttachments[index].Id + if (indexToRemove > -1 && indexToRemove < this.loadedEventAttachments.length) { + this.loadedEventAttachments.splice(indexToRemove, 1); + } + this.deletedAttachmentsList.push(DocumentId) } diff --git a/src/app/pages/gabinete-digital/event-list/event-list.page.html b/src/app/pages/gabinete-digital/event-list/event-list.page.html index 2c84e21de..f1d06cb2f 100644 --- a/src/app/pages/gabinete-digital/event-list/event-list.page.html +++ b/src/app/pages/gabinete-digital/event-list/event-list.page.html @@ -63,8 +63,8 @@
-
AGEANDA DO PR
-
AGEANDA DO MDGPR
+
AGENDA DO PR
+
AGENDA DO MDGPR
Agenda {{calendars.wxFullName}}
Minha agenda diff --git a/src/app/services/Repositorys/Agenda/agenda-data-repository.service.ts b/src/app/services/Repositorys/Agenda/agenda-data-repository.service.ts index aeaa6ccf4..db4c7ddd0 100644 --- a/src/app/services/Repositorys/Agenda/agenda-data-repository.service.ts +++ b/src/app/services/Repositorys/Agenda/agenda-data-repository.service.ts @@ -50,7 +50,7 @@ export class AgendaDataRepositoryService { try { const result = await this.agendaDataService.getEvent(id).pipe( map((response) => { - APINODReturn(EventOutputDTOSchema, response, 'get/Events/${id}', tracing) + APINODReturn(EventOutputDTOSchema, response, `get/Events/${id}`, tracing) return EventMapper.toDomain(response) }) ).toPromise() @@ -78,7 +78,7 @@ export class AgendaDataRepositoryService { try { const result = await this.agendaDataService.getEvent(id).pipe( map((response) => { - APINODReturn(EventOutputDTOSchema, response, 'get/Events/${id}', tracing) + APINODReturn(EventOutputDTOSchema, response, `get/Events/${id}`, tracing) console.log('response',response) console.log('ToDomain',EventToApproveDetailsMapper.toDomain(response)) return EventToApproveDetailsMapper.toDomain(response) diff --git a/src/app/services/Repositorys/notification/notification-repository.service.spec.ts b/src/app/services/Repositorys/notification/notification-repository.service.spec.ts new file mode 100644 index 000000000..4b12a2a12 --- /dev/null +++ b/src/app/services/Repositorys/notification/notification-repository.service.spec.ts @@ -0,0 +1,16 @@ +import { TestBed } from '@angular/core/testing'; + +import { NotificationRepositoryService } from './notification-repository.service'; + +describe('NotificationRepositoryService', () => { + let service: NotificationRepositoryService; + + beforeEach(() => { + TestBed.configureTestingModule({}); + service = TestBed.inject(NotificationRepositoryService); + }); + + it('should be created', () => { + expect(service).toBeTruthy(); + }); +}); diff --git a/src/app/services/Repositorys/notification/notification-repository.service.ts b/src/app/services/Repositorys/notification/notification-repository.service.ts new file mode 100644 index 000000000..416d21b31 --- /dev/null +++ b/src/app/services/Repositorys/notification/notification-repository.service.ts @@ -0,0 +1,9 @@ +import { Injectable } from '@angular/core'; + +@Injectable({ + providedIn: 'root' +}) +export class NotificationRepositoryService { + + constructor() { } +} diff --git a/src/app/services/monitoring/opentelemetry/tracer.ts b/src/app/services/monitoring/opentelemetry/tracer.ts index 9322de5df..639efd96d 100644 --- a/src/app/services/monitoring/opentelemetry/tracer.ts +++ b/src/app/services/monitoring/opentelemetry/tracer.ts @@ -3,6 +3,7 @@ import { SemanticAttributes } from '@opentelemetry/semantic-conventions'; import { Tracer, Span } from '@opentelemetry/sdk-trace-base'; import { OpentelemetryAgendaProvider, OpentelemetryInterceptorProvider, OpentelemetryNotificationProvider } from './opentelemetry'; import { Device, DeviceInfo } from '@capacitor/device'; +import { SessionStore } from 'src/app/store/session.service'; const tracerInstance = OpentelemetryAgendaProvider.getTracer('example-tracer-hole', '111', {}) @@ -58,9 +59,7 @@ const createTracingInstance = ({bugPrint, name, module, autoFinish}): TracingTyp span.setAttribute(key, value); }, finish: () => { - if(!window.location.origin.includes('https')) { - span.end(); - } + span.end(); if(bugPrint && hasBug) { console.error(name, data) @@ -87,6 +86,7 @@ export function XTracerAsync({ name, bugPrint, module = null, autoFinish = true const tracing = createTracingInstance({bugPrint, name, module, autoFinish}) + tracing.setAttribute('User', SessionStore?.user?.FullName); tracing.setAttribute('current.page', window.location.pathname); tracing.setAttribute('device.name', device?.name || device?.model) @@ -95,11 +95,17 @@ export function XTracerAsync({ name, bugPrint, module = null, autoFinish = true try { const result = await originalMethod.apply(this, args); - tracing.finish() + if(autoFinish) { + tracing.finish() + } + return result } catch (e) { tracing.setAttribute('catch', 'true') - tracing.finish() + + if(autoFinish) { + tracing.finish() + } console.error(e); return false } @@ -119,6 +125,7 @@ export function XTracer({ name, bugPrint, module, autoFinish = true }) { const tracing = createTracingInstance({bugPrint, name, module, autoFinish}) + tracing.setAttribute('User', SessionStore?.user?.FullName); tracing.setAttribute('current.page', window.location.pathname); tracing.setAttribute('device.name', device?.name || device?.model) @@ -127,12 +134,18 @@ export function XTracer({ name, bugPrint, module, autoFinish = true }) { try { const result = originalMethod.apply(this, args); - tracing.finish() + + if(autoFinish) { + tracing.finish() + } return result } catch (e) { tracing.setAttribute('catch', 'true') - tracing.finish() + + if(autoFinish) { + tracing.finish() + } console.error(e); return false } diff --git a/src/app/services/notifications.service.ts b/src/app/services/notifications.service.ts index 1d5bdc9cf..c9cab64b8 100644 --- a/src/app/services/notifications.service.ts +++ b/src/app/services/notifications.service.ts @@ -18,7 +18,22 @@ import { ChatService } from 'src/app/services/chat.service'; import { FCM } from '@capacitor-community/fcm'; import { ChatSystemService } from './chat/chat-system.service'; import {ChatController} from 'src/app/controller/chat' -import { TracingType, XTracerAsync } from 'src/app/services/monitoring/opentelemetry/tracer'; +import { TracingType, XTracer, XTracerAsync } from 'src/app/services/monitoring/opentelemetry/tracer'; +import { z } from 'zod'; + +const notificationDataSchema = z.object({ + Service: z.string(), + IdObject: z.string().optional(), + Object: z.string().optional(), + FolderId: z.string().optional(), +}); + +const notificationSchema = z.object({ + notification: z.object({ + data: notificationDataSchema, + }), +}); + @Injectable({ providedIn: 'root' }) @@ -105,6 +120,8 @@ export class NotificationsService { if (this.platform.is('mobile')) { if (!this.isPushNotificationsAvailable) { + tracing.setAttribute('notification.available', 'false') + tracing.setAttribute('outcome', 'failed') return false } if (this.platform.is('ios')) { @@ -143,11 +160,13 @@ export class NotificationsService { this.token = token tracing.setAttribute('notification.token', 'true') tracing.setAttribute('outcome', 'success') + tracing.finish() }, (error) => { console.error('Permission denied:', error); tracing.setAttribute('notification.token', 'false') tracing.setAttribute('outcome', 'failed') + tracing.finish() } ); } @@ -343,69 +362,91 @@ export class NotificationsService { } - notificatinsRoutes = (notification) => { + @XTracer({name:'Notification/notificatinsRoutes', bugPrint: true, module:'notification'}) + notificatinsRoutes (notification, tracing?: TracingType) { - console.log('BACK BACK', notification) + try { - if (notification.notification.data.Service === "agenda" && notification.notification.data.IdObject.length > 10) { + console.log('BACK BACK', notification) - this.zone.run(() => this.router.navigate(['/home/agenda', notification.notification.data.IdObject, 'agenda'])); - } - else if (notification.notification.data.Service === "gabinete-digital" && notification.notification.data.Object === "expedientes") { - this.zone.run(() => this.router.navigate(['/home/gabinete-digital/expediente', notification.notification.data.IdObject, 'gabinete-digital'])); - } - else if (notification.notification.data.Service === "agenda" && notification.notification.data.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', notification.notification.data.IdObject, 'agenda'])); + if (notification.notification.data.Service === "agenda" && notification.notification.data.IdObject.length > 10) { - } else if (notification.notification.data.Service === "gabinete-digital" && notification.notification.data.Object === "despachos") { + this.zone.run(() => this.router.navigate(['/home/agenda', notification.notification.data.IdObject, 'agenda'])); + } + else if (notification.notification.data.Service === "gabinete-digital" && notification.notification.data.Object === "expedientes") { + this.zone.run(() => this.router.navigate(['/home/gabinete-digital/expediente', notification.notification.data.IdObject, 'gabinete-digital'])); + } + else if (notification.notification.data.Service === "agenda" && notification.notification.data.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', notification.notification.data.IdObject, 'agenda'])); - this.zone.run(() => this.router.navigate(['/home/gabinete-digital/despachos', notification.notification.data.IdObject, 'gabinete-digital'], { replaceUrl: true })); - } - else if (notification.notification.data.Service === "gabinete-digital" && notification.notification.data.Object === "parecer") { + } else if (notification.notification.data.Service === "gabinete-digital" && notification.notification.data.Object === "despachos") { - this.zone.run(() => this.router.navigate(['/home/gabinete-digital/pedidos', notification.notification.data.IdObject, 'gabinete-digital'])); - } - else if (notification.notification.data.Service === "gabinete-digital" && notification.notification.data.Object === "deferimento") { + this.zone.run(() => this.router.navigate(['/home/gabinete-digital/despachos', notification.notification.data.IdObject, 'gabinete-digital'], { replaceUrl: true })); + } + else if (notification.notification.data.Service === "gabinete-digital" && notification.notification.data.Object === "parecer") { - this.zone.run(() => this.router.navigate(['/home/gabinete-digital/pedidos', notification.notification.data.IdObject, 'gabinete-digital'])); - } - else if (notification.notification.data.Service === "gabinete-digital" && notification.notification.data.Object === "despachos-pr") { + this.zone.run(() => this.router.navigate(['/home/gabinete-digital/pedidos', notification.notification.data.IdObject, 'gabinete-digital'])); + } + else if (notification.notification.data.Service === "gabinete-digital" && notification.notification.data.Object === "deferimento") { - this.zone.run(() => this.router.navigate(['/home/gabinete-digital/despachos-pr', notification.notification.data.IdObject, 'gabinete-digital'])); - } - else if (notification.notification.data.Service === "accoes" && notification.notification.data.Object === "accao") { - this.zone.run(() => this.router.navigate(['/home/publications', notification.notification.data.IdObject])); - } - else if (notification.notification.data.Service === "accoes" && notification.notification.data.Object === "publicacao") { - this.zone.run(() => this.router.navigate(['/home/publications/view-publications', notification.notification.data.FolderId, notification.data.IdObject])); - } - else if (notification.notification.data.Service === "gabinete-digital" && notification.notification.data.Object === "diplomas") { - this.zone.run(() => this.router.navigate(['/home/gabinete-digital/diplomas', notification.notification.data.IdObject, 'gabinete-digital'])); - } - else if (notification.notification.data.Service === "gabinete-digital" && notification.notification.data.Object === "diplomas-assinar") { + this.zone.run(() => this.router.navigate(['/home/gabinete-digital/pedidos', notification.notification.data.IdObject, 'gabinete-digital'])); + } + else if (notification.notification.data.Service === "gabinete-digital" && notification.notification.data.Object === "despachos-pr") { - this.zone.run(() => this.router.navigate(['/home/gabinete-digital/diplomas-assinar', notification.notification.data.IdObject, 'gabinete-digital'])); - } + this.zone.run(() => this.router.navigate(['/home/gabinete-digital/despachos-pr', notification.notification.data.IdObject, 'gabinete-digital'])); + } + else if (notification.notification.data.Service === "accoes" && notification.notification.data.Object === "accao") { + this.zone.run(() => this.router.navigate(['/home/publications', notification.notification.data.IdObject])); + } + else if (notification.notification.data.Service === "accoes" && notification.notification.data.Object === "publicacao") { + this.zone.run(() => this.router.navigate(['/home/publications/view-publications', notification.notification.data.FolderId, notification.data.IdObject])); + } + else if (notification.notification.data.Service === "gabinete-digital" && notification.notification.data.Object === "diplomas") { + this.zone.run(() => this.router.navigate(['/home/gabinete-digital/diplomas', notification.notification.data.IdObject, 'gabinete-digital'])); + } + else if (notification.notification.data.Service === "gabinete-digital" && notification.notification.data.Object === "diplomas-assinar") { - else if (notification.notification.data.Service === "gabinete-digital" && notification.notification.data.Object === "diploma-revisao") { - - this.zone.run(() => this.router.navigate(['/home/gabinete-digital/diplomas', notification.notification.data.IdObject, 'gabinete-digital'])); - } - - else if (notification.notification.data.Service === "gabinete-digital" && notification.notification.data.Object === "expedientes-pr") { - this.zone.run(() => this.router.navigate(['/home/gabinete-digital/expedientes-pr', notification.notification.data.IdObject, 'gabinete-digital'])); - } else if (notification.notification.data.Service === "chat") { - - let navigationExtras: NavigationExtras = { queryParams: { "roomId": notification.notification.data.IdObject, } }; - - if (window.location.search.includes("roomId")) { - this.zone.run(() => this.router.navigate(['/home/chat'])); + this.zone.run(() => this.router.navigate(['/home/gabinete-digital/diplomas-assinar', notification.notification.data.IdObject, 'gabinete-digital'])); } - setTimeout(() => { - this.zone.run(() => this.router.navigate(['/home/chat'], navigationExtras)); - }, 200); + else if (notification.notification.data.Service === "gabinete-digital" && notification.notification.data.Object === "diploma-revisao") { + + this.zone.run(() => this.router.navigate(['/home/gabinete-digital/diplomas', notification.notification.data.IdObject, 'gabinete-digital'])); + } + + else if (notification.notification.data.Service === "gabinete-digital" && notification.notification.data.Object === "expedientes-pr") { + this.zone.run(() => this.router.navigate(['/home/gabinete-digital/expedientes-pr', notification.notification.data.IdObject, 'gabinete-digital'])); + } else if (notification.notification.data.Service === "chat") { + + let navigationExtras: NavigationExtras = { queryParams: { "roomId": notification.notification.data.IdObject, } }; + + if (window.location.search.includes("roomId")) { + this.zone.run(() => this.router.navigate(['/home/chat'])); + } + + setTimeout(() => { + this.zone.run(() => this.router.navigate(['/home/chat'], navigationExtras)); + }, 200); + } else { + tracing.setAttribute('notification.route', 'false') + tracing.setAttribute('outcome', 'failed') + tracing.setAttribute('parameters', JSON.stringify(notification)) + } + } catch (error) { + + const validationError = notificationSchema.safeParse(notification) + + if(!validationError.success) { + const errors: z.ZodError = (validationError as any).error; + console.log("Validation errors:", errors.issues); + tracing.setAttribute('parameters', JSON.stringify(notification)) + tracing.setAttribute('validation.errors', JSON.stringify(errors.issues)) + } + + tracing.setAttribute('outcome', 'failed') + tracing.setAttribute('parameters', JSON.stringify(notification)) + tracing.setAttribute('error', JSON.stringify(error)) } diff --git a/src/app/shared/agenda/edit-event/edit-event.page.ts b/src/app/shared/agenda/edit-event/edit-event.page.ts index dbf890c3b..8f81922e3 100644 --- a/src/app/shared/agenda/edit-event/edit-event.page.ts +++ b/src/app/shared/agenda/edit-event/edit-event.page.ts @@ -428,8 +428,6 @@ export class EditEventPage implements OnInit { })); - await this.saveDocument() - if (this.addedAttachmentsList.length > 0) { this.agendaDataRepository.addEventAttachment(this._postEvent.EventId, this.loadedEventAttachments).subscribe((value) => { console.log(value) @@ -456,112 +454,6 @@ export class EditEventPage implements OnInit { } - // async save() { - - // this.injectValidation() - // this.runValidation() - - // if (this.Form.invalid) { - // return false - // } - - // this._postEvent.Attendees = this.taskParticipants.concat(this.taskParticipantsCc); - // this._postEvent.Subject = /* this.domSanitizeService.sanitizeInput( */this._postEvent.Subject/* ) */; - // this._postEvent.Location = /* this.domSanitizeService.sanitizeInput( */this._postEvent.Location/* ) */; - // this._postEvent.Body.Text = /* this.domSanitizeService.sanitizeInput( */this._postEvent.Body.Text/* ) */; - - // if (!this._postEvent.EventRecurrence.hasOwnProperty('Type')) { - // this._postEvent.EventRecurrence.Type = '-1' - // } else { - - // } - - // if (this._postEvent.EventRecurrence.Type == undefined) { - // this._postEvent.EventRecurrence.Type = '-1' - // } - - // this.showLoader = true; - - // try { - // if (this.sesseionStora.user.Profile == 'MDGPR' || this.sesseionStora.user.Profile == 'PR') { - // await this.eventsService.editEvent(this._postEvent, 2, 3, this._postEvent.CalendarId).toPromise() - // if (this.initCalendarName != this._postEvent.CalendarName) { - // let body = { - // "EventId": this._postEvent.EventId, - // "CalendarDestinationName": this._postEvent.CalendarName, - // } - - // try { - // await this.eventsService.changeAgenda(body).toPromise(); - // } catch (e) { } - // } - // this.showLoader = false; - // this.httpErrorHandle.httpsSucessMessagge('Editar evento') - // } else { - // console.log(this._postEvent, 2, 3, this._postEvent.CalendarId) - // await this.eventsService.editEvent(this._postEvent, 2, 3, this._postEvent.CalendarId).toPromise() - // if (this.initCalendarName != this._postEvent.CalendarName) { - // let body = { - // "EventId": this._postEvent.EventId, - // "CalendarDestinationName": this._postEvent.CalendarName, - // } - - // try { - // await this.eventsService.changeAgenda(body).toPromise(); - // } catch (e) { } - // } - // this.showLoader = false; - // this.httpErrorHandle.httpsSucessMessagge('Editar evento') - // } - - - // } catch (error) { - // this.showLoader = false - // this.httpErrorHandle.httpStatusHandle(error) - // } - - // this.clearPostEvent.emit(); - // this.deleteTemporaryData(); - - // await this.saveDocument() - - // this.close(); - // } - - - async saveDocument() { - - console.log('save document', this.loadedEventAttachments) - try { - - for (let e of this.loadedEventAttachments) { - const id: any = e.Id - const remove = e['remove'] - - if (id == 'add') { - //data.selected - const DocumentToSave = { - SourceTitle: e.SourceName, - ParentId: this._postEvent.EventId, - Source: '1', - SourceId: e.SourceId, - ApplicationId: e.ApplicationId.toString(), - Id: '0', - Link: '', - SerialNumber: '', - }; - - // await this.attachmentsService.setEventAttachmentById(DocumentToSave).toPromise(); - - } else if (remove) { - await this.attachmentsService.deleteEventAttachmentById(e.Id).toPromise() - } - } - } catch (error) { - - } - - } async addParticipants() { @@ -617,32 +509,17 @@ export class EditEventPage implements OnInit { window['temp.path:/home/agenda/edit-event.component.ts'] = {} } - async getAttachments(eventId: string) { - if (this._postEvent.HasAttachments) { - let rest: any; - try { - rest = this.attachmentsService.getAttachmentsById(eventId).toPromise() - console.log('GetAttachment', rest) - } catch (error) { - console.error('getAttchment', error) - } - this.loadedEventAttachments = rest; - } - } - deleteAttachment(attachmentID: string, index) { - console.log(JSON.stringify(this.loadedEventAttachments)) - const id: any = this.loadedEventAttachments[index].Id - console.log(JSON.stringify(id)) - let update = this.removeItemById(this.loadedEventAttachments, id) - this.loadedEventAttachments = update - console.log(update) - this.deletedAttachmentsList.push(id) + const indexToRemove = index; // Assuming you already know the index you want to remove + + const DocumentId: any = this.loadedEventAttachments[index].Id + if (indexToRemove > -1 && indexToRemove < this.loadedEventAttachments.length) { + this.loadedEventAttachments.splice(indexToRemove, 1); + } + + this.deletedAttachmentsList.push(DocumentId) } - removeItemById(array, id) { - return array.filter(item => item.Id !== id); - } async getDoc() { diff --git a/src/app/shared/agenda/event-list/event-list.page.html b/src/app/shared/agenda/event-list/event-list.page.html index 41fd02055..1917e7073 100644 --- a/src/app/shared/agenda/event-list/event-list.page.html +++ b/src/app/shared/agenda/event-list/event-list.page.html @@ -12,8 +12,8 @@
-
AGEANDA DO PR
-
AGEANDA DO MDGPR
+
AGENDA DO PR
+
AGENDA DO MDGPR
Agenda {{calendars.wxFullName}}
Minha agenda diff --git a/src/app/shared/gabinete-digital/events-to-approve/events-to-approve.page.html b/src/app/shared/gabinete-digital/events-to-approve/events-to-approve.page.html index 8ff1ee674..d5a727e49 100644 --- a/src/app/shared/gabinete-digital/events-to-approve/events-to-approve.page.html +++ b/src/app/shared/gabinete-digital/events-to-approve/events-to-approve.page.html @@ -57,8 +57,8 @@
-
AGEANDA DO PR
-
AGEANDA DO MDGPR
+
AGENDA DO PR
+
AGENDA DO MDGPR
Agenda {{calendars.wxFullName}}
Minha agenda diff --git a/src/app/store/notification-holder.service.ts b/src/app/store/notification-holder.service.ts index 6d8c80049..686f972f7 100644 --- a/src/app/store/notification-holder.service.ts +++ b/src/app/store/notification-holder.service.ts @@ -2,6 +2,7 @@ import { Injectable, NgZone } from '@angular/core'; import { StorageService } from '../services/storage.service'; import { v4 as uuidv4 } from 'uuid' import { SHA1 } from 'crypto-js'; +import { XTracer } from '../services/monitoring/opentelemetry/tracer'; @Injectable({ providedIn: 'root' }) @@ -185,6 +186,7 @@ export class NotificationHolderService { addNotification(notification) { + console.log(notification) let notificationObject = this.notificationObject(notification) //alert("add notification") diff --git a/src/global.scss b/src/global.scss index 45c1c67e9..9c856843f 100644 --- a/src/global.scss +++ b/src/global.scss @@ -55,7 +55,7 @@ td.monthview-primary-with-event { td.monthview-current{ border-bottom: 1px solid var(--monthview-selected) !important; color: black !important; - background-color: #e39c956b !important; + background-color: #c0c0c0 !important; font-weight: 500; } // selected date ============================= diff --git a/version/git-version.ts b/version/git-version.ts index 8c1bb6e22..7fbe8e44c 100644 --- a/version/git-version.ts +++ b/version/git-version.ts @@ -1,5 +1,5 @@ export let versionData = { - "shortSHA": "680f573P466", + "shortSHA": "680f57366", "SHA": "680f57313f4d97d944e96c6e3457b7f1a9f379f0", "branch": "notification-header/feature", "lastCommitAuthor": "'Peter Maquiran'",