Update with NPM

Fix css and function name
This commit is contained in:
Sébastien André
2020-01-09 16:29:48 +01:00
parent 192af9e0bf
commit 79deeb4c2a
24 changed files with 3432 additions and 1744 deletions

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@@ -12,35 +12,35 @@
}, },
"private": true, "private": true,
"dependencies": { "dependencies": {
"@angular/animations": "^8.2.10", "@angular/animations": "^8.2.14",
"@angular/cdk": "~8.2.3", "@angular/cdk": "~8.2.3",
"@angular/common": "^8.2.10", "@angular/common": "^8.2.14",
"@angular/compiler": "^8.2.10", "@angular/compiler": "^8.2.14",
"@angular/core": "^8.2.10", "@angular/core": "^8.2.14",
"@angular/forms": "^8.2.10", "@angular/forms": "^8.2.14",
"@angular/material": "^8.2.3", "@angular/material": "^8.2.3",
"@angular/platform-browser": "^8.2.10", "@angular/platform-browser": "^8.2.14",
"@angular/platform-browser-dynamic": "^8.2.10", "@angular/platform-browser-dynamic": "^8.2.14",
"@angular/router": "^8.2.10", "@angular/router": "^8.2.14",
"core-js": "^2.4.1", "core-js": "^2.6.11",
"hammerjs": "^2.0.8", "hammerjs": "^2.0.8",
"rxjs": "^6.5.3", "rxjs": "^6.5.4",
"rxjs-compat": "^6.0.0-rc.0", "rxjs-compat": "^6.5.4",
"tslib": "^1.10.0", "tslib": "^1.10.0",
"zone.js": "~0.9.1" "zone.js": "~0.9.1"
}, },
"devDependencies": { "devDependencies": {
"@angular-devkit/build-angular": "~0.803.8", "@angular-devkit/build-angular": "^0.803.22",
"@angular/cli": "^8.3.8", "@angular/cli": "^8.3.22",
"@angular/compiler-cli": "^8.2.10", "@angular/compiler-cli": "^8.2.14",
"@angular/language-service": "^8.2.10", "@angular/language-service": "^8.2.14",
"@types/jasmine": "~2.8.3", "@types/jasmine": "~2.8.3",
"@types/jasminewd2": "~2.0.2", "@types/jasminewd2": "^2.0.8",
"@types/node": "~6.0.60", "@types/node": "~6.0.60",
"codelyzer": "^5.0.1", "codelyzer": "^5.2.1",
"jasmine-core": "~2.8.0", "jasmine-core": "~2.8.0",
"jasmine-spec-reporter": "~4.2.1", "jasmine-spec-reporter": "~4.2.1",
"karma": "^4.3.0", "karma": "^4.4.1",
"karma-chrome-launcher": "~2.2.0", "karma-chrome-launcher": "~2.2.0",
"karma-coverage-istanbul-reporter": "^1.2.1", "karma-coverage-istanbul-reporter": "^1.2.1",
"karma-jasmine": "~1.1.0", "karma-jasmine": "~1.1.0",

View File

@@ -1,16 +1,16 @@
import { Component, OnInit } from "@angular/core"; import { Component, OnInit } from '@angular/core';
import { ServiceComm } from "../services/service-comm.service"; import { ServiceComm } from '../services/service-comm.service';
@Component({ @Component({
selector: "app-root", selector: 'app-root',
templateUrl: "./app.component.html", templateUrl: './app.component.html',
styleUrls: ["./app.component.css"] styleUrls: ['./app.component.css']
}) })
export class AppComponent implements OnInit { export class AppComponent implements OnInit {
title = "app"; title = 'app';
showMenu = false; showMenu = false;
constructor(private serviceComm: ServiceComm) {} constructor(private serviceComm: ServiceComm) { }
ngOnInit() { ngOnInit() {
this.serviceComm.componentTitle.subscribe(title => (this.title = title)); this.serviceComm.componentTitle.subscribe(title => (this.title = title));

View File

@@ -97,7 +97,7 @@ const appRoutes: Routes = [
ServiceComm, ServiceComm,
DateService, DateService,
RequestCache, RequestCache,
{ provide: HTTP_INTERCEPTORS, useClass: CachingInterceptor, multi: true } // { provide: HTTP_INTERCEPTORS, useClass: CachingInterceptor, multi: true }
], ],
bootstrap: [AppComponent] bootstrap: [AppComponent]
}) })

View File

@@ -13,7 +13,7 @@
<td mat-cell *matCellDef="let element">{{element.name}}</td> <td mat-cell *matCellDef="let element">{{element.name}}</td>
</ng-container> </ng-container>
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr> <tr mat-header-row *matHeaderRowDef="displayedColumns; sticky: true"></tr>
<tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr> <tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
</table> </table>
</div> </div>

View File

@@ -24,7 +24,7 @@ export class ListOfAircraftsComponent implements OnInit {
) { } ) { }
ngOnInit() { ngOnInit() {
this.serviceComm.updatedComponentTitle('List of aircrafts'); this.serviceComm.UpdatedComponentTitle('List of aircrafts');
this.getListOfAircrafts(); this.getListOfAircrafts();
} }

