diff --git a/src/app/components/logs-dashboard/logs-home/logs-home.component.html b/src/app/components/logs-dashboard/logs-home/logs-home.component.html index d23473f3e0eff48a8a3516db46a8e2386b071194..d5d6d3e109be782c9def585b01a889e9bd2cce59 100644 --- a/src/app/components/logs-dashboard/logs-home/logs-home.component.html +++ b/src/app/components/logs-dashboard/logs-home/logs-home.component.html @@ -56,7 +56,7 @@ <div class="columns is-centered is-marginless"> <div class="column has-text-centered is-marginless"> - <app-logs-sessions [hidden]="isToggled" [childSessionId]="sessionId" [childNbSessions]="nbSessionId"> + <app-logs-sessions [hidden]="isToggled"> </app-logs-sessions> <app-logs-slugs [hidden]="!isToggled"></app-logs-slugs> </div> 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 f30bf59605c9d4f3a0b96607081e8120ea56f1ba..d94f2870a4fd1545e8b1921407a55fda06c62b9b 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 @@ -3,7 +3,7 @@ <div class="section"> <div class="columns is-centered is-marginless"> <div class="column has-text-left"> - <h2>{{ childNbSessions }} session(s) trouvée(s)</h2> + <h2>{{ nbSessions }} session(s) trouvée(s)</h2> </div> </div> @@ -25,7 +25,7 @@ <i class="fas fa-sort-down"></i> </span> </span> - <span class="column-title">All?</span> + <span class="column-title">Nb of Slugs</span> </span> </div> <div class="column is-2 has-text-left"> @@ -73,27 +73,28 @@ </div> <div class="data-list"> <div class="data columns is-multiline is-vcentered is-marginless" - *ngFor="let session of allSessionsIdInfo; let i=index; let odd=odd; let even=even;" + *ngFor="let session of allSessionsInfoList; 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.session_id }} </div> <div class="column is-1 has-text-left"> - <!-- {{ format.mapServerType}} --> + {{ session.data.length }} </div> <div class="column is-2 has-text-left"> - <span class="column-title">Completion Date</span> + {{ session.data[0].completionDate.$date }} </div> <div class="column is-2 has-text-left"> - <span class="column-title">{{ session.totalHoursSpent }}: - {{ session.totalMinutesSpent }}: - {{ session.totalSecondsSpent }}</span> + <span class="column-title"> + {{ session.data[0].duration.hours }}: + {{ session.data[0].duration.minutes }}: + {{ session.data[0].duration.seconds }}</span> </div> <div class="column is-1 has-text-centered actions"> - 0 + {{ session.data[0].count.ERROR }} </div> <div class="column is-1 actions"> - <a class="button button-gl " [routerLink]="['preReport','session', session._id]"> + <a class="button button-gl " [routerLink]="['preReport','session', session._id.session_id]"> <i class="fas fa-eye"></i> </a> </div> 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 33af5a08a130b88ba9090cce058024bd84a8fcdf..831fb94747a62918e3991936a54cdbf3af5aee03 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 @@ -10,18 +10,19 @@ import { FormsModule } from '@angular/forms'; styleUrls: ['./logs-sessions.component.scss'], }) export class LogsSessionsComponent implements OnInit { - @Input() childSessionId: string; + // @Input() childSessionId: string; // @Input() childSessionsList: []; - @Input() childNbSessions: number; + // @Input() childNbSessions: number; + nbSessions: number = 0; allSessionsIdInfo: any = []; - childSessionsList: any = []; + allSessionsInfoList: any = []; urlCode: string = 'sessionUrl'; constructor( private dataLogsService: DataLogsService, ) { } ngOnInit() { - this.getAllUniqueFields(); + this.getAllSessionsInfo(); } getProcessTimeAggr (sessionId) { @@ -31,16 +32,29 @@ export class LogsSessionsComponent implements OnInit { }, ); } - getAllUniqueFields() { - this.dataLogsService.getAllUniqueFields().subscribe((result) => { - this.childSessionsList = result[0]['session_id_list']; - for (let i = 0; i < this.childNbSessions; i += 1) { - this.getProcessTimeAggr(this.childSessionsList[i]); - } - // console.log('allSessionsIdInfo: ', this.allSessionsIdInfo); + + getAllSessionsInfo() { + this.dataLogsService.getAllInfoForAllSessions().subscribe((result) => { + this.allSessionsInfoList = result; + this.nbSessions = result.length; + console.log('allSessionsInfoList: ', this.allSessionsInfoList); + this.formatDate(); }, ); + } + formatDate() { + for (let i = 0; i < this.nbSessions; i += 1) { + 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); + } + } + } + seeDashboard() {} } 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 637c51660fb922eab371ec738dba7d296e6e98ae..cd66488d77154b07368f53987397915fd7154f13 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 @@ -51,7 +51,7 @@ <i class="fas fa-sort-down"></i> </span> </span> - <span class="column-title">Duration (min)</span> + <span class="column-title">Duration (h:min:s)</span> </span> </div> <div class="column is-1 has-text-left"> <span class="is-sortable"> @@ -87,10 +87,10 @@ {{slug.data[0].completionDate.$date}} </div> <div class="column is-2 has-text-left"> - {{slug.data[0].duration }} + {{slug.data[0].duration.hours}}:{{slug.data[0].duration.minutes}}:{{slug.data[0].duration.seconds}} </div> <div class="column is-1 has-text-left actions"> - {{slug.data[0].count[0].count}} + {{slug.data[0].count.ERROR}} </div> <div class="column is-1 has-text-left actions"> <a class="button button-gl is-left" [routerLink]="['preReport', 'slug', slug._id.slug]"> 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 593c57a604b3dbc8a2260b19aec7760ca64e5a98..a794189bf4ad9fa1882ce681516c94f5c11418c0 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 @@ -30,18 +30,18 @@ export class LogsSlugsComponent implements OnInit { this.allSlugsInfoList = result; this.childNbSlugs = result.length; console.log('allSlugsInfoList: ', this.allSlugsInfoList); - this.computeDateDuration(); + this.formatDate(); }, ); } - computeDateDuration() { + formatDate() { for (let i = 0; i < this.childNbSlugs; i += 1) { 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); + // 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); } } 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 288af878f576ee2277ee8c834ba2108f58a4ba9f..96ae6280312c3e4f50a80ed3e9755da2f1a7b8e4 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 @@ -29,7 +29,7 @@ <i class="fas fa-sort-down"></i> </span> </span> - <span class="column-title">All?</span> + <span class="column-title">Nb of Slugs</span> </span> </div> <div class="column is-2 has-text-left"> @@ -77,23 +77,21 @@ </div> <div class="data-list"> <div class="data columns is-multiline is-vcentered is-marginless" - *ngFor="let session of responseArray.session_id_list; let i=index; let odd=odd; let even=even;" [ngClass]="{ odd: odd, even: even }"> + *ngFor="let session of allSessionsInfoList; let i=index; let odd=odd; let even=even;" [ngClass]="{ odd: odd, even: even }"> <div class="column is-4 has-text-left"> - {{ session }} + {{ session._id.session_id }} </div> <div class="column is-1 has-text-left"> - <!-- {{ format.mapServerType}} --> + {{ session.data.length }} </div> <div class="column is-2 has-text-left"> - <span class="column-title">Completion Date</span> + {{ session.data[0].completionDate.$date }} </div> <div class="column is-2 has-text-left"> - <span class="column-title">{{ session.totalHoursSpent }}: - {{ session.totalMinutesSpent }}: - {{ session.totalSecondsSpent }}</span> + {{session.data[0].duration.hours}}:{{session.data[0].duration.minutes}}:{{session.data[0].duration.seconds}} </div> <div class="column is-1 has-text-left actions"> - 0 + {{ session.data[0].count.ERROR }} </div> <div class="column is-1 actions"> <a class="button button-gl " [routerLink]="['/','datalogs','report', id, session, 'slug']"> @@ -208,10 +206,10 @@ {{slug.data[0].completionDate.$date}} </div> <div class="column is-2 has-text-left"> - {{slug.data[0].duration }} - </div> + {{slug.data[0].duration.hours}}:{{slug.data[0].duration.minutes}}:{{slug.data[0].duration.seconds}} + </div> <div class="column is-1 has-text-left actions"> - {{slug.data[0].count[0].count}} + {{slug.data[0].count.ERROR}} </div> <div class="column is-1 has-text-left actions"> <a class="button button-gl is-left" [routerLink]="['/','datalogs','report', slug._id.slug, id, 'session']"> 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 bf1b4d48971099da9b929ca5fb6cc205e5469c75..c37938bc22ac20a9dc150fa17c143422aa715751 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 @@ -25,6 +25,8 @@ export class LogsPreReportComponent implements OnInit { nbObjects: number = 0; isSession:boolean = false; allSlugsInfoList:any = []; + allSessionsInfoList: any = []; + oneTempSlugsInfo:any = []; constructor( @@ -56,31 +58,28 @@ export class LogsPreReportComponent implements OnInit { if (this.type === 'session') { this.nbObjects = response[0].slug_list.length; console.log('response[0]', response[0]); - this.completeAllSlugsInfos(response[0].slug_list); + this.completeSlugsInfos(response[0].slug_list); } else { this.nbObjects = response[0].session_id_list.length; + console.log('response[0]', response[0]); + this.completeSessionsInfos(response[0].session_id_list); } // console.log('responseArray: ', this.responseArray); // console.log('nbObjects: ', this.nbObjects); }); } - completeAllSlugsInfos(slugList) { + completeSlugsInfos(slugList) { this.allSlugsInfoList = []; - this.oneTempSlugsInfo = []; for (let i = 0; i < slugList.length; i += 1) { console.log('slugList[i]', slugList[i]); this.getAllInfoForOneSlug(slugList[i]); } } getAllInfoForOneSlug(slug) { - this._dataLogsService.getAllInfoForOneSlugs(slug).subscribe((result) => { + this._dataLogsService.getAllInfoForOneSlug(slug).subscribe((result) => { console.log('result[0]', result[0]); for (let j = 0; j < result[0].data.length; j += 1) { - const date1 = new Date(result[0].data[j].completionDate.$date); - const date2 = new Date(result[0].data[j].startDate.$date); - result[0].data[j].duration = - Math.round((result[0].data[j].completionDate.$date - result[0].data[j].startDate.$date) / 60000); result[0].data[j].completionDate.$date = new Date(result[0].data[j].completionDate.$date); } this.allSlugsInfoList.push(result[0]) ; @@ -89,16 +88,23 @@ export class LogsPreReportComponent implements OnInit { } - // computeDateDuration() { - // for (let i = 0; i < this.nbObjects; i += 1) { - // 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); - // } - // } - // } + completeSessionsInfos(sessionList) { + this.allSessionsInfoList = []; + for (let i = 0; i < sessionList.length; i += 1) { + console.log('sessionList[i]', sessionList[i]); + this.getAllInfoForOneSession(sessionList[i]); + } + } + getAllInfoForOneSession(sessionId) { + this._dataLogsService.getAllInfoForOneSession(sessionId).subscribe((result) => { + console.log('result[0]', result[0]); + for (let j = 0; j < result[0].data.length; j += 1) { + result[0].data[j].completionDate.$date = new Date(result[0].data[j].completionDate.$date); + } + this.allSessionsInfoList.push(result[0]) ; + }, + ); + + } } diff --git a/src/app/services/data-logs.service.ts b/src/app/services/data-logs.service.ts index 761cf8c3bd814908d8f18f21c078493a55a33931..0b73a31131ba7684aa6f468011bf661b579b21c2 100644 --- a/src/app/services/data-logs.service.ts +++ b/src/app/services/data-logs.service.ts @@ -64,7 +64,15 @@ export class DataLogsService { ); } - getAllInfoForOneSlugs(slug): Observable<any[]> { + getAllInfoForAllSessions(): Observable<any[]> { + const aggregationEndPoint = '/_aggrs/allFullSessionAggr'; + return this._httpClient.get<any[]>(this.resourceServiceUrl + aggregationEndPoint).pipe( + map((response) => { + return response; + }), + ); + } + getAllInfoForOneSlug(slug): Observable<any[]> { const query = { slug }; const stringQuery = JSON.stringify(query); const aggregationEndPoint = '/_aggrs/oneFullSlugAggr?avars='; @@ -75,6 +83,17 @@ export class DataLogsService { ); } + getAllInfoForOneSession(sessionId): Observable<any[]> { + const query = { session_id: sessionId }; + const stringQuery = JSON.stringify(query); + const aggregationEndPoint = '/_aggrs/oneFullSessionAggr?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);