mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 20:47:54 +00:00
add filter
This commit is contained in:
@@ -3,9 +3,6 @@
|
|||||||
{
|
{
|
||||||
"path": "."
|
"path": "."
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"path": "../_________________"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"path": "../socket-server"
|
"path": "../socket-server"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ import { map } from 'rxjs/operators';
|
|||||||
import { EEventFilterStatus } from 'src/app/services/Repositorys/Agenda/model/enums';
|
import { EEventFilterStatus } from 'src/app/services/Repositorys/Agenda/model/enums';
|
||||||
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 { ToastService } from 'src/app/services/toast.service';
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-agenda',
|
selector: 'app-agenda',
|
||||||
templateUrl: './agenda.page.html',
|
templateUrl: './agenda.page.html',
|
||||||
@@ -197,6 +198,7 @@ export class AgendaPage implements OnInit {
|
|||||||
public p: PermissionService,
|
public p: PermissionService,
|
||||||
public RoleIdService: RoleIdService,
|
public RoleIdService: RoleIdService,
|
||||||
public AgendaDataRepositoryService: AgendaDataRepositoryService,
|
public AgendaDataRepositoryService: AgendaDataRepositoryService,
|
||||||
|
private toastService: ToastService,
|
||||||
) {
|
) {
|
||||||
|
|
||||||
this.selectedUserCalendar = SessionStore.user.UserId
|
this.selectedUserCalendar = SessionStore.user.UserId
|
||||||
@@ -675,7 +677,7 @@ export class AgendaPage implements OnInit {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@XTracerAsync({name:'AgendaPage/loadRangeEventRun', log: false, bugPrint: false})
|
@XTracerAsync({name:'AgendaPage/loadRangeEventRun', log: false, bugPrint: true})
|
||||||
async loadRangeEventRun(startTime: Date, endTime: Date, tracing?: TracingType) {
|
async loadRangeEventRun(startTime: Date, endTime: Date, tracing?: TracingType) {
|
||||||
|
|
||||||
tracing.addEvent('load range start')
|
tracing.addEvent('load range start')
|
||||||
@@ -744,6 +746,10 @@ export class AgendaPage implements OnInit {
|
|||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
if(!isHttpError(response.error)) {
|
||||||
|
this.toastService._badRequest('Pedimos desculpa mas não foi possível executar a acção. Por favor, contacte o apoio técnico. #1')
|
||||||
|
}
|
||||||
|
|
||||||
tracing.setAttribute('outcome', 'failed')
|
tracing.setAttribute('outcome', 'failed')
|
||||||
tracing.bugFlag()
|
tracing.bugFlag()
|
||||||
|
|
||||||
@@ -763,10 +769,10 @@ export class AgendaPage implements OnInit {
|
|||||||
console.log('not user', JSON.stringify(selectedCalendar))
|
console.log('not user', JSON.stringify(selectedCalendar))
|
||||||
tracing.setAttribute('outcome', 'failed')
|
tracing.setAttribute('outcome', 'failed')
|
||||||
tracing.setAttribute('error', 'selectedCalendar.wxUserId')
|
tracing.setAttribute('error', 'selectedCalendar.wxUserId')
|
||||||
|
this.toastService._badRequest('Pedimos desculpa mas não foi possível executar a acção. Por favor, contacte o apoio técnico. #2')
|
||||||
tracing.bugFlag()
|
tracing.bugFlag()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
tracing.addEvent('load range end')
|
tracing.addEvent('load range end')
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,6 +19,12 @@ import { map } from 'rxjs/operators';
|
|||||||
import { Observable } from 'rxjs';
|
import { Observable } from 'rxjs';
|
||||||
import { TableSharedCalendar } from 'src/app/services/Repositorys/Agenda/agenda-local-data-source.service';
|
import { TableSharedCalendar } from 'src/app/services/Repositorys/Agenda/agenda-local-data-source.service';
|
||||||
import { RoleIdService } from 'src/app/services/role-id.service'
|
import { RoleIdService } from 'src/app/services/role-id.service'
|
||||||
|
import { EEventFilterStatus } from 'src/app/services/Repositorys/Agenda/model/enums';
|
||||||
|
import { isHttpError } from 'src/app/services/http.service';
|
||||||
|
import { ToastService } from 'src/app/services/toast.service';
|
||||||
|
import { TracingType, XTracerAsync } from 'src/app/services/monitoring/opentelemetry/tracer';
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-event-list',
|
selector: 'app-event-list',
|
||||||
templateUrl: './event-list.page.html',
|
templateUrl: './event-list.page.html',
|
||||||
@@ -67,6 +73,7 @@ export class EventListPage implements OnInit {
|
|||||||
public TaskService: TaskService,
|
public TaskService: TaskService,
|
||||||
public AgendaDataRepositoryService: AgendaDataRepositoryService,
|
public AgendaDataRepositoryService: AgendaDataRepositoryService,
|
||||||
public RoleIdService: RoleIdService,
|
public RoleIdService: RoleIdService,
|
||||||
|
private toastService: ToastService,
|
||||||
) { }
|
) { }
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
@@ -210,7 +217,8 @@ export class EventListPage implements OnInit {
|
|||||||
this.LoadToApproveEvents();
|
this.LoadToApproveEvents();
|
||||||
}
|
}
|
||||||
|
|
||||||
async LoadToApproveEvents() {
|
@XTracerAsync({name:'EventListPage/LoadToApproveEvents', log: false, bugPrint: true})
|
||||||
|
async LoadToApproveEvents(tracing?: TracingType) {
|
||||||
console.log('aprove event')
|
console.log('aprove event')
|
||||||
this.showLoader = true;
|
this.showLoader = true;
|
||||||
this.skeletonLoader = true
|
this.skeletonLoader = true
|
||||||
@@ -232,8 +240,13 @@ export class EventListPage implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
let allEvents = await this.AgendaDataRepositoryService.eventToApproveList({userId})
|
let allEvents = await this.AgendaDataRepositoryService.eventToApproveList({
|
||||||
|
userId,
|
||||||
|
status: EEventFilterStatus.Pending
|
||||||
|
})
|
||||||
|
|
||||||
if(allEvents.isOk()) {
|
if(allEvents.isOk()) {
|
||||||
|
tracing.setAttribute('outcome', 'success')
|
||||||
|
|
||||||
if(allEvents.value.length >= 1) {
|
if(allEvents.value.length >= 1) {
|
||||||
const eventsList = this.sortService.sortArrayByDate(allEvents.value).reverse();
|
const eventsList = this.sortService.sortArrayByDate(allEvents.value).reverse();
|
||||||
@@ -242,6 +255,12 @@ export class EventListPage implements OnInit {
|
|||||||
this.eventoaprovacaostore.save(segment, [])
|
this.eventoaprovacaostore.save(segment, [])
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
tracing.setAttribute('outcome', 'failed')
|
||||||
|
tracing.bugFlag()
|
||||||
|
if(!isHttpError(allEvents.error)) {
|
||||||
|
this.toastService._badRequest('Pedimos desculpa mas não foi possível executar a acção. Por favor, contacte o apoio técnico. #4')
|
||||||
|
}
|
||||||
this.eventoaprovacaostore.save(segment, [])
|
this.eventoaprovacaostore.save(segment, [])
|
||||||
// this.showLoader = false;
|
// this.showLoader = false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -83,13 +83,14 @@ export class AgendaDataRepositoryService {
|
|||||||
if(isHttpError(e)) {
|
if(isHttpError(e)) {
|
||||||
tracing?.setAttribute('status.code', e.status.toString())
|
tracing?.setAttribute('status.code', e.status.toString())
|
||||||
} else {
|
} else {
|
||||||
|
console.error(e)
|
||||||
tracing?.setAttribute('map.error', JSON.stringify(e.error))
|
tracing?.setAttribute('map.error', JSON.stringify(e.error))
|
||||||
}
|
}
|
||||||
return err(e as HttpErrorResponse)
|
return err(e as HttpErrorResponse)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async eventToApproveList({ userId, startDate = null, endDate = null, status = EEventFilterStatus.Pending, category = null, type = null, calendarOwnerName = '' }) {
|
async eventToApproveList({ userId, startDate = null, endDate = null, status = EEventFilterStatus.Pending, category = null, type = null, calendarOwnerName = '' }, tracing?: TracingType) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const result = await this.agendaDataService.getEvents(userId, startDate = null, endDate = null, status, category = null, type = null).pipe(
|
const result = await this.agendaDataService.getEvents(userId, startDate = null, endDate = null, status, category = null, type = null).pipe(
|
||||||
@@ -100,6 +101,12 @@ export class AgendaDataRepositoryService {
|
|||||||
|
|
||||||
return ok(result)
|
return ok(result)
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
if(isHttpError(e)) {
|
||||||
|
tracing?.setAttribute('status.code', e.status.toString())
|
||||||
|
} else {
|
||||||
|
console.error(e)
|
||||||
|
tracing?.setAttribute('map.error', JSON.stringify(e.error))
|
||||||
|
}
|
||||||
return err(e as HttpErrorResponse)
|
return err(e as HttpErrorResponse)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -54,10 +54,10 @@ export class AgendaDataService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if(status == -1 || status == undefined) {
|
if(status != null || status != undefined) {
|
||||||
params = params.set('status', status);
|
params = params.set('status', status);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (startDate !== null && startDate !== undefined) {
|
if (startDate !== null && startDate !== undefined) {
|
||||||
params = params.set('startDate', startDate);
|
params = params.set('startDate', startDate);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ export class ListBoxService {
|
|||||||
// daysObject[day] = object[day]
|
// daysObject[day] = object[day]
|
||||||
// }
|
// }
|
||||||
|
|
||||||
console.log('newStracture', newStracture)
|
// console.log('newStracture', newStracture)
|
||||||
|
|
||||||
return this.display(newStracture, selectedDate).year
|
return this.display(newStracture, selectedDate).year
|
||||||
|
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ Device.getInfo().then(e => {
|
|||||||
device = e
|
device = e
|
||||||
});
|
});
|
||||||
|
|
||||||
export function XTracerAsync({name, log, bugPrint}: any) {
|
export function XTracerAsync({ name, log, bugPrint }: any, p0?: any) {
|
||||||
return (
|
return (
|
||||||
target: unknown,
|
target: unknown,
|
||||||
propertyKey: string,
|
propertyKey: string,
|
||||||
@@ -26,12 +26,14 @@ export function XTracerAsync({name, log, bugPrint}: any) {
|
|||||||
|
|
||||||
const requestId = uuidv4()
|
const requestId = uuidv4()
|
||||||
const span = tracerInstance.startSpan(name);
|
const span = tracerInstance.startSpan(name);
|
||||||
|
|
||||||
let hasBug:Boolean
|
let hasBug:Boolean
|
||||||
|
|
||||||
const createTracingInstance = (): TracingType => {
|
const data = {
|
||||||
const logs: any[] = []
|
event: {},
|
||||||
|
tags: {}
|
||||||
|
}
|
||||||
|
|
||||||
|
const createTracingInstance = (): TracingType => {
|
||||||
|
|
||||||
return {
|
return {
|
||||||
span: span as any,
|
span: span as any,
|
||||||
@@ -42,27 +44,23 @@ export function XTracerAsync({name, log, bugPrint}: any) {
|
|||||||
span.setStatus(status);
|
span.setStatus(status);
|
||||||
},
|
},
|
||||||
addEvent: (context: string, message?: any, obj?: any) => {
|
addEvent: (context: string, message?: any, obj?: any) => {
|
||||||
if(log == true) {
|
|
||||||
// logger.error(obj, context, message)
|
data.event[context] = message;
|
||||||
} else {
|
|
||||||
logs.push({context, message: message, obj})
|
|
||||||
}
|
|
||||||
|
|
||||||
const value = [JSON.stringify(message)] as any
|
const value = [JSON.stringify(message)] as any
|
||||||
span.addEvent(context, value);
|
span.addEvent(context, value);
|
||||||
},
|
},
|
||||||
LocalLogEvent:(context: string, message: any, obj: any) => {
|
LocalLogEvent:(context: string, message: any, obj: any) => {
|
||||||
logs.push({context, message, obj})
|
data.tags[context] = message;
|
||||||
},
|
},
|
||||||
setAttribute: (key: string, value: string) => {
|
setAttribute: (key: string, value: string) => {
|
||||||
|
data.tags[key] = value;
|
||||||
span.setAttribute(key, value);
|
span.setAttribute(key, value);
|
||||||
},
|
},
|
||||||
finish: () => {
|
finish: () => {
|
||||||
span.end();
|
span.end();
|
||||||
if(bugPrint && hasBug) {
|
if(bugPrint && hasBug) {
|
||||||
for(const {context, message, obj} of logs) {
|
console.error(name, data)
|
||||||
// logger.error(obj, context, message)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
bugFlag:() => {
|
bugFlag:() => {
|
||||||
@@ -76,7 +74,7 @@ export function XTracerAsync({name, log, bugPrint}: any) {
|
|||||||
|
|
||||||
const tracing = createTracingInstance()
|
const tracing = createTracingInstance()
|
||||||
tracing.setAttribute('current.page', window.location.pathname);
|
tracing.setAttribute('current.page', window.location.pathname);
|
||||||
tracing.setAttribute('device.name', device.name || device.model)
|
tracing.setAttribute('device.name', device?.name || device?.model)
|
||||||
|
|
||||||
args.push(tracing)
|
args.push(tracing)
|
||||||
|
|
||||||
@@ -111,9 +109,12 @@ export function XTracer({name, log, bugPrint}: any) {
|
|||||||
|
|
||||||
let hasBug:Boolean
|
let hasBug:Boolean
|
||||||
|
|
||||||
const createTracingInstance = (): TracingType => {
|
const data = {
|
||||||
const logs: any[] = []
|
event: {},
|
||||||
|
tags: {}
|
||||||
|
}
|
||||||
|
|
||||||
|
const createTracingInstance = (): TracingType => {
|
||||||
|
|
||||||
return {
|
return {
|
||||||
span: span as any,
|
span: span as any,
|
||||||
@@ -124,27 +125,23 @@ export function XTracer({name, log, bugPrint}: any) {
|
|||||||
span.setStatus(status);
|
span.setStatus(status);
|
||||||
},
|
},
|
||||||
addEvent: (context: string, message?: any, obj?: any) => {
|
addEvent: (context: string, message?: any, obj?: any) => {
|
||||||
if(log == true) {
|
|
||||||
// logger.error(obj, context, message)
|
data.event[context] = message;
|
||||||
} else {
|
|
||||||
logs.push({context, message: message, obj})
|
|
||||||
}
|
|
||||||
|
|
||||||
const value = [JSON.stringify(message)] as any
|
const value = [JSON.stringify(message)] as any
|
||||||
span.addEvent(context, value);
|
span.addEvent(context, value);
|
||||||
},
|
},
|
||||||
LocalLogEvent:(context: string, message: any, obj: any) => {
|
LocalLogEvent:(context: string, message: any, obj: any) => {
|
||||||
logs.push({context, message, obj})
|
data.tags[context] = message;
|
||||||
},
|
},
|
||||||
setAttribute: (key: string, value: any) => {
|
setAttribute: (key: string, value: string) => {
|
||||||
|
data.tags[key] = value;
|
||||||
span.setAttribute(key, value);
|
span.setAttribute(key, value);
|
||||||
},
|
},
|
||||||
finish: () => {
|
finish: () => {
|
||||||
span.end();
|
span.end();
|
||||||
if(bugPrint && hasBug) {
|
if(bugPrint && hasBug) {
|
||||||
for(const {context, message, obj} of logs) {
|
console.error(name, data)
|
||||||
// logger.error(obj, context, message)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
bugFlag:() => {
|
bugFlag:() => {
|
||||||
@@ -158,7 +155,7 @@ export function XTracer({name, log, bugPrint}: any) {
|
|||||||
|
|
||||||
const tracing = createTracingInstance()
|
const tracing = createTracingInstance()
|
||||||
tracing.setAttribute('current.page', window.location.pathname);
|
tracing.setAttribute('current.page', window.location.pathname);
|
||||||
tracing.setAttribute('device.name', device.name || device.model)
|
tracing.setAttribute('device.name', device?.name || device?.model)
|
||||||
|
|
||||||
args.push(tracing)
|
args.push(tracing)
|
||||||
|
|
||||||
|
|||||||
@@ -21,6 +21,8 @@ import { ChangeProfileService } from './change-profile.service';
|
|||||||
import { PermissionService } from './permission.service';
|
import { PermissionService } from './permission.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 { SortService } from './functions/sort.service';
|
import { SortService } from './functions/sort.service';
|
||||||
|
import { TracingType, XTracerAsync } from './monitoring/opentelemetry/tracer';
|
||||||
|
import { EEventFilterStatus } from './Repositorys/Agenda/model/enums';
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
})
|
})
|
||||||
@@ -311,7 +313,8 @@ export class TaskService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
async loadEventosParaAprovacao() {
|
@XTracerAsync({name:'taskService/loadEventosParaAprovacao', log: false, bugPrint: true})
|
||||||
|
async loadEventosParaAprovacao(tracing?: TracingType) {
|
||||||
this.showLoaderNum++
|
this.showLoaderNum++
|
||||||
console.log('PR')
|
console.log('PR')
|
||||||
// PR dont have event to approve
|
// PR dont have event to approve
|
||||||
@@ -328,8 +331,13 @@ export class TaskService {
|
|||||||
userId = calendar.OwnerUserId
|
userId = calendar.OwnerUserId
|
||||||
}
|
}
|
||||||
|
|
||||||
let allEvents = await this.AgendaDataRepositoryService.eventToApproveList({userId})
|
let allEvents = await this.AgendaDataRepositoryService.eventToApproveList({
|
||||||
|
userId,
|
||||||
|
status: EEventFilterStatus.Pending
|
||||||
|
})
|
||||||
|
|
||||||
if(allEvents.isOk()) {
|
if(allEvents.isOk()) {
|
||||||
|
tracing.setAttribute('outcome', 'success')
|
||||||
|
|
||||||
let eventsList = []
|
let eventsList = []
|
||||||
if(allEvents.value.length >= 1) {
|
if(allEvents.value.length >= 1) {
|
||||||
@@ -338,6 +346,9 @@ export class TaskService {
|
|||||||
} else {
|
} else {
|
||||||
this.eventoaprovacaostore.save(userId, [])
|
this.eventoaprovacaostore.save(userId, [])
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
|
||||||
|
tracing.setAttribute('outcome', 'failed')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|||||||
@@ -15,7 +15,10 @@ import { RoleIdService } from 'src/app/services/role-id.service'
|
|||||||
import { map } from 'rxjs/operators';
|
import { map } from 'rxjs/operators';
|
||||||
import { Observable } from 'rxjs';
|
import { Observable } from 'rxjs';
|
||||||
import { TableSharedCalendar } from 'src/app/services/Repositorys/Agenda/agenda-local-data-source.service';
|
import { TableSharedCalendar } from 'src/app/services/Repositorys/Agenda/agenda-local-data-source.service';
|
||||||
|
import { EEventFilterStatus } from 'src/app/services/Repositorys/Agenda/model/enums';
|
||||||
|
import { TracingType, XTracerAsync } from 'src/app/services/monitoring/opentelemetry/tracer';
|
||||||
|
import { isHttpError } from 'src/app/services/http.service';
|
||||||
|
import { ToastService } from 'src/app/services/toast.service';
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-event-list',
|
selector: 'app-event-list',
|
||||||
templateUrl: './event-list.page.html',
|
templateUrl: './event-list.page.html',
|
||||||
@@ -52,6 +55,7 @@ export class EventListPage implements OnInit {
|
|||||||
public eventService: EventsService,
|
public eventService: EventsService,
|
||||||
public AgendaDataRepositoryService: AgendaDataRepositoryService,
|
public AgendaDataRepositoryService: AgendaDataRepositoryService,
|
||||||
public RoleIdService: RoleIdService,
|
public RoleIdService: RoleIdService,
|
||||||
|
private toastService: ToastService,
|
||||||
) {
|
) {
|
||||||
this.loggeduser = SessionStore.user;
|
this.loggeduser = SessionStore.user;
|
||||||
|
|
||||||
@@ -115,7 +119,8 @@ export class EventListPage implements OnInit {
|
|||||||
return new Date(e).toDateString()
|
return new Date(e).toDateString()
|
||||||
}
|
}
|
||||||
|
|
||||||
async LoadToApproveEvents() {
|
@XTracerAsync({name:'EventListPageShared/LoadToApproveEvents', log: false, bugPrint: true})
|
||||||
|
async LoadToApproveEvents(tracing?: TracingType) {
|
||||||
|
|
||||||
this.showLoader = true;
|
this.showLoader = true;
|
||||||
const segment = this.selectedUserCalendar
|
const segment = this.selectedUserCalendar
|
||||||
@@ -137,20 +142,40 @@ export class EventListPage implements OnInit {
|
|||||||
userId = this.selectedUserCalendar
|
userId = this.selectedUserCalendar
|
||||||
}
|
}
|
||||||
|
|
||||||
let allEvents = await this.AgendaDataRepositoryService.eventToApproveList({userId})
|
if(userId) {
|
||||||
if(allEvents.isOk()) {
|
let allEvents = await this.AgendaDataRepositoryService.eventToApproveList({
|
||||||
|
userId,
|
||||||
|
status: EEventFilterStatus.Pending
|
||||||
|
})
|
||||||
|
if(allEvents.isOk()) {
|
||||||
|
|
||||||
if(allEvents.value.length >= 1) {
|
tracing.setAttribute('outcome', 'success')
|
||||||
this.eventsList = this.sortService.sortArrayByDate(allEvents.value).reverse();
|
|
||||||
this.eventoaprovacaostore.save(this.selectedUserCalendar, this.eventsList)
|
if(allEvents.value.length >= 1) {
|
||||||
} else {
|
this.eventsList = this.sortService.sortArrayByDate(allEvents.value).reverse();
|
||||||
this.eventoaprovacaostore.save(this.selectedUserCalendar, [])
|
this.eventoaprovacaostore.save(this.selectedUserCalendar, this.eventsList)
|
||||||
|
} else {
|
||||||
|
this.eventoaprovacaostore.save(this.selectedUserCalendar, [])
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
|
||||||
|
tracing.setAttribute('outcome', 'failed')
|
||||||
|
tracing.bugFlag()
|
||||||
|
|
||||||
|
if(!isHttpError(allEvents.error)) {
|
||||||
|
this.toastService._badRequest('Pedimos desculpa mas não foi possível executar a acção. Por favor, contacte o apoio técnico. #3')
|
||||||
|
console.log(allEvents.error)
|
||||||
|
}
|
||||||
|
|
||||||
|
this.eventsList = [];
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
this.eventsList = [];
|
this.showLoader = false;
|
||||||
|
} else {
|
||||||
|
console.warn('calling to early eventlistpageshared/loadtoapproveevents')
|
||||||
}
|
}
|
||||||
|
|
||||||
this.showLoader = false;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -17,6 +17,10 @@ import { map } from 'rxjs/operators';
|
|||||||
import { RoleIdService } from 'src/app/services/role-id.service'
|
import { RoleIdService } from 'src/app/services/role-id.service'
|
||||||
import { TableSharedCalendar } from 'src/app/services/Repositorys/Agenda/agenda-local-data-source.service';
|
import { TableSharedCalendar } from 'src/app/services/Repositorys/Agenda/agenda-local-data-source.service';
|
||||||
import { Observable } from 'rxjs';
|
import { Observable } from 'rxjs';
|
||||||
|
import { EEventFilterStatus } from 'src/app/services/Repositorys/Agenda/model/enums';
|
||||||
|
import { isHttpError } from 'src/app/services/http.service';
|
||||||
|
import { TracingType, XTracerAsync } from 'src/app/services/monitoring/opentelemetry/tracer';
|
||||||
|
import { ToastService } from 'src/app/services/toast.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-events-to-approve',
|
selector: 'app-events-to-approve',
|
||||||
@@ -64,7 +68,8 @@ export class EventsToApprovePage implements OnInit {
|
|||||||
public ThemeService: ThemeService,
|
public ThemeService: ThemeService,
|
||||||
public AgendaDataRepositoryService: AgendaDataRepositoryService,
|
public AgendaDataRepositoryService: AgendaDataRepositoryService,
|
||||||
public RoleIdService: RoleIdService,
|
public RoleIdService: RoleIdService,
|
||||||
)
|
private toastService: ToastService,
|
||||||
|
)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
@@ -190,7 +195,8 @@ export class EventsToApprovePage implements OnInit {
|
|||||||
this.dynamicSearch()
|
this.dynamicSearch()
|
||||||
}
|
}
|
||||||
|
|
||||||
async LoadToApproveEvents() {
|
@XTracerAsync({name:'Events-to-approve/LoadToApproveEvents', log: false, bugPrint: true})
|
||||||
|
async LoadToApproveEvents(tracing?: TracingType) {
|
||||||
this.showLoader = true;
|
this.showLoader = true;
|
||||||
const segment = this.selectedUserCalendar
|
const segment = this.selectedUserCalendar
|
||||||
|
|
||||||
@@ -210,8 +216,13 @@ export class EventsToApprovePage implements OnInit {
|
|||||||
userId = this.selectedUserCalendar
|
userId = this.selectedUserCalendar
|
||||||
}
|
}
|
||||||
|
|
||||||
let allEvents = await this.AgendaDataRepositoryService.eventToApproveList({userId})
|
let allEvents = await this.AgendaDataRepositoryService.eventToApproveList({
|
||||||
|
userId,
|
||||||
|
status: EEventFilterStatus.Pending
|
||||||
|
}, tracing)
|
||||||
if(allEvents.isOk()) {
|
if(allEvents.isOk()) {
|
||||||
|
tracing.setAttribute('outcome', 'success')
|
||||||
|
|
||||||
if(allEvents.value.length >= 1) {
|
if(allEvents.value.length >= 1) {
|
||||||
this.eventsList = this.sortService.sortArrayByDate(allEvents.value).reverse();
|
this.eventsList = this.sortService.sortArrayByDate(allEvents.value).reverse();
|
||||||
this.eventoaprovacaostore.save(segment, this.eventsList)
|
this.eventoaprovacaostore.save(segment, this.eventsList)
|
||||||
@@ -221,6 +232,13 @@ export class EventsToApprovePage implements OnInit {
|
|||||||
|
|
||||||
this.showLoader = false;
|
this.showLoader = false;
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
tracing.setAttribute('outcome', 'failed')
|
||||||
|
tracing.bugFlag()
|
||||||
|
|
||||||
|
if(!isHttpError(allEvents.error)) {
|
||||||
|
this.toastService._badRequest('Pedimos desculpa mas não foi possível executar a acção. Por favor, contacte o apoio técnico. #4')
|
||||||
|
}
|
||||||
this.showLoader = false;
|
this.showLoader = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user