From e66280b5a5f99d1f6e637d3b8499298abe1434d0 Mon Sep 17 00:00:00 2001 From: Joy Ng Jing Ru Date: Thu, 20 Jul 2023 12:28:23 +0800 Subject: [PATCH 1/8] Add merged option for filter status --- src/app/shared/filter-bar/filter-bar.component.html | 1 + src/app/shared/filter-bar/filter-bar.component.ts | 7 +++++++ src/app/shared/issue-tables/dropdownfilter.ts | 2 ++ 3 files changed, 10 insertions(+) diff --git a/src/app/shared/filter-bar/filter-bar.component.html b/src/app/shared/filter-bar/filter-bar.component.html index ea5270e3..a1db9d87 100644 --- a/src/app/shared/filter-bar/filter-bar.component.html +++ b/src/app/shared/filter-bar/filter-bar.component.html @@ -13,6 +13,7 @@ All Open Closed + Merged diff --git a/src/app/shared/filter-bar/filter-bar.component.ts b/src/app/shared/filter-bar/filter-bar.component.ts index 13d00dcd..61bd0753 100644 --- a/src/app/shared/filter-bar/filter-bar.component.ts +++ b/src/app/shared/filter-bar/filter-bar.component.ts @@ -87,6 +87,13 @@ export class FilterBarComponent implements OnInit, AfterViewInit, OnDestroy { this.views$?.value?.forEach((v) => (v.retrieveFilterable().dropdownFilter = this.dropdownFilter)); } + /** + * Checks if program is filtering by type issue. + */ + isFilterIssue() { + return this.dropdownFilter.type != 'issue'; + } + /** * Fetch and initialize all information from repository to populate Issue Dashboard. */ diff --git a/src/app/shared/issue-tables/dropdownfilter.ts b/src/app/shared/issue-tables/dropdownfilter.ts index 6ddbd96b..d1eb1d12 100644 --- a/src/app/shared/issue-tables/dropdownfilter.ts +++ b/src/app/shared/issue-tables/dropdownfilter.ts @@ -32,6 +32,8 @@ export function applyDropdownFilter(dropdownFilter: DropdownFilter): (a: Issue) } else if (dropdownFilter.status === 'closed') { // there is apparently also a status called 'all' based on github api ret = ret && issue.state === 'CLOSED'; + } else if (dropdownFilter.status === 'merged') { + ret = ret && issue.state === 'MERGED' } if (dropdownFilter.type === 'issue') { From 3ada5d9244d5c5fb980eb0717171ff51efda3400 Mon Sep 17 00:00:00 2001 From: Joy Ng Jing Ru Date: Thu, 20 Jul 2023 15:57:21 +0800 Subject: [PATCH 2/8] Use 'All' as default for status when changing type from 'All/PR' to 'Issue' and status was 'Merged' --- src/app/shared/filter-bar/filter-bar.component.html | 4 ++-- src/app/shared/filter-bar/filter-bar.component.ts | 8 +++++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/app/shared/filter-bar/filter-bar.component.html b/src/app/shared/filter-bar/filter-bar.component.html index a1db9d87..cc63ffe9 100644 --- a/src/app/shared/filter-bar/filter-bar.component.html +++ b/src/app/shared/filter-bar/filter-bar.component.html @@ -13,12 +13,12 @@ All Open Closed - Merged + Merged Type - + All Issue Pull Request diff --git a/src/app/shared/filter-bar/filter-bar.component.ts b/src/app/shared/filter-bar/filter-bar.component.ts index 61bd0753..621e2a16 100644 --- a/src/app/shared/filter-bar/filter-bar.component.ts +++ b/src/app/shared/filter-bar/filter-bar.component.ts @@ -80,6 +80,12 @@ export class FilterBarComponent implements OnInit, AfterViewInit, OnDestroy { this.views$?.value?.forEach((v) => (v.retrieveFilterable().filter = filterValue)); } + checkValidCombination() { + if (this.dropdownFilter.status === 'merged' && this.dropdownFilter.type === 'issue') { + this.dropdownFilter.status = 'all'; + } + } + /** * Signals to IssuesDataTable that a change has occurred in dropdown filter. */ @@ -90,7 +96,7 @@ export class FilterBarComponent implements OnInit, AfterViewInit, OnDestroy { /** * Checks if program is filtering by type issue. */ - isFilterIssue() { + isNotFilterIssue() { return this.dropdownFilter.type != 'issue'; } From 8e0d15a85c75f326b6ba52f502f70cf80fbe72df Mon Sep 17 00:00:00 2001 From: Joy Ng Jing Ru Date: Thu, 20 Jul 2023 16:02:40 +0800 Subject: [PATCH 3/8] Add comments --- src/app/shared/filter-bar/filter-bar.component.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/app/shared/filter-bar/filter-bar.component.ts b/src/app/shared/filter-bar/filter-bar.component.ts index 621e2a16..e0ddff50 100644 --- a/src/app/shared/filter-bar/filter-bar.component.ts +++ b/src/app/shared/filter-bar/filter-bar.component.ts @@ -80,6 +80,9 @@ export class FilterBarComponent implements OnInit, AfterViewInit, OnDestroy { this.views$?.value?.forEach((v) => (v.retrieveFilterable().filter = filterValue)); } + /** + * Changes status to a valid, default value when an incompatible combination of type and status is encountered. + */ checkValidCombination() { if (this.dropdownFilter.status === 'merged' && this.dropdownFilter.type === 'issue') { this.dropdownFilter.status = 'all'; From 363f25775daba0708fb8e5cc1d24ec6bfa323484 Mon Sep 17 00:00:00 2001 From: Joy Ng Jing Ru Date: Thu, 20 Jul 2023 16:49:18 +0800 Subject: [PATCH 4/8] Pass lint --- src/app/shared/filter-bar/filter-bar.component.ts | 2 +- src/app/shared/issue-tables/dropdownfilter.ts | 2 +- tests/app/auth/confirm-login/confirm-login.component.spec.ts | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/app/shared/filter-bar/filter-bar.component.ts b/src/app/shared/filter-bar/filter-bar.component.ts index e0ddff50..ed8691a1 100644 --- a/src/app/shared/filter-bar/filter-bar.component.ts +++ b/src/app/shared/filter-bar/filter-bar.component.ts @@ -100,7 +100,7 @@ export class FilterBarComponent implements OnInit, AfterViewInit, OnDestroy { * Checks if program is filtering by type issue. */ isNotFilterIssue() { - return this.dropdownFilter.type != 'issue'; + return this.dropdownFilter.type !== 'issue'; } /** diff --git a/src/app/shared/issue-tables/dropdownfilter.ts b/src/app/shared/issue-tables/dropdownfilter.ts index d1eb1d12..c41dc477 100644 --- a/src/app/shared/issue-tables/dropdownfilter.ts +++ b/src/app/shared/issue-tables/dropdownfilter.ts @@ -33,7 +33,7 @@ export function applyDropdownFilter(dropdownFilter: DropdownFilter): (a: Issue) // there is apparently also a status called 'all' based on github api ret = ret && issue.state === 'CLOSED'; } else if (dropdownFilter.status === 'merged') { - ret = ret && issue.state === 'MERGED' + ret = ret && issue.state === 'MERGED'; } if (dropdownFilter.type === 'issue') { diff --git a/tests/app/auth/confirm-login/confirm-login.component.spec.ts b/tests/app/auth/confirm-login/confirm-login.component.spec.ts index 5426e5d6..24cff92d 100644 --- a/tests/app/auth/confirm-login/confirm-login.component.spec.ts +++ b/tests/app/auth/confirm-login/confirm-login.component.spec.ts @@ -1,4 +1,4 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; import { Router } from '@angular/router'; import { of } from 'rxjs'; import { ConfirmLoginComponent } from '../../../../src/app/auth/confirm-login/confirm-login.component'; @@ -31,7 +31,7 @@ describe('ConfirmLoginComponent', () => { let component: ConfirmLoginComponent; let fixture: ComponentFixture; - beforeEach(async(() => { + beforeEach(waitForAsync(() => { authService = jasmine.createSpyObj('AuthService', ['changeAuthState', 'setTitleWithPhaseDetail', 'startOAuthProcess']); phaseService = jasmine.createSpyObj('PhaseService', ['initializeCurrentRepository', 'currentRepo']); logger = jasmine.createSpyObj('LoggingService', ['info']); From 963735d0b8154abe51b5918afde47f2ba75d442e Mon Sep 17 00:00:00 2001 From: Joy Ng Jing Ru Date: Sat, 22 Jul 2023 23:32:58 +0800 Subject: [PATCH 5/8] Remove unnecessary changes --- tests/app/auth/confirm-login/confirm-login.component.spec.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/app/auth/confirm-login/confirm-login.component.spec.ts b/tests/app/auth/confirm-login/confirm-login.component.spec.ts index 24cff92d..5eafc632 100644 --- a/tests/app/auth/confirm-login/confirm-login.component.spec.ts +++ b/tests/app/auth/confirm-login/confirm-login.component.spec.ts @@ -31,7 +31,7 @@ describe('ConfirmLoginComponent', () => { let component: ConfirmLoginComponent; let fixture: ComponentFixture; - beforeEach(waitForAsync(() => { + beforeEach(async(() => { authService = jasmine.createSpyObj('AuthService', ['changeAuthState', 'setTitleWithPhaseDetail', 'startOAuthProcess']); phaseService = jasmine.createSpyObj('PhaseService', ['initializeCurrentRepository', 'currentRepo']); logger = jasmine.createSpyObj('LoggingService', ['info']); From d088ccdc22f0a4374ef2669613cfaf6d30d94597 Mon Sep 17 00:00:00 2001 From: Joy Ng Jing Ru Date: Sat, 22 Jul 2023 23:33:42 +0800 Subject: [PATCH 6/8] Remove unnecessary imports --- tests/app/auth/confirm-login/confirm-login.component.spec.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/app/auth/confirm-login/confirm-login.component.spec.ts b/tests/app/auth/confirm-login/confirm-login.component.spec.ts index 5eafc632..4f57c4b3 100644 --- a/tests/app/auth/confirm-login/confirm-login.component.spec.ts +++ b/tests/app/auth/confirm-login/confirm-login.component.spec.ts @@ -1,4 +1,4 @@ -import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'; +import { ComponentFixture, TestBed } from '@angular/core/testing'; import { Router } from '@angular/router'; import { of } from 'rxjs'; import { ConfirmLoginComponent } from '../../../../src/app/auth/confirm-login/confirm-login.component'; From dc88c7937ccf0d04149eb28a00db420adcd005ef Mon Sep 17 00:00:00 2001 From: Joy Ng Jing Ru Date: Sat, 22 Jul 2023 23:34:48 +0800 Subject: [PATCH 7/8] Import necessary components --- tests/app/auth/confirm-login/confirm-login.component.spec.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/app/auth/confirm-login/confirm-login.component.spec.ts b/tests/app/auth/confirm-login/confirm-login.component.spec.ts index 4f57c4b3..5426e5d6 100644 --- a/tests/app/auth/confirm-login/confirm-login.component.spec.ts +++ b/tests/app/auth/confirm-login/confirm-login.component.spec.ts @@ -1,4 +1,4 @@ -import { ComponentFixture, TestBed } from '@angular/core/testing'; +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { Router } from '@angular/router'; import { of } from 'rxjs'; import { ConfirmLoginComponent } from '../../../../src/app/auth/confirm-login/confirm-login.component'; From 25503f29154b8e3f5d2a671a2c4b407e5f56883b Mon Sep 17 00:00:00 2001 From: Joy Ng Jing Ru Date: Mon, 24 Jul 2023 13:50:14 +0800 Subject: [PATCH 8/8] Update type to PR when status merge is selected --- src/app/shared/filter-bar/filter-bar.component.html | 4 ++-- src/app/shared/filter-bar/filter-bar.component.ts | 11 ++++++++++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/app/shared/filter-bar/filter-bar.component.html b/src/app/shared/filter-bar/filter-bar.component.html index c3737e0e..1823f473 100644 --- a/src/app/shared/filter-bar/filter-bar.component.html +++ b/src/app/shared/filter-bar/filter-bar.component.html @@ -9,7 +9,7 @@