mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 20:47:54 +00:00
ITOTEAM-523 A app não redireciona as notificações
This commit is contained in:
@@ -187,7 +187,7 @@ export class HomePage implements OnInit {
|
|||||||
|
|
||||||
if ("serviceWorker" in navigator) {
|
if ("serviceWorker" in navigator) {
|
||||||
navigator.serviceWorker.onmessage = (event) => {
|
navigator.serviceWorker.onmessage = (event) => {
|
||||||
console.log('Mensagem recebida do Service Worker:', event.data.data);
|
console.log('Mensagem recebida do Service Worker:', event.data);
|
||||||
let object = {
|
let object = {
|
||||||
notification: event.data
|
notification: event.data
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,32 +2,8 @@ import { Injectable } from '@angular/core';
|
|||||||
import { HTTP_INTERCEPTORS, HttpEvent, HttpHandler, HttpInterceptor, HttpRequest, HttpResponse } from '@angular/common/http';
|
import { HTTP_INTERCEPTORS, HttpEvent, HttpHandler, HttpInterceptor, HttpRequest, HttpResponse } from '@angular/common/http';
|
||||||
import { Observable } from 'rxjs';
|
import { Observable } from 'rxjs';
|
||||||
import { tap } from 'rxjs/operators';
|
import { tap } from 'rxjs/operators';
|
||||||
import { metrics } from '@opentelemetry/api';
|
import { meter, RequestCounter } from '../services/monitoring/opentelemetry/matrix';
|
||||||
import { OTLPMetricExporter } from '@opentelemetry/exporter-metrics-otlp-http';
|
|
||||||
import { MeterProvider, PeriodicExportingMetricReader } from '@opentelemetry/sdk-metrics';
|
|
||||||
|
|
||||||
// Initialize OpenTelemetry metrics
|
|
||||||
const meterProvider = new MeterProvider();
|
|
||||||
metrics.setGlobalMeterProvider(meterProvider);
|
|
||||||
|
|
||||||
if (window.location.protocol !== 'https:') {
|
|
||||||
const metricReader = new PeriodicExportingMetricReader({
|
|
||||||
exporter: new OTLPMetricExporter({
|
|
||||||
url: 'http://5-180-182-151.cloud-xip.com:4318/v1/metrics',
|
|
||||||
// headers: {
|
|
||||||
// 'Authorization': 'Basic ' + btoa('tabteste@006:tabteste@006'),
|
|
||||||
// }
|
|
||||||
}),
|
|
||||||
exportIntervalMillis: 3000,
|
|
||||||
});
|
|
||||||
|
|
||||||
meterProvider.addMetricReader(metricReader);
|
|
||||||
}
|
|
||||||
|
|
||||||
const meter = meterProvider.getMeter('example-exporter-collector');
|
|
||||||
const requestCounter = meter.createCounter('post_requests', {
|
|
||||||
description: 'Example of a Counter',
|
|
||||||
});
|
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class MetricsInterceptor implements HttpInterceptor {
|
export class MetricsInterceptor implements HttpInterceptor {
|
||||||
@@ -37,7 +13,7 @@ export class MetricsInterceptor implements HttpInterceptor {
|
|||||||
if (event instanceof HttpResponse) {
|
if (event instanceof HttpResponse) {
|
||||||
// Capture the status code and check protocol
|
// Capture the status code and check protocol
|
||||||
if (req.method !== 'GET' && !req.urlWithParams.includes('metrics')) {
|
if (req.method !== 'GET' && !req.urlWithParams.includes('metrics')) {
|
||||||
|
|
||||||
console.log('response', event.body)
|
console.log('response', event.body)
|
||||||
const path = req.urlWithParams;
|
const path = req.urlWithParams;
|
||||||
const url = new URL(path);
|
const url = new URL(path);
|
||||||
@@ -45,7 +21,7 @@ export class MetricsInterceptor implements HttpInterceptor {
|
|||||||
let attributes = { path: url.pathname, method: req.method };
|
let attributes = { path: url.pathname, method: req.method };
|
||||||
const statusCode = event.status;
|
const statusCode = event.status;
|
||||||
const extendedAttributes = { ...attributes, status: statusCode };
|
const extendedAttributes = { ...attributes, status: statusCode };
|
||||||
requestCounter.add(1, extendedAttributes);
|
RequestCounter.add(1, extendedAttributes);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -58,4 +34,4 @@ export const metricsInterceptor = {
|
|||||||
provide: HTTP_INTERCEPTORS,
|
provide: HTTP_INTERCEPTORS,
|
||||||
useClass: MetricsInterceptor,
|
useClass: MetricsInterceptor,
|
||||||
multi: true
|
multi: true
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import { Component, OnInit, NgZone } from '@angular/core';
|
import { Component, OnInit, NgZone } from '@angular/core';
|
||||||
import { NavigationExtras, Router } from '@angular/router';
|
import { NavigationExtras, Router } from '@angular/router';
|
||||||
import { AnimationController, ModalController, Platform } from '@ionic/angular';
|
import { AnimationController, ModalController, Platform } from '@ionic/angular';
|
||||||
import { LoginUserRespose } from 'src/app/models/user.model';
|
|
||||||
import { AuthService } from 'src/app/services/auth.service';
|
import { AuthService } from 'src/app/services/auth.service';
|
||||||
import { EditProfilePage } from './edit-profile/edit-profile.page';
|
import { EditProfilePage } from './edit-profile/edit-profile.page';
|
||||||
import { StorageService } from '../../services/storage.service';
|
import { StorageService } from '../../services/storage.service';
|
||||||
@@ -13,7 +12,9 @@ import { environment } from 'src/environments/environment';
|
|||||||
import { ProcessesService } from 'src/app/services/processes.service';
|
import { ProcessesService } from 'src/app/services/processes.service';
|
||||||
import { EventsService } from 'src/app/services/events.service';
|
import { EventsService } from 'src/app/services/events.service';
|
||||||
import { NotificationHolderService } from 'src/app/store/notification-holder.service';
|
import { NotificationHolderService } from 'src/app/store/notification-holder.service';
|
||||||
import { TracingType, XTracer } from 'src/app/services/monitoring/opentelemetry/tracer';
|
import { TracingType, XTracerAsync } from 'src/app/services/monitoring/opentelemetry/tracer';
|
||||||
|
import { AgendaDataRepositoryService } from 'src/app/services/Repositorys/Agenda/agenda-data-repository.service';
|
||||||
|
import { ToastService } from 'src/app/services/toast.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-profile',
|
selector: 'app-profile',
|
||||||
@@ -58,7 +59,9 @@ export class ProfilePage implements OnInit {
|
|||||||
private eventsService: EventsService,
|
private eventsService: EventsService,
|
||||||
private storageService: StorageService,
|
private storageService: StorageService,
|
||||||
public NotificationHolderService: NotificationHolderService,
|
public NotificationHolderService: NotificationHolderService,
|
||||||
private authservice: AuthService
|
private authservice: AuthService,
|
||||||
|
private agendaDataRepository: AgendaDataRepositoryService,
|
||||||
|
private toastService: ToastService,
|
||||||
) {
|
) {
|
||||||
|
|
||||||
window['e'] = () => {
|
window['e'] = () => {
|
||||||
@@ -212,41 +215,68 @@ export class ProfilePage implements OnInit {
|
|||||||
return time;
|
return time;
|
||||||
}
|
}
|
||||||
|
|
||||||
@XTracer({name:'profile/notificationClick', bugPrint: true, module:'notification'})
|
@XTracerAsync({name:'profile/notificationClick', bugPrint: true, module:'notification'})
|
||||||
notificatinsRoutes (index, Service, Object, IdObject, FolderId, i, tracing?: TracingType) {
|
async notificatinsRoutes (index, Service, Object, IdObject, FolderId, i, tracing?: TracingType) {
|
||||||
|
|
||||||
console.log(index, i)
|
console.log(index, i)
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (Service === "agenda") {
|
if (Service === "agenda") {
|
||||||
this.isloading = true
|
this.isloading = true
|
||||||
if (Service === "agenda" && IdObject.length > 10) {
|
if (Service === "agenda") {
|
||||||
this.eventsService.getEvent(IdObject).subscribe((task) => {
|
|
||||||
|
|
||||||
this.zone.run(() => this.router.navigate(['/home/agenda', IdObject, 'agenda']));
|
let res = await this.agendaDataRepository.getEventById(IdObject, tracing)
|
||||||
this.deleteNotification(index);
|
|
||||||
this.isloading = false
|
|
||||||
|
|
||||||
}, (error) => {
|
if(IdObject) {
|
||||||
this.NotificationHolderService.notificationList[i].read = true;
|
|
||||||
this.isloading = false
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Service === "agenda" && Object === "event-list") {
|
if(res.isOk()) {
|
||||||
|
|
||||||
|
this.zone.run(() => this.router.navigate(['/home/agenda', IdObject, 'agenda']));
|
||||||
|
this.deleteNotification(index);
|
||||||
|
tracing.setAttribute('outcome', 'success')
|
||||||
|
} else {
|
||||||
|
tracing.setAttribute('outcome', 'success')
|
||||||
|
tracing.setAttribute('data.exist', 'false')
|
||||||
|
this.NotificationHolderService.notificationList[i].read = true;
|
||||||
|
console.log('error', res.error)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
tracing.setAttribute('data.IdObject', 'false')
|
||||||
|
this.toastService._badRequest('Pedimos desculpa mas não foi possível executar a acção. Por favor, contacte o apoio técnico. #01')
|
||||||
|
}
|
||||||
|
|
||||||
|
this.isloading = false
|
||||||
|
|
||||||
|
} else if (Service === "agenda" && Object === "event-list") {
|
||||||
this.isloading = true
|
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) => {
|
if(IdObject) {
|
||||||
console.log('evento não existe')
|
|
||||||
this.NotificationHolderService.notificationList[i].read = true;
|
|
||||||
this.isloading = false
|
|
||||||
})
|
|
||||||
|
|
||||||
|
let res = await this.agendaDataRepository.getEventById(IdObject, tracing)
|
||||||
|
if(res.isOk()) {
|
||||||
|
console.log('evento exist')
|
||||||
|
tracing.setAttribute('outcome', 'success')
|
||||||
|
this.zone.run(() => this.router.navigate(['/home/agenda/event-list/approve-event', IdObject, 'agenda']));
|
||||||
|
this.deleteNotification(index);
|
||||||
|
this.isloading = false
|
||||||
|
} else {
|
||||||
|
tracing.setAttribute('outcome', 'success')
|
||||||
|
console.log('evento não existe')
|
||||||
|
tracing.setAttribute('data.exist', 'false')
|
||||||
|
this.NotificationHolderService.notificationList[i].read = true;
|
||||||
|
this.isloading = false
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
tracing.setAttribute('data.IdObject', 'false')
|
||||||
|
this.toastService._badRequest('Pedimos desculpa mas não foi possível executar a acção. Por favor, contacte o apoio técnico. #01')
|
||||||
|
}
|
||||||
|
|
||||||
|
this.isloading = false
|
||||||
|
|
||||||
|
} else {
|
||||||
|
tracing.setAttribute('notification.route', 'false')
|
||||||
|
tracing.setAttribute('outcome', 'failed')
|
||||||
|
tracing.setAttribute('parameters', JSON.stringify({Service, Object, IdObject, FolderId}))
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (Service === "gabinete-digital") {
|
} else if (Service === "gabinete-digital") {
|
||||||
|
|||||||
@@ -92,6 +92,55 @@ export class ViewDocumentPage implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// @XTracerAsync({name:'view-document/LoadViewer', bugPrint: true, daley: 4000})
|
||||||
|
// async LoadViewer(tracing?: TracingType) {
|
||||||
|
// this.processes.GetViewer(this.docId, this.applicationId).subscribe(async(res)=> {
|
||||||
|
|
||||||
|
// const link: string = res.replace('//pdfjs/web/', '/pdfjs/web/')
|
||||||
|
// this.trustedUrl = this.sanitazer.bypassSecurityTrustResourceUrl(link);
|
||||||
|
|
||||||
|
// // const iframe = document.getElementById("iframe")
|
||||||
|
// // const handleLoad = () => {
|
||||||
|
// // this.loader = false
|
||||||
|
// // };
|
||||||
|
|
||||||
|
// // iframe.addEventListener('load', handleLoad, true)
|
||||||
|
|
||||||
|
// if(res == "") {
|
||||||
|
// const alert = await this.alertController.create({
|
||||||
|
// cssClass: 'my-custom-class',
|
||||||
|
// //header: 'Apagar evento!',
|
||||||
|
// message: 'Sem imagem',
|
||||||
|
// buttons: [
|
||||||
|
// {
|
||||||
|
// text: 'Sim',
|
||||||
|
// handler: () => {
|
||||||
|
// this.close();
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// ]
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
|
||||||
|
// tracing.setAttribute('outcome', 'success')
|
||||||
|
|
||||||
|
// }, (error)=>{
|
||||||
|
// if(isHttpError(error)) {
|
||||||
|
// tracing?.setAttribute('status.code', error.status.toString())
|
||||||
|
// if (error.status == 400) {
|
||||||
|
// tracing?.bugFlag()
|
||||||
|
// tracing?.setAttribute('outcome', 'failed')
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// tracing.setAttribute('outcome', 'failed')
|
||||||
|
// this.close();
|
||||||
|
// });
|
||||||
|
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
close() {
|
close() {
|
||||||
this.modalController.dismiss();
|
this.modalController.dismiss();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -72,8 +72,8 @@ export const EventInputDTOSchema = z.object({
|
|||||||
subject: z.string().min(1),
|
subject: z.string().min(1),
|
||||||
body: z.string().min(1),
|
body: z.string().min(1),
|
||||||
location: z.string().nullable().optional(),
|
location: z.string().nullable().optional(),
|
||||||
startDate: z.string().datetime(),
|
startDate: z.string(),
|
||||||
endDate: z.string().datetime(),
|
endDate: z.string(),
|
||||||
type: EEventTypeDTO,
|
type: EEventTypeDTO,
|
||||||
category: EEventCategoryDTO,
|
category: EEventCategoryDTO,
|
||||||
attendees: z.array(AttendeeInputDTOSchema).nullable().optional(),
|
attendees: z.array(AttendeeInputDTOSchema).nullable().optional(),
|
||||||
|
|||||||
@@ -131,73 +131,69 @@ export class ListBoxService {
|
|||||||
cloneSelectedDate.setMinutes(0)
|
cloneSelectedDate.setMinutes(0)
|
||||||
cloneSelectedDate.setSeconds(0)
|
cloneSelectedDate.setSeconds(0)
|
||||||
|
|
||||||
if (diffDays <= 150 ) {
|
|
||||||
|
|
||||||
if (diffDays >= 1) {
|
if (diffDays >= 1) {
|
||||||
|
|
||||||
const StartEvent = this.transForm(event, {startMany: true, endMany: false, middle: false})
|
const StartEvent = this.transForm(event, {startMany: true, endMany: false, middle: false})
|
||||||
|
|
||||||
if(this.CanPush(event, selectedDate) && (new Date(event.start)).getTime() >= cloneSelectedDate.getTime()) {
|
if(this.CanPush(event, selectedDate) && (new Date(event.start)).getTime() >= cloneSelectedDate.getTime()) {
|
||||||
days[day].push(StartEvent); this.push(StartEvent, year)
|
days[day].push(StartEvent); this.push(StartEvent, year)
|
||||||
|
}
|
||||||
|
|
||||||
|
let i = 1;
|
||||||
|
|
||||||
|
//create event between date
|
||||||
|
while (startDate.getFullYear() != endDate.getFullYear() ||
|
||||||
|
startDate.getMonth() != endDate.getMonth() ||
|
||||||
|
startDate.getDate() != endDate.getDate()) {
|
||||||
|
|
||||||
|
const newDate = startDate.setDate(startDate.getDate()+ i)
|
||||||
|
let otherDays = this.dateService.getDay(newDate)
|
||||||
|
|
||||||
|
const cloneEvent = {...event}
|
||||||
|
cloneEvent['other'] = true
|
||||||
|
|
||||||
|
cloneEvent.start = new Date(startDate)
|
||||||
|
|
||||||
|
if(!days.hasOwnProperty(otherDays)) {
|
||||||
|
days[otherDays] = []
|
||||||
}
|
}
|
||||||
|
|
||||||
let i = 1;
|
if (!(startDate.getFullYear() != endDate.getFullYear() ||
|
||||||
|
startDate.getMonth() != endDate.getMonth() ||
|
||||||
|
startDate.getDate() != endDate.getDate())) {
|
||||||
|
// last push
|
||||||
|
const EndEvent = this.transForm(cloneEvent, {startMany: false, endMany: true, middle: false})
|
||||||
|
if(this.CanPush(cloneEvent, selectedDate) && cloneEvent.start.getTime() >= cloneSelectedDate.getTime()) {
|
||||||
|
days[otherDays].push(EndEvent) ; this.push(EndEvent, year)
|
||||||
|
}
|
||||||
|
|
||||||
//create event between date
|
} else {
|
||||||
while (startDate.getFullYear() != endDate.getFullYear() ||
|
|
||||||
startDate.getMonth() != endDate.getMonth() ||
|
|
||||||
startDate.getDate() != endDate.getDate()) {
|
|
||||||
|
|
||||||
const newDate = startDate.setDate(startDate.getDate()+ i)
|
const EndEvent = this.transForm(cloneEvent, {startMany: false,endMany: true, middle: true})
|
||||||
let otherDays = this.dateService.getDay(newDate)
|
if(this.CanPush(cloneEvent, selectedDate) && cloneEvent.start.getTime() >= cloneSelectedDate.getTime()) {
|
||||||
|
days[otherDays].push(EndEvent) ; this.push(EndEvent, year)
|
||||||
const cloneEvent = {...event}
|
} else {
|
||||||
cloneEvent['other'] = true
|
if( cloneEvent.start.getFullYear() == cloneSelectedDate.getFullYear() && cloneEvent.start.getDate() == cloneSelectedDate.getDate() && cloneEvent.start.getMonth() == cloneSelectedDate.getMonth()) {
|
||||||
|
// console.log("00_00")
|
||||||
cloneEvent.start = new Date(startDate)
|
|
||||||
|
|
||||||
if(!days.hasOwnProperty(otherDays)) {
|
|
||||||
days[otherDays] = []
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!(startDate.getFullYear() != endDate.getFullYear() ||
|
|
||||||
startDate.getMonth() != endDate.getMonth() ||
|
|
||||||
startDate.getDate() != endDate.getDate())) {
|
|
||||||
// last push
|
|
||||||
const EndEvent = this.transForm(cloneEvent, {startMany: false, endMany: true, middle: false})
|
|
||||||
if(this.CanPush(cloneEvent, selectedDate) && cloneEvent.start.getTime() >= cloneSelectedDate.getTime()) {
|
|
||||||
days[otherDays].push(EndEvent) ; this.push(EndEvent, year)
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
|
||||||
|
|
||||||
const EndEvent = this.transForm(cloneEvent, {startMany: false,endMany: true, middle: true})
|
|
||||||
if(this.CanPush(cloneEvent, selectedDate) && cloneEvent.start.getTime() >= cloneSelectedDate.getTime()) {
|
|
||||||
days[otherDays].push(EndEvent) ; this.push(EndEvent, year)
|
days[otherDays].push(EndEvent) ; this.push(EndEvent, year)
|
||||||
} else {
|
} else {
|
||||||
if( cloneEvent.start.getFullYear() == cloneSelectedDate.getFullYear() && cloneEvent.start.getDate() == cloneSelectedDate.getDate() && cloneEvent.start.getMonth() == cloneSelectedDate.getMonth()) {
|
// console.log('0000000000000000000000000',cloneEvent.start.getTime(), cloneSelectedDate.getTime())
|
||||||
// console.log("00_00")
|
// console.log('0000000000000000000000000',cloneEvent.start, cloneSelectedDate)
|
||||||
days[otherDays].push(EndEvent) ; this.push(EndEvent, year)
|
|
||||||
} else {
|
|
||||||
// console.log('0000000000000000000000000',cloneEvent.start.getTime(), cloneSelectedDate.getTime())
|
|
||||||
// console.log('0000000000000000000000000',cloneEvent.start, cloneSelectedDate)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
days[otherDays] = days[otherDays].reverse()
|
days[otherDays] = days[otherDays].reverse()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
if(this.CanPush(event, selectedDate)) { days[day].push(event) ; this.push(event, year) }
|
||||||
|
}
|
||||||
|
|
||||||
if(this.CanPush(event, selectedDate)) { days[day].push(event) ; this.push(event, year) }
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if(this.CanPush(event, selectedDate)) { days[day].push(event) ; this.push(event, year) }
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
if(this.CanPush(event, selectedDate) && diffDays != 2) { days[day].push(event) ; this.push(event, year) }
|
if(this.CanPush(event, selectedDate) && diffDays != 2) { days[day].push(event) ; this.push(event, year) }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,67 +1,31 @@
|
|||||||
const { DiagConsoleLogger, DiagLogLevel, diag, metrics } = require('@opentelemetry/api');
|
import { metrics } from '@opentelemetry/api';
|
||||||
const { OTLPMetricExporter } = require('@opentelemetry/exporter-metrics-otlp-http');
|
import { OTLPMetricExporter } from '@opentelemetry/exporter-metrics-otlp-http';
|
||||||
const { MeterProvider, PeriodicExportingMetricReader } = require('@opentelemetry/sdk-metrics');
|
import { MeterProvider, PeriodicExportingMetricReader } from '@opentelemetry/sdk-metrics';
|
||||||
|
import { environment } from 'src/environments/environment';
|
||||||
|
|
||||||
// Optional and only needed to see the internal diagnostic logging (during development)
|
// Initialize OpenTelemetry metrics
|
||||||
// diag.setLogger(new DiagConsoleLogger(), DiagLogLevel.DEBUG);
|
const meterProvider = new MeterProvider();
|
||||||
|
metrics.setGlobalMeterProvider(meterProvider);
|
||||||
|
|
||||||
let interval;
|
if (window.location.protocol !== 'https:' && environment.presidential == false) {
|
||||||
let meter;
|
const metricReader = new PeriodicExportingMetricReader({
|
||||||
|
exporter: new OTLPMetricExporter({
|
||||||
|
url: 'http://5-180-182-151.cloud-xip.com:4318/v1/metrics',
|
||||||
|
// headers: {
|
||||||
|
// 'Authorization': 'Basic ' + btoa('tabteste@006:tabteste@006'),
|
||||||
|
// }
|
||||||
|
}),
|
||||||
|
exportIntervalMillis: 3000,
|
||||||
|
});
|
||||||
|
|
||||||
// function stopMetrics() {
|
meterProvider.addMetricReader(metricReader);
|
||||||
// console.log('STOPPING METRICS');
|
}
|
||||||
// clearInterval(interval);
|
|
||||||
// metrics.getMeterProvider().shutdown()
|
|
||||||
// .then(() => metrics.disable());
|
|
||||||
// }
|
|
||||||
|
|
||||||
// function startMetrics() {
|
export const meter = meterProvider.getMeter('example-exporter-collector');
|
||||||
// console.log('STARTING METRICS');
|
export const RequestCounter = meter.createCounter('post_requests', {
|
||||||
|
description: 'Example of a Counter',
|
||||||
|
});
|
||||||
|
|
||||||
// const meterProvider = new MeterProvider();
|
export const UseCaseCounter = meter.createCounter('use_case', {
|
||||||
// metrics.setGlobalMeterProvider(meterProvider);
|
description: 'use case counter',
|
||||||
|
});
|
||||||
// meterProvider.addMetricReader(new PeriodicExportingMetricReader({
|
|
||||||
// exporter: new OTLPMetricExporter({
|
|
||||||
// //url: 'http://localhost:8019/collector/v1/metrics',
|
|
||||||
// // url: 'http://localhost:4318/v1/metrics',
|
|
||||||
// url: 'http://5-180-182-151.cloud-xip.com:4318/v1/metrics', // Custom port 85
|
|
||||||
// //url: 'https://5-180-182-151.cloud-xip.com:85/collector/v1/metrics', // Custom port 85
|
|
||||||
// // headers: {
|
|
||||||
// // 'Authorization': 'Basic ' + btoa('tabteste@006:tabteste@006'),
|
|
||||||
// // }
|
|
||||||
// }),
|
|
||||||
// exportIntervalMillis: 2000
|
|
||||||
// }));
|
|
||||||
|
|
||||||
// meter = meterProvider.getMeter('example-exporter-collector')
|
|
||||||
|
|
||||||
// const requestCounter = meter.createCounter('requests', {
|
|
||||||
// description: 'Example of a Counter',
|
|
||||||
// });
|
|
||||||
|
|
||||||
// const upDownCounter = meter.createUpDownCounter('test_up_down_counter', {
|
|
||||||
// description: 'Example of a UpDownCounter',
|
|
||||||
// });
|
|
||||||
|
|
||||||
// const attributes = { environment: 'staging' };
|
|
||||||
|
|
||||||
// interval = setInterval(() => {
|
|
||||||
// requestCounter.add(1, attributes);
|
|
||||||
// requestCounter.add(1, {environment: 'testing'});
|
|
||||||
// requestCounter.add(1, {environment: 'ok'});
|
|
||||||
// upDownCounter.add(Math.random() > 0.5 ? 1 : -1, attributes);
|
|
||||||
// }, 1000);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// const addClickEvents = () => {
|
|
||||||
// // const startBtn = document.getElementById('startBtn');
|
|
||||||
|
|
||||||
// // const stopBtn = document.getElementById('stopBtn');
|
|
||||||
// // startBtn.addEventListener('click', startMetrics);
|
|
||||||
// // stopBtn.addEventListener('click', stopMetrics);
|
|
||||||
|
|
||||||
// // startMetrics()
|
|
||||||
// };
|
|
||||||
|
|
||||||
// // addClickEvents();
|
|
||||||
|
|||||||
@@ -5,6 +5,8 @@ import { OpentelemetryAgendaProvider, OpentelemetryInterceptorProvider, Opentele
|
|||||||
import { Device, DeviceInfo } from '@capacitor/device';
|
import { Device, DeviceInfo } from '@capacitor/device';
|
||||||
import { SessionStore } from 'src/app/store/session.service';
|
import { SessionStore } from 'src/app/store/session.service';
|
||||||
import { environment } from 'src/environments/environment';
|
import { environment } from 'src/environments/environment';
|
||||||
|
import { UseCaseCounter } from './matrix';
|
||||||
|
// import { context, propagation } from '@opentelemetry/api';
|
||||||
|
|
||||||
const tracerInstance = OpentelemetryAgendaProvider.getTracer('example-tracer-hole', '111', {})
|
const tracerInstance = OpentelemetryAgendaProvider.getTracer('example-tracer-hole', '111', {})
|
||||||
const tracerNotificationInstance = OpentelemetryNotificationProvider.getTracer('example-tracer-hole', '111', {})
|
const tracerNotificationInstance = OpentelemetryNotificationProvider.getTracer('example-tracer-hole', '111', {})
|
||||||
@@ -58,10 +60,16 @@ const createTracingInstance = ({bugPrint, name, module, autoFinish}): TracingTyp
|
|||||||
data.tags[key] = value;
|
data.tags[key] = value;
|
||||||
span.setAttribute(key, value);
|
span.setAttribute(key, value);
|
||||||
},
|
},
|
||||||
|
getAttribute: (key: string) => {
|
||||||
|
return data.tags[key]
|
||||||
|
},
|
||||||
finish: () => {
|
finish: () => {
|
||||||
span.end();
|
if(environment.presidential == false) {
|
||||||
|
span.end();
|
||||||
|
UseCaseCounter.add(1, {user: SessionStore?.user?.FullName, outcome:data.tags['outcome'], usecase: name})
|
||||||
|
}
|
||||||
|
|
||||||
if(bugPrint && hasBug) {
|
if(bugPrint && data.tags['outcome'] == 'failed') {
|
||||||
console.error(name, data)
|
console.error(name, data)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -92,12 +100,13 @@ export function XTracerAsync({ name, bugPrint, module = null, autoFinish = true,
|
|||||||
tracing.setAttribute('commit.date', environment.version.lastCommitTime)
|
tracing.setAttribute('commit.date', environment.version.lastCommitTime)
|
||||||
tracing.setAttribute('commit.branch', environment.version.branch)
|
tracing.setAttribute('commit.branch', environment.version.branch)
|
||||||
|
|
||||||
|
|
||||||
args.push(tracing)
|
args.push(tracing)
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const result = await originalMethod.apply(this, args);
|
const result = await originalMethod.apply(this, args);
|
||||||
|
|
||||||
if(autoFinish) {
|
if(autoFinish ) {
|
||||||
setTimeout(tracing.finish , daley)
|
setTimeout(tracing.finish , daley)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -167,6 +176,7 @@ export type TracingType = {
|
|||||||
//logEvent: (name: string, attributesOrStartTime?: AttributeValue | TimeInput) => void;
|
//logEvent: (name: string, attributesOrStartTime?: AttributeValue | TimeInput) => void;
|
||||||
addEvent: (context: string, message?: any, obj?: any) => void;
|
addEvent: (context: string, message?: any, obj?: any) => void;
|
||||||
setAttribute: (key: string, value: string) => void;
|
setAttribute: (key: string, value: string) => void;
|
||||||
|
getAttribute: (key: string) => string;
|
||||||
LocalLogEvent: (name: string, attributesOrStartTime: any, obj?:any) => void;
|
LocalLogEvent: (name: string, attributesOrStartTime: any, obj?:any) => void;
|
||||||
finish: () => void;
|
finish: () => void;
|
||||||
bugFlag:() => void;
|
bugFlag:() => void;
|
||||||
|
|||||||
@@ -143,7 +143,7 @@ export class NotificationsService {
|
|||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
navigator.serviceWorker.onmessage = (event) => {
|
navigator.serviceWorker.onmessage = (event) => {
|
||||||
console.log('Mensagem recebida do Service Worker:', event.data.data);
|
console.log('Mensagem recebida do Service Worker:', event.data);
|
||||||
let object = {
|
let object = {
|
||||||
notification: event.data
|
notification: event.data
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -288,7 +288,7 @@ export class NotificationsService {
|
|||||||
try {
|
try {
|
||||||
|
|
||||||
navigator.serviceWorker.onmessage = (event) => {
|
navigator.serviceWorker.onmessage = (event) => {
|
||||||
console.log('Mensagem recebida do Service Worker:', event.data.data);
|
console.log('Mensagem recebida do Service Worker:', event.data);
|
||||||
let object = {
|
let object = {
|
||||||
notification: event.data
|
notification: event.data
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -57,6 +57,23 @@ export class ToastService {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
removeBeforeHash(text) {
|
||||||
|
const hashIndex = text.indexOf('#');
|
||||||
|
if (hashIndex !== -1) {
|
||||||
|
return text.substring(hashIndex);
|
||||||
|
}
|
||||||
|
return text;
|
||||||
|
}
|
||||||
|
|
||||||
|
getEverythingBeforeHash(text) {
|
||||||
|
const hashIndex = text.indexOf('#');
|
||||||
|
if (hashIndex !== -1) {
|
||||||
|
return text.substring(0, hashIndex).trim();
|
||||||
|
}
|
||||||
|
return text;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
async _badRequest(message?: string, callback?) {
|
async _badRequest(message?: string, callback?) {
|
||||||
|
|
||||||
let notification = document.createElement('div')
|
let notification = document.createElement('div')
|
||||||
@@ -73,9 +90,9 @@ export class ToastService {
|
|||||||
`
|
`
|
||||||
|
|
||||||
notification.style.animationName = 'notification-top'
|
notification.style.animationName = 'notification-top'
|
||||||
|
console.error(this.removeBeforeHash(message))
|
||||||
document.body.append(notification)
|
document.body.append(notification)
|
||||||
notification.querySelector('.text').innerHTML = message || 'Processo não efetuado'
|
notification.querySelector('.text').innerHTML = this.getEverythingBeforeHash(message) || 'Processo não efetuado'
|
||||||
setTimeout(()=>{
|
setTimeout(()=>{
|
||||||
if (callback) {
|
if (callback) {
|
||||||
callback()
|
callback()
|
||||||
|
|||||||
@@ -78,6 +78,8 @@ export class ViewEventPage implements OnInit {
|
|||||||
this.loadedEvent = new Event();
|
this.loadedEvent = new Event();
|
||||||
this.eventBody = { BodyType : "1", Text : ""};
|
this.eventBody = { BodyType : "1", Text : ""};
|
||||||
this.loadedEvent.Body = this.eventBody;
|
this.loadedEvent.Body = this.eventBody;
|
||||||
|
|
||||||
|
console.log()
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
@@ -128,7 +130,7 @@ export class ViewEventPage implements OnInit {
|
|||||||
setTimeZone() {
|
setTimeZone() {
|
||||||
this.TimeZoneString = this.loadedEvent.TimeZone
|
this.TimeZoneString = this.loadedEvent.TimeZone
|
||||||
}
|
}
|
||||||
@XTracerAsync({name:'ViewEventPage/loadEvent', bugPrint: true})
|
@XTracerAsync({name:'desktop/event-details', bugPrint: true})
|
||||||
async loadEvent(tracing?: TracingType) {
|
async loadEvent(tracing?: TracingType) {
|
||||||
|
|
||||||
let res = await this.agendaDataRepository.getEventById(this.eventId, tracing)
|
let res = await this.agendaDataRepository.getEventById(this.eventId, tracing)
|
||||||
@@ -139,6 +141,7 @@ export class ViewEventPage implements OnInit {
|
|||||||
|
|
||||||
/* let changeDate = this.dateService.fixDate(res.value as any) as any */
|
/* let changeDate = this.dateService.fixDate(res.value as any) as any */
|
||||||
this.loadedEvent = res.value as any;
|
this.loadedEvent = res.value as any;
|
||||||
|
console.log('this.loadedEvent', this.loadedEvent)
|
||||||
this.setTimeZone()
|
this.setTimeZone()
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ export class NotificationHolderService {
|
|||||||
FolderId: element.FolderId || element.data.folderId,
|
FolderId: element.FolderId || element.data.folderId,
|
||||||
IdObject: element.IdObject || element.data.idObject,
|
IdObject: element.IdObject || element.data.idObject,
|
||||||
Location: element.Location,
|
Location: element.Location,
|
||||||
Object: element.Object || element.data.service,
|
Object: element.Object || element.data.object,
|
||||||
Role: element.Role,
|
Role: element.Role,
|
||||||
Service: element.Service || element.data.service,
|
Service: element.Service || element.data.service,
|
||||||
Status: element.Status,
|
Status: element.Status,
|
||||||
@@ -144,7 +144,7 @@ export class NotificationHolderService {
|
|||||||
title: element.title,
|
title: element.title,
|
||||||
Service: element.data.Service || element.data.service,
|
Service: element.data.Service || element.data.service,
|
||||||
Object: element.data.Object || element.data.object,
|
Object: element.data.Object || element.data.object,
|
||||||
IdObject: element.data.IdObject || element.data.odObject,
|
IdObject: element.data.IdObject || element.data.idObject,
|
||||||
FolderId: element.data.FolderId || element.data.folderId,
|
FolderId: element.data.FolderId || element.data.folderId,
|
||||||
body: element.body,
|
body: element.body,
|
||||||
dateInit: this.getFormatedTime(element.data.dateInit),
|
dateInit: this.getFormatedTime(element.data.dateInit),
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
export let versionData = {
|
export let versionData = {
|
||||||
"shortSHA": "93476dc5c",
|
"shortSHA": "76ff62d42",
|
||||||
"SHA": "93476dc5c494511533d5ae327a3b026399581e9b",
|
"SHA": "76ff62d4287fd56a7bfe5e837cc0d63d8fe3679d",
|
||||||
"branch": "feature/agenda-api-peter",
|
"branch": "feature/agenda-api-peter",
|
||||||
"lastCommitAuthor": "'Peter Maquiran'",
|
"lastCommitAuthor": "'Peter Maquiran'",
|
||||||
"lastCommitTime": "'Mon Jun 24 15:35:16 2024 +0100'",
|
"lastCommitTime": "'Mon Jun 24 16:08:20 2024 +0100'",
|
||||||
"lastCommitMessage": "ITOTEAM-597 remove atendess from list",
|
"lastCommitMessage": "ITOTEAM-594 Implementar o endpoint de listagem do tipo de agenda",
|
||||||
"lastCommitNumber": "5840",
|
"lastCommitNumber": "5841",
|
||||||
"changeStatus": "On branch feature/agenda-api-peter\nYour branch is ahead of 'origin/feature/agenda-api-peter' by 3 commits.\n (use \"git push\" to publish your local commits)\n\nChanges to be committed:\n (use \"git restore --staged <file>...\" to unstage)\n\tmodified: src/app/pages/agenda/edit-event/edit-event.page.ts\n\tmodified: src/app/pages/agenda/new-event/new-event.page.ts\n\tmodified: src/app/shared/agenda/edit-event/edit-event.page.ts\n\tmodified: src/app/shared/agenda/new-event/new-event.page.ts\n\nChanges not staged for commit:\n (use \"git add <file>...\" to update what will be committed)\n (use \"git restore <file>...\" to discard changes in working directory)\n\tmodified: src/app/services/notification/notification-holder.service.ts\n\tmodified: version/git-version.ts",
|
"changeStatus": "On branch feature/agenda-api-peter\nYour branch is ahead of 'origin/feature/agenda-api-peter' by 4 commits.\n (use \"git push\" to publish your local commits)\n\nChanges to be committed:\n (use \"git restore --staged <file>...\" to unstage)\n\tmodified: src/app/home/home.page.ts\n\tmodified: src/app/interceptors/metter.interceptor.ts\n\tmodified: src/app/modals/profile/profile.page.ts\n\tmodified: src/app/modals/view-document/view-document.page.ts\n\tmodified: src/app/services/Repositorys/Agenda/agendaDataModels.ts\n\tmodified: src/app/services/agenda/list-box.service.ts\n\tmodified: src/app/services/monitoring/opentelemetry/matrix.ts\n\tmodified: src/app/services/monitoring/opentelemetry/tracer.ts\n\tmodified: src/app/services/notification/notifications.service.ts\n\tmodified: src/app/services/notifications.service.ts\n\tmodified: src/app/services/toast.service.ts\n\tmodified: src/app/shared/agenda/view-event/view-event.page.ts\n\tmodified: src/app/store/notification-holder.service.ts\n\tmodified: version/git-version.ts",
|
||||||
"changeAuthor": "peter.maquiran"
|
"changeAuthor": "peter.maquiran"
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user