From 263426aef1e9895bbaf13a97f6e2a0731e01d300 Mon Sep 17 00:00:00 2001 From: Gabriel Goh <77230723+gycgabriel@users.noreply.github.com> Date: Thu, 14 Mar 2024 14:29:40 +0800 Subject: [PATCH] Deploy v1.1.1 (#292) Co-authored-by: Arif Khalid <88131400+Arif-Khalid@users.noreply.github.com> Co-authored-by: NereusWB922 <107099783+NereusWB922@users.noreply.github.com> Co-authored-by: AdityaMisra <114080910+MadLamprey@users.noreply.github.com> Co-authored-by: Misra Aditya Co-authored-by: Vignesh Sankar Iyer <68676914+vigneshsankariyer1234567890@users.noreply.github.com> --- package.json | 4 +- src/app/core/models/milestone.model.ts | 8 +- src/app/core/services/filters.service.ts | 38 +++-- .../card-view/card-view.component.html | 2 +- .../filter-bar/filter-bar.component.html | 12 +- .../shared/filter-bar/filter-bar.component.ts | 27 ++-- .../issue-pr-card.component.html | 2 +- .../issue-pr-card/issue-pr-card.component.ts | 4 +- .../shared/issue-tables/IssuesDataTable.ts | 33 ++--- src/app/shared/issue-tables/dropdownfilter.ts | 35 ++--- .../shared/issue-tables/filterableTypes.ts | 7 +- src/app/shared/issue-tables/issue-sorter.ts | 22 ++- src/test.ts | 5 +- .../label-filter-bar.component.spec.ts | 56 ------- .../label-filter-bar.component.spec.ts | 140 ++++++++++++++++++ .../shared/issue-tables/issue-sorter.spec.ts | 29 ++-- tests/constants/label.constants.ts | 15 +- tests/services/phase.service.spec.ts | 98 ++++++++---- tests/services/user.service.spec.ts | 73 +++------ 19 files changed, 341 insertions(+), 269 deletions(-) delete mode 100644 tests/app/issues-viewer/label-filter-bar/label-filter-bar.component.spec.ts create mode 100644 tests/app/shared/filter-bar/label-filter-bar/label-filter-bar.component.spec.ts diff --git a/package.json b/package.json index 6148a7c99..70efb1a57 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "WATcher", - "version": "1.1.0", + "version": "1.1.1", "main": "main.js", "scripts": { "ng": "ng", @@ -24,7 +24,7 @@ "husky": { "hooks": { "pre-commit": "pretty-quick --staged", - "pre-push": "npm run lint" + "pre-push": "npm run lint && npm run test" } }, "dependencies": { diff --git a/src/app/core/models/milestone.model.ts b/src/app/core/models/milestone.model.ts index b2a00e0f4..8f90e5058 100644 --- a/src/app/core/models/milestone.model.ts +++ b/src/app/core/models/milestone.model.ts @@ -2,18 +2,16 @@ * Represents a milestone and its attributes fetched from Github. */ export class Milestone { - static DefaultMilestone: Milestone = new Milestone({ number: 'untracked', title: 'Without a milestone', state: null }); - readonly number: string; // equivalent to the id of an issue e.g. milestone #1 + static DefaultMilestone: Milestone = new Milestone({ title: 'Without a milestone', state: null }); title: string; state: string; - constructor(milestone: { number: string; title: string; state: string }) { - this.number = milestone.number; + constructor(milestone: { title: string; state: string }) { this.title = milestone.title; this.state = milestone.state; } public equals(milestone: Milestone) { - return this.number === milestone.number; + return this.title === milestone.title; } } diff --git a/src/app/core/services/filters.service.ts b/src/app/core/services/filters.service.ts index aa1b4352e..c6c0af356 100644 --- a/src/app/core/services/filters.service.ts +++ b/src/app/core/services/filters.service.ts @@ -1,39 +1,57 @@ import { Injectable } from '@angular/core'; +import { Sort } from '@angular/material/sort'; import { BehaviorSubject, pipe } from 'rxjs'; -import { DEFAULT_DROPDOWN_FILTER, DropdownFilter } from '../../shared/issue-tables/dropdownfilter'; + +export type Filter = { + title: string; + status: string; + type: string; + sort: Sort; + labels: string[]; + milestones: string[]; + hiddenLabels?: Set; +}; + +export const DEFAULT_FILTER: Filter = { + title: '', + status: 'all', + type: 'all', + sort: { active: 'id', direction: 'asc' }, + labels: [], + milestones: [] +}; @Injectable({ providedIn: 'root' }) - /** * Responsible for centralising filters * Filters are subscribed to and emitted from this service */ export class FiltersService { - public dropdownFilter$ = new BehaviorSubject(DEFAULT_DROPDOWN_FILTER); + public filter$ = new BehaviorSubject(DEFAULT_FILTER); private _validateFilter = pipe(this.updateStatusPairing, this.updateTypePairing); clearFilters(): void { - this.dropdownFilter$.next(DEFAULT_DROPDOWN_FILTER); + this.filter$.next(DEFAULT_FILTER); } - updateFilters(newFilters: Partial): void { - let nextDropdownFilter: DropdownFilter = { - ...this.dropdownFilter$.value, + updateFilters(newFilters: Partial): void { + let nextDropdownFilter: Filter = { + ...this.filter$.value, ...newFilters }; nextDropdownFilter = this._validateFilter(nextDropdownFilter); - this.dropdownFilter$.next(nextDropdownFilter); + this.filter$.next(nextDropdownFilter); } /** * Changes type to a valid, default value when an incompatible combination of type and status is encountered. */ - updateTypePairing(dropdownFilter: DropdownFilter): DropdownFilter { + updateTypePairing(dropdownFilter: Filter): Filter { if (dropdownFilter.status === 'merged') { dropdownFilter.type = 'pullrequest'; } @@ -43,7 +61,7 @@ export class FiltersService { /** * Changes status to a valid, default value when an incompatible combination of type and status is encountered. */ - updateStatusPairing(dropdownFilter: DropdownFilter): DropdownFilter { + updateStatusPairing(dropdownFilter: Filter): Filter { if (dropdownFilter.status === 'merged' && dropdownFilter.type === 'issue') { dropdownFilter.status = 'all'; } diff --git a/src/app/issues-viewer/card-view/card-view.component.html b/src/app/issues-viewer/card-view/card-view.component.html index 872080b8d..8c2968a81 100644 --- a/src/app/issues-viewer/card-view/card-view.component.html +++ b/src/app/issues-viewer/card-view/card-view.component.html @@ -21,7 +21,7 @@
- +
diff --git a/src/app/shared/filter-bar/filter-bar.component.html b/src/app/shared/filter-bar/filter-bar.component.html index 39d0a718a..bad68b9cc 100644 --- a/src/app/shared/filter-bar/filter-bar.component.html +++ b/src/app/shared/filter-bar/filter-bar.component.html @@ -1,7 +1,7 @@ - + @@ -9,7 +9,7 @@