diff --git a/src/app/components/logs-dashboard/logs-sessions/logs-sessions.component.html b/src/app/components/logs-dashboard/logs-sessions/logs-sessions.component.html index 1545a1f6e4fe57b2c90077aaf8ed6b71e5ac1be4..3c5b3c86aaf91f422478695cd0f98670386380b5 100644 --- a/src/app/components/logs-dashboard/logs-sessions/logs-sessions.component.html +++ b/src/app/components/logs-dashboard/logs-sessions/logs-sessions.component.html @@ -2,7 +2,11 @@ <div class="column has-text-left"> <P>{{ childNbSessions }} session(s) trouvée(s)</P> </div> + <div class="column has-text-centered"> + <p>Values below are for the latest Slug</p> + </div> </div> + <div class="table entity-list-table"> <div class="header columns is-marginless"> <div class="column is-4 has-text-centered"> diff --git a/src/app/components/logs-dashboard/logs-sessions/logs-sessions.component.ts b/src/app/components/logs-dashboard/logs-sessions/logs-sessions.component.ts index 86f5e6e70832b15162297ba83006e11f905f1261..2baa6c8378c879cdccf4656e60431e1e94582406 100644 --- a/src/app/components/logs-dashboard/logs-sessions/logs-sessions.component.ts +++ b/src/app/components/logs-dashboard/logs-sessions/logs-sessions.component.ts @@ -9,8 +9,6 @@ import { Subscription } from 'rxjs'; styleUrls: ['./logs-sessions.component.scss'], }) export class LogsSessionsComponent implements OnChanges { - // @Input() childSessionId: string; - // @Input() childSessionsList: []; @Input() childNbSessions: number; sessionChangeSub: Subscription; nbSessions: number = 0; @@ -67,15 +65,6 @@ export class LogsSessionsComponent implements OnChanges { formatDate() { for (let i = 0; i < this.nbSessions; i += 1) { this.allSessionsInfoList[i].latest.completionDate.$date = new Date(this.allSessionsInfoList[i].latest.completionDate.$date); - - // for (let j = 0; j < this.allSessionsInfoList[i].data.length; j += 1) { - // // const date1 = new Date(this.allSlugsInfoList[i].data[j].completionDate.$date); - // // const date2 = new Date(this.allSlugsInfoList[i].data[j].startDate.$date); - // // this.allSlugsInfoList[i].data[j].duration = - // // Math.round((this.allSlugsInfoList[i].data[j].completionDate.$date - - // // this.allSlugsInfoList[i].data[j].startDate.$date) / 60000); - // this.allSessionsInfoList[i].data[j].completionDate.$date = new Date(this.allSessionsInfoList[i].data[j].completionDate.$date); - // } } } diff --git a/src/app/components/logs-dashboard/logs-slugs/logs-slugs.component.html b/src/app/components/logs-dashboard/logs-slugs/logs-slugs.component.html index 762252d921346ac4285bf16b35f00d1f2e1c65d8..35b93bbf316e35779a6eba06ad233085b2f92e59 100644 --- a/src/app/components/logs-dashboard/logs-slugs/logs-slugs.component.html +++ b/src/app/components/logs-dashboard/logs-slugs/logs-slugs.component.html @@ -13,6 +13,9 @@ <div class="column has-text-left"> <P>{{ childNbSlugs }} slug(s) trouvé(s)</P> </div> + <div class="column has-text-centered"> + <p>Values below are for the latest Session</p> + </div> </div> <div class="table entity-list-table"> <div class="header columns is-marginless"> diff --git a/src/app/components/logs-dashboard/logs-slugs/logs-slugs.component.ts b/src/app/components/logs-dashboard/logs-slugs/logs-slugs.component.ts index 6be6b3a1b9dd63d72d7e39da1c58be5fc8841973..4e60be2691d8b390e40406785c4a301759486f9b 100644 --- a/src/app/components/logs-dashboard/logs-slugs/logs-slugs.component.ts +++ b/src/app/components/logs-dashboard/logs-slugs/logs-slugs.component.ts @@ -16,14 +16,6 @@ export class LogsSlugsComponent implements OnChanges { searchSlug: string = ''; slugInOnePage:number = 1; allSessionsIdInfo:any = []; - characters = [ - 'Finn the human', - 'Jake the dog', - 'Princess bubblegum', - 'Lumpy Space Princess', - 'Beemo1', - 'Beemo2', - ]; childSessionsList: any; paginator: PaginatorOptions; constructor( @@ -68,15 +60,6 @@ export class LogsSlugsComponent implements OnChanges { formatDate() { for (let i = 0; i < this.slugInOnePage; i += 1) { this.allSlugsInfoList[i].latest.completionDate.$date = new Date(this.allSlugsInfoList[i].latest.completionDate.$date); - - // for (let j = 0; j < this.allSlugsInfoList[i].data.length; j += 1) { - // // const date1 = new Date(this.allSlugsInfoList[i].data[j].completionDate.$date); - // // const date2 = new Date(this.allSlugsInfoList[i].data[j].startDate.$date); - // // this.allSlugsInfoList[i].data[j].duration = - // // Math.round((this.allSlugsInfoList[i].data[j].completionDate.$date - - // // this.allSlugsInfoList[i].data[j].startDate.$date) / 60000); - // this.allSlugsInfoList[i].data[j].completionDate.$date = new Date(this.allSlugsInfoList[i].data[j].completionDate.$date); - // } } } // When pagination is changed by user, we update datasetList with new pagination options 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 ec7a1728515808111dc9f75db2b7ed7a4623c634..cddf6e4525541778655458bbd6f2d15927f88504 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 @@ -5,7 +5,8 @@ <div class="section"> <div class="columns is-left is-marginless"> <div class="column has-text-left"> - <p>{{ nbObjects }} session(s) trouvée(s)</p> + <span>{{nbObjects}} sessions(s) found for the slug : </span> + <span class="bold-text">{{id}}</span> </div> </div> @@ -74,43 +75,44 @@ </div> </div> <div class="data-list"> - <div class="data columns is-multiline is-vcentered is-marginless" - *ngFor="let session of allSlugSessionInfoList; let i=index; let odd=odd; let even=even;" + <div *ngFor="let session of allSlugSessionInfoList; let i=index; let odd=odd; let even=even;"> + <div class="data columns is-multiline is-vcentered is-marginless" + *ngIf="session._id.slug_list" [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 }} --> - </div> - <div class="column is-2 has-text-left"> - {{ session._id.completionDate.$date }} - </div> - <div class="column is-2 has-text-left"> - {{session._id.duration.hours}}:{{session._id.duration.minutes}}:{{session._id.duration.seconds}} - </div> - <div class="column is-1 has-text-left actions"> - {{ session._id.count.ERROR }} - </div> - <div class="column is-1 actions"> - <a class="button button-gl " - [routerLink]="['/','datalogs','report', id, session._id.session_id , 'slug']"> - <i class="fas fa-eye"></i> - </a> + <div class="column is-4 has-text-left"> + {{ session._id.session_id }} + </div> + <div class="column is-1 has-text-left"> + {{session._id.slug_list.length}} + </div> + <div class="column is-2 has-text-left"> + {{ session._id.completionDate.$date }} + </div> + <div class="column is-2 has-text-left"> + {{session._id.duration.hours}}:{{session._id.duration.minutes}}:{{session._id.duration.seconds}} + </div> + <div class="column is-1 has-text-left actions"> + {{ session._id.count.ERROR }} + </div> + <div class="column is-1 actions"> + <a class="button button-gl " + [routerLink]="['/','datalogs','report', id, session._id.session_id , 'slug']"> + <i class="fas fa-eye"></i> + </a> + </div> </div> </div> </div> </div> <div class="columns is-marginless"> - <div class="column"> - <app-paginator *ngIf="paginator.length > 0" [length]="paginator.length" [pageSize]="paginator.limit" - [pageSizeOptions]="paginator.pageSizeOptions" [pageIndex]="paginator.pageIndex" [pagesToShow]="5" - [showFirstLastButtons]="true" (page)="changePagination($event)" - (pageSizeChanged)="changePageSize($event)"> - </app-paginator> - </div> + <div class="column"> + <app-paginator *ngIf="paginator.length > 0" [length]="paginator.length" [pageSize]="paginator.limit" + [pageSizeOptions]="paginator.pageSizeOptions" [pageIndex]="paginator.pageIndex" [pagesToShow]="5" + [showFirstLastButtons]="true" (page)="changePagination($event)" (pageSizeChanged)="changePageSize($event)"> + </app-paginator> </div> + </div> </div> </div> @@ -121,7 +123,8 @@ <div class="column has-text-left"> <div class="columns is-centered is-marginless"> <div class="column has-text-left"> - <p>{{nbObjects}} slug(s) trouvé(s)</p> + <span>{{nbObjects}} slug(s) found for the session : </span> + <span class="bold-text">{{id}}</span> </div> </div> </div> @@ -189,7 +192,8 @@ </div> <div class="data-list"> <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" + <div class="data columns is-multiline is-vcentered is-marginless" + *ngIf="slug._id.session_list" [ngClass]="{ odd: odd, even: even }"> <div class="column is-3 has-text-left"> {{slug._id.slug}} <br> @@ -198,7 +202,7 @@ </div> </div> <div class="column is-2 has-text-left"> - <!-- {{slug.all.length}} --> + {{slug._id.session_list.length}} </div> <div class="column is-2 has-text-left"> {{slug._id.completionDate.$date}} diff --git a/src/app/components/logs-dashboard/report/logs-pre-report/logs-pre-report.component.scss b/src/app/components/logs-dashboard/report/logs-pre-report/logs-pre-report.component.scss index cef87095f4bc3d6c48f7e83f5c3214c53e21b07e..91a597bb399dbba7bb8dbcea2fa25645674cb756 100644 --- a/src/app/components/logs-dashboard/report/logs-pre-report/logs-pre-report.component.scss +++ b/src/app/components/logs-dashboard/report/logs-pre-report/logs-pre-report.component.scss @@ -23,6 +23,12 @@ h1 { } } } + .hidden { display: none; +} + +.bold-text { + font-weight:bold; + display:inline; } \ No newline at end of file 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 472ea75a28743be21c884a3235b873a49d789508..71428fe69f033dc753ff3a723119e568666a1ad8 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 @@ -5,7 +5,7 @@ import { filter, switchMap } from 'rxjs/operators'; import { DataLogsService } from 'src/app/services/data-logs.service'; import { IPageHeaderInfo } from 'src/app/models/page.model'; import { PaginatorOptions } from 'src/app/models/paginator-options.model'; -import { Subscription } from 'rxjs'; +import { Subscription, forkJoin } from 'rxjs'; @Component({ selector: 'app-logs-pre-report', @@ -63,24 +63,46 @@ export class LogsPreReportComponent implements OnInit { console.log('slugList', slugList, 'sessionId', sessionId); this.allSlugSessionInfoList = []; for (let i = 0; i < slugList.length; i += 1) { - this.getAllInfoForOneSlugSession(slugList[i], sessionId); + this.getAllInfoForOneSlugSession(slugList[i], sessionId, 'slug'); } } completeSessionsInfos(slug, sessionList) { console.log('slug', slug, 'sessionList', sessionList); - this.allSlugSessionInfoList = []; for (let i = 0; i < sessionList.length; i += 1) { - this.getAllInfoForOneSlugSession(slug, sessionList[i]); + this.getAllInfoForOneSlugSession(slug, sessionList[i], 'session'); } } - 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]); - }, - ); + getAllInfoForOneSlugSession(slug, sessionId, type) { + if (type === 'session') { + forkJoin( + this._dataLogsService.getAllInfoForSlugSession(slug, sessionId), + this._dataLogsService.getAllInfoForOneSession(sessionId), + ) + .subscribe(([res1, res2]) => { + let sessionData = {}; + res1[0]._id.completionDate.$date = new Date(res1[0]._id.completionDate.$date); + sessionData = res1[0]; + sessionData['_id']['slug_list'] = res2[0]['all']; + this.allSlugSessionInfoList.push(sessionData); + console.log('allSlugSessionInfoList', this.allSlugSessionInfoList); + + }); + } else { + forkJoin( + this._dataLogsService.getAllInfoForSlugSession(slug, sessionId), + this._dataLogsService.getAllInfoForOneSlug(slug), + ) + .subscribe(([res1, res2]) => { + let sessionData = {}; + res1[0]._id.completionDate.$date = new Date(res1[0]._id.completionDate.$date); + sessionData = res1[0]; + sessionData['_id']['session_list'] = res2[0]['all']; + this.allSlugSessionInfoList.push(sessionData); + console.log('allSlugSessionInfoList', this.allSlugSessionInfoList); + }); + } } getComplementaryInformation() {