Skip to content

Commit e5cbb08

Browse files
committed
Team Group updated in meta.yaml and added teamVisible variable
1 parent 105ff33 commit e5cbb08

3 files changed

Lines changed: 43 additions & 14 deletions

File tree

src/app/component/circular-heatmap/circular-heatmap.component.html

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,6 @@ <h2>Nothing to show</h2>
185185
</div>
186186
</ng-template>
187187
</div>
188-
<!-- Trying a change -->
189188
<div id="chart" class="heatmapClass">
190189
<div class="right-panel">
191190
<div class="team-filter">
@@ -198,6 +197,12 @@ <h2>Nothing to show</h2>
198197
selected>
199198
All
200199
</mat-chip>
200+
<mat-chip
201+
#c="matChip"
202+
*ngFor="let group of teamGroups | keyvalue"
203+
(click)="toggleTeamSelection(c)">
204+
{{ group.key }}
205+
</mat-chip>
201206
<mat-chip
202207
#c="matChip"
203208
*ngFor="let team of teamList"

src/app/component/circular-heatmap/circular-heatmap.component.ts

Lines changed: 33 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@ export class CircularHeatmapComponent implements OnInit {
3737
radial_labels: string[] = [];
3838
YamlObject: any;
3939
teamList: any;
40-
filteredTeamView: string[] = [];
40+
teamGroups: any;
41+
selectedTeamChips: string[] = ['All'];
42+
teamVisible: string[] = [];
4143
segment_labels: string[] = [];
4244
taskDetails: any;
4345
showOverlay: boolean;
@@ -59,6 +61,8 @@ export class CircularHeatmapComponent implements OnInit {
5961
this.maxLevelOfTasks = y;
6062
}
6163
this.teamList = this.YamlObject['strings']['en']['teams'];
64+
this.teamGroups = this.YamlObject['strings']['en']['teamGroups'];
65+
this.teamVisible = this.teamList;
6266
});
6367
this.yaml.setURI('./assets/YAML/generated/generated.yaml');
6468
// Function sets data
@@ -120,7 +124,6 @@ export class CircularHeatmapComponent implements OnInit {
120124
teams.forEach((singleTeam: any) => {
121125
teamStatus[singleTeam] = false;
122126
});
123-
console.log('check', teamStatus);
124127

125128
var teamsImplemented: any =
126129
this.YamlObject[allDimensionNames[i]][
@@ -135,7 +138,6 @@ export class CircularHeatmapComponent implements OnInit {
135138
Object.keys(teamStatus) as (keyof typeof teamStatus)[]
136139
).forEach((key, index) => {
137140
// 👇️ name Bobby Hadz 0, country Chile 1
138-
console.log(key, teamStatus[key], index);
139141
totalTaskTeams += 1;
140142
if (teamStatus[key] === true) {
141143
totalTeamsImplemented += 1;
@@ -174,18 +176,36 @@ export class CircularHeatmapComponent implements OnInit {
174176

175177
toggleTeamSelection(chip: MatChip) {
176178
chip.toggleSelected();
177-
// this.filteredTeamView = chip.value.replace(/\s/g, '');
179+
let currChipValue = chip.value.replace(/\s/g, '');
180+
let visibilityUpdated = false;
178181
if (chip.selected) {
179-
this.filteredTeamView = [
180-
...this.filteredTeamView,
181-
chip.value.replace(/\s/g, ''),
182-
];
182+
this.selectedTeamChips = [...this.selectedTeamChips, currChipValue];
183+
if (currChipValue == 'All') {
184+
this.teamVisible = this.teamList;
185+
console.log('All', this.teamList);
186+
visibilityUpdated = true;
187+
} else {
188+
this.teamVisible = [];
189+
190+
(
191+
Object.keys(this.teamGroups) as (keyof typeof this.teamGroups)[]
192+
).forEach((key, index) => {
193+
if (key === currChipValue) {
194+
this.teamVisible = this.teamGroups[key];
195+
visibilityUpdated = true;
196+
}
197+
});
198+
if (!visibilityUpdated) {
199+
this.teamVisible.push(currChipValue);
200+
}
201+
}
183202
} else {
184-
this.filteredTeamView = this.filteredTeamView.filter(
185-
o => o !== chip.value.replace(/\s/g, '')
203+
this.selectedTeamChips = this.selectedTeamChips.filter(
204+
o => o !== currChipValue
186205
);
187206
}
188-
console.log(this.filteredTeamView);
207+
console.log('Selected Chips', this.selectedTeamChips);
208+
console.log('Team Visible', this.teamVisible);
189209

190210
// Update heatmap based on selection
191211
this.reColorHeatmap();
@@ -644,8 +664,8 @@ export class CircularHeatmapComponent implements OnInit {
644664
(Object.keys(teamList) as (keyof typeof teamList)[]).forEach(
645665
(key, index) => {
646666
if (
647-
this.filteredTeamView[0] === 'All' ||
648-
key === this.filteredTeamView[0]
667+
this.selectedTeamChips[0] === 'All' ||
668+
key === this.selectedTeamChips[0]
649669
) {
650670
// console.log('Yes');
651671
if (teamList[key] === true) {

src/assets/YAML/meta.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ strings:
2323
ISO 27001:2022
2424
labels: ['Very Low', 'Low', 'Medium', 'High', 'Very High']
2525
teams: ['A', 'B', 'C']
26+
teamGroups:
27+
AB: ['A', 'B']
28+
BC: ['B', 'C']
29+
AC: ['A', 'C']
2630
KnowledgeLabels:
2731
[
2832
'Very Low (one discipline)',

0 commit comments

Comments
 (0)