add monitoring

This commit is contained in:
Peter Maquiran
2024-06-18 09:14:22 +01:00
parent 157ecdd10b
commit 62c6afbe5b
19 changed files with 190 additions and 114 deletions
+1 -1
View File
@@ -711,7 +711,7 @@ export class AgendaPage implements OnInit {
calendarOwnerName: selectedCalendar.wxFullName,
endDate: endTime.toISOString(),
startDate: startTime.toISOString(),
status: EEventFilterStatus.Approved
status: EEventFilterStatus.AllToCommunicate
}, tracing)
if(response.isOk()) {
@@ -96,7 +96,7 @@
<ion-label class="width-100 d-flex " (click)="docIndex(i);LoadDocumentDetails()">
<p class="flex-grow-1" >
<span class="attach-title-item d-block">{{attach.SourceName || attach.subject || attach.sourceName || 'Sem título'}}</span>
<span class="span-left d-block">{{attach.Stakeholders}}</span>
</p>
@@ -20,6 +20,8 @@ import { HttpErrorHandle } from 'src/app/services/http-error-handle.service'
import { AttachmentsService } from 'src/app/services/attachments.service';
import { DateService } from 'src/app/services/date.service';
import { AgendaDataRepositoryService } from 'src/app/services/Repositorys/Agenda/agenda-data-repository.service';
import { TracingType, XTracerAsync } from 'src/app/services/monitoring/opentelemetry/tracer';
import { isHttpError } from 'src/app/services/http.service';
@Component({
selector: 'app-view-event',
@@ -189,33 +191,51 @@ export class ViewEventPage implements OnInit {
this.TimeZoneString = this.loadedEvent.TimeZone
}
async loadEvent() {
@XTracerAsync({name:'ViewEventPage/loadEvent', log: false, bugPrint: true})
async loadEvent(tracing?: TracingType) {
const loader = this.toastService.loading();
let res = await this.agendaDataRepository.getEventById(this.eventId)
let res = await this.agendaDataRepository.getEventById(this.eventId, tracing)
if (res.isOk()) {
tracing.setAttribute('outcome', 'success')
console.log('Loaded Event', res.value)
loader.remove()
/* let changeDate = this.dateService.fixDate(res.value as any) as any */
this.loadedEvent = res.value as any;
this.setTimeZone()
} else {
this.httpErrorHandle.httpStatusHandle(res.error)
loader.remove()
this.toastService.badRequest('Este evento já não existe na sua agenda')
tracing.setAttribute('eventId', this.eventId)
if(!isHttpError(res.error)) {
this.toastService._badRequest('Pedimos desculpa mas não foi possível executar a acção. Por favor, contacte o apoio técnico. #13')
console.log(res.error)
} else if (isHttpError(res.error)) {
if(res.error.status == 404) {
this.toastService._badRequest('Este evento já não existe')
} else {
this.httpErrorHandle.httpStatusHandle(res.error)
}
}
tracing.setAttribute('outcome', 'failed')
tracing.bugFlag()
// this.toastService.badRequest('Este evento já não existe na sua agenda')
this.RouteService.goBack();
}
loader.remove()
}
/* loadEvent1() {
if(this.sesseionStora.user.Profile == 'MDGPR' || this.sesseionStora.user.Profile == 'PR') {
this.eventsService.getEvent(this.eventId).subscribe(res => {
res = this.dateService.fixDate(res as any)
this.loadedEvent = res;
this.setTimeZone()
@@ -223,22 +243,22 @@ export class ViewEventPage implements OnInit {
}, (error) => {
});
} else {
if(this.CalendarId) {
this.eventsService.genericGetEvent(this.eventId, this.CalendarId).subscribe(res => {
res = this.dateService.fixDate(res as any)
this.loadedEvent = res;
this.setTimeZone()
}, (error) => {
});
}
}
} */
deleteYesOrNo() {
@@ -264,7 +284,7 @@ export class ViewEventPage implements OnInit {
} else {
this.deleteEvent(false);
}
}
},
{
@@ -299,7 +319,7 @@ export class ViewEventPage implements OnInit {
res.present();
});
}
}
deleteEvent(deleteAll) {
@@ -337,7 +357,7 @@ export class ViewEventPage implements OnInit {
header: 'Evento removido',
buttons: ['OK']
});
setTimeout(() => {
alert.dismiss();
}, 1500);
@@ -347,16 +367,16 @@ export class ViewEventPage implements OnInit {
() => {
loader.remove();
});
} else {
this.eventsService.genericDeleteEvent(this.loadedEvent.EventId, 0, this.loadedEvent.CalendarName, this.loadedEvent.CalendarId).subscribe(async () => {
const alert = await this.alertController.create({
cssClass: 'my-custom-class',
header: 'Evento removido',
buttons: ['OK']
});
setTimeout(() => {
alert.dismiss();
}, 1500);
@@ -368,8 +388,8 @@ export class ViewEventPage implements OnInit {
() => {
loader.remove();
});
} */
}