remove alert and change tracer

This commit is contained in:
Peter Maquiran
2024-06-19 09:03:26 +01:00
parent cb1e2ad753
commit 3fc377299c
18 changed files with 36 additions and 30 deletions
+1 -1
View File
@@ -121,7 +121,7 @@ export class ViewEventPage implements OnInit {
ev.target.complete(); ev.target.complete();
} }
@XTracerAsync({name:'ViewEventPage/loadEvent', log: false, bugPrint: true}) @XTracerAsync({name:'ViewEventPage/loadEvent', bugPrint: true})
async loadEvent(tracing?: TracingType) { async loadEvent(tracing?: TracingType) {
const loader = this.toastService.loading(); const loader = this.toastService.loading();
+1 -1
View File
@@ -678,7 +678,7 @@ export class AgendaPage implements OnInit {
}); });
}; };
@XTracerAsync({name:'AgendaPage/loadRangeEventRun', log: false, bugPrint: true}) @XTracerAsync({name:'AgendaPage/loadRangeEventRun', bugPrint: true})
async loadRangeEventRun(startTime: Date, endTime: Date, tracing?: TracingType) { async loadRangeEventRun(startTime: Date, endTime: Date, tracing?: TracingType) {
tracing.addEvent('load range start') tracing.addEvent('load range start')
@@ -191,7 +191,7 @@ export class ViewEventPage implements OnInit {
this.TimeZoneString = this.loadedEvent.TimeZone this.TimeZoneString = this.loadedEvent.TimeZone
} }
@XTracerAsync({name:'ViewEventPage/loadEvent', log: false, bugPrint: true}) @XTracerAsync({name:'ViewEventPage/loadEvent', bugPrint: true})
async loadEvent(tracing?: TracingType) { async loadEvent(tracing?: TracingType) {
const loader = this.toastService.loading(); const loader = this.toastService.loading();
@@ -99,7 +99,7 @@ export class ApproveEventPage implements OnInit {
} }
@XTracerAsync({name:'ApproveEventPage/getTask', log: false, bugPrint: true}) @XTracerAsync({name:'ApproveEventPage/getTask', bugPrint: true})
async getTask(tracing?: TracingType) { async getTask(tracing?: TracingType) {
const res = await this.AgendaDataRepositoryService.getEventToApproveById(this.serialNumber, tracing) const res = await this.AgendaDataRepositoryService.getEventToApproveById(this.serialNumber, tracing)
@@ -217,7 +217,7 @@ export class EventListPage implements OnInit {
this.LoadToApproveEvents(); this.LoadToApproveEvents();
} }
@XTracerAsync({name:'EventListPage/LoadToApproveEvents', log: false, bugPrint: true}) @XTracerAsync({name:'EventListPage/LoadToApproveEvents', bugPrint: true})
async LoadToApproveEvents(tracing?: TracingType) { async LoadToApproveEvents(tracing?: TracingType) {
console.log('aprove event') console.log('aprove event')
this.showLoader = true; this.showLoader = true;
@@ -116,7 +116,7 @@ export class AgendaDataRepositoryService {
return ok(result) return ok(result)
} catch (e) { } catch (e) {
if(isHttpError(e)) { if(isHttpError(e)) {
alert(e.status) console.log(e.status)
tracing?.setAttribute('status.code', e.status.toString()) tracing?.setAttribute('status.code', e.status.toString())
if (e.status == 400) { if (e.status == 400) {
tracing?.bugFlag() tracing?.bugFlag()
@@ -39,13 +39,13 @@ const OrganizerSchema = z.object({
}); });
const EventRecurrenceSchema = z.object({ const EventRecurrenceSchema = z.object({
Type: z.number(), Type: z.number().optional(),
Day: null, Day: z.any().optional(),
DayOfWeek: null, DayOfWeek: z.any(),
Month: null, Month: z.any(),
LastOccurrence: null, LastOccurrence: z.any().optional(),
frequency: z.number(), frequency: z.number().optional(),
until: z.string() until: z.string().optional()
}).nullable() }).nullable()
+5 -5
View File
@@ -21,7 +21,7 @@ export class BackgroundService {
private themeservice: ThemeService, private themeservice: ThemeService,
private storageservice: StorageService, private storageservice: StorageService,
private http: HttpClient, private http: HttpClient,
) { ) {
window.addEventListener('focus', (event) => { window.addEventListener('focus', (event) => {
if(this.status == 'offline') { if(this.status == 'offline') {
@@ -35,7 +35,7 @@ export class BackgroundService {
return false return false
} }
this.status = 'online' this.status = 'online'
this.paint() this.paint()
this.callBacks.forEach((e) => { this.callBacks.forEach((e) => {
if (e.type == 'Online') { if (e.type == 'Online') {
@@ -104,14 +104,14 @@ export class BackgroundService {
} }
try { try {
await this.http.post(environment.apiURL + "UserAuthentication/Login", '', opts).toPromise(); await this.http.get("assets/images/theme/gov/governoangola_A.png").toPromise();
return true return true
} catch (error) { } catch (error) {
if(error.status === 0) { if(error.status === 0) {
return false return false
} }
return true return true
} }
@@ -19,7 +19,6 @@ export function APIReturn(schema: z.ZodTypeAny, path: string) {
} catch (error) { } catch (error) {
if (error instanceof ZodError) { if (error instanceof ZodError) {
// If validation fails, throw an error with the details // If validation fails, throw an error with the details
//
console.error('unexpected data structure', path) console.error('unexpected data structure', path)
// Capture the Zod validation error with additional context // Capture the Zod validation error with additional context
console.error('Validation failed:', error.errors); console.error('Validation failed:', error.errors);
@@ -31,4 +31,5 @@ function createProvider(serviceName) {
export const OpentelemetryChatProvider = createProvider('FO-chat-service'); export const OpentelemetryChatProvider = createProvider('FO-chat-service');
export const OpentelemetryAgendaProvider = createProvider('FO-agenda-service'); export const OpentelemetryAgendaProvider = createProvider('FO-agenda-service');
export const OpentelemetryNotificationProvider = createProvider('FO-notification'); export const OpentelemetryNotificationProvider = createProvider('FO-notification');
export const OpentelemetryInterceptorProvider = createProvider('FO-interceptor');
export const OpentelemetryPublicationProvider = createProvider('FO-publication-service'); export const OpentelemetryPublicationProvider = createProvider('FO-publication-service');
@@ -1,13 +1,12 @@
import { v4 as uuidv4 } from 'uuid'; import { v4 as uuidv4 } from 'uuid';
import { SemanticAttributes } from '@opentelemetry/semantic-conventions'; import { SemanticAttributes } from '@opentelemetry/semantic-conventions';
import { Tracer, Span } from '@opentelemetry/sdk-trace-base'; import { Tracer, Span } from '@opentelemetry/sdk-trace-base';
import { OpentelemetryAgendaProvider, OpentelemetryNotificationProvider } from './opentelemetry'; import { OpentelemetryAgendaProvider, OpentelemetryInterceptorProvider, OpentelemetryNotificationProvider } from './opentelemetry';
import { Device, DeviceInfo } from '@capacitor/device'; import { Device, DeviceInfo } from '@capacitor/device';
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', {})
// const logger: ILoggerAdapter = new ColoredLoggerService() // const logger: ILoggerAdapter = new ColoredLoggerService()
let device: DeviceInfo; let device: DeviceInfo;
@@ -59,7 +58,10 @@ const createTracingInstance = ({bugPrint, name, module, autoFinish}): TracingTyp
span.setAttribute(key, value); span.setAttribute(key, value);
}, },
finish: () => { finish: () => {
span.end(); if(!window.location.origin.includes('https')) {
span.end();
}
if(bugPrint && hasBug) { if(bugPrint && hasBug) {
console.error(name, data) console.error(name, data)
} }
@@ -73,7 +75,7 @@ const createTracingInstance = ({bugPrint, name, module, autoFinish}): TracingTyp
} }
} }
export function XTracerAsync({ name, log, bugPrint, module = null, autoFinish = true }) { export function XTracerAsync({ name, bugPrint, module = null, autoFinish = true }) {
return ( return (
target: unknown, target: unknown,
propertyKey: string, propertyKey: string,
@@ -114,7 +116,7 @@ export function XTracerAsync({ name, log, bugPrint, module = null, autoFinish =
} }
export function XTracer({ name, log, bugPrint, module, autoFinish = true }: any) { export function XTracer({ name, bugPrint, module, autoFinish = true }) {
return ( return (
target: unknown, target: unknown,
propertyKey: string, propertyKey: string,
+1 -1
View File
@@ -99,7 +99,7 @@ export class NotificationsService {
} }
} }
@XTracerAsync({name:'Notification/getAndpostToken', log: false, bugPrint: true, module:'notification', autoFinish: false}) @XTracerAsync({name:'Notification/getAndpostToken', bugPrint: true, module:'notification', autoFinish: false})
private getAndpostToken(username, tracing?: TracingType) { private getAndpostToken(username, tracing?: TracingType) {
const geturl = environment.apiURL + 'notifications/token'; const geturl = environment.apiURL + 'notifications/token';
+1 -1
View File
@@ -313,7 +313,7 @@ export class TaskService {
} }
@XTracerAsync({name:'taskService/loadEventosParaAprovacao', log: false, bugPrint: true}) @XTracerAsync({name:'taskService/loadEventosParaAprovacao', bugPrint: true})
async loadEventosParaAprovacao(tracing?: TracingType) { async loadEventosParaAprovacao(tracing?: TracingType) {
this.showLoaderNum++ this.showLoaderNum++
console.log('PR') console.log('PR')
@@ -82,7 +82,7 @@ export class ApproveEventPage implements OnInit {
this.modalController.dismiss(); this.modalController.dismiss();
} }
@XTracerAsync({name:'ApproveEventPage/getTask', log: false, bugPrint: true}) @XTracerAsync({name:'ApproveEventPage/getTask', bugPrint: true})
async getTask(tracing?: TracingType) { async getTask(tracing?: TracingType) {
const res = await this.agendaDataRepository.getEventToApproveById(this.serialNumber, tracing) const res = await this.agendaDataRepository.getEventToApproveById(this.serialNumber, tracing)
@@ -119,7 +119,7 @@ export class EventListPage implements OnInit {
return new Date(e).toDateString() return new Date(e).toDateString()
} }
@XTracerAsync({name:'EventListPageShared/LoadToApproveEvents', log: false, bugPrint: true}) @XTracerAsync({name:'EventListPageShared/LoadToApproveEvents', bugPrint: true})
async LoadToApproveEvents(tracing?: TracingType) { async LoadToApproveEvents(tracing?: TracingType) {
this.showLoader = true; this.showLoader = true;
@@ -126,7 +126,7 @@ export class ViewEventPage implements OnInit {
setTimeZone() { setTimeZone() {
this.TimeZoneString = this.loadedEvent.TimeZone this.TimeZoneString = this.loadedEvent.TimeZone
} }
@XTracerAsync({name:'ViewEventPage/loadEvent', log: false, bugPrint: true}) @XTracerAsync({name:'ViewEventPage/loadEvent', 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)
@@ -193,7 +193,7 @@ export class EventsToApprovePage implements OnInit {
this.dynamicSearch() this.dynamicSearch()
} }
@XTracerAsync({name:'Events-to-approve/LoadToApproveEvents', log: false, bugPrint: true}) @XTracerAsync({name:'Events-to-approve/LoadToApproveEvents', bugPrint: true})
async LoadToApproveEvents(tracing?: TracingType) { async LoadToApproveEvents(tracing?: TracingType) {
this.showLoader = true; this.showLoader = true;
const segment = this.selectedUserCalendar const segment = this.selectedUserCalendar
+4
View File
@@ -52,6 +52,10 @@ class SessionService {
this._user.Inactivity = false this._user.Inactivity = false
} }
window['clearS'] = () => {
delete this._user.Authorization
}
} }
getDataFromLocalStorage() { getDataFromLocalStorage() {