diff --git a/src/app/issues-viewer/card-view/card-view.component.ts b/src/app/issues-viewer/card-view/card-view.component.ts index a66a2a7e..b4fb9151 100644 --- a/src/app/issues-viewer/card-view/card-view.component.ts +++ b/src/app/issues-viewer/card-view/card-view.component.ts @@ -17,6 +17,7 @@ import { Issue } from '../../core/models/issue.model'; import { FiltersService } from '../../core/services/filters.service'; import { GroupBy, GroupingContextService } from '../../core/services/grouping/grouping-context.service'; import { IssueService } from '../../core/services/issue.service'; +import { MilestoneService } from '../../core/services/milestone.service'; import { FilterableComponent, FilterableSource } from '../../shared/issue-tables/filterableTypes'; import { IssuesDataTable } from '../../shared/issue-tables/IssuesDataTable'; @@ -57,7 +58,8 @@ export class CardViewComponent implements OnInit, AfterViewInit, OnDestroy, Filt public element: ElementRef, public issueService: IssueService, public groupingContextService: GroupingContextService, - private filtersService: FiltersService + private filtersService: FiltersService, + private milestoneService: MilestoneService ) {} ngOnInit() { @@ -65,6 +67,7 @@ export class CardViewComponent implements OnInit, AfterViewInit, OnDestroy, Filt this.issueService, this.groupingContextService, this.filtersService, + this.milestoneService, this.paginator, this.headers, this.group, diff --git a/src/app/shared/issue-tables/IssuesDataTable.ts b/src/app/shared/issue-tables/IssuesDataTable.ts index f40f3165..438b1952 100644 --- a/src/app/shared/issue-tables/IssuesDataTable.ts +++ b/src/app/shared/issue-tables/IssuesDataTable.ts @@ -7,6 +7,7 @@ import { Issue } from '../../core/models/issue.model'; import { Filter, FiltersService } from '../../core/services/filters.service'; import { GroupingContextService } from '../../core/services/grouping/grouping-context.service'; import { IssueService } from '../../core/services/issue.service'; +import { MilestoneService } from '../../core/services/milestone.service'; import { applyDropdownFilter } from './dropdownfilter'; import { FilterableSource } from './filterableTypes'; import { paginateData } from './issue-paginator'; @@ -25,6 +26,7 @@ export class IssuesDataTable extends DataSource implements FilterableSour private issueService: IssueService, private groupingContextService: GroupingContextService, private filtersService: FiltersService, + private milestoneService: MilestoneService, private paginator: MatPaginator, private displayedColumn: string[], private group?: Group, @@ -67,7 +69,7 @@ export class IssuesDataTable extends DataSource implements FilterableSour data = this.groupingContextService.getDataForGroup(data, this.group); // Apply Filters - data = applyDropdownFilter(this.filter, data); + data = applyDropdownFilter(this.filter, data, !this.milestoneService.hasNoMilestones); data = applySearchFilter(this.filter.title, this.displayedColumn, this.issueService, data); this.count = data.length; diff --git a/src/app/shared/issue-tables/dropdownfilter.ts b/src/app/shared/issue-tables/dropdownfilter.ts index abe9322a..13f08127 100644 --- a/src/app/shared/issue-tables/dropdownfilter.ts +++ b/src/app/shared/issue-tables/dropdownfilter.ts @@ -20,7 +20,7 @@ const infoFromStatus = (statusString: string): StatusInfo => { * This module exports a single function applyDropDownFilter which is called by IssueList. * This functions returns the data passed in after all the filters of dropdownFilters are applied */ -export function applyDropdownFilter(filter: Filter, data: Issue[]): Issue[] { +export function applyDropdownFilter(filter: Filter, data: Issue[], isFilteringByMilestone: boolean): Issue[] { const filteredData: Issue[] = data.filter((issue) => { let ret = true; @@ -38,7 +38,7 @@ export function applyDropdownFilter(filter: Filter, data: Issue[]): Issue[] { ret = ret && issue.issueOrPr === 'PullRequest'; } - ret = ret && filter.milestones.some((milestone) => issue.milestone.title === milestone); + ret = ret && (!isFilteringByMilestone || filter.milestones.some((milestone) => issue.milestone.title === milestone)); ret = ret && issue.labels.every((label) => !filter.deselectedLabels.has(label)); return ret && filter.labels.every((label) => issue.labels.includes(label)); });