indent_size à 4
This commit is contained in:
@@ -1,22 +1,22 @@
|
||||
table {
|
||||
width: 100%;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.mat-row td {
|
||||
padding: 15px;
|
||||
padding: 15px;
|
||||
}
|
||||
|
||||
.spanWithBreakWord {
|
||||
display: inline-block;
|
||||
min-width: 200px;
|
||||
word-wrap: break-word;
|
||||
display: inline-block;
|
||||
min-width: 200px;
|
||||
word-wrap: break-word;
|
||||
}
|
||||
|
||||
.content {
|
||||
min-height: 90vh;
|
||||
display: flex;
|
||||
justify-content: left;
|
||||
flex-direction: column;
|
||||
align-items: initial;
|
||||
padding-top: 25px;
|
||||
min-height: 90vh;
|
||||
display: flex;
|
||||
justify-content: left;
|
||||
flex-direction: column;
|
||||
align-items: initial;
|
||||
padding-top: 25px;
|
||||
}
|
||||
|
||||
@@ -1,47 +1,54 @@
|
||||
<div class="content">
|
||||
@if (dataSourceTable != null) {
|
||||
<div>
|
||||
@if (isUserAdmin == true) {
|
||||
<button
|
||||
mat-raised-button
|
||||
color="accent"
|
||||
(click)="openDialogToAdd()"
|
||||
>
|
||||
{{ "ListAircrafts_Add" | translate }}
|
||||
</button>
|
||||
}
|
||||
<table mat-table [dataSource]="dataSourceTable">
|
||||
<ng-container matColumnDef="id">
|
||||
<th mat-header-cell *matHeaderCellDef>
|
||||
{{ "ListAircrafts_Header_Id" | translate }}
|
||||
</th>
|
||||
<td mat-cell *matCellDef="let element">{{ element.id }}</td>
|
||||
</ng-container>
|
||||
<ng-container matColumnDef="name">
|
||||
<th mat-header-cell *matHeaderCellDef>
|
||||
{{ "ListAircrafts_Header_Name" | translate }}
|
||||
</th>
|
||||
<td mat-cell *matCellDef="let element">{{ element.name }}</td>
|
||||
</ng-container>
|
||||
<ng-container matColumnDef="imageData">
|
||||
<th mat-header-cell *matHeaderCellDef>
|
||||
{{ "ListAircrafts_Header_Image" | translate }}
|
||||
</th>
|
||||
<td mat-cell *matCellDef="let element">
|
||||
<img
|
||||
src="{{ element.imageData }}"
|
||||
alt="No image"
|
||||
style="width: 128px"
|
||||
/>
|
||||
</td>
|
||||
</ng-container>
|
||||
<tr mat-header-row *matHeaderRowDef="displayedColumns; sticky: true"></tr>
|
||||
<tr mat-row *matRowDef="let row; columns: displayedColumns"></tr>
|
||||
</table>
|
||||
</div>
|
||||
} @else {
|
||||
<mat-progress-spinner [mode]="'indeterminate'"></mat-progress-spinner>
|
||||
}
|
||||
<mat-paginator [length]="resultsLength" [pageSize]="10"></mat-paginator>
|
||||
|
||||
@if (dataSourceTable != null) {
|
||||
<div>
|
||||
@if (isUserAdmin == true) {
|
||||
<button
|
||||
mat-raised-button
|
||||
color="accent"
|
||||
(click)="openDialogToAdd()"
|
||||
>
|
||||
{{ "ListAircrafts_Add" | translate }}
|
||||
</button>
|
||||
}
|
||||
<table mat-table [dataSource]="dataSourceTable">
|
||||
<ng-container matColumnDef="id">
|
||||
<th mat-header-cell *matHeaderCellDef>
|
||||
{{ "ListAircrafts_Header_Id" | translate }}
|
||||
</th>
|
||||
<td mat-cell *matCellDef="let element">{{ element.id }}</td>
|
||||
</ng-container>
|
||||
<ng-container matColumnDef="name">
|
||||
<th mat-header-cell *matHeaderCellDef>
|
||||
{{ "ListAircrafts_Header_Name" | translate }}
|
||||
</th>
|
||||
<td mat-cell *matCellDef="let element">
|
||||
{{ element.name }}
|
||||
</td>
|
||||
</ng-container>
|
||||
<ng-container matColumnDef="imageData">
|
||||
<th mat-header-cell *matHeaderCellDef>
|
||||
{{ "ListAircrafts_Header_Image" | translate }}
|
||||
</th>
|
||||
<td mat-cell *matCellDef="let element">
|
||||
<img
|
||||
src="{{ element.imageData }}"
|
||||
alt="No image"
|
||||
style="width: 128px"
|
||||
/>
|
||||
</td>
|
||||
</ng-container>
|
||||
<tr
|
||||
mat-header-row
|
||||
*matHeaderRowDef="displayedColumns; sticky: true"
|
||||
></tr>
|
||||
<tr
|
||||
mat-row
|
||||
*matRowDef="let row; columns: displayedColumns"
|
||||
></tr>
|
||||
</table>
|
||||
</div>
|
||||
} @else {
|
||||
<mat-progress-spinner [mode]="'indeterminate'"></mat-progress-spinner>
|
||||
}
|
||||
<mat-paginator [length]="resultsLength" [pageSize]="10"></mat-paginator>
|
||||
</div>
|
||||
|
||||
@@ -15,70 +15,72 @@ import { AddAction } from "../../models/add-action.enum";
|
||||
import { AircraftResp } from "../../models/aircraft";
|
||||
|
||||
@Component({
|
||||
selector: "app-list-of-aircrafts",
|
||||
templateUrl: "./list-of-aircrafts.component.html",
|
||||
styleUrls: ["./list-of-aircrafts.component.css"],
|
||||
imports: [
|
||||
TranslateModule,
|
||||
MatPaginatorModule,
|
||||
MatProgressSpinnerModule,
|
||||
MatTableModule,
|
||||
MatButtonModule
|
||||
],
|
||||
selector: "app-list-of-aircrafts",
|
||||
templateUrl: "./list-of-aircrafts.component.html",
|
||||
styleUrls: ["./list-of-aircrafts.component.css"],
|
||||
imports: [
|
||||
TranslateModule,
|
||||
MatPaginatorModule,
|
||||
MatProgressSpinnerModule,
|
||||
MatTableModule,
|
||||
MatButtonModule,
|
||||
],
|
||||
})
|
||||
export class ListOfAircraftsComponent implements OnInit {
|
||||
public displayedColumns: Array<string> = ["name", "imageData"];
|
||||
public dataSourceTable: MatTableDataSource<AircraftResp>;
|
||||
public resultsLength = 0;
|
||||
public isUserAdmin: boolean;
|
||||
@ViewChild(MatPaginator, { static: true }) paginator: MatPaginator;
|
||||
public displayedColumns: Array<string> = ["name", "imageData"];
|
||||
public dataSourceTable: MatTableDataSource<AircraftResp>;
|
||||
public resultsLength = 0;
|
||||
public isUserAdmin: boolean;
|
||||
@ViewChild(MatPaginator, { static: true }) paginator: MatPaginator;
|
||||
|
||||
constructor(
|
||||
private serviceApi: AircraftService,
|
||||
private serviceComm: ServiceComm,
|
||||
private authenticationService: AuthenticationService,
|
||||
public dialog: MatDialog,
|
||||
private translateService: TranslateService
|
||||
) {
|
||||
this.isUserAdmin =
|
||||
this.authenticationService.currentUserValue.roles === "admin";
|
||||
}
|
||||
constructor(
|
||||
private serviceApi: AircraftService,
|
||||
private serviceComm: ServiceComm,
|
||||
private authenticationService: AuthenticationService,
|
||||
public dialog: MatDialog,
|
||||
private translateService: TranslateService,
|
||||
) {
|
||||
this.isUserAdmin =
|
||||
this.authenticationService.currentUserValue.roles === "admin";
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.serviceComm.refreshRequest.subscribe((action) => {
|
||||
if (action === AddAction.Aircraft) {
|
||||
this.dialog.closeAll();
|
||||
this.getListOfAircrafts();
|
||||
}
|
||||
});
|
||||
this.serviceComm.forceTranslateTitle.subscribe((data) => {
|
||||
if (data === true) {
|
||||
this.updateTitle();
|
||||
}
|
||||
});
|
||||
|
||||
ngOnInit() {
|
||||
this.serviceComm.refreshRequest.subscribe((action) => {
|
||||
if (action === AddAction.Aircraft) {
|
||||
this.dialog.closeAll();
|
||||
this.getListOfAircrafts();
|
||||
}
|
||||
});
|
||||
this.serviceComm.forceTranslateTitle.subscribe((data) => {
|
||||
if (data === true) {
|
||||
this.updateTitle();
|
||||
}
|
||||
});
|
||||
this.getListOfAircrafts();
|
||||
}
|
||||
|
||||
this.updateTitle();
|
||||
this.getListOfAircrafts();
|
||||
}
|
||||
private getListOfAircrafts() {
|
||||
this.serviceApi.getListOfAircrafts().subscribe((data) => {
|
||||
setTimeout(() => {
|
||||
data.sort((a, b) => a.name.localeCompare(b.name));
|
||||
this.dataSourceTable = new MatTableDataSource<AircraftResp>(
|
||||
data,
|
||||
);
|
||||
this.dataSourceTable.paginator = this.paginator;
|
||||
this.resultsLength = data.length;
|
||||
}, 500);
|
||||
});
|
||||
}
|
||||
|
||||
private getListOfAircrafts() {
|
||||
this.serviceApi.getListOfAircrafts().subscribe((data) => {
|
||||
setTimeout(() => {
|
||||
data.sort((a, b) => a.name.localeCompare(b.name));
|
||||
this.dataSourceTable = new MatTableDataSource<AircraftResp>(data);
|
||||
this.dataSourceTable.paginator = this.paginator;
|
||||
this.resultsLength = data.length;
|
||||
}, 500);
|
||||
});
|
||||
}
|
||||
openDialogToAdd() {
|
||||
this.dialog.open(NewAircraftComponent);
|
||||
}
|
||||
|
||||
openDialogToAdd() {
|
||||
this.dialog.open(NewAircraftComponent);
|
||||
}
|
||||
|
||||
private updateTitle() {
|
||||
this.translateService.get("ListAircrafts_Title").subscribe((data) => {
|
||||
this.serviceComm.updatedComponentTitle(data);
|
||||
});
|
||||
}
|
||||
private updateTitle() {
|
||||
this.translateService.get("ListAircrafts_Title").subscribe((data) => {
|
||||
this.serviceComm.updatedComponentTitle(data);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user