[FEATURE] Display qualifications list in homepage (#10)
Co-authored-by: Phan Huy Tran <p.tran@neusta.de> Reviewed-on: #10 Reviewed-by: Constantin Simonis <constantin@simonis.lol>
This commit is contained in:
parent
e4f811bdae
commit
e0b3d7267f
4
src/app/Qualification.ts
Normal file
4
src/app/Qualification.ts
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
export class Qualification {
|
||||||
|
constructor(public skill?: string) {
|
||||||
|
}
|
||||||
|
}
|
@ -1,10 +1,10 @@
|
|||||||
import {Routes} from '@angular/router';
|
import {Routes} from '@angular/router';
|
||||||
import {EmployeeListComponent} from "./employee-list/employee-list.component";
|
|
||||||
import {LoginComponent} from "./login/login.component";
|
import {LoginComponent} from "./login/login.component";
|
||||||
import {AuthGuardService} from "./services/auth-guard.service";
|
import {AuthGuardService} from "./services/auth-guard.service";
|
||||||
|
import {HomeComponent} from "./home/home.component";
|
||||||
|
|
||||||
export const routes: Routes = [
|
export const routes: Routes = [
|
||||||
{path: 'login', component: LoginComponent},
|
{path: 'login', component: LoginComponent},
|
||||||
{path: '', component: EmployeeListComponent, canActivate: [AuthGuardService]},
|
{path: '', component: HomeComponent, canActivate: [AuthGuardService]},
|
||||||
{path: '**', redirectTo: ''}
|
{path: '**', redirectTo: ''}
|
||||||
];
|
];
|
||||||
|
0
src/app/home/home.component.css
Normal file
0
src/app/home/home.component.css
Normal file
2
src/app/home/home.component.html
Normal file
2
src/app/home/home.component.html
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
<app-employee-list></app-employee-list>
|
||||||
|
<app-qualifications></app-qualifications>
|
16
src/app/home/home.component.ts
Normal file
16
src/app/home/home.component.ts
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
import { Component } from '@angular/core';
|
||||||
|
import {EmployeeListComponent} from "../employee-list/employee-list.component";
|
||||||
|
import {QualificationsComponent} from "../qualifications/qualifications.component";
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-home',
|
||||||
|
imports: [
|
||||||
|
EmployeeListComponent,
|
||||||
|
QualificationsComponent
|
||||||
|
],
|
||||||
|
templateUrl: './home.component.html',
|
||||||
|
styleUrl: './home.component.css'
|
||||||
|
})
|
||||||
|
export class HomeComponent {
|
||||||
|
|
||||||
|
}
|
0
src/app/qualifications/qualifications.component.css
Normal file
0
src/app/qualifications/qualifications.component.css
Normal file
7
src/app/qualifications/qualifications.component.html
Normal file
7
src/app/qualifications/qualifications.component.html
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
<ul>
|
||||||
|
@for (qualification of qualifications$ | async; track qualification.skill) {
|
||||||
|
<li>
|
||||||
|
{{ qualification.skill }}
|
||||||
|
</li>
|
||||||
|
}
|
||||||
|
</ul>
|
25
src/app/qualifications/qualifications.component.ts
Normal file
25
src/app/qualifications/qualifications.component.ts
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
import { Component } from '@angular/core';
|
||||||
|
import {Observable} from "rxjs";
|
||||||
|
import {Employee} from "../Employee";
|
||||||
|
import {Qualification} from "../Qualification";
|
||||||
|
import {HttpClient} from "@angular/common/http";
|
||||||
|
import {MatSnackBar} from "@angular/material/snack-bar";
|
||||||
|
import {AsyncPipe} from "@angular/common";
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-qualifications',
|
||||||
|
imports: [
|
||||||
|
AsyncPipe
|
||||||
|
],
|
||||||
|
templateUrl: './qualifications.component.html',
|
||||||
|
styleUrl: './qualifications.component.css'
|
||||||
|
})
|
||||||
|
export class QualificationsComponent {
|
||||||
|
public qualifications$: Observable<Qualification[]>;
|
||||||
|
|
||||||
|
constructor(
|
||||||
|
private readonly httpClient: HttpClient,
|
||||||
|
) {
|
||||||
|
this.qualifications$ = this.httpClient.get<Qualification[]>('http://localhost:8089/qualifications');
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user