Display qualifications list in homepage
This commit is contained in:
parent
53c0fde21f
commit
f0ecf3db11
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>
|
23
src/app/qualifications/qualifications.component.spec.ts
Normal file
23
src/app/qualifications/qualifications.component.spec.ts
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
|
import { QualificationsComponent } from './qualifications.component';
|
||||||
|
|
||||||
|
describe('QualificationsComponent', () => {
|
||||||
|
let component: QualificationsComponent;
|
||||||
|
let fixture: ComponentFixture<QualificationsComponent>;
|
||||||
|
|
||||||
|
beforeEach(async () => {
|
||||||
|
await TestBed.configureTestingModule({
|
||||||
|
imports: [QualificationsComponent]
|
||||||
|
})
|
||||||
|
.compileComponents();
|
||||||
|
|
||||||
|
fixture = TestBed.createComponent(QualificationsComponent);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create', () => {
|
||||||
|
expect(component).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
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