mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 04:57:52 +00:00
monitoring notifications
This commit is contained in:
@@ -101,17 +101,28 @@ export class ChatTokenInterceptor implements HttpInterceptor {
|
||||
}
|
||||
|
||||
private addToken(request: HttpRequest<any>, 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<any>, token: string) {
|
||||
|
||||
@@ -134,6 +134,10 @@
|
||||
<img style="width: 40px;" src="assets/images/logo-removebg-preview.png" />
|
||||
</div>
|
||||
|
||||
<!-- <div class="btn-close d-flex cursor-pointer pr-10 pl-10" (click)="changeTheme('default')">
|
||||
<img style="width: 40px;" src="assets/images/logo-removebg-preview.png" />
|
||||
</div> -->
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -63,8 +63,8 @@
|
||||
|
||||
<ion-segment-button *ngFor="let calendars of calendarData" value="{{calendars.wxUserId}}" >
|
||||
<div *ngIf="environment.presidential">
|
||||
<div *ngIf="calendars.roleId == RoleIdService.PRES">AGEANDA DO PR </div>
|
||||
<div *ngIf="calendars.roleId == RoleIdService.MD && calendars.roleId != SessionStore.user.RoleID">AGEANDA DO MDGPR</div>
|
||||
<div *ngIf="calendars.roleId == RoleIdService.PRES">AGENDA DO PR </div>
|
||||
<div *ngIf="calendars.roleId == RoleIdService.MD && calendars.roleId != SessionStore.user.RoleID">AGENDA DO MDGPR</div>
|
||||
<div *ngIf="calendars.roleId != RoleIdService.MD && calendars.roleId != RoleIdService.PRES && calendars.wxFullName && calendars.wxUserId != SessionStore.user.UserId "> Agenda {{calendars.wxFullName}} </div>
|
||||
<div *ngIf="calendars.wxUserId == SessionStore.user.UserId ">
|
||||
Minha agenda
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,9 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class NotificationRepositoryService {
|
||||
|
||||
constructor() { }
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -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<any> = (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))
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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() {
|
||||
|
||||
|
||||
@@ -12,8 +12,8 @@
|
||||
<ion-segment [(ngModel)]="selectedUserCalendar" (ionChange)="segmentChanged($event)" *ngIf="SessionStore.user.RoleID !== 100000014">
|
||||
<ion-segment-button *ngFor="let calendars of calendarData" value="{{calendars.wxUserId}}" >
|
||||
<div *ngIf="environment.presidential">
|
||||
<div *ngIf="calendars.roleId == RoleIdService.PRES">AGEANDA DO PR </div>
|
||||
<div *ngIf="calendars.roleId == RoleIdService.MD && calendars.roleId != SessionStore.user.RoleID">AGEANDA DO MDGPR</div>
|
||||
<div *ngIf="calendars.roleId == RoleIdService.PRES">AGENDA DO PR </div>
|
||||
<div *ngIf="calendars.roleId == RoleIdService.MD && calendars.roleId != SessionStore.user.RoleID">AGENDA DO MDGPR</div>
|
||||
<div *ngIf="calendars.roleId != RoleIdService.MD && calendars.roleId != RoleIdService.PRES && calendars.wxFullName && calendars.wxUserId != SessionStore.user.UserId "> Agenda {{calendars.wxFullName}} </div>
|
||||
<div *ngIf="calendars.wxUserId == SessionStore.user.UserId ">
|
||||
Minha agenda
|
||||
|
||||
@@ -57,8 +57,8 @@
|
||||
|
||||
<ion-segment-button *ngFor="let calendars of calendarData" value="{{calendars.wxUserId}}" >
|
||||
<div *ngIf="environment.presidential">
|
||||
<div *ngIf="calendars.roleId == RoleIdService.PRES">AGEANDA DO PR </div>
|
||||
<div *ngIf="calendars.roleId == RoleIdService.MD && calendars.roleId != SessionStore.user.RoleID">AGEANDA DO MDGPR</div>
|
||||
<div *ngIf="calendars.roleId == RoleIdService.PRES">AGENDA DO PR </div>
|
||||
<div *ngIf="calendars.roleId == RoleIdService.MD && calendars.roleId != SessionStore.user.RoleID">AGENDA DO MDGPR</div>
|
||||
<div *ngIf="calendars.roleId != RoleIdService.MD && calendars.roleId != RoleIdService.PRES && calendars.wxFullName && calendars.wxUserId != SessionStore.user.UserId "> Agenda {{calendars.wxFullName}} </div>
|
||||
<div *ngIf="calendars.wxUserId == SessionStore.user.UserId ">
|
||||
Minha agenda
|
||||
|
||||
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user