-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into preset-view
- Loading branch information
Showing
19 changed files
with
219 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
src/app/core/services/grouping/milestone-grouping-strategy.service.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import { Injectable } from '@angular/core'; | ||
import { Observable } from 'rxjs'; | ||
import { map } from 'rxjs/operators'; | ||
import { Issue } from '../../models/issue.model'; | ||
import { Milestone } from '../../models/milestone.model'; | ||
import { MilestoneService } from '../milestone.service'; | ||
import { GroupingStrategy } from './grouping-strategy.interface'; | ||
|
||
/** | ||
* A GroupingStrategy that groups issues/prs based on their milestones. | ||
*/ | ||
@Injectable({ | ||
providedIn: 'root' | ||
}) | ||
export class MilestoneGroupingStrategy implements GroupingStrategy { | ||
constructor(private milestoneService: MilestoneService) {} | ||
|
||
/** | ||
* Retrieves data for a milestone. | ||
*/ | ||
getDataForGroup(issues: Issue[], key: Milestone): Issue[] { | ||
return issues.filter((issue) => issue.milestone.equals(key)); | ||
} | ||
|
||
/** | ||
* Retrieves an Observable emitting milestones available for grouping issues. | ||
*/ | ||
getGroups(): Observable<Milestone[]> { | ||
return this.milestoneService.fetchMilestones().pipe( | ||
map((milestones) => { | ||
return this.milestoneService.parseMilestoneData(milestones); | ||
}) | ||
); | ||
} | ||
|
||
/** | ||
* Groups other than Default Milestone need to be shown on the | ||
* hidden group list if empty. | ||
*/ | ||
isInHiddenList(group: Milestone): boolean { | ||
return group !== Milestone.IssueWithoutMilestone && group !== Milestone.PRWithoutMilestone; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.