Skip to content

Commit

Permalink
Merge pull request #57 from oneteme/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
antonin77 authored Nov 26, 2024
2 parents dca1515 + 2596954 commit ce79299
Show file tree
Hide file tree
Showing 6 changed files with 116 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,17 @@
<rest-table [requests]="session.restRequests"
(onClickRow)="selectedRequest($event)"></rest-table>
</div>
<div *ngIf="session.stages?.length" style="margin-bottom: 2em;">
<div style="display: flex; flex-direction: row; justify-content: center; align-items: center; align-content: center; margin-bottom: 0.5em;">
<mat-divider style="margin-right: 2em; flex: 1 1 0"></mat-divider>
<div style="display: flex; align-items: center; gap: 0.5em; font-size: 20px; font-weight: 500;">
<mat-icon>memory</mat-icon>
<div [matBadge]="session.stages?.length" matBadgeOverlap="false" matBadgeColor="primary">LOCAL</div>
</div>
<mat-divider style="margin-left: 2em; flex: 1 1 0"></mat-divider>
</div>
<local-table [requests]="session.stages"></local-table>
</div>
<div *ngIf="session.ftpRequests?.length" style="margin-bottom: 2em;">
<div style="display: flex; flex-direction: row; justify-content: center; align-items: center; align-content: center; margin-bottom: 0.5em;">
<mat-divider style="margin-right: 2em; flex: 1 1 0"></mat-divider>
Expand Down Expand Up @@ -62,7 +73,7 @@
(onClickRow)="selectedQuery($event)">
</database-table>
</div>
<div *ngIf="(session.databaseRequests?.length || session.restRequests?.length) && (session.databaseRequests?.length+session.restRequests?.length <500) " style="margin-bottom: 1em;">
<div *ngIf="(session.databaseRequests?.length || session.restRequests?.length || session.stages?.length || session.ldapRequests?.length || session.ftpRequests?.length || session.mailRequests?.length) && (session.databaseRequests?.length+session.restRequests?.length+session.stages?.length+session.ldapRequests?.length+session.ftpRequests?.length+session.mailRequests?.length < 500) " style="margin-bottom: 1em;">
<div style="display: flex; flex-direction: row; justify-content: center; align-items: center; align-content: center; margin-bottom: 0.5em;">
<mat-divider style="margin-right: 2em; flex: 1 1 0"></mat-divider>
<div style="display: flex; align-items: center; gap: 0.5em; font-size: 20px; font-weight: 500;">
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<div class="mat-elevation-z8">
<table mat-table [dataSource]="dataSource" #sort="matSort" matSort
matSortActive="date_debut" matSortDirection="desc">


<ng-container matColumnDef="status">
<th mat-header-cell *matHeaderCellDef style="width:1%">
</th>
<td [ngStyle]="{'border-left': element.status ? '4px solid green' :
'4px solid red'}" mat-cell *matCellDef="let element">
</td>
</ng-container>

<ng-container matColumnDef="name">
<th mat-header-cell *matHeaderCellDef mat-sort-header> Nom</th>
<td mat-cell *matCellDef="let element">
{{element["name"] || 'N/A'}}
</td>
</ng-container>

<ng-container matColumnDef="location">
<th mat-header-cell *matHeaderCellDef mat-sort-header> Location</th>
<td mat-cell *matCellDef="let element">
{{element["location"] || 'N/A'}}
</td>
</ng-container>

<ng-container matColumnDef="start">
<th mat-header-cell *matHeaderCellDef mat-sort-header>Début</th>
<td mat-cell *matCellDef="let element">
<div class="table-column-content">
{{ (element.start*1000 |date:'dd/MM/yyyy')}}
</div>
<br>
<div class="table-column-content">
{{ (element.start*1000 |date:'HH:mm:ss.SSS')}}
</div>
</td>
</ng-container>

<ng-container matColumnDef="duration">
<th mat-header-cell *matHeaderCellDef mat-sort-header class="center-text"> Durée </th>
<td mat-cell *matCellDef="let element" class="center-text">
<span
[matTooltip]="(element.start * 1000| date:'dd/MM/yyyy, HH:mm:ss.SSS':'fr') +' \n '+ (element.end * 1000 | date:'dd/MM/yyyy, HH:mm:ss.SSS':'fr') "
matTooltipClass="mat-tooltip">
{{{start: element.start, end: element.end} | duration }}
</span>
</td>
</ng-container>

