Skip to content

Commit

Permalink
Deploy V1.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
NereusWB922 authored Mar 31, 2024
2 parents 263426a + 390e84e commit 4549bdf
Show file tree
Hide file tree
Showing 60 changed files with 1,543 additions and 485 deletions.
19 changes: 19 additions & 0 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name-template: 'v$RESOLVED_VERSION'
tag-template: 'v$RESOLVED_VERSION'
categories:
- title: 'Features'
labels:
- 'category.Feature'
- 'category.Enhancement'
- title: 'Bug Fixes'
labels:
- 'category.Bug'
- title: 'Maintenance'
label: 'category.Chore'
change-template: '- $TITLE @$AUTHOR (#$NUMBER)'
change-title-escapes: '\<*_&' # You can add # and @ to disable mentions, and add ` to disable code blocks.

template: |
## Changelog
$CHANGES
3 changes: 3 additions & 0 deletions .github/workflows/github-actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ jobs:
- run: npm update
- run: npm run lint
- run: npm run build:prod:web
- run: npm run test
# - run: npm test -- "--karma-config=./tests/karma.ci.conf.js"
# - run: npm run webdriver-manager update -- --gecko false --standalone false --versions.chrome $(curl https://chromedriver.storage.googleapis.com/LATEST_RELEASE_$(google-chrome --version | grep -iEo "[0-9]{1,3}" | head -n1))
# - run: npm run webdriver-manager update -- --chrome false --standalone false
Expand All @@ -45,6 +46,7 @@ jobs:
- run: npm install
- run: npm update
- run: npm run lint
- run: npm run test
# - run: npm test -- "--karma-config=./tests/karma.ci.conf.js" || npm test -- "--karma-config=./tests/karma.ci.conf.js"
# retry tests once, in case they timed out on Mac OS
windows-setup-and-tests:
Expand All @@ -61,4 +63,5 @@ jobs:
- run: npm install
- run: npm update
- run: npm run lint
- run: npm run test
# - run: npm test -- "--karma-config=./tests/karma.ci.conf.js"
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "WATcher",
"version": "1.1.1",
"version": "1.2.0",
"main": "main.js",
"scripts": {
"ng": "ng",
Expand Down
6 changes: 3 additions & 3 deletions src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ import { GithubEventService } from './core/services/githubevent.service';
import { IssueService } from './core/services/issue.service';
import { LabelService } from './core/services/label.service';
import { LoggingService } from './core/services/logging.service';
import { PhaseService } from './core/services/phase.service';
import { RepoSessionStorageService } from './core/services/repo-session-storage.service';
import { UserService } from './core/services/user.service';
import { ViewService } from './core/services/view.service';
import { IssuesViewerModule } from './issues-viewer/issues-viewer.module';
import { LabelDefinitionPopupComponent } from './shared/label-definition-popup/label-definition-popup.component';
import { HeaderComponent } from './shared/layout';
Expand Down Expand Up @@ -64,7 +64,7 @@ import { SharedModule } from './shared/shared.module';
UserService,
IssueService,
LabelService,
PhaseService,
ViewService,
GithubEventService,
Title,
ErrorHandlingService,
Expand All @@ -74,7 +74,7 @@ import { SharedModule } from './shared/shared.module';
{
provide: IssueService,
useFactory: IssueServiceFactory,
deps: [GithubService, UserService, PhaseService]
deps: [GithubService, UserService, ViewService]
},
{
provide: ErrorHandler,
Expand Down
8 changes: 4 additions & 4 deletions src/app/auth/auth.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import { AuthService, AuthState } from '../core/services/auth.service';
import { ErrorHandlingService } from '../core/services/error-handling.service';
import { ErrorMessageService } from '../core/services/error-message.service';
import { LoggingService } from '../core/services/logging.service';
import { PhaseService } from '../core/services/phase.service';
import { UserService } from '../core/services/user.service';
import { ViewService } from '../core/services/view.service';

@Component({
selector: 'app-auth',
Expand All @@ -33,7 +33,7 @@ export class AuthComponent implements OnInit, OnDestroy {
private userService: UserService,
private errorHandlingService: ErrorHandlingService,
private router: Router,
private phaseService: PhaseService,
private viewService: ViewService,
private ngZone: NgZone,
private activatedRoute: ActivatedRoute,
private logger: LoggingService
Expand All @@ -46,7 +46,7 @@ export class AuthComponent implements OnInit, OnDestroy {
const state = this.activatedRoute.snapshot.queryParamMap.get('state');

if (this.authService.isAuthenticated()) {
this.router.navigate([this.phaseService.currentPhase]);
this.router.navigate([this.viewService.currentView]);
return;
}
this.initAccessTokenSubscription();
Expand Down Expand Up @@ -141,7 +141,7 @@ export class AuthComponent implements OnInit, OnDestroy {
}

isRepoSet(): boolean {
return this.phaseService.isRepoSet();
return this.viewService.isRepoSet();
}

get currentSessionOrg(): string {
Expand Down
49 changes: 48 additions & 1 deletion src/app/core/models/github-user.model.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
export interface GithubUser {
import { Group } from './github/group.interface';

/**
* Represents raw data returned from the GitHub API about a user.
*/
export interface RawGithubUser {
avatar_url: string;
created_at: string;
html_url: string;
Expand All @@ -11,3 +16,45 @@ export interface GithubUser {
updated_at: string;
url: string;
}

/**
* Represents a GitHub user in WATcher
*/
export class GithubUser implements RawGithubUser, Group {
static NO_ASSIGNEE: GithubUser = new GithubUser({
avatar_url: '',
created_at: '',
html_url: '',
login: 'Unassigned',
name: '',
node_id: '',
two_factor_authentication: false,
site_admin: false,
type: '',
updated_at: '',
url: ''
});

avatar_url: string;
created_at: string;
html_url: string;
login: string;
name: string;
node_id: string;
two_factor_authentication: boolean;
site_admin: false;
type: string;
updated_at: string;
url: string;

constructor(rawData: RawGithubUser) {
Object.assign(this, rawData);
}

equals(other: any) {
if (!(other instanceof GithubUser)) {
return false;
}
return this.login === other.login;
}
}
8 changes: 8 additions & 0 deletions src/app/core/models/github/group.interface.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/**
* Represents a group used for grouping purposes.
* Groups can be used to organize issues/prs based on certain criteria,
* such as milestones, assignees, or other properties.
*/
export interface Group {
equals(other: any): boolean;
}
9 changes: 6 additions & 3 deletions src/app/core/models/issue.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export class Issue {
author: string;
isDraft: boolean;

/** Depending on the phase, assignees attribute can be derived from Github's assignee feature OR from the Github's issue description */
/** Depending on the view, assignees attribute can be derived from Github's assignee feature OR from the Github's issue description */
assignees?: string[];
labels?: string[];
githubLabels?: GithubLabel[];
Expand Down Expand Up @@ -82,8 +82,6 @@ export class Issue {
this.title = githubIssue.title;
this.hiddenDataInDescription = new HiddenData(githubIssue.body);
this.description = Issue.updateDescription(this.hiddenDataInDescription.originalStringWithoutHiddenData);
// githubIssue without milestone will be set to default milestone
this.milestone = githubIssue.milestone ? new Milestone(githubIssue.milestone) : Milestone.DefaultMilestone;
this.state = githubIssue.state;
this.stateReason = githubIssue.stateReason;
this.issueOrPr = githubIssue.issueOrPr;
Expand All @@ -94,6 +92,11 @@ export class Issue {
this.assignees = githubIssue.assignees.map((assignee) => assignee.login);
this.githubLabels = githubIssue.labels;
this.labels = githubIssue.labels.map((label) => label.name);
this.milestone = githubIssue.milestone
? new Milestone(githubIssue.milestone)
: this.issueOrPr === 'Issue'
? Milestone.IssueWithoutMilestone
: Milestone.PRWithoutMilestone;
}

public static createPhaseBugReportingIssue(githubIssue: GithubIssue): Issue {
Expand Down
18 changes: 13 additions & 5 deletions src/app/core/models/milestone.model.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,25 @@
import { Group } from './github/group.interface';

/**
* Represents a milestone and its attributes fetched from Github.
*/
export class Milestone {
static DefaultMilestone: Milestone = new Milestone({ title: 'Without a milestone', state: null });
export class Milestone implements Group {
static IssueWithoutMilestone: Milestone = new Milestone({ title: 'Issue without a milestone', state: null });
static PRWithoutMilestone: Milestone = new Milestone({ title: 'PR without a milestone', state: null });
title: string;
state: string;
deadline?: Date;

constructor(milestone: { title: string; state: string }) {
constructor(milestone: { title: string; state: string; due_on?: string }) {
this.title = milestone.title;
this.state = milestone.state;
this.deadline = milestone.due_on ? new Date(milestone.due_on) : undefined;
}

public equals(milestone: Milestone) {
return this.title === milestone.title;
public equals(other: any) {
if (!(other instanceof Milestone)) {
return false;
}
return this.title === other.title;
}
}
8 changes: 0 additions & 8 deletions src/app/core/models/phase.model.ts

This file was deleted.

7 changes: 7 additions & 0 deletions src/app/core/models/repo-change-response.model.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/**
* Represents the response of the repo-change-form component
*/
export type RepoChangeResponse = {
repo: string;
keepFilters: boolean;
};
26 changes: 13 additions & 13 deletions src/app/core/models/session.model.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { pipe } from 'rxjs';
import { throwIfFalse } from '../../shared/lib/custom-ops';
import { Phase } from './phase.model';
import { Repo } from './repo.model';
import { View } from './view.model';

/**
* Session repository comprises the phase and its corresponding repository array.
* Session repository comprises the view and its corresponding repository array.
*/
export interface SessionRepo {
phase: Phase;
view: View;
repos: Repo[];
}

Expand All @@ -20,8 +20,8 @@ export interface SessionData {

export const SESSION_DATA_UNAVAILABLE = 'Session data does not exist.';
export const SESSION_DATA_MISSING_FIELDS = 'Session data does not contain any repositories.';
export const NO_VALID_OPEN_PHASES = 'Invalid phases in Session data.';
export const OPENED_PHASE_REPO_UNDEFINED = 'Phase has no repo defined.';
export const NO_VALID_OPEN_VIEWS = 'Invalid views in Session data.';
export const OPENED_VIEW_REPO_UNDEFINED = 'View has no repo defined.';

export function assertSessionDataIntegrity() {
return pipe(
Expand All @@ -30,8 +30,8 @@ export function assertSessionDataIntegrity() {
() => new Error(SESSION_DATA_UNAVAILABLE)
),
throwIfFalse(hasSessionRepo, () => new Error(SESSION_DATA_MISSING_FIELDS)),
throwIfFalse(arePhasesValid, () => new Error(NO_VALID_OPEN_PHASES)),
throwIfFalse(areReposDefined, () => new Error(OPENED_PHASE_REPO_UNDEFINED))
throwIfFalse(areViewsValid, () => new Error(NO_VALID_OPEN_VIEWS)),
throwIfFalse(areReposDefined, () => new Error(OPENED_VIEW_REPO_UNDEFINED))
);
}

Expand All @@ -44,24 +44,24 @@ function hasSessionRepo(sessionData: SessionData): boolean {
}

/**
* Checks if Phases belong to a pre-defined Phase.
* Checks if Views belong to a pre-defined View.
* @param sessionData
*/
function arePhasesValid(sessionData: SessionData): boolean {
function areViewsValid(sessionData: SessionData): boolean {
return sessionData.sessionRepo.reduce(
(isPhaseValidSoFar: boolean, currentPhaseRepo: SessionRepo) => isPhaseValidSoFar && currentPhaseRepo.phase in Phase,
(isViewValidSoFar: boolean, currentViewRepo: SessionRepo) => isViewValidSoFar && currentViewRepo.view in View,
true
);
}

/**
* Checks if each Phase has an associated repo defined as well.
* Checks if each View has an associated repo defined as well.
* @param sessionData
*/
function areReposDefined(sessionData: SessionData): boolean {
return sessionData.sessionRepo.reduce(
(isPhaseRepoDefinedSoFar: boolean, currentPhaseRepo: SessionRepo) =>
isPhaseRepoDefinedSoFar && !!currentPhaseRepo.repos && Array.isArray(currentPhaseRepo.repos) && currentPhaseRepo.repos.length > 0,
(isViewRepoDefinedSoFar: boolean, currentViewRepo: SessionRepo) =>
isViewRepoDefinedSoFar && !!currentViewRepo.repos && Array.isArray(currentViewRepo.repos) && currentViewRepo.repos.length > 0,
true
);
}
4 changes: 4 additions & 0 deletions src/app/core/models/view.model.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export enum View {
issuesViewer = 'issuesViewer',
activityDashboard = 'activityDashboard'
}
Loading

0 comments on commit 4549bdf

Please sign in to comment.