merge made with peter branch

This commit is contained in:
Eudes Inácio
2024-06-18 12:26:54 +01:00
33 changed files with 438 additions and 217 deletions
@@ -17,6 +17,9 @@ import { HttpErrorHandle } from 'src/app/services/http-error-handle.service';
import { TaskService } from 'src/app/services/task.service';
import { AttachmentsService } from 'src/app/services/attachments.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';
import { EventsService } from 'src/app/services/events.service';
@Component({
selector: 'app-approve-event',
@@ -59,7 +62,8 @@ export class ApproveEventPage implements OnInit {
private httpErrorHandle: HttpErrorHandle,
public TaskService: TaskService,
private attachmentsService: AttachmentsService,
public AgendaDataRepositoryService: AgendaDataRepositoryService
public AgendaDataRepositoryService: AgendaDataRepositoryService,
public EventsService: EventsService
) {
this.activatedRoute.paramMap.subscribe(params => {
//
@@ -95,19 +99,38 @@ export class ApproveEventPage implements OnInit {
}
async getTask() {
@XTracerAsync({name:'ApproveEventPage/getTask', log: false, bugPrint: true})
async getTask(tracing?: TracingType) {
const res = await this.AgendaDataRepositoryService.getEventToApproveById(this.serialNumber)
console.log(res)
const res = await this.AgendaDataRepositoryService.getEventToApproveById(this.serialNumber, tracing)
if (res.isOk()) {
this.loadedEvent = res.value;
this.today = new Date(res.value.workflowInstanceDataFields.StartDate);
//
this.customDate = this.days[this.today.getDay()] + ", " + this.today.getDate() + " de " + (this.months[this.today.getMonth()]);
this.loadedAttachments = res.value.Attachments
} else {
console.log(res.error.status)
tracing.setAttribute('outcome', 'success')
} else if(isHttpError(res.error)) {
tracing.setAttribute('eventId', this.serialNumber)
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.httpErrorHandle.httpStatusHandle(res.error)
} else if(!isHttpError(res.error)) {
tracing.setAttribute('outcome', 'failed')
tracing.bugFlag()
this.toastService._badRequest('Pedimos desculpa mas não foi possível executar a acção. Por favor, contacte o apoio técnico. #12')
}
}
@@ -243,7 +243,7 @@ export class EventListPage implements OnInit {
let allEvents = await this.AgendaDataRepositoryService.eventToApproveList({
userId,
status: EEventFilterStatus.Pending
})
}, tracing)
if(allEvents.isOk()) {
tracing.setAttribute('outcome', 'success')