-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
15,954 additions
and
5 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<p *ngIf="capsule">capsule: {{capsule.capsule_serial}}</p> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { ComponentFixture, TestBed } from '@angular/core/testing'; | ||
|
||
import { CapsuleComponent } from './capsule.component'; | ||
|
||
describe('CapsuleComponent', () => { | ||
let component: CapsuleComponent; | ||
let fixture: ComponentFixture<CapsuleComponent>; | ||
|
||
beforeEach(async () => { | ||
await TestBed.configureTestingModule({ | ||
declarations: [ CapsuleComponent ] | ||
}) | ||
.compileComponents(); | ||
}); | ||
|
||
beforeEach(() => { | ||
fixture = TestBed.createComponent(CapsuleComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { Component, OnInit } from '@angular/core'; | ||
import { ActivatedRoute } from '@angular/router'; | ||
import { CapsulesService } from 'src/app/services/capsules.service'; | ||
|
||
@Component({ | ||
selector: 'app-capsule', | ||
templateUrl: './capsule.component.html', | ||
styleUrls: ['./capsule.component.css'] | ||
}) | ||
export class CapsuleComponent implements OnInit { | ||
capsule: any; | ||
|
||
constructor( | ||
private capsuleService: CapsulesService, | ||
private route: ActivatedRoute | ||
) { } | ||
|
||
ngOnInit(): void { | ||
const id = this.route.snapshot.paramMap.get('id'); | ||
|
||
if(id != null) { | ||
this.capsuleService.getOneCapsule(id).toPromise().then(capsule => { | ||
this.capsule = capsule; | ||
}) | ||
} else { | ||
console.log("error: capsule serial null") | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
tbody tr:hover { | ||
cursor: pointer; | ||
background-color: rgb(184, 181, 167); | ||
} |
19 changes: 19 additions & 0 deletions
19
src/app/components/list-capsule/list-capsule.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<h1>Liste des Capsules</h1> | ||
|
||
<table class="table"> | ||
<thead> | ||
<tr> | ||
<th>id</th> | ||
<th>Launch Date</th> | ||
<th>status</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<tr *ngFor="let capsule of listCapsules" (click)="redirectToCapsule(capsule.capsule_serial)"> | ||
<td>{{ capsule.capsule_serial }}</td> | ||
<td>{{ capsule.original_launch | date: 'dd LLL y H\'h\'mm' }}</td> | ||
<td>{{ capsule.status }}</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
|
25 changes: 25 additions & 0 deletions
25
src/app/components/list-capsule/list-capsule.component.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { ComponentFixture, TestBed } from '@angular/core/testing'; | ||
|
||
import { ListCapsuleComponent } from './list-capsule.component'; | ||
|
||
describe('ListCapsuleComponent', () => { | ||
let component: ListCapsuleComponent; | ||
let fixture: ComponentFixture<ListCapsuleComponent>; | ||
|
||
beforeEach(async () => { | ||
await TestBed.configureTestingModule({ | ||
declarations: [ ListCapsuleComponent ] | ||
}) | ||
.compileComponents(); | ||
}); | ||
|
||
beforeEach(() => { | ||
fixture = TestBed.createComponent(ListCapsuleComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { Component, OnInit } from '@angular/core'; | ||
import { Router } from '@angular/router'; | ||
import { CapsulesService } from 'src/app/services/capsules.service'; | ||
|
||
@Component({ | ||
selector: 'app-list-capsule', | ||
templateUrl: './list-capsule.component.html', | ||
styleUrls: ['./list-capsule.component.css'] | ||
}) | ||
export class ListCapsuleComponent implements OnInit { | ||
listCapsules: any; | ||
|
||
constructor( | ||
private capsulesService: CapsulesService, | ||
private router: Router | ||
) { } | ||
|
||
ngOnInit(): void { | ||
this.capsulesService.getCapsules().subscribe(capsules => { | ||
this.listCapsules = capsules; | ||
console.log(capsules); | ||
}) | ||
} | ||
|
||
redirectToCapsule(id: String): void { | ||
this.router.navigate(["capsule/" + id]); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters