New view of list
This commit is contained in:
@@ -2,6 +2,8 @@
|
|||||||
<a routerLink="/summary" routerLinkActive="active">Summary</a>
|
<a routerLink="/summary" routerLinkActive="active">Summary</a>
|
||||||
<a routerLink="/jumpsList" routerLinkActive="active">List of jumps</a>
|
<a routerLink="/jumpsList" routerLinkActive="active">List of jumps</a>
|
||||||
<a routerLink="/dz" routerLinkActive="active">List of DZs</a>
|
<a routerLink="/dz" routerLinkActive="active">List of DZs</a>
|
||||||
<a routerLink="/newjump" routerLinkActive="active">Add a new jumps</a>
|
<a routerLink="/aircraftList" routerLinkActive="active">List of aircrafts</a>
|
||||||
|
<a routerLink="/jumpTypeList" routerLinkActive="active">List of jump types</a>
|
||||||
|
<a routerLink="/newjump" routerLinkActive="active">Add a new jump</a>
|
||||||
</nav>
|
</nav>
|
||||||
<router-outlet></router-outlet>
|
<router-outlet></router-outlet>
|
||||||
@@ -10,13 +10,17 @@ import { NewJumpComponent } from './new-jump/new-jump.component';
|
|||||||
|
|
||||||
import { ServiceApi } from '../services/serviceApi';
|
import { ServiceApi } from '../services/serviceApi';
|
||||||
import { HttpClientModule } from '@angular/common/http';
|
import { HttpClientModule } from '@angular/common/http';
|
||||||
|
import { ListOfAircraftsComponent } from './list-of-aircrafts/list-of-aircrafts.component';
|
||||||
|
import { ListOfJumpTypesComponent } from './list-of-jump-types/list-of-jump-types.component';
|
||||||
|
|
||||||
|
|
||||||
const appRoutes: Routes = [
|
const appRoutes: Routes = [
|
||||||
{ path: 'summary', component: SummaryComponent },
|
{ path: 'summary', component: SummaryComponent },
|
||||||
{ path: 'jumpsList', component: ListOfJumpsComponent },
|
{ path: 'jumpsList', component: ListOfJumpsComponent },
|
||||||
{ path: 'dz', component: ListOfDzsComponent },
|
{ path: 'dz', component: ListOfDzsComponent },
|
||||||
{ path: 'newjump', component: NewJumpComponent }
|
{ path: 'newjump', component: NewJumpComponent },
|
||||||
|
{ path: 'aircraftList', component: ListOfAircraftsComponent },
|
||||||
|
{ path: 'jumpTypeList', component: ListOfJumpTypesComponent }
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
@@ -26,7 +30,9 @@ const appRoutes: Routes = [
|
|||||||
SummaryComponent,
|
SummaryComponent,
|
||||||
ListOfJumpsComponent,
|
ListOfJumpsComponent,
|
||||||
ListOfDzsComponent,
|
ListOfDzsComponent,
|
||||||
NewJumpComponent
|
NewJumpComponent,
|
||||||
|
ListOfAircraftsComponent,
|
||||||
|
ListOfJumpTypesComponent
|
||||||
],
|
],
|
||||||
imports: [
|
imports: [
|
||||||
RouterModule.forRoot(
|
RouterModule.forRoot(
|
||||||
|
|||||||
@@ -0,0 +1,10 @@
|
|||||||
|
<p>
|
||||||
|
list-of-aircrafts works!
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<table>
|
||||||
|
<tr *ngFor="let aircraft of this.listOfAircrafts; index as i;">
|
||||||
|
<td>{{ aircraft.id }}</td>
|
||||||
|
<td>{{ aircraft.name }}</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
|
import { ListOfAircraftsComponent } from './list-of-aircrafts.component';
|
||||||
|
|
||||||
|
describe('ListOfAircraftsComponent', () => {
|
||||||
|
let component: ListOfAircraftsComponent;
|
||||||
|
let fixture: ComponentFixture<ListOfAircraftsComponent>;
|
||||||
|
|
||||||
|
beforeEach(async(() => {
|
||||||
|
TestBed.configureTestingModule({
|
||||||
|
declarations: [ ListOfAircraftsComponent ]
|
||||||
|
})
|
||||||
|
.compileComponents();
|
||||||
|
}));
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
fixture = TestBed.createComponent(ListOfAircraftsComponent);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create', () => {
|
||||||
|
expect(component).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
import { Component, OnInit } from '@angular/core';
|
||||||
|
import { AircraftResp } from '../../models/aircraft';
|
||||||
|
import { ServiceApi } from '../../services/serviceApi';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-list-of-aircrafts',
|
||||||
|
templateUrl: './list-of-aircrafts.component.html',
|
||||||
|
styleUrls: ['./list-of-aircrafts.component.css']
|
||||||
|
})
|
||||||
|
export class ListOfAircraftsComponent implements OnInit {
|
||||||
|
public listOfAircrafts: Array<AircraftResp> = new Array<AircraftResp>();
|
||||||
|
|
||||||
|
constructor(private serviceApi: ServiceApi) {
|
||||||
|
}
|
||||||
|
|
||||||
|
ngOnInit() {
|
||||||
|
this.getListOfAircrafts();
|
||||||
|
}
|
||||||
|
|
||||||
|
getListOfAircrafts() {
|
||||||
|
this.serviceApi.getListOfAircrafts()
|
||||||
|
.subscribe(data => this.listOfAircrafts = data);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
<p>
|
||||||
|
list-of-jump-types works!
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<table>
|
||||||
|
<tr *ngFor="let jumpType of this.listOfJumpTypes; index as i;">
|
||||||
|
<td>{{ jumpType.id }}</td>
|
||||||
|
<td>{{ jumpType.name }}</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
|
import { ListOfJumpTypesComponent } from './list-of-jump-types.component';
|
||||||
|
|
||||||
|
describe('ListOfJumpTypesComponent', () => {
|
||||||
|
let component: ListOfJumpTypesComponent;
|
||||||
|
let fixture: ComponentFixture<ListOfJumpTypesComponent>;
|
||||||
|
|
||||||
|
beforeEach(async(() => {
|
||||||
|
TestBed.configureTestingModule({
|
||||||
|
declarations: [ ListOfJumpTypesComponent ]
|
||||||
|
})
|
||||||
|
.compileComponents();
|
||||||
|
}));
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
fixture = TestBed.createComponent(ListOfJumpTypesComponent);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create', () => {
|
||||||
|
expect(component).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
import { Component, OnInit } from '@angular/core';
|
||||||
|
import { JumpTypeResp } from '../../models/jumpType';
|
||||||
|
import { ServiceApi } from '../../services/serviceApi';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-list-of-jump-types',
|
||||||
|
templateUrl: './list-of-jump-types.component.html',
|
||||||
|
styleUrls: ['./list-of-jump-types.component.css']
|
||||||
|
})
|
||||||
|
export class ListOfJumpTypesComponent implements OnInit {
|
||||||
|
public listOfJumpTypes: Array<JumpTypeResp> = new Array<JumpTypeResp>();
|
||||||
|
|
||||||
|
constructor(private serviceApi: ServiceApi) {
|
||||||
|
}
|
||||||
|
|
||||||
|
ngOnInit() {
|
||||||
|
this.getListOfJumpTypes();
|
||||||
|
}
|
||||||
|
|
||||||
|
getListOfJumpTypes() {
|
||||||
|
this.serviceApi.getListOfJumpTypes()
|
||||||
|
.subscribe(data => this.listOfJumpTypes = data);
|
||||||
|
}
|
||||||
|
}
|
||||||
17
Front/skydivelogs-app/src/models/aircraft.ts
Normal file
17
Front/skydivelogs-app/src/models/aircraft.ts
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
export class AircraftReq {
|
||||||
|
constructor(data: any) {
|
||||||
|
Object.assign(this, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public id: number;
|
||||||
|
public name: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class AircraftResp {
|
||||||
|
constructor(data: any) {
|
||||||
|
Object.assign(this, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public id: number;
|
||||||
|
public name: number;
|
||||||
|
}
|
||||||
@@ -3,12 +3,27 @@ export class DropZoneResp {
|
|||||||
Object.assign(this, data);
|
Object.assign(this, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Id: number;
|
public id: number;
|
||||||
public Latitude: string;
|
public latitude: string;
|
||||||
public Longitude: string;
|
public longitude: string;
|
||||||
public Name: string;
|
public name: string;
|
||||||
public Address: string;
|
public address: string;
|
||||||
public Website: string;
|
public website: string;
|
||||||
public Email: string;
|
public email: string;
|
||||||
public Type: Array<string>;
|
public type: Array<string>;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class DropZoneReq {
|
||||||
|
constructor(data: any) {
|
||||||
|
Object.assign(this, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public id: number;
|
||||||
|
public latitude: string;
|
||||||
|
public longitude: string;
|
||||||
|
public name: string;
|
||||||
|
public address: string;
|
||||||
|
public website: string;
|
||||||
|
public email: string;
|
||||||
|
public type: Array<string>;
|
||||||
}
|
}
|
||||||
@@ -1,23 +1,31 @@
|
|||||||
export class JumpReq {
|
export class JumpReq {
|
||||||
public Id: number;
|
constructor(data: any) {
|
||||||
public JumpTypeId: number;
|
Object.assign(this, data);
|
||||||
public AircraftId: number;
|
}
|
||||||
public DropZoneId: number;
|
|
||||||
public GearId: number;
|
public id: number;
|
||||||
public ExitAltitude: number;
|
public jumpTypeId: number;
|
||||||
public DeployAltitude: number;
|
public aircraftId: number;
|
||||||
public WithCutaway: boolean;
|
public dropZoneId: number;
|
||||||
public Notes: string;
|
public gearId: number;
|
||||||
|
public exitAltitude: number;
|
||||||
|
public deployAltitude: number;
|
||||||
|
public withCutaway: boolean;
|
||||||
|
public notes: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class JumpResp {
|
export class JumpResp {
|
||||||
public Id: number;
|
constructor(data: any) {
|
||||||
public JumpTypeId: number;
|
Object.assign(this, data);
|
||||||
public AircraftId: number;
|
}
|
||||||
public DropZoneId: number;
|
|
||||||
public GearId: number;
|
public id: number;
|
||||||
public ExitAltitude: number;
|
public jumpTypeId: number;
|
||||||
public DeployAltitude: number;
|
public aircraftId: number;
|
||||||
public WithCutaway: boolean;
|
public dropZoneId: number;
|
||||||
public Notes: string;
|
public gearId: number;
|
||||||
|
public exitAltitude: number;
|
||||||
|
public deployAltitude: number;
|
||||||
|
public withCutaway: boolean;
|
||||||
|
public notes: string;
|
||||||
}
|
}
|
||||||
17
Front/skydivelogs-app/src/models/jumpType.ts
Normal file
17
Front/skydivelogs-app/src/models/jumpType.ts
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
export class JumpTypeReq {
|
||||||
|
constructor(data: any) {
|
||||||
|
Object.assign(this, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public id: number;
|
||||||
|
public name: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class JumpTypeResp {
|
||||||
|
constructor(data: any) {
|
||||||
|
Object.assign(this, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public id: number;
|
||||||
|
public name: number;
|
||||||
|
}
|
||||||
@@ -1,20 +1,23 @@
|
|||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { HttpClient, HttpHeaders } from '@angular/common/http';
|
import { HttpClient, HttpHeaders } from '@angular/common/http';
|
||||||
|
import { Observable } from 'rxjs/Observable';
|
||||||
|
import { map } from 'rxjs/operators';
|
||||||
|
|
||||||
import { DropZoneResp } from '../models/dropzone';
|
import { DropZoneResp } from '../models/dropzone';
|
||||||
import { JumpResp } from '../models/jump';
|
import { JumpResp } from '../models/jump';
|
||||||
import { Observable } from 'rxjs/Observable';
|
import { AircraftResp } from '../models/aircraft';
|
||||||
import { tap, map } from 'rxjs/operators';
|
import { JumpTypeResp } from '../models/jumpType';
|
||||||
|
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class ServiceApi {
|
export class ServiceApi {
|
||||||
|
private readonly headers = new HttpHeaders({
|
||||||
|
'Access-Control-Allow-Origin': 'http://localhost:5000',
|
||||||
|
});
|
||||||
constructor(private http: HttpClient) { }
|
constructor(private http: HttpClient) { }
|
||||||
|
|
||||||
public getListOfDropZones(): Observable<Array<DropZoneResp>> {
|
public getListOfDropZones(): Observable<Array<DropZoneResp>> {
|
||||||
const headers = new HttpHeaders({
|
return this.http.get<Array<DropZoneResp>>('http://localhost:5000/api/DropZone', { headers: this.headers })
|
||||||
'Access-Control-Allow-Origin': 'http://localhost:5000',
|
|
||||||
});
|
|
||||||
|
|
||||||
return this.http.get<Array<DropZoneResp>>('http://localhost:5000/api/DropZone', { headers: headers })
|
|
||||||
.pipe(
|
.pipe(
|
||||||
map(response => {
|
map(response => {
|
||||||
const details = response.map(data => new DropZoneResp(data));
|
const details = response.map(data => new DropZoneResp(data));
|
||||||
@@ -24,10 +27,14 @@ export class ServiceApi {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public getListOfJumps(): Observable<Array<JumpResp>> {
|
public getListOfJumps(): Observable<Array<JumpResp>> {
|
||||||
const headers = new HttpHeaders({
|
return this.http.get<Array<JumpResp>>('http://localhost:5000/api/Jump', { headers: this.headers });
|
||||||
'Access-Control-Allow-Origin': 'http://localhost:5000',
|
}
|
||||||
});
|
|
||||||
|
|
||||||
return this.http.get<Array<JumpResp>>('http://localhost:5000/api/Jump', { headers: headers });
|
public getListOfAircrafts(): Observable<Array<AircraftResp>> {
|
||||||
|
return this.http.get<Array<AircraftResp>>('http://localhost:5000/api/Aircraft', { headers: this.headers });
|
||||||
|
}
|
||||||
|
|
||||||
|
public getListOfJumpTypes(): Observable<Array<JumpTypeResp>> {
|
||||||
|
return this.http.get<Array<JumpTypeResp>>('http://localhost:5000/api/JumpType', { headers: this.headers });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user