Skip to content

Commit d4339ee

Browse files
committed
Team component: dynamic team data from teams.yaml
1 parent fad9e2d commit d4339ee

4 files changed

Lines changed: 22 additions & 37 deletions

File tree

src/app/app.module.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import { ReadmeToHtmlComponent } from './component/readme-to-html/readme-to-html
1919
import { UsageComponent } from './component/usage/usage.component';
2020
import { AboutUsComponent } from './component/about-us/about-us.component';
2121
import { DependencyGraphComponent } from './component/dependency-graph/dependency-graph.component';
22+
import { Teams } from './component/teams/teams.component';
2223

2324
@NgModule({
2425
declarations: [
@@ -34,6 +35,7 @@ import { DependencyGraphComponent } from './component/dependency-graph/dependenc
3435
UsageComponent,
3536
AboutUsComponent,
3637
DependencyGraphComponent,
38+
Teams,
3739
],
3840
imports: [
3941
BrowserModule,

src/app/component/teams/teams.component.html

Lines changed: 7 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -6,40 +6,12 @@ <h2>Team List</h2>
66
</ul>
77
</div>
88
<h2>Team Group</h2>
9-
<h3>Group 123</h3>
10-
<div class="team-list">
11-
<ul>
12-
<li>Team 1</li>
13-
<li>Team 2</li>
14-
<li>Team 3</li>
15-
</ul>
16-
</div>
17-
<h3>Group 123</h3>
18-
<div class="team-list">
19-
<ul>
20-
<li>Team 1</li>
21-
<li>Team 2</li>
22-
<li>Team 3</li>
23-
<li>Team 1</li>
24-
<li>Team 2</li>
25-
<li>Team 3</li>
26-
<li>Team 1</li>
27-
<li>Team 2</li>
28-
<li>Team 3</li>
29-
<li>Team 1</li>
30-
<li>Team 2</li>
31-
<li>Team 3</li>
32-
<li>Team 1</li>
33-
<li>Team 2</li>
34-
<li>Team 3</li>
35-
</ul>
36-
</div>
37-
<h3>Group 123</h3>
38-
<div class="team-list">
39-
<ul>
40-
<li>Team 1</li>
41-
<li>Team 2</li>
42-
<li>Team 3</li>
43-
</ul>
9+
<div class="group-expand" *ngFor="let group of teamGroups | keyvalue">
10+
<h3>{{ group.key }}</h3>
11+
<div class="team-list">
12+
<ul>
13+
<li *ngFor="let team of group.value">{{ team }}</li>
14+
</ul>
15+
</div>
4416
</div>
4517
</div>

src/app/component/teams/teams.component.spec.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
1+
import { HttpClientModule, HttpHandler } from '@angular/common/http';
2+
import { HttpClientTestingModule } from '@angular/common/http/testing';
13
import { ComponentFixture, TestBed } from '@angular/core/testing';
4+
// import { MatAutocomplete } from '@angular/material/autocomplete';
5+
import { RouterTestingModule } from '@angular/router/testing';
6+
import { ymlService } from 'src/app/service/yaml-parser/yaml-parser.service';
7+
import { MatChip } from '@angular/material/chips';
28

39
import { Teams } from './teams.component';
410

@@ -8,7 +14,9 @@ describe('Teams', () => {
814

915
beforeEach(async () => {
1016
await TestBed.configureTestingModule({
11-
declarations: [Teams],
17+
providers: [ymlService, HttpClientTestingModule],
18+
imports: [RouterTestingModule, HttpClientModule],
19+
declarations: [Teams, MatChip],
1220
}).compileComponents();
1321
});
1422

src/app/component/teams/teams.component.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import * as yaml from 'js-yaml';
1010
export class Teams implements OnInit {
1111
YamlObject: any;
1212
teamList: any;
13-
teamGroups: any;
13+
teamGroups: Map<string, string[]> = new Map();
1414

1515
constructor(private yaml: ymlService) {}
1616
ngOnInit(): void {
@@ -27,4 +27,7 @@ export class Teams implements OnInit {
2727
console.log('teamGroups', this.teamGroups);
2828
});
2929
}
30+
getTeamArray(key: string): string[] {
31+
return this.teamGroups.get(key) || [];
32+
}
3033
}

0 commit comments

Comments
 (0)