-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #57 from oneteme/develop
Develop
- Loading branch information
Showing
6 changed files
with
116 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 58 additions & 0 deletions
58
src/app/views/detail/session/_component/local-table/detail-local-table.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
37 changes: 37 additions & 0 deletions
37
src/app/views/detail/session/_component/local-table/detail-local-table.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters