indent_size à 4
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
import { Component, OnInit, ViewChild } from "@angular/core";
|
||||
import { RouterLink, RouterModule } from "@angular/router";
|
||||
import {
|
||||
MatPaginator,
|
||||
MatPaginatorModule,
|
||||
PageEvent,
|
||||
MatPaginator,
|
||||
MatPaginatorModule,
|
||||
PageEvent,
|
||||
} from "@angular/material/paginator";
|
||||
import { MatTableDataSource, MatTableModule } from "@angular/material/table";
|
||||
import { MatDialog } from "@angular/material/dialog";
|
||||
@@ -25,108 +25,108 @@ import { JumpInfosComponent } from "../jump-infos/jump-infos.component";
|
||||
import { StatsService } from "../../services/stats.service";
|
||||
|
||||
@Component({
|
||||
selector: "app-list-of-jumps",
|
||||
templateUrl: "./list-of-jumps.component.html",
|
||||
styleUrls: ["./list-of-jumps.component.css"],
|
||||
imports: [
|
||||
TranslateModule,
|
||||
CommonModule,
|
||||
RouterLink,
|
||||
RouterModule,
|
||||
MatIconModule,
|
||||
MatPaginatorModule,
|
||||
MatProgressSpinnerModule,
|
||||
MatProgressBarModule,
|
||||
MatTableModule,
|
||||
MatFormFieldModule,
|
||||
ReactiveFormsModule,
|
||||
MatInputModule,
|
||||
MatButtonModule,
|
||||
],
|
||||
selector: "app-list-of-jumps",
|
||||
templateUrl: "./list-of-jumps.component.html",
|
||||
styleUrls: ["./list-of-jumps.component.css"],
|
||||
imports: [
|
||||
TranslateModule,
|
||||
CommonModule,
|
||||
RouterLink,
|
||||
RouterModule,
|
||||
MatIconModule,
|
||||
MatPaginatorModule,
|
||||
MatProgressSpinnerModule,
|
||||
MatProgressBarModule,
|
||||
MatTableModule,
|
||||
MatFormFieldModule,
|
||||
ReactiveFormsModule,
|
||||
MatInputModule,
|
||||
MatButtonModule,
|
||||
],
|
||||
})
|
||||
export class ListOfJumpsComponent implements OnInit {
|
||||
public displayedColumns: Array<string> = [
|
||||
"infos",
|
||||
"id",
|
||||
"jumpDate",
|
||||
"jumpType",
|
||||
"aircraft",
|
||||
"dropZone",
|
||||
"actions",
|
||||
];
|
||||
public dataSourceTable: MatTableDataSource<Jump> = new MatTableDataSource();
|
||||
@ViewChild(MatPaginator, { static: true }) paginator: MatPaginator;
|
||||
public isLoading: boolean = false;
|
||||
public displayedColumns: Array<string> = [
|
||||
"infos",
|
||||
"id",
|
||||
"jumpDate",
|
||||
"jumpType",
|
||||
"aircraft",
|
||||
"dropZone",
|
||||
"actions",
|
||||
];
|
||||
public dataSourceTable: MatTableDataSource<Jump> = new MatTableDataSource();
|
||||
@ViewChild(MatPaginator, { static: true }) paginator: MatPaginator;
|
||||
public isLoading: boolean = false;
|
||||
|
||||
constructor(
|
||||
private serviceApi: JumpService,
|
||||
private serviceComm: ServiceComm,
|
||||
public dialog: MatDialog,
|
||||
private translateService: TranslateService,
|
||||
private statsService: StatsService
|
||||
) {}
|
||||
constructor(
|
||||
private serviceApi: JumpService,
|
||||
private serviceComm: ServiceComm,
|
||||
public dialog: MatDialog,
|
||||
private translateService: TranslateService,
|
||||
private statsService: StatsService,
|
||||
) {}
|
||||
|
||||
ngAferViewInit(): void {
|
||||
this.dataSourceTable.paginator = this.paginator;
|
||||
}
|
||||
ngAferViewInit(): void {
|
||||
this.dataSourceTable.paginator = this.paginator;
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.serviceComm.refreshRequest.subscribe((action) => {
|
||||
if (action === AddAction.Jump) {
|
||||
this.dialog.closeAll();
|
||||
this.getListOfJumps();
|
||||
}
|
||||
});
|
||||
this.serviceComm.forceTranslateTitle.subscribe((data) => {
|
||||
if (data === true) {
|
||||
this.updateTitle();
|
||||
}
|
||||
});
|
||||
|
||||
ngOnInit() {
|
||||
this.serviceComm.refreshRequest.subscribe((action) => {
|
||||
if (action === AddAction.Jump) {
|
||||
this.dialog.closeAll();
|
||||
this.getListOfJumps();
|
||||
}
|
||||
});
|
||||
this.serviceComm.forceTranslateTitle.subscribe((data) => {
|
||||
if (data === true) {
|
||||
this.updateTitle();
|
||||
}
|
||||
});
|
||||
this.getListOfJumps();
|
||||
}
|
||||
|
||||
this.updateTitle();
|
||||
this.getListOfJumps();
|
||||
}
|
||||
getListOfJumps(pageSize: number = 20, pageIndex: number = 0) {
|
||||
this.isLoading = true;
|
||||
|
||||
getListOfJumps(pageSize: number = 20, pageIndex: number = 0) {
|
||||
this.isLoading = true;
|
||||
this.serviceApi
|
||||
.getJumps(pageIndex * pageSize, pageIndex * pageSize + pageSize)
|
||||
.subscribe((data) => {
|
||||
this.dataSourceTable.data = data.rows;
|
||||
setTimeout(() => {
|
||||
this.paginator.length = data.count;
|
||||
this.paginator.pageIndex = pageIndex;
|
||||
this.isLoading = false;
|
||||
}, 500);
|
||||
});
|
||||
}
|
||||
|
||||
this.serviceApi
|
||||
.getJumps(pageIndex * pageSize, pageIndex * pageSize + pageSize)
|
||||
.subscribe((data) => {
|
||||
this.dataSourceTable.data = data.rows;
|
||||
setTimeout(() => {
|
||||
this.paginator.length = data.count;
|
||||
this.paginator.pageIndex = pageIndex;
|
||||
this.isLoading = false;
|
||||
}, 500);
|
||||
});
|
||||
}
|
||||
openDialog(item: Jump, editMode: boolean) {
|
||||
this.dialog.open(JumpInfosComponent, {
|
||||
data: { jump: item, editMode: editMode },
|
||||
maxHeight: "400px",
|
||||
minWidth: "350px",
|
||||
});
|
||||
}
|
||||
|
||||
openDialog(item: Jump, editMode: boolean) {
|
||||
this.dialog.open(JumpInfosComponent, {
|
||||
data: { jump: item, editMode: editMode },
|
||||
maxHeight: "400px",
|
||||
minWidth: "350px",
|
||||
});
|
||||
}
|
||||
delete(item: Jump) {
|
||||
let data: Array<Jump> = this.dataSourceTable.data;
|
||||
data = data.filter((d) => d.id !== item.id);
|
||||
|
||||
delete(item: Jump) {
|
||||
let data: Array<Jump> = this.dataSourceTable.data;
|
||||
data = data.filter((d) => d.id !== item.id);
|
||||
this.dataSourceTable.data = data;
|
||||
|
||||
this.dataSourceTable.data = data;
|
||||
this.serviceApi.deleteJump(item);
|
||||
this.statsService.resetStats();
|
||||
}
|
||||
|
||||
this.serviceApi.deleteJump(item);
|
||||
this.statsService.resetStats();
|
||||
}
|
||||
pageChanged(event: PageEvent) {
|
||||
this.getListOfJumps(event.pageSize, event.pageIndex);
|
||||
}
|
||||
|
||||
pageChanged(event: PageEvent) {
|
||||
this.getListOfJumps(event.pageSize, event.pageIndex);
|
||||
}
|
||||
|
||||
private updateTitle() {
|
||||
this.translateService.get("ListJumps_Title").subscribe((data) => {
|
||||
this.serviceComm.updatedComponentTitle(data);
|
||||
});
|
||||
}
|
||||
private updateTitle() {
|
||||
this.translateService.get("ListJumps_Title").subscribe((data) => {
|
||||
this.serviceComm.updatedComponentTitle(data);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user