<tr mat-header-row *matHeaderRowDef="displayedColumns;"></tr>
<tr mat-row *matRowDef="let row;columns: displayedColumns;">
</tr>
</table>
<mat-paginator #paginator [pageSize]="3" [hidePageSize]="true"
showFirstLastButtons></mat-paginator>
</div>
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import {Component, Input, OnInit, ViewChild} from "@angular/core";
import {MatTableDataSource} from "@angular/material/table";
import {LocalRequest, NamingRequest} from "../../../../../model/trace.model";
import {MatPaginator} from "@angular/material/paginator";
import {MatSort} from "@angular/material/sort";

@Component({
selector: 'local-table',
templateUrl: './detail-local-table.component.html',
styleUrls: ['./detail-local-table.component.scss']
})
export class DetailLocalTableComponent implements OnInit {
displayedColumns: string[] = ['status', 'name', 'location', 'start', 'duration'];
dataSource: MatTableDataSource<LocalRequest> = new MatTableDataSource();

@ViewChild('paginator', {static: true}) paginator: MatPaginator;
@ViewChild('sort', {static: true}) sort: MatSort;

@Input() set requests(requests: LocalRequest[]) {
if(requests) {
this.dataSource = new MatTableDataSource(requests);
this.dataSource.paginator = this.paginator;
this.dataSource.sort = this.sort;
}
}

ngOnInit() {
this.dataSource.sortingDataAccessor = sortingDataAccessor;
}
}

const sortingDataAccessor = (row: any, columnName: string) => {
if (columnName == "location") return row["location"] as string;
if (columnName == "start") return row['start'] as string;
if (columnName == "duree") return (row["end"] - row["start"]);
return row[columnName as keyof any] as string;
}
14 changes: 7 additions & 7 deletions src/app/views/detail/session/rest/detail-session-rest.view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {InstanceEnvironment, InstanceRestSession} from "../../../../model/trace.
import {ActivatedRoute} from "@angular/router";
import {TraceService} from "../../../../service/trace.service";
import {Location} from "@angular/common";
import {catchError, combineLatest, finalize, forkJoin, of, Subscription, switchMap} from "rxjs";
import {catchError, combineLatest, finalize, forkJoin, Observable, of, Subscription, switchMap, EMPTY} from "rxjs";
import {application} from "../../../../../environments/environment";
import {Utils} from "../../../../shared/util";
import {EnvRouter} from "../../../../service/router.service";
Expand Down Expand Up @@ -49,12 +49,12 @@ export class DetailSessionRestView implements OnInit, OnDestroy {
session: of(s),
instance: this._traceService.getInstance(s.instanceId),
parent: this._traceService.getSessionParent(id).pipe(catchError(() => of(null))),
requests: this._traceService.getRestRequests(s.id),
queries: this._traceService.getDatabaseRequests(s.id),
stages: this._traceService.getLocalRequests(s.id),
ftps: this._traceService.getFtpRequests(s.id),
mails: this._traceService.getSmtpRequests(s.id),
ldaps: this._traceService.getLdapRequests(s.id)
requests: (s.mask & 4) > 0 ? this._traceService.getRestRequests(s.id) : of([]),
queries: (s.mask & 2) > 0 ? this._traceService.getDatabaseRequests(s.id) : of([]),
stages: (s.mask & 1) > 0 ? this._traceService.getLocalRequests(s.id) : of([]),
ftps: (s.mask & 8) > 0 ? this._traceService.getFtpRequests(s.id) : of([]),
mails: (s.mask & 16) > 0 ? this._traceService.getSmtpRequests(s.id) : of([]),
ldaps: (s.mask & 32) > 0 ? this._traceService.getLdapRequests(s.id) : of([])
});
}),
finalize(() => this.isLoading = false)
Expand Down
2 changes: 2 additions & 0 deletions src/app/views/views.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ import {
import {ServerHistoryTableComponent} from "./statistic/application/history-table/server-history-table.component";
import {StatisticClientView} from "./statistic/view/statistic-client.view";
import {ArchitectureView} from "./architecture/architecture.view";
import {DetailLocalTableComponent} from "./detail/session/_component/local-table/detail-local-table.component";


@NgModule({
Expand Down Expand Up @@ -74,6 +75,7 @@ import {ArchitectureView} from "./architecture/architecture.view";
DetailFtpTableComponent,
DetailSmtpTableComponent,
DetailLdapTableComponent,
DetailLocalTableComponent,
DetailTimelineComponent,
DetailSessionComponent,
StatisticApplicationView,
Expand Down

0 comments on commit ce79299

Please sign in to comment.