Add the view to show the list of DZs

This commit is contained in:
Sébastien André
2019-10-02 14:33:42 +02:00
parent bbb5c59794
commit 7d6d69550c
6 changed files with 104 additions and 20 deletions

36
.vscode/launch.json vendored Normal file
View File

@@ -0,0 +1,36 @@
{
// Use IntelliSense to find out which attributes exist for C# debugging
// Use hover for the description of the existing attributes
// For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md
"version": "0.2.0",
"configurations": [
{
"name": ".NET Core Launch (web)",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
// If you have changed target frameworks, make sure to update the program path.
"program": "${workspaceFolder}/Back/skydiveLogs-api/bin/Debug/netcoreapp2.2/skydiveLogs-api.dll",
"args": [],
"cwd": "${workspaceFolder}/Back/skydiveLogs-api",
"stopAtEntry": false,
// Enable launching a web browser when ASP.NET Core starts. For more information: https://aka.ms/VSCode-CS-LaunchJson-WebBrowser
"serverReadyAction": {
"action": "openExternally",
"pattern": "^\\s*Now listening on:\\s+(https?://\\S+)"
},
"env": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"sourceFileMap": {
"/Views": "${workspaceFolder}/Views"
}
},
{
"name": ".NET Core Attach",
"type": "coreclr",
"request": "attach",
"processId": "${command:pickProcess}"
}
]
}

42
.vscode/tasks.json vendored Normal file
View File

@@ -0,0 +1,42 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "build",
"command": "dotnet",
"type": "process",
"args": [
"build",
"${workspaceFolder}/Back/skydiveLogs-api/skydiveLogs-api.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
},
{
"label": "publish",
"command": "dotnet",
"type": "process",
"args": [
"publish",
"${workspaceFolder}/Back/skydiveLogs-api/skydiveLogs-api.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
},
{
"label": "watch",
"command": "dotnet",
"type": "process",
"args": [
"watch",
"run",
"${workspaceFolder}/Back/skydiveLogs-api/skydiveLogs-api.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
}
]
}

View File

@@ -8,23 +8,15 @@ import { ListOfJumpsComponent } from './list-of-jumps/list-of-jumps.component';
import { ListOfDzsComponent } from './list-of-dzs/list-of-dzs.component'; import { ListOfDzsComponent } from './list-of-dzs/list-of-dzs.component';
import { NewJumpComponent } from './new-jump/new-jump.component'; import { NewJumpComponent } from './new-jump/new-jump.component';
import { ServiceApi } from '../services/serviceApi';
import { HttpClientModule } from '@angular/common/http';
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: 'hero/:id', component: HeroDetailComponent },
// {
// path: 'heroes',
// component: HeroListComponent,
// data: { title: 'Heroes List' }
// },
// { path: '',
// redirectTo: '/heroes',
// pathMatch: 'full'
// },
// { path: '**', component: PageNotFoundComponent }
]; ];
@@ -41,9 +33,10 @@ const appRoutes: Routes = [
appRoutes, appRoutes,
{ enableTracing: true } // <-- debugging purposes only { enableTracing: true } // <-- debugging purposes only
), ),
BrowserModule BrowserModule,
], ],
providers: [], exports: [HttpClientModule],
providers: [ServiceApi],
bootstrap: [AppComponent] bootstrap: [AppComponent]
}) })
export class AppModule { } export class AppModule { }

View File

@@ -1,3 +1,11 @@
<p> <p>
list-of-dzs works! list-of-dzs works!
</p> </p>
<table>
<tr *ngFor="let dropZone of userObservable | async as listOfDropZones; index as i;">
<td>{{ dropZone.Id }}</td>
<td>{{ dropZone.Name }}</td>
</tr>
</table>

View File

@@ -12,16 +12,15 @@ import { ServiceApi } from '../../services/serviceApi';
export class ListOfDzsComponent implements OnInit { export class ListOfDzsComponent implements OnInit {
public listOfDropZones: Array<DropZoneResp>; public listOfDropZones: Array<DropZoneResp>;
constructor(private serviceApi: ServiceApi) { } constructor(private serviceApi: ServiceApi) {
}
ngOnInit() { ngOnInit() {
this.getListOfDropZones();
} }
getListOfDropZones() { getListOfDropZones() {
this.serviceApi.getListOfDropZones() this.serviceApi.getListOfDropZones()
.subscribe((data: DropZoneResp) => this.listOfDropZones = { .subscribe((data: Array<DropZoneResp>) => this.listOfDropZones = data);
heroesUrl: data['heroesUrl'],
textfile: data['textfile']
});
} }
} }

View File

@@ -1,5 +1,5 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http'; import { HttpClient, HttpHeaders } from '@angular/common/http';
import { DropZoneResp } from '../models/dropzone'; import { DropZoneResp } from '../models/dropzone';
@Injectable() @Injectable()
@@ -7,6 +7,12 @@ export class ServiceApi {
constructor(private http: HttpClient) { } constructor(private http: HttpClient) { }
public getListOfDropZones() { public getListOfDropZones() {
return this.http.get<DropZoneResp>('http://localhost:1234/api/DropZone'); const httpOptions = {
headers: new HttpHeaders({
'Access-Control-Allow-Origin': 'https://localhost:44344',
})
};
return this.http.get<Array<DropZoneResp>>('https://localhost:44344/api/DropZone', httpOptions);
} }
} }