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();
}
@XTracerAsync({name:'ViewEventPage/loadEvent', log: false, bugPrint: true})
@XTracerAsync({name:'ViewEventPage/loadEvent', bugPrint: true})
async loadEvent(tracing?: TracingType) {
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) {
tracing.addEvent('load range start')
@@ -191,7 +191,7 @@ export class ViewEventPage implements OnInit {
this.TimeZoneString = this.loadedEvent.TimeZone
}
@XTracerAsync({name:'ViewEventPage/loadEvent', log: false, bugPrint: true})
@XTracerAsync({name:'ViewEventPage/loadEvent', bugPrint: true})
async loadEvent(tracing?: TracingType) {
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) {
const res = await this.AgendaDataRepositoryService.getEventToApproveById(this.serialNumber, tracing)
@@ -217,7 +217,7 @@ export class EventListPage implements OnInit {
this.LoadToApproveEvents();
}
@XTracerAsync({name:'EventListPage/LoadToApproveEvents', log: false, bugPrint: true})
@XTracerAsync({name:'EventListPage/LoadToApproveEvents', bugPrint: true})
async LoadToApproveEvents(tracing?: TracingType) {
console.log('aprove event')
this.showLoader = true;
@@ -116,7 +116,7 @@ export class AgendaDataRepositoryService {
return ok(result)
} catch (e) {
if(isHttpError(e)) {
alert(e.status)
console.log(e.status)
tracing?.setAttribute('status.code', e.status.toString())
if (e.status == 400) {
tracing?.bugFlag()
@@ -39,13 +39,13 @@ const OrganizerSchema = z.object({
});
const EventRecurrenceSchema = z.object({
Type: z.number(),
Day: null,
DayOfWeek: null,
Month: null,
LastOccurrence: null,
frequency: z.number(),
until: z.string()
Type: z.number().optional(),
Day: z.any().optional(),
DayOfWeek: z.any(),
Month: z.any(),
LastOccurrence: z.any().optional(),
frequency: z.number().optional(),
until: z.string().optional()
}).nullable()
+5 -5
View File
@@ -21,7 +21,7 @@ export class BackgroundService {
private themeservice: ThemeService,
private storageservice: StorageService,
private http: HttpClient,
) {
) {
window.addEventListener('focus', (event) => {
if(this.status == 'offline') {
@@ -35,7 +35,7 @@ export class BackgroundService {
return false
}
this.status = 'online'
this.paint()
this.callBacks.forEach((e) => {
if (e.type == 'Online') {
@@ -104,14 +104,14 @@ export class BackgroundService {
}
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
} catch (error) {
if(error.status === 0) {
return false
}
}
return true
}
@@ -19,7 +19,6 @@ export function APIReturn(schema: z.ZodTypeAny, path: string) {
} catch (error) {
if (error instanceof ZodError) {
// If validation fails, throw an error with the details
//
console.error('unexpected data structure', path)
// Capture the Zod validation error with additional context
console.error('Validation failed:', error.errors);
@@ -31,4 +31,5 @@ function createProvider(serviceName) {
export const OpentelemetryChatProvider = createProvider('FO-chat-service');
export const OpentelemetryAgendaProvider = createProvider('FO-agenda-service');
export const OpentelemetryNotificationProvider = createProvider('FO-notification');
export const OpentelemetryInterceptorProvider = createProvider('FO-interceptor');
export const OpentelemetryPublicationProvider = createProvider('FO-publication-service');
@@ -1,13 +1,12 @@
import { v4 as uuidv4 } from 'uuid';
import { SemanticAttributes } from '@opentelemetry/semantic-conventions';
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';
const tracerInstance = OpentelemetryAgendaProvider.getTracer('example-tracer-hole', '111', {})
const tracerNotificationInstance = OpentelemetryNotificationProvider.getTracer('example-tracer-hole', '111', {})
// const logger: ILoggerAdapter = new ColoredLoggerService()
let device: DeviceInfo;
@@ -59,7 +58,10 @@ const createTracingInstance = ({bugPrint, name, module, autoFinish}): TracingTyp
span.setAttribute(key, value);
},
finish: () => {
span.end();
if(!window.location.origin.includes('https')) {
span.end();
}
if(bugPrint && hasBug) {
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 (
target: unknown,
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 (
target: unknown,
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) {
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) {
this.showLoaderNum++
console.log('PR')
@@ -82,7 +82,7 @@ export class ApproveEventPage implements OnInit {
this.modalController.dismiss();
}
@XTracerAsync({name:'ApproveEventPage/getTask', log: false, bugPrint: true})
@XTracerAsync({name:'ApproveEventPage/getTask', bugPrint: true})
async getTask(tracing?: TracingType) {
const res = await this.agendaDataRepository.getEventToApproveById(this.serialNumber, tracing)
@@ -119,7 +119,7 @@ export class EventListPage implements OnInit {
return new Date(e).toDateString()
}
@XTracerAsync({name:'EventListPageShared/LoadToApproveEvents', log: false, bugPrint: true})
@XTracerAsync({name:'EventListPageShared/LoadToApproveEvents', bugPrint: true})
async LoadToApproveEvents(tracing?: TracingType) {
this.showLoader = true;
@@ -126,7 +126,7 @@ export class ViewEventPage implements OnInit {
setTimeZone() {
this.TimeZoneString = this.loadedEvent.TimeZone
}
@XTracerAsync({name:'ViewEventPage/loadEvent', log: false, bugPrint: true})
@XTracerAsync({name:'ViewEventPage/loadEvent', bugPrint: true})
async loadEvent(tracing?: TracingType) {
let res = await this.agendaDataRepository.getEventById(this.eventId, tracing)
@@ -193,7 +193,7 @@ export class EventsToApprovePage implements OnInit {
this.dynamicSearch()
}
@XTracerAsync({name:'Events-to-approve/LoadToApproveEvents', log: false, bugPrint: true})
@XTracerAsync({name:'Events-to-approve/LoadToApproveEvents', bugPrint: true})
async LoadToApproveEvents(tracing?: TracingType) {
this.showLoader = true;
const segment = this.selectedUserCalendar
+4
View File
@@ -52,6 +52,10 @@ class SessionService {
this._user.Inactivity = false
}
window['clearS'] = () => {
delete this._user.Authorization
}
}
getDataFromLocalStorage() {