View File

@@ -45,7 +45,7 @@
<td mat-cell *matCellDef="let element">{{element.type}}</td> <td mat-cell *matCellDef="let element">{{element.type}}</td>
</ng-container> </ng-container>
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr> <tr mat-header-row *matHeaderRowDef="displayedColumns; sticky: true"></tr>
<tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr> <tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
</table> </table>
</div> </div>

View File

@@ -35,7 +35,7 @@ export class ListOfDzsComponent implements OnInit {
) { } ) { }
ngOnInit() { ngOnInit() {
this.serviceComm.updatedComponentTitle('List of DZs'); this.serviceComm.UpdatedComponentTitle('List of DZs');
this.getListOfDropZones(); this.getListOfDropZones();
} }

View File

@@ -38,7 +38,7 @@
<td mat-cell *matCellDef="let element">{{element.reserveCanopy}}</td> <td mat-cell *matCellDef="let element">{{element.reserveCanopy}}</td>
</ng-container> </ng-container>
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr> <tr mat-header-row *matHeaderRowDef="displayedColumns; sticky: true"></tr>
<tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr> <tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
</table> </table>
</div> </div>

View File

@@ -4,6 +4,7 @@ import { MatPaginator, MatTableDataSource } from '@angular/material';
import { ServiceApiGet } from '../../services/service-api-get.service'; import { ServiceApiGet } from '../../services/service-api-get.service';
import { ServiceComm } from '../../services/service-comm.service'; import { ServiceComm } from '../../services/service-comm.service';
import { GearResp } from '../../models/gear'; import { GearResp } from '../../models/gear';
import { AddAction } from '../../models/add-action.enum';
@Component({ @Component({
selector: 'app-list-of-gears', selector: 'app-list-of-gears',
@@ -31,7 +32,13 @@ export class ListOfGearsComponent implements OnInit {
) { } ) { }
ngOnInit() { ngOnInit() {
this.serviceComm.updatedComponentTitle('List of gears'); this.serviceComm.refreshRequest.subscribe(action => {
if (action === AddAction.Gear) {
this.getListOfGears();
}
});
this.serviceComm.UpdatedComponentTitle('List of gears');
this.getListOfGears(); this.getListOfGears();
} }

View File

@@ -13,7 +13,7 @@
<td mat-cell *matCellDef="let element">{{element.name}}</td> <td mat-cell *matCellDef="let element">{{element.name}}</td>
</ng-container> </ng-container>
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr> <tr mat-header-row *matHeaderRowDef="displayedColumns; sticky: true"></tr>
<tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr> <tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
</table> </table>
</div> </div>

View File

@@ -24,7 +24,7 @@ export class ListOfJumpTypesComponent implements OnInit {
) { } ) { }
ngOnInit() { ngOnInit() {
this.serviceComm.updatedComponentTitle('List of jump types'); this.serviceComm.UpdatedComponentTitle('List of jump types');
this.getListOfJumpTypes(); this.getListOfJumpTypes();
} }

View File

@@ -27,7 +27,7 @@
<td mat-cell *matCellDef="let element">{{element.gear.name}}</td> <td mat-cell *matCellDef="let element">{{element.gear.name}}</td>
</ng-container> </ng-container>
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr> <tr mat-header-row *matHeaderRowDef="displayedColumns; sticky: true"></tr>
<tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr> <tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
</table> </table>
</div> </div>

View File

@@ -32,7 +32,7 @@ export class ListOfJumpsComponent implements OnInit {
) { } ) { }
ngOnInit() { ngOnInit() {
this.serviceComm.updatedComponentTitle('List of jumps'); this.serviceComm.UpdatedComponentTitle('List of jumps');
this.getListOfJumps(); this.getListOfJumps();
} }

View File

@@ -1,6 +1,9 @@
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from '@angular/core';
import { FormControl, FormGroup, Validators } from '@angular/forms'; import { FormControl, FormGroup, Validators } from '@angular/forms';
import { ServiceApiPost } from '../../services/service-api-post.service'; import { ServiceApiPost } from '../../services/service-api-post.service';
import { ServiceComm } from '../../services/service-comm.service';
import { AddAction } from '../../models/add-action.enum';
@Component({ @Component({
selector: 'app-new-aircraft', selector: 'app-new-aircraft',
@@ -10,7 +13,8 @@ import { ServiceApiPost } from '../../services/service-api-post.service';
export class NewAircraftComponent implements OnInit { export class NewAircraftComponent implements OnInit {
public addForm: FormGroup; public addForm: FormGroup;
constructor(private serviceApiPost: ServiceApiPost) { constructor(private serviceComm: ServiceComm,
private serviceApiPost: ServiceApiPost) {
this.addForm = new FormGroup({ this.addForm = new FormGroup({
aircraftName: new FormControl('', Validators.required) aircraftName: new FormControl('', Validators.required)
}); });
@@ -20,10 +24,9 @@ export class NewAircraftComponent implements OnInit {
} }
onSubmit(formData) { onSubmit(formData) {
console.log(formData.status); this.serviceApiPost.AddAircraft(formData.value.aircraftName);
console.warn('New data : ', formData); this.serviceComm.RefreshData(AddAction.Aircraft);
this.serviceApiPost.AddAircraft(this.addForm.value.aircraftName);
this.addForm.reset(); this.addForm.reset();
} }
} }

View File

@@ -1,6 +1,11 @@
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from '@angular/core';
import { FormControl, FormGroup, Validators } from '@angular/forms'; import { FormControl, FormGroup, Validators } from '@angular/forms';
import { ServiceComm } from '../../services/service-comm.service';
import { ServiceApiPost } from '../../services/service-api-post.service';
import { AddAction } from '../../models/add-action.enum';
@Component({ @Component({
selector: 'app-new-gear', selector: 'app-new-gear',
templateUrl: './new-gear.component.html', templateUrl: './new-gear.component.html',
@@ -9,7 +14,7 @@ import { FormControl, FormGroup, Validators } from '@angular/forms';
export class NewGearComponent implements OnInit { export class NewGearComponent implements OnInit {
public addForm: FormGroup; public addForm: FormGroup;
constructor() { constructor(private serviceComm: ServiceComm, private servicePost: ServiceApiPost) {
this.addForm = new FormGroup({ this.addForm = new FormGroup({
name: new FormControl('', Validators.required), name: new FormControl('', Validators.required),
manufacturer: new FormControl('', Validators.required), manufacturer: new FormControl('', Validators.required),
@@ -25,8 +30,17 @@ export class NewGearComponent implements OnInit {
} }
onSubmit(formData) { onSubmit(formData) {
console.log(formData.status); this.servicePost.AddGear(
console.warn('New data : ', formData); formData.value.name,
formData.value.manufacturer,
formData.value.minSize,
formData.value.maxSize,
formData.value.aad,
formData.value.mainCanopy,
formData.value.reserveCanopy
);
this.serviceComm.RefreshData(AddAction.Gear);
this.addForm.reset(); this.addForm.reset();
} }

View File

@@ -38,7 +38,7 @@ export class NewJumpComponent implements OnInit {
) { } ) { }
ngOnInit() { ngOnInit() {
this.serviceComm.updatedComponentTitle('Add a new jump'); this.serviceComm.UpdatedComponentTitle('Add a new jump');
this.endDate = new Date(); this.endDate = new Date();

View File

@@ -1,14 +1,14 @@
import { Component, OnInit } from "@angular/core"; import { Component, OnInit } from '@angular/core';
import { ServiceComm } from "../../services/service-comm.service"; import { ServiceComm } from '../../services/service-comm.service';
import { ServiceApiGet } from "../../services/service-api-get.service"; import { ServiceApiGet } from '../../services/service-api-get.service';
@Component({ @Component({
selector: "app-summary", selector: 'app-summary',
templateUrl: "./summary.component.html", templateUrl: './summary.component.html',
styleUrls: ["./summary.component.css"] styleUrls: ['./summary.component.css']
}) })
export class SummaryComponent implements OnInit { export class SummaryComponent implements OnInit {
public displayedColumns: Array<string> = ["label", "nb"]; public displayedColumns: Array<string> = ['label', 'nb'];
public dsNbJumpByDz; public dsNbJumpByDz;
public dsNbJumpByAircraft; public dsNbJumpByAircraft;
public dsNbJumpByRig; public dsNbJumpByRig;
@@ -18,9 +18,9 @@ export class SummaryComponent implements OnInit {
constructor( constructor(
private serviceApi: ServiceApiGet, private serviceApi: ServiceApiGet,
private serviceComm: ServiceComm private serviceComm: ServiceComm
) {} ) { }
ngOnInit() { ngOnInit() {
this.serviceComm.updatedComponentTitle("Summary"); this.serviceComm.UpdatedComponentTitle('Summary');
} }
} }

View File

@@ -0,0 +1,8 @@
export enum AddAction {
None,
JumpType,
Jump,
Aircraft,
Gear,
Dropzone
}

View File

@@ -5,6 +5,7 @@ import { JumpReq } from '../models/jump';
import { environment } from '../environments/environment'; import { environment } from '../environments/environment';
import { DateService } from './date.service'; import { DateService } from './date.service';
import { AircraftReq } from '../models/aircraft'; import { AircraftReq } from '../models/aircraft';
import { GearReq } from '../models/gear';
@Injectable() @Injectable()
export class ServiceApiPost { export class ServiceApiPost {
@@ -105,4 +106,29 @@ export class ServiceApiPost {
}) })
.subscribe(data => console.log(data)); .subscribe(data => console.log(data));
} }
public AddGear(name: string,
manufacturer: string,
minSize: number,
maxSize: number,
aad: string,
mainCanopy: string,
reserveCanopy: string) {
const bodyNewGear: GearReq = {
id: 0,
name: name,
manufacturer: manufacturer,
minSize: minSize,
maxSize: maxSize,
aad: aad,
mainCanopy: mainCanopy,
reserveCanopy: reserveCanopy
};
this.http
.post(`${environment.urlApi}/api/Gear`, bodyNewGear, {
headers: this.headers
})
.subscribe(data => console.log(data));
}
} }

View File

@@ -1,14 +1,23 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { BehaviorSubject } from 'rxjs'; import { BehaviorSubject } from 'rxjs';
import { AddAction } from '../models/add-action.enum';
@Injectable() @Injectable()
export class ServiceComm { export class ServiceComm {
private componentTitleSource = new BehaviorSubject<string>(''); private componentTitleSource = new BehaviorSubject<string>('');
componentTitle = this.componentTitleSource.asObservable(); componentTitle = this.componentTitleSource.asObservable();
private refreshRequestSource = new BehaviorSubject<AddAction>(AddAction.None);
refreshRequest = this.refreshRequestSource.asObservable();
constructor() { } constructor() { }
updatedComponentTitle(title: string) { UpdatedComponentTitle(title: string) {
this.componentTitleSource.next(title); this.componentTitleSource.next(title);
} }
RefreshData(refreshAfter: AddAction) {
this.refreshRequestSource.next(refreshAfter);
}
} }

View File

@@ -6,6 +6,6 @@ body {
} }
body { body {
margin: 0; /* margin: 0; */
font-family: Roboto, "Helvetica Neue", sans-serif; font-family: Roboto, "Helvetica Neue", sans-serif;
} }