From 6c40fa0bd74d649a0d72e9f19093270648bda0c4 Mon Sep 17 00:00:00 2001 From: Nereus Ng Wei Bin Date: Sun, 31 Mar 2024 13:58:49 +0800 Subject: [PATCH] Revert "Deploy v1.1.1 (#292)" This reverts commit 263426aef1e9895bbaf13a97f6e2a0731e01d300. --- 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, 269 insertions(+), 341 deletions(-) create mode 100644 tests/app/issues-viewer/label-filter-bar/label-filter-bar.component.spec.ts delete 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 70efb1a57..6148a7c99 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "WATcher", - "version": "1.1.1", + "version": "1.1.0", "main": "main.js", "scripts": { "ng": "ng", @@ -24,7 +24,7 @@ "husky": { "hooks": { "pre-commit": "pretty-quick --staged", - "pre-push": "npm run lint && npm run test" + "pre-push": "npm run lint" } }, "dependencies": { diff --git a/src/app/core/models/milestone.model.ts b/src/app/core/models/milestone.model.ts index 8f90e5058..b2a00e0f4 100644 --- a/src/app/core/models/milestone.model.ts +++ b/src/app/core/models/milestone.model.ts @@ -2,16 +2,18 @@ * Represents a milestone and its attributes fetched from Github. */ export class Milestone { - static DefaultMilestone: Milestone = new Milestone({ title: 'Without a milestone', state: null }); + 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 title: string; state: string; - constructor(milestone: { title: string; state: string }) { + constructor(milestone: { number: string; title: string; state: string }) { + this.number = milestone.number; this.title = milestone.title; this.state = milestone.state; } public equals(milestone: Milestone) { - return this.title === milestone.title; + return this.number === milestone.number; } } diff --git a/src/app/core/services/filters.service.ts b/src/app/core/services/filters.service.ts index c6c0af356..aa1b4352e 100644 --- a/src/app/core/services/filters.service.ts +++ b/src/app/core/services/filters.service.ts @@ -1,57 +1,39 @@ import { Injectable } from '@angular/core'; -import { Sort } from '@angular/material/sort'; import { BehaviorSubject, pipe } from 'rxjs'; - -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: [] -}; +import { DEFAULT_DROPDOWN_FILTER, DropdownFilter } from '../../shared/issue-tables/dropdownfilter'; @Injectable({ providedIn: 'root' }) + /** * Responsible for centralising filters * Filters are subscribed to and emitted from this service */ export class FiltersService { - public filter$ = new BehaviorSubject(DEFAULT_FILTER); + public dropdownFilter$ = new BehaviorSubject(DEFAULT_DROPDOWN_FILTER); private _validateFilter = pipe(this.updateStatusPairing, this.updateTypePairing); clearFilters(): void { - this.filter$.next(DEFAULT_FILTER); + this.dropdownFilter$.next(DEFAULT_DROPDOWN_FILTER); } - updateFilters(newFilters: Partial): void { - let nextDropdownFilter: Filter = { - ...this.filter$.value, + updateFilters(newFilters: Partial): void { + let nextDropdownFilter: DropdownFilter = { + ...this.dropdownFilter$.value, ...newFilters }; nextDropdownFilter = this._validateFilter(nextDropdownFilter); - this.filter$.next(nextDropdownFilter); + this.dropdownFilter$.next(nextDropdownFilter); } /** * Changes type to a valid, default value when an incompatible combination of type and status is encountered. */ - updateTypePairing(dropdownFilter: Filter): Filter { + updateTypePairing(dropdownFilter: DropdownFilter): DropdownFilter { if (dropdownFilter.status === 'merged') { dropdownFilter.type = 'pullrequest'; } @@ -61,7 +43,7 @@ export class FiltersService { /** * Changes status to a valid, default value when an incompatible combination of type and status is encountered. */ - updateStatusPairing(dropdownFilter: Filter): Filter { + updateStatusPairing(dropdownFilter: DropdownFilter): DropdownFilter { 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 8c2968a81..872080b8d 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 bad68b9cc..39d0a718a 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 @@