mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 20:47:54 +00:00
add monitoring
This commit is contained in:
@@ -17,6 +17,8 @@ import { RouteService } from 'src/app/services/route.service';
|
|||||||
import { SessionStore } from 'src/app/store/session.service';
|
import { SessionStore } from 'src/app/store/session.service';
|
||||||
import { HttpErrorHandle } from 'src/app/services/http-error-handle.service';
|
import { HttpErrorHandle } from 'src/app/services/http-error-handle.service';
|
||||||
import { AgendaDataRepositoryService } from 'src/app/services/Repositorys/Agenda/agenda-data-repository.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({
|
@Component({
|
||||||
selector: 'app-view-event',
|
selector: 'app-view-event',
|
||||||
@@ -119,76 +121,32 @@ export class ViewEventPage implements OnInit {
|
|||||||
ev.target.complete();
|
ev.target.complete();
|
||||||
}
|
}
|
||||||
|
|
||||||
async loadEvent() {
|
@XTracerAsync({name:'ViewEventPage/loadEvent', log: false, bugPrint: true})
|
||||||
|
async loadEvent(tracing?: TracingType) {
|
||||||
const loader = this.toastService.loading();
|
const loader = this.toastService.loading();
|
||||||
|
|
||||||
if(this.sesseionStora.user.Profile == 'MDGPR' || this.sesseionStora.user.Profile == 'PR') {
|
|
||||||
this.eventsService.getEvent(this.eventId).subscribe(res => {
|
|
||||||
this.loadedEvent = res;
|
|
||||||
// this.addEventToDb(res);
|
|
||||||
|
|
||||||
loader.remove()
|
|
||||||
}, (error) => {
|
|
||||||
|
|
||||||
|
|
||||||
if (error.status === 0) {
|
|
||||||
// this.getFromDb();
|
|
||||||
} else {
|
|
||||||
this.toastService.badRequest('Este evento já não existe na sua agenda')
|
|
||||||
loader.remove()
|
|
||||||
this.modalController.dismiss('Eevent not Foud');
|
|
||||||
this.RouteService.goBack();
|
|
||||||
}
|
|
||||||
loader.remove()
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
|
|
||||||
if(this.CalendarId) {
|
|
||||||
|
|
||||||
this.eventsService.genericGetEvent(this.eventId, this.CalendarId).subscribe(res => {
|
|
||||||
this.loadedEvent = res;
|
|
||||||
// this.addEventToDb(res);
|
|
||||||
|
|
||||||
loader.remove()
|
|
||||||
}, (error) => {
|
|
||||||
|
|
||||||
if (error.status === 0) {
|
|
||||||
// this.getFromDb();
|
|
||||||
} else {
|
|
||||||
this.toastService.badRequest('Este evento já não existe na sua agenda')
|
|
||||||
loader.remove()
|
|
||||||
this.modalController.dismiss('Eevent not Foud');
|
|
||||||
this.RouteService.goBack();
|
|
||||||
}
|
|
||||||
loader.remove()
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
let res = await this.agendaDataRepository.getEventById(this.eventId)
|
let res = await this.agendaDataRepository.getEventById(this.eventId)
|
||||||
|
|
||||||
if(res.isOk()) {
|
if(res.isOk()) {
|
||||||
|
tracing.setAttribute('outcome', 'success')
|
||||||
this.loadedEvent = res.value as any;
|
this.loadedEvent = res.value as any;
|
||||||
// this.addEventToDb(res);
|
|
||||||
|
|
||||||
loader.remove()
|
|
||||||
} else {
|
} else {
|
||||||
if (res.error.status === 0) {
|
tracing.setAttribute('eventId', this.eventId)
|
||||||
// this.getFromDb();
|
tracing.setAttribute('outcome', 'failed')
|
||||||
} else {
|
tracing.bugFlag()
|
||||||
this.toastService.badRequest('Este evento já não existe na sua agenda')
|
|
||||||
loader.remove()
|
if(!isHttpError(res.error)) {
|
||||||
this.modalController.dismiss('Eevent not Foud');
|
this.toastService._badRequest('Pedimos desculpa mas não foi possível executar a acção. Por favor, contacte o apoio técnico. #13')
|
||||||
this.RouteService.goBack();
|
} else if (isHttpError(res.error)) {
|
||||||
|
|
||||||
}
|
}
|
||||||
loader.remove()
|
this.modalController.dismiss('Eevent not Foud');
|
||||||
|
this.RouteService.goBack();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
loader.remove()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -155,8 +155,16 @@ const Attachments = z.object({
|
|||||||
FileSize: z.number().optional(),
|
FileSize: z.number().optional(),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const OwnerSchema = z.object({
|
||||||
|
wxUserId: z.number(),
|
||||||
|
wxFullName: z.string(),
|
||||||
|
wxeMail: z.string(),
|
||||||
|
userPhoto: z.string(),
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
const EventToApproveDetails = z.object({
|
const EventToApproveDetails = z.object({
|
||||||
|
owner: OwnerSchema,
|
||||||
serialNumber: z.string(),
|
serialNumber: z.string(),
|
||||||
taskStatus: z.string().nullable(),
|
taskStatus: z.string().nullable(),
|
||||||
originator: OriginatorSchema,
|
originator: OriginatorSchema,
|
||||||
|
|||||||
@@ -711,7 +711,7 @@ export class AgendaPage implements OnInit {
|
|||||||
calendarOwnerName: selectedCalendar.wxFullName,
|
calendarOwnerName: selectedCalendar.wxFullName,
|
||||||
endDate: endTime.toISOString(),
|
endDate: endTime.toISOString(),
|
||||||
startDate: startTime.toISOString(),
|
startDate: startTime.toISOString(),
|
||||||
status: EEventFilterStatus.Approved
|
status: EEventFilterStatus.AllToCommunicate
|
||||||
}, tracing)
|
}, tracing)
|
||||||
|
|
||||||
if(response.isOk()) {
|
if(response.isOk()) {
|
||||||
|
|||||||
@@ -96,7 +96,7 @@
|
|||||||
<ion-label class="width-100 d-flex " (click)="docIndex(i);LoadDocumentDetails()">
|
<ion-label class="width-100 d-flex " (click)="docIndex(i);LoadDocumentDetails()">
|
||||||
<p class="flex-grow-1" >
|
<p class="flex-grow-1" >
|
||||||
<span class="attach-title-item d-block">{{attach.SourceName || attach.subject || attach.sourceName || 'Sem título'}}</span>
|
<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>
|
<span class="span-left d-block">{{attach.Stakeholders}}</span>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
|||||||
@@ -20,6 +20,8 @@ import { HttpErrorHandle } from 'src/app/services/http-error-handle.service'
|
|||||||
import { AttachmentsService } from 'src/app/services/attachments.service';
|
import { AttachmentsService } from 'src/app/services/attachments.service';
|
||||||
import { DateService } from 'src/app/services/date.service';
|
import { DateService } from 'src/app/services/date.service';
|
||||||
import { AgendaDataRepositoryService } from 'src/app/services/Repositorys/Agenda/agenda-data-repository.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({
|
@Component({
|
||||||
selector: 'app-view-event',
|
selector: 'app-view-event',
|
||||||
@@ -189,33 +191,51 @@ export class ViewEventPage implements OnInit {
|
|||||||
this.TimeZoneString = this.loadedEvent.TimeZone
|
this.TimeZoneString = this.loadedEvent.TimeZone
|
||||||
}
|
}
|
||||||
|
|
||||||
async loadEvent() {
|
@XTracerAsync({name:'ViewEventPage/loadEvent', log: false, bugPrint: true})
|
||||||
|
async loadEvent(tracing?: TracingType) {
|
||||||
const loader = this.toastService.loading();
|
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()) {
|
if (res.isOk()) {
|
||||||
|
tracing.setAttribute('outcome', 'success')
|
||||||
console.log('Loaded Event', res.value)
|
console.log('Loaded Event', res.value)
|
||||||
loader.remove()
|
loader.remove()
|
||||||
/* let changeDate = this.dateService.fixDate(res.value as any) as any */
|
/* let changeDate = this.dateService.fixDate(res.value as any) as any */
|
||||||
this.loadedEvent = res.value as any;
|
this.loadedEvent = res.value as any;
|
||||||
this.setTimeZone()
|
this.setTimeZone()
|
||||||
} else {
|
} else {
|
||||||
this.httpErrorHandle.httpStatusHandle(res.error)
|
|
||||||
loader.remove()
|
tracing.setAttribute('eventId', this.eventId)
|
||||||
this.toastService.badRequest('Este evento já não existe na sua agenda')
|
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();
|
this.RouteService.goBack();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
loader.remove()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* loadEvent1() {
|
/* loadEvent1() {
|
||||||
|
|
||||||
|
|
||||||
if(this.sesseionStora.user.Profile == 'MDGPR' || this.sesseionStora.user.Profile == 'PR') {
|
if(this.sesseionStora.user.Profile == 'MDGPR' || this.sesseionStora.user.Profile == 'PR') {
|
||||||
this.eventsService.getEvent(this.eventId).subscribe(res => {
|
this.eventsService.getEvent(this.eventId).subscribe(res => {
|
||||||
|
|
||||||
res = this.dateService.fixDate(res as any)
|
res = this.dateService.fixDate(res as any)
|
||||||
this.loadedEvent = res;
|
this.loadedEvent = res;
|
||||||
this.setTimeZone()
|
this.setTimeZone()
|
||||||
@@ -223,22 +243,22 @@ export class ViewEventPage implements OnInit {
|
|||||||
}, (error) => {
|
}, (error) => {
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
|
||||||
if(this.CalendarId) {
|
if(this.CalendarId) {
|
||||||
this.eventsService.genericGetEvent(this.eventId, this.CalendarId).subscribe(res => {
|
this.eventsService.genericGetEvent(this.eventId, this.CalendarId).subscribe(res => {
|
||||||
|
|
||||||
res = this.dateService.fixDate(res as any)
|
res = this.dateService.fixDate(res as any)
|
||||||
this.loadedEvent = res;
|
this.loadedEvent = res;
|
||||||
this.setTimeZone()
|
this.setTimeZone()
|
||||||
|
|
||||||
}, (error) => {
|
}, (error) => {
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} */
|
} */
|
||||||
|
|
||||||
deleteYesOrNo() {
|
deleteYesOrNo() {
|
||||||
@@ -264,7 +284,7 @@ export class ViewEventPage implements OnInit {
|
|||||||
} else {
|
} else {
|
||||||
this.deleteEvent(false);
|
this.deleteEvent(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -299,7 +319,7 @@ export class ViewEventPage implements OnInit {
|
|||||||
res.present();
|
res.present();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
deleteEvent(deleteAll) {
|
deleteEvent(deleteAll) {
|
||||||
@@ -337,7 +357,7 @@ export class ViewEventPage implements OnInit {
|
|||||||
header: 'Evento removido',
|
header: 'Evento removido',
|
||||||
buttons: ['OK']
|
buttons: ['OK']
|
||||||
});
|
});
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
alert.dismiss();
|
alert.dismiss();
|
||||||
}, 1500);
|
}, 1500);
|
||||||
@@ -347,16 +367,16 @@ export class ViewEventPage implements OnInit {
|
|||||||
() => {
|
() => {
|
||||||
loader.remove();
|
loader.remove();
|
||||||
});
|
});
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
this.eventsService.genericDeleteEvent(this.loadedEvent.EventId, 0, this.loadedEvent.CalendarName, this.loadedEvent.CalendarId).subscribe(async () => {
|
this.eventsService.genericDeleteEvent(this.loadedEvent.EventId, 0, this.loadedEvent.CalendarName, this.loadedEvent.CalendarId).subscribe(async () => {
|
||||||
const alert = await this.alertController.create({
|
const alert = await this.alertController.create({
|
||||||
cssClass: 'my-custom-class',
|
cssClass: 'my-custom-class',
|
||||||
header: 'Evento removido',
|
header: 'Evento removido',
|
||||||
buttons: ['OK']
|
buttons: ['OK']
|
||||||
});
|
});
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
alert.dismiss();
|
alert.dismiss();
|
||||||
}, 1500);
|
}, 1500);
|
||||||
@@ -368,8 +388,8 @@ export class ViewEventPage implements OnInit {
|
|||||||
() => {
|
() => {
|
||||||
loader.remove();
|
loader.remove();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
} */
|
} */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ import { ChangeProfileService } from 'src/app/services/change-profile.service';
|
|||||||
import { SessionStore } from 'src/app/store/session.service';
|
import { SessionStore } from 'src/app/store/session.service';
|
||||||
import { TaskService } from 'src/app/services/task.service';
|
import { TaskService } from 'src/app/services/task.service';
|
||||||
import { AgendaDataRepositoryService } from 'src/app/services/Repositorys/Agenda/agenda-data-repository.service';
|
import { AgendaDataRepositoryService } from 'src/app/services/Repositorys/Agenda/agenda-data-repository.service';
|
||||||
|
import { EEventFilterStatus } from 'src/app/services/Repositorys/Agenda/model/enums';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-events',
|
selector: 'app-events',
|
||||||
@@ -237,7 +238,8 @@ export class EventsPage implements OnInit {
|
|||||||
userId: SessionStore.user.UserId,
|
userId: SessionStore.user.UserId,
|
||||||
calendarOwnerName: SessionStore.user.FullName,
|
calendarOwnerName: SessionStore.user.FullName,
|
||||||
startDate: date.toISOString(),
|
startDate: date.toISOString(),
|
||||||
endDate: new Date(end).toISOString()
|
endDate: new Date(end).toISOString(),
|
||||||
|
status: EEventFilterStatus.AllToCommunicate
|
||||||
})
|
})
|
||||||
|
|
||||||
if(response.isOk()) {
|
if(response.isOk()) {
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ import { AttachmentsService } from 'src/app/services/attachments.service';
|
|||||||
import { AgendaDataRepositoryService } from 'src/app/services/Repositorys/Agenda/agenda-data-repository.service';
|
import { AgendaDataRepositoryService } from 'src/app/services/Repositorys/Agenda/agenda-data-repository.service';
|
||||||
import { TracingType, XTracerAsync } from 'src/app/services/monitoring/opentelemetry/tracer';
|
import { TracingType, XTracerAsync } from 'src/app/services/monitoring/opentelemetry/tracer';
|
||||||
import { isHttpError } from 'src/app/services/http.service';
|
import { isHttpError } from 'src/app/services/http.service';
|
||||||
|
import { EventsService } from 'src/app/services/events.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-approve-event',
|
selector: 'app-approve-event',
|
||||||
@@ -61,7 +62,8 @@ export class ApproveEventPage implements OnInit {
|
|||||||
private httpErrorHandle: HttpErrorHandle,
|
private httpErrorHandle: HttpErrorHandle,
|
||||||
public TaskService: TaskService,
|
public TaskService: TaskService,
|
||||||
private attachmentsService: AttachmentsService,
|
private attachmentsService: AttachmentsService,
|
||||||
public AgendaDataRepositoryService: AgendaDataRepositoryService
|
public AgendaDataRepositoryService: AgendaDataRepositoryService,
|
||||||
|
public EventsService: EventsService
|
||||||
) {
|
) {
|
||||||
this.activatedRoute.paramMap.subscribe(params => {
|
this.activatedRoute.paramMap.subscribe(params => {
|
||||||
//
|
//
|
||||||
@@ -111,6 +113,14 @@ export class ApproveEventPage implements OnInit {
|
|||||||
tracing.setAttribute('outcome', 'success')
|
tracing.setAttribute('outcome', 'success')
|
||||||
} else if(isHttpError(res.error)) {
|
} 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.setAttribute('outcome', 'failed')
|
||||||
tracing.bugFlag()
|
tracing.bugFlag()
|
||||||
|
|
||||||
|
|||||||
@@ -243,7 +243,7 @@ export class EventListPage implements OnInit {
|
|||||||
let allEvents = await this.AgendaDataRepositoryService.eventToApproveList({
|
let allEvents = await this.AgendaDataRepositoryService.eventToApproveList({
|
||||||
userId,
|
userId,
|
||||||
status: EEventFilterStatus.Pending
|
status: EEventFilterStatus.Pending
|
||||||
})
|
}, tracing)
|
||||||
|
|
||||||
if(allEvents.isOk()) {
|
if(allEvents.isOk()) {
|
||||||
tracing.setAttribute('outcome', 'success')
|
tracing.setAttribute('outcome', 'success')
|
||||||
|
|||||||
@@ -44,17 +44,28 @@ export class AgendaDataRepositoryService {
|
|||||||
return this.agendaLocalDataSourceService.createCalendar(currentUserCalendar)
|
return this.agendaLocalDataSourceService.createCalendar(currentUserCalendar)
|
||||||
}
|
}
|
||||||
|
|
||||||
async getEventById(id: string) {
|
async getEventById(id: string, tracing?: TracingType) {
|
||||||
try {
|
try {
|
||||||
const result = await this.agendaDataService.getEvent(id).pipe(
|
const result = await this.agendaDataService.getEvent(id).pipe(
|
||||||
map((response) => {
|
map((response) => {
|
||||||
console.log('Response', response.data)
|
EventMapper.toDomain(response)
|
||||||
console.log('Output', EventMapper.toDomain(response.data))
|
return EventMapper.toDomain(response)
|
||||||
return EventMapper.toDomain(response.data)
|
|
||||||
})
|
})
|
||||||
).toPromise()
|
).toPromise()
|
||||||
return ok(result)
|
return ok(result)
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
if(isHttpError(e)) {
|
||||||
|
tracing?.setAttribute('status.code', e.status.toString())
|
||||||
|
if (e.status == 400) {
|
||||||
|
tracing.bugFlag()
|
||||||
|
tracing.setAttribute('outcome', 'failed')
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
tracing.bugFlag()
|
||||||
|
tracing.setAttribute('outcome', 'failed')
|
||||||
|
tracing?.setAttribute('map.error', 'true')
|
||||||
|
tracing?.setAttribute('map.error.context', JSON.stringify(e))
|
||||||
|
}
|
||||||
return err(e as HttpErrorResponse)
|
return err(e as HttpErrorResponse)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -72,7 +83,13 @@ export class AgendaDataRepositoryService {
|
|||||||
} catch (e) {
|
} catch (e) {
|
||||||
if(isHttpError(e)) {
|
if(isHttpError(e)) {
|
||||||
tracing?.setAttribute('status.code', e.status.toString())
|
tracing?.setAttribute('status.code', e.status.toString())
|
||||||
|
if (e.status == 400) {
|
||||||
|
tracing.bugFlag()
|
||||||
|
tracing.setAttribute('outcome', 'failed')
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
|
tracing.bugFlag()
|
||||||
|
tracing.setAttribute('outcome', 'failed')
|
||||||
tracing?.setAttribute('map.error', 'true')
|
tracing?.setAttribute('map.error', 'true')
|
||||||
tracing?.setAttribute('map.error.context', JSON.stringify(e))
|
tracing?.setAttribute('map.error.context', JSON.stringify(e))
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,8 @@ import { SharedCalendarListOutputDTO, SharedCalendarListOutputDTOSchema } from '
|
|||||||
import { HttpService } from '../../http.service';
|
import { HttpService } from '../../http.service';
|
||||||
import { APIReturn } from '../../decorator/api-validate-schema.decorator';
|
import { APIReturn } from '../../decorator/api-validate-schema.decorator';
|
||||||
import { TracingType } from '../../monitoring/opentelemetry/tracer';
|
import { TracingType } from '../../monitoring/opentelemetry/tracer';
|
||||||
import { EventListOutputDTOSchema } from './model/eventListDTOOutput';
|
import { EventListOutputDTO, EventListOutputDTOSchema } from './model/eventListDTOOutput';
|
||||||
|
import { EventOutputDTO } from './model/eventDTOOutput';
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
@@ -48,7 +49,7 @@ export class AgendaDataService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// @APIReturn(EventListOutputDTOSchema, 'get/Events')
|
// @APIReturn(EventListOutputDTOSchema, 'get/Events')
|
||||||
getEvents(userId: number, startDate: string, endDate: string, status: number, category: string, type: string, tracing?: TracingType): Observable<any> {
|
getEvents(userId: number, startDate: string, endDate: string, status: number, category: string, type: string, tracing?: TracingType): Observable<EventListOutputDTO> {
|
||||||
let params = new HttpParams()
|
let params = new HttpParams()
|
||||||
.set('UserId', userId)
|
.set('UserId', userId)
|
||||||
|
|
||||||
@@ -72,7 +73,7 @@ export class AgendaDataService {
|
|||||||
return this.http.get<any>(`${this.baseUrl}/Events`, { params });
|
return this.http.get<any>(`${this.baseUrl}/Events`, { params });
|
||||||
}
|
}
|
||||||
|
|
||||||
getEvent(id: string): Observable<any> {
|
getEvent(id: string): Observable<EventOutputDTO> {
|
||||||
return this.http.get<any>(`${this.baseUrl}/Events/${id}`);
|
return this.http.get<any>(`${this.baseUrl}/Events/${id}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -53,7 +53,9 @@ export class EventMapper {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
"owner": dto.owner,
|
||||||
"HasAttachments": dto.hasAttachments,
|
"HasAttachments": dto.hasAttachments,
|
||||||
"EventComunicationId": 1682,
|
"EventComunicationId": 1682,
|
||||||
"EventId": dto.id,
|
"EventId": dto.id,
|
||||||
|
|||||||
@@ -28,6 +28,11 @@ export class EventToApproveDetailsMapper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let color;
|
let color;
|
||||||
|
if(dto.ownerType == EEventOwnerType.PR) {
|
||||||
|
color = 'PR'
|
||||||
|
} else {
|
||||||
|
color = 'MDGPR'
|
||||||
|
}
|
||||||
|
|
||||||
// if(dto.ownerType != 'PR') {
|
// if(dto.ownerType != 'PR') {
|
||||||
let ownerType;
|
let ownerType;
|
||||||
@@ -74,6 +79,7 @@ export class EventToApproveDetailsMapper {
|
|||||||
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
"owner": dto.owner,
|
||||||
"serialNumber": dto.id,
|
"serialNumber": dto.id,
|
||||||
"taskStatus": taskStatus,
|
"taskStatus": taskStatus,
|
||||||
"originator": {
|
"originator": {
|
||||||
|
|||||||
@@ -186,7 +186,7 @@ export class AuthService {
|
|||||||
this.RochetChatConnectorService.logout();
|
this.RochetChatConnectorService.logout();
|
||||||
this.RochetChatConnectorService.connect();
|
this.RochetChatConnectorService.connect();
|
||||||
this.RochetChatConnectorService.login().then((message: any) => {
|
this.RochetChatConnectorService.login().then((message: any) => {
|
||||||
console.log('Chat login', message)
|
// console.log('Chat login', message)
|
||||||
|
|
||||||
SessionStore.user.RochetChatUserId = message.result.id
|
SessionStore.user.RochetChatUserId = message.result.id
|
||||||
SessionStore.save()
|
SessionStore.save()
|
||||||
|
|||||||
@@ -420,7 +420,7 @@ export class EventsService {
|
|||||||
isMyEvent(event: any) {
|
isMyEvent(event: any) {
|
||||||
|
|
||||||
const data: any = event
|
const data: any = event
|
||||||
return data.Organizer.Id == SessionStore.user.UserId
|
return data.owner.wxUserId == SessionStore.user.UserId
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import { Tracer, Span } from '@opentelemetry/sdk-trace-base';
|
|||||||
import { OpentelemetryAgendaProvider } from './opentelemetry';
|
import { OpentelemetryAgendaProvider } from './opentelemetry';
|
||||||
import { Device, DeviceInfo } from '@capacitor/device';
|
import { Device, DeviceInfo } from '@capacitor/device';
|
||||||
|
|
||||||
|
|
||||||
const tracerInstance = OpentelemetryAgendaProvider.getTracer('example-tracer-hole', '111', {
|
const tracerInstance = OpentelemetryAgendaProvider.getTracer('example-tracer-hole', '111', {
|
||||||
|
|
||||||
})
|
})
|
||||||
@@ -81,12 +82,18 @@ export function XTracerAsync({ name, log, bugPrint }: any, p0?: any) {
|
|||||||
try {
|
try {
|
||||||
const result = await originalMethod.apply(this, args);
|
const result = await originalMethod.apply(this, args);
|
||||||
|
|
||||||
tracing.finish()
|
if(!window.location.origin.includes('https')) {
|
||||||
|
tracing.finish()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
return result
|
return result
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|
||||||
tracing.finish()
|
|
||||||
|
if(!window.location.origin.includes('https')) {
|
||||||
|
tracing.finish()
|
||||||
|
}
|
||||||
console.error(e);
|
console.error(e);
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
@@ -162,12 +169,18 @@ export function XTracer({name, log, bugPrint}: any) {
|
|||||||
try {
|
try {
|
||||||
const result = originalMethod.apply(this, args);
|
const result = originalMethod.apply(this, args);
|
||||||
|
|
||||||
tracing.finish()
|
|
||||||
|
if(!window.location.origin.includes('https')) {
|
||||||
|
tracing.finish()
|
||||||
|
}
|
||||||
|
|
||||||
return result
|
return result
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|
||||||
tracing.finish()
|
|
||||||
|
if(!window.location.origin.includes('https')) {
|
||||||
|
tracing.finish()
|
||||||
|
}
|
||||||
console.error(e);
|
console.error(e);
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -334,7 +334,7 @@ export class TaskService {
|
|||||||
let allEvents = await this.AgendaDataRepositoryService.eventToApproveList({
|
let allEvents = await this.AgendaDataRepositoryService.eventToApproveList({
|
||||||
userId,
|
userId,
|
||||||
status: EEventFilterStatus.Pending
|
status: EEventFilterStatus.Pending
|
||||||
})
|
}, tracing)
|
||||||
|
|
||||||
if(allEvents.isOk()) {
|
if(allEvents.isOk()) {
|
||||||
tracing.setAttribute('outcome', 'success')
|
tracing.setAttribute('outcome', 'success')
|
||||||
|
|||||||
@@ -13,6 +13,9 @@ import { HttpErrorHandle } from 'src/app/services/http-error-handle.service';
|
|||||||
import { TaskService } from 'src/app/services/task.service'
|
import { TaskService } from 'src/app/services/task.service'
|
||||||
import { AgendaDataRepositoryService } from 'src/app/services/Repositorys/Agenda/agenda-data-repository.service';
|
import { AgendaDataRepositoryService } from 'src/app/services/Repositorys/Agenda/agenda-data-repository.service';
|
||||||
import { EventToApproveDetails } from 'src/app/models/entiry/agenda/eventToApproveDetails';
|
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({
|
@Component({
|
||||||
selector: 'app-approve-event',
|
selector: 'app-approve-event',
|
||||||
@@ -53,7 +56,9 @@ export class ApproveEventPage implements OnInit {
|
|||||||
public ThemeService: ThemeService,
|
public ThemeService: ThemeService,
|
||||||
private httpErroHandle: HttpErrorHandle,
|
private httpErroHandle: HttpErrorHandle,
|
||||||
public TaskService: TaskService,
|
public TaskService: TaskService,
|
||||||
private agendaDataRepository: AgendaDataRepositoryService
|
private agendaDataRepository: AgendaDataRepositoryService,
|
||||||
|
public EventsService: EventsService,
|
||||||
|
private httpErrorHandle: HttpErrorHandle,
|
||||||
) {
|
) {
|
||||||
// Event to approve list
|
// Event to approve list
|
||||||
|
|
||||||
@@ -77,19 +82,33 @@ export class ApproveEventPage implements OnInit {
|
|||||||
this.modalController.dismiss();
|
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()) {
|
if (res.isOk()) {
|
||||||
this.loadedEvent = res.value;
|
this.loadedEvent = res.value;
|
||||||
console.log('attachment', res.value)
|
|
||||||
this.loadedAttachments = this.loadedEvent.Attachments
|
this.loadedAttachments = this.loadedEvent.Attachments
|
||||||
this.today = new Date(res.value.workflowInstanceDataFields.StartDate);
|
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.customDate = this.days[this.today.getDay()] + ", " + this.today.getDate() + " de " + (this.months[this.today.getMonth()]);
|
||||||
|
tracing.setAttribute('outcome', 'success')
|
||||||
} else {
|
} 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({
|
let allEvents = await this.AgendaDataRepositoryService.eventToApproveList({
|
||||||
userId,
|
userId,
|
||||||
status: EEventFilterStatus.Pending
|
status: EEventFilterStatus.Pending
|
||||||
})
|
}, tracing)
|
||||||
if(allEvents.isOk()) {
|
if(allEvents.isOk()) {
|
||||||
|
|
||||||
tracing.setAttribute('outcome', 'success')
|
tracing.setAttribute('outcome', 'success')
|
||||||
|
|||||||
@@ -20,6 +20,8 @@ import { EventController } from 'src/app/controller/event'
|
|||||||
import { DateService } from 'src/app/services/date.service';
|
import { DateService } from 'src/app/services/date.service';
|
||||||
import { AgendaDataRepositoryService } from 'src/app/services/Repositorys/Agenda/agenda-data-repository.service';
|
import { AgendaDataRepositoryService } from 'src/app/services/Repositorys/Agenda/agenda-data-repository.service';
|
||||||
import { SearchList_v2 } from 'src/app/models/search-document';
|
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({
|
@Component({
|
||||||
selector: 'app-view-event',
|
selector: 'app-view-event',
|
||||||
@@ -68,7 +70,7 @@ export class ViewEventPage implements OnInit {
|
|||||||
private httpErrorHandle: HttpErrorHandle,
|
private httpErrorHandle: HttpErrorHandle,
|
||||||
private router: Router,
|
private router: Router,
|
||||||
private dateService: DateService,
|
private dateService: DateService,
|
||||||
private agendaDataRepository: AgendaDataRepositoryService
|
private agendaDataRepository: AgendaDataRepositoryService,
|
||||||
) {
|
) {
|
||||||
this.isEventEdited = false;
|
this.isEventEdited = false;
|
||||||
this.loadedEvent = new Event();
|
this.loadedEvent = new Event();
|
||||||
@@ -124,29 +126,47 @@ export class ViewEventPage implements OnInit {
|
|||||||
setTimeZone() {
|
setTimeZone() {
|
||||||
this.TimeZoneString = this.loadedEvent.TimeZone
|
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()) {
|
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 */
|
/* let changeDate = this.dateService.fixDate(res.value as any) as any */
|
||||||
this.loadedEvent = res.value as any;
|
this.loadedEvent = res.value as any;
|
||||||
this.setTimeZone()
|
this.setTimeZone()
|
||||||
} else {
|
} 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({
|
this.viewEventDetailDismiss.emit({
|
||||||
type: 'close'
|
type: 'close'
|
||||||
})
|
})
|
||||||
console.log(res.error)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
deleteYesOrNo() {
|
deleteYesOrNo() {
|
||||||
if (this.loadedEvent.IsRecurring) {
|
if (this.loadedEvent.IsRecurring) {
|
||||||
this.alertController.create({
|
this.alertController.create({
|
||||||
header: 'Eliminar evento?',
|
header: 'Eliminar evento?',
|
||||||
message: 'Este evento tem recorrência, deseja eliminar a Sequência de eventos?',
|
message: 'Este evento tem recorrência, deseja eliminar a Sequência de eventos?',
|
||||||
@@ -200,7 +220,7 @@ export class ViewEventPage implements OnInit {
|
|||||||
res.present();
|
res.present();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
deleteEvent_v2(deleteAll) {
|
deleteEvent_v2(deleteAll) {
|
||||||
|
|||||||
Reference in New Issue
Block a user