Skip to content

Commit 8e19cbe

Browse files
committed
Multi select chips for team filter
1 parent 4a98b97 commit 8e19cbe

2 files changed

Lines changed: 16 additions & 5 deletions

File tree

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ <h2>Nothing to show</h2>
190190
<div class="team-filter">
191191
<mat-form-field class="team-chip-list">
192192
<mat-label>Team Filter</mat-label>
193-
<mat-chip-list selectable>
193+
<mat-chip-list multiple selectable>
194194
<mat-chip
195195
#c="matChip"
196196
(click)="toggleTeamSelection(c)"

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

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export class CircularHeatmapComponent implements OnInit {
3737
radial_labels: string[] = [];
3838
YamlObject: any;
3939
teamList: any;
40-
filteredTeamView: string = 'All';
40+
filteredTeamView: string[] = [];
4141
segment_labels: string[] = [];
4242
taskDetails: any;
4343
showOverlay: boolean;
@@ -174,7 +174,18 @@ export class CircularHeatmapComponent implements OnInit {
174174

175175
toggleTeamSelection(chip: MatChip) {
176176
chip.toggleSelected();
177-
this.filteredTeamView = chip.value.replace(/\s/g, '');
177+
// this.filteredTeamView = chip.value.replace(/\s/g, '');
178+
if (chip.selected) {
179+
this.filteredTeamView = [
180+
...this.filteredTeamView,
181+
chip.value.replace(/\s/g, ''),
182+
];
183+
} else {
184+
this.filteredTeamView = this.filteredTeamView.filter(
185+
o => o !== chip.value.replace(/\s/g, '')
186+
);
187+
}
188+
console.log(this.filteredTeamView);
178189

179190
// Update heatmap based on selection
180191
this.reColorHeatmap();
@@ -633,8 +644,8 @@ export class CircularHeatmapComponent implements OnInit {
633644
(Object.keys(teamList) as (keyof typeof teamList)[]).forEach(
634645
(key, index) => {
635646
if (
636-
this.filteredTeamView === 'All' ||
637-
key === this.filteredTeamView
647+
this.filteredTeamView[0] === 'All' ||
648+
key === this.filteredTeamView[0]
638649
) {
639650
// console.log('Yes');
640651
if (teamList[key] === true) {

0 commit comments

Comments
 (0)