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
@@ -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)
}
}
}
}