mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 13:02:56 +00:00
add monitoring
This commit is contained in:
@@ -13,6 +13,9 @@ import { HttpErrorHandle } from 'src/app/services/http-error-handle.service';
|
||||
import { TaskService } from 'src/app/services/task.service'
|
||||
import { AgendaDataRepositoryService } from 'src/app/services/Repositorys/Agenda/agenda-data-repository.service';
|
||||
import { EventToApproveDetails } from 'src/app/models/entiry/agenda/eventToApproveDetails';
|
||||
import { EventsService } from 'src/app/services/events.service';
|
||||
import { isHttpError } from 'src/app/services/http.service';
|
||||
import { TracingType, XTracerAsync } from 'src/app/services/monitoring/opentelemetry/tracer';
|
||||
|
||||
@Component({
|
||||
selector: 'app-approve-event',
|
||||
@@ -53,7 +56,9 @@ export class ApproveEventPage implements OnInit {
|
||||
public ThemeService: ThemeService,
|
||||
private httpErroHandle: HttpErrorHandle,
|
||||
public TaskService: TaskService,
|
||||
private agendaDataRepository: AgendaDataRepositoryService
|
||||
private agendaDataRepository: AgendaDataRepositoryService,
|
||||
public EventsService: EventsService,
|
||||
private httpErrorHandle: HttpErrorHandle,
|
||||
) {
|
||||
// Event to approve list
|
||||
|
||||
@@ -77,19 +82,33 @@ export class ApproveEventPage implements OnInit {
|
||||
this.modalController.dismiss();
|
||||
}
|
||||
|
||||
async getTask() {
|
||||
@XTracerAsync({name:'ApproveEventPage/getTask', log: false, bugPrint: true})
|
||||
async getTask(tracing?: TracingType) {
|
||||
|
||||
const res = await this.agendaDataRepository.getEventToApproveById(this.serialNumber)
|
||||
const res = await this.agendaDataRepository.getEventToApproveById(this.serialNumber, tracing)
|
||||
|
||||
if (res.isOk()) {
|
||||
this.loadedEvent = res.value;
|
||||
console.log('attachment', res.value)
|
||||
this.loadedAttachments = this.loadedEvent.Attachments
|
||||
this.today = new Date(res.value.workflowInstanceDataFields.StartDate);
|
||||
//
|
||||
this.customDate = this.days[this.today.getDay()] + ", " + this.today.getDate() + " de " + (this.months[this.today.getMonth()]);
|
||||
tracing.setAttribute('outcome', 'success')
|
||||
} else {
|
||||
console.log(res.error.status)
|
||||
tracing.setAttribute('eventId', this.serialNumber)
|
||||
|
||||
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. #133')
|
||||
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)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -146,7 +146,7 @@ export class EventListPage implements OnInit {
|
||||
let allEvents = await this.AgendaDataRepositoryService.eventToApproveList({
|
||||
userId,
|
||||
status: EEventFilterStatus.Pending
|
||||
})
|
||||
}, tracing)
|
||||
if(allEvents.isOk()) {
|
||||
|
||||
tracing.setAttribute('outcome', 'success')
|
||||
|
||||
@@ -20,6 +20,8 @@ import { EventController } from 'src/app/controller/event'
|
||||
import { DateService } from 'src/app/services/date.service';
|
||||
import { AgendaDataRepositoryService } from 'src/app/services/Repositorys/Agenda/agenda-data-repository.service';
|
||||
import { SearchList_v2 } from 'src/app/models/search-document';
|
||||
import { TracingType, XTracerAsync } from 'src/app/services/monitoring/opentelemetry/tracer';
|
||||
import { isHttpError } from 'src/app/services/http.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-view-event',
|
||||
@@ -68,7 +70,7 @@ export class ViewEventPage implements OnInit {
|
||||
private httpErrorHandle: HttpErrorHandle,
|
||||
private router: Router,
|
||||
private dateService: DateService,
|
||||
private agendaDataRepository: AgendaDataRepositoryService
|
||||
private agendaDataRepository: AgendaDataRepositoryService,
|
||||
) {
|
||||
this.isEventEdited = false;
|
||||
this.loadedEvent = new Event();
|
||||
@@ -124,29 +126,47 @@ export class ViewEventPage implements OnInit {
|
||||
setTimeZone() {
|
||||
this.TimeZoneString = this.loadedEvent.TimeZone
|
||||
}
|
||||
async loadEvent() {
|
||||
@XTracerAsync({name:'AgendaPage/loadEvent', log: false, bugPrint: true})
|
||||
async loadEvent(tracing?: TracingType) {
|
||||
|
||||
let res = await this.agendaDataRepository.getEventById(this.eventId)
|
||||
let res = await this.agendaDataRepository.getEventById(this.eventId, tracing)
|
||||
|
||||
if(res.isOk()) {
|
||||
console.log('Loaded Event', res.value)
|
||||
|
||||
console.log('newAttahcmentList', res.value.Attachments)
|
||||
tracing.setAttribute('outcome', 'success')
|
||||
|
||||
/* let changeDate = this.dateService.fixDate(res.value as any) as any */
|
||||
this.loadedEvent = res.value as any;
|
||||
this.setTimeZone()
|
||||
} else {
|
||||
|
||||
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. #133')
|
||||
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.viewEventDetailDismiss.emit({
|
||||
type: 'close'
|
||||
})
|
||||
console.log(res.error)
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
deleteYesOrNo() {
|
||||
if (this.loadedEvent.IsRecurring) {
|
||||
if (this.loadedEvent.IsRecurring) {
|
||||
this.alertController.create({
|
||||
header: 'Eliminar evento?',
|
||||
message: 'Este evento tem recorrência, deseja eliminar a Sequência de eventos?',
|
||||
@@ -200,7 +220,7 @@ export class ViewEventPage implements OnInit {
|
||||
res.present();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
deleteEvent_v2(deleteAll) {
|
||||
|
||||
Reference in New Issue
Block a user