diff --git a/src/app/components/logs-dashboard/report/logs-pre-report/logs-pre-report.component.html b/src/app/components/logs-dashboard/report/logs-pre-report/logs-pre-report.component.html index b3ae850ed71ccbffe504c88e86560a9e90841044..ec7a1728515808111dc9f75db2b7ed7a4623c634 100644 --- a/src/app/components/logs-dashboard/report/logs-pre-report/logs-pre-report.component.html +++ b/src/app/components/logs-dashboard/report/logs-pre-report/logs-pre-report.component.html @@ -75,22 +75,22 @@ </div> <div class="data-list"> <div class="data columns is-multiline is-vcentered is-marginless" - *ngFor="let session of allSessionsInfoList; let i=index; let odd=odd; let even=even;" + *ngFor="let session of allSlugSessionInfoList; let i=index; let odd=odd; let even=even;" [ngClass]="{ odd: odd, even: even }"> <div class="column is-4 has-text-left"> {{ session._id.session_id }} </div> <div class="column is-1 has-text-left"> - {{ session.all.length }} + <!-- {{ session.all.length }} --> </div> <div class="column is-2 has-text-left"> - {{ session.latest.completionDate.$date }} + {{ session._id.completionDate.$date }} </div> <div class="column is-2 has-text-left"> - {{session.latest.duration.hours}}:{{session.latest.duration.minutes}}:{{session.latest.duration.seconds}} + {{session._id.duration.hours}}:{{session._id.duration.minutes}}:{{session._id.duration.seconds}} </div> <div class="column is-1 has-text-left actions"> - {{ session.latest.count.ERROR }} + {{ session._id.count.ERROR }} </div> <div class="column is-1 actions"> <a class="button button-gl " @@ -188,7 +188,7 @@ </div> </div> <div class="data-list"> - <div *ngFor="let slug of allSlugsInfoList; let i=index; let odd=odd; let even=even;"> + <div *ngFor="let slug of allSlugSessionInfoList; let i=index; let odd=odd; let even=even;"> <div class="data columns is-multiline is-vcentered is-marginless" *ngIf="slug._id.slug" [ngClass]="{ odd: odd, even: even }"> <div class="column is-3 has-text-left"> @@ -198,16 +198,16 @@ </div> </div> <div class="column is-2 has-text-left"> - {{slug.all.length}} + <!-- {{slug.all.length}} --> </div> <div class="column is-2 has-text-left"> - {{slug.latest.completionDate.$date}} + {{slug._id.completionDate.$date}} </div> <div class="column is-2 has-text-left"> - {{slug.latest.duration.hours}}:{{slug.latest.duration.minutes}}:{{slug.latest.duration.seconds}} + {{slug._id.duration.hours}}:{{slug._id.duration.minutes}}:{{slug._id.duration.seconds}} </div> <div class="column is-1 has-text-left actions"> - {{slug.latest.count.ERROR}} + {{slug._id.count.ERROR}} </div> <div class="column is-1 has-text-left actions"> <a class="button button-gl is-left" diff --git a/src/app/components/logs-dashboard/report/logs-pre-report/logs-pre-report.component.ts b/src/app/components/logs-dashboard/report/logs-pre-report/logs-pre-report.component.ts index c5bc6dff1b8ce0e68aef790d40740a5bca06c7a3..472ea75a28743be21c884a3235b873a49d789508 100644 --- a/src/app/components/logs-dashboard/report/logs-pre-report/logs-pre-report.component.ts +++ b/src/app/components/logs-dashboard/report/logs-pre-report/logs-pre-report.component.ts @@ -26,8 +26,7 @@ export class LogsPreReportComponent implements OnInit { serviceName: string; nbObjects: number = 0; isSession: boolean = false; - allSlugsInfoList: any = []; - allSessionsInfoList: any = []; + allSlugSessionInfoList: any = []; // Paginator options paginator: PaginatorOptions; pageSizeOptions = [5, 10, 25, 100]; @@ -60,34 +59,26 @@ export class LogsPreReportComponent implements OnInit { this.getComplementaryInformation(); } - completeSlugsInfos(slugList) { - this.allSlugsInfoList = []; + completeSlugsInfos(slugList, sessionId) { + console.log('slugList', slugList, 'sessionId', sessionId); + this.allSlugSessionInfoList = []; for (let i = 0; i < slugList.length; i += 1) { - this.getAllInfoForOneSlug(slugList[i]); + this.getAllInfoForOneSlugSession(slugList[i], sessionId); } } - getAllInfoForOneSlug(slug) { - this._dataLogsService.getAllInfoForOneSlug(slug).subscribe((result) => { - for (let j = 0; j < result[0].all.length; j += 1) { - result[0].all[j].completionDate.$date = new Date(result[0].all[j].completionDate.$date); - } - this.allSlugsInfoList.push(result[0]); - }, - ); - } - completeSessionsInfos(sessionList) { - this.allSessionsInfoList = []; + completeSessionsInfos(slug, sessionList) { + console.log('slug', slug, 'sessionList', sessionList); + + this.allSlugSessionInfoList = []; for (let i = 0; i < sessionList.length; i += 1) { - this.getAllInfoForOneSession(sessionList[i]); + this.getAllInfoForOneSlugSession(slug, sessionList[i]); } } - getAllInfoForOneSession(sessionId) { - this._dataLogsService.getAllInfoForOneSession(sessionId).subscribe((result) => { - for (let j = 0; j < result[0].all.length; j += 1) { - result[0].all[j].completionDate.$date = new Date(result[0].all[j].completionDate.$date); - } - this.allSessionsInfoList.push(result[0]); + getAllInfoForOneSlugSession(slug, sessionId) { + this._dataLogsService.getAllInfoForSlugSession(slug, sessionId).subscribe((result) => { + result[0]._id.completionDate.$date = new Date(result[0]._id.completionDate.$date); + this.allSlugSessionInfoList.push(result[0]); }, ); } @@ -106,11 +97,11 @@ export class LogsPreReportComponent implements OnInit { if (this.type === 'session') { this.nbObjects = response[0].slug_list.length; this.paginator.length = response[0].slug_list.length; - this.completeSlugsInfos(response[0].slug_list.slice(0, this.paginator.limit)); + this.completeSlugsInfos(response[0].slug_list.slice(0, this.paginator.limit), this.id); } else { this.nbObjects = response[0].session_id_list.length; this.paginator.length = response[0].session_id_list.length; - this.completeSessionsInfos(response[0].session_id_list.slice(0, this.paginator.limit)); + this.completeSessionsInfos(this.id, response[0].session_id_list.slice(0, this.paginator.limit)); } }); } @@ -119,15 +110,17 @@ export class LogsPreReportComponent implements OnInit { changePagination(pageIndex) { this.paginator.pageIndex = pageIndex; if (this.type === 'slug') { - this.completeSessionsInfos(this.responseArray.session_id_list.slice( + this.completeSessionsInfos(this.id, this.responseArray.session_id_list.slice( (this.paginator.pageIndex - 1) * (this.paginator.limit), (this.paginator.pageIndex - 1) * (this.paginator.limit) + this.paginator.limit, )); } else { - this.completeSlugsInfos(this.responseArray.slug_list.slice( + this.completeSlugsInfos( + this.responseArray.slug_list.slice( (this.paginator.pageIndex - 1) * (this.paginator.limit), (this.paginator.pageIndex - 1) * (this.paginator.limit) + this.paginator.limit, - )); + ), + this.id); } } diff --git a/src/app/services/data-logs.service.ts b/src/app/services/data-logs.service.ts index 033bf880dd4d3acb3a4785e589106bdb6cc7b0a0..73bc312313a1067b5796a3f253886a612c26b247 100644 --- a/src/app/services/data-logs.service.ts +++ b/src/app/services/data-logs.service.ts @@ -110,6 +110,17 @@ export class DataLogsService { ); } + getAllInfoForSlugSession(slug, sessionId): Observable<any[]> { + const query = { slug, session_id: sessionId }; + const stringQuery = JSON.stringify(query); + const aggregationEndPoint = '/_aggrs/oneFullSessionSlugAggr?avars='; + return this._httpClient.get<any[]>(this.resourceServiceUrl + aggregationEndPoint + stringQuery).pipe( + map((response) => { + return response; + }), + ); + } + getData(thisUuid, sessionId): Observable<any[]> { const query = { uuid: thisUuid, session_id: sessionId }; const stringQuery = JSON.stringify(query);