diff --git a/codegen.yml b/codegen.yml index 32397492..7b0b3fae 100644 --- a/codegen.yml +++ b/codegen.yml @@ -1,7 +1,7 @@ overwrite: true -schema: - - "graphql/schema/github-schema.ts" - - "graphql/schema/schema-extension.graphql" +schema: + - 'graphql/schema/github-schema.ts' + - 'graphql/schema/schema-extension.graphql' documents: - graphql/fragments/*.graphql - graphql/queries/*.graphql @@ -9,8 +9,8 @@ documents: generates: graphql/graphql-types.ts: plugins: - - "typescript" - - "typescript-operations" - - "typescript-document-nodes" - - "typescript-resolvers" - - "fragment-matcher" + - 'typescript' + - 'typescript-operations' + - 'typescript-document-nodes' + - 'typescript-resolvers' + - 'fragment-matcher' diff --git a/graphql/fragments/issue.fragment.graphql b/graphql/fragments/issue.fragment.graphql index 9095f13d..5502742e 100644 --- a/graphql/fragments/issue.fragment.graphql +++ b/graphql/fragments/issue.fragment.graphql @@ -4,6 +4,7 @@ fragment issue on Issue { title body state + stateReason createdAt updatedAt url diff --git a/graphql/schema/schema-extension.graphql b/graphql/schema/schema-extension.graphql index 632a77fb..dfd532a2 100644 --- a/graphql/schema/schema-extension.graphql +++ b/graphql/schema/schema-extension.graphql @@ -1,3 +1,3 @@ extend type Issue { isDraft: Boolean -} \ No newline at end of file +} diff --git a/package.json b/package.json index 0879ac16..624de616 100644 --- a/package.json +++ b/package.json @@ -70,7 +70,7 @@ "@graphql-codegen/typescript-document-nodes": "1.17.7", "@graphql-codegen/typescript-operations": "^1.18.4", "@graphql-codegen/typescript-resolvers": "^1.20.0", - "@octokit/graphql-schema": "^8.24.0", + "@octokit/graphql-schema": "^10.74.0", "@types/jasmine": "^3.8.2", "@types/jasminewd2": "2.0.8", "@types/node": "^14.17.6", diff --git a/src/app/auth/session-selection/session-selection.component.ts b/src/app/auth/session-selection/session-selection.component.ts index ae0e5f61..d13df5e1 100644 --- a/src/app/auth/session-selection/session-selection.component.ts +++ b/src/app/auth/session-selection/session-selection.component.ts @@ -83,7 +83,7 @@ export class SessionSelectionComponent implements OnInit { this.authService.setRepo().subscribe((res) => { this.isSettingUpSession = false; }); - } + } private initProfileForm() { this.profileForm = this.formBuilder.group({ diff --git a/src/app/core/models/github/github-graphql.issue-or-pr.ts b/src/app/core/models/github/github-graphql.issue-or-pr.ts index 3010808f..7de5cba7 100644 --- a/src/app/core/models/github/github-graphql.issue-or-pr.ts +++ b/src/app/core/models/github/github-graphql.issue-or-pr.ts @@ -14,6 +14,7 @@ export class GithubGraphqlIssueOrPr extends GithubIssue { url: String(issue.url), title: issue.title, state: issue.state, + stateReason: issue.stateReason, user: { login: issue.author.login }, diff --git a/src/app/core/models/github/github-graphql.issue.ts b/src/app/core/models/github/github-graphql.issue.ts index bb36d15a..30bb12aa 100644 --- a/src/app/core/models/github/github-graphql.issue.ts +++ b/src/app/core/models/github/github-graphql.issue.ts @@ -13,6 +13,7 @@ export class GithubGraphqlIssue extends GithubIssue { url: String(issue.url), title: issue.title, state: issue.state, + stateReason: issue.stateReason, user: { login: issue.author.login }, diff --git a/src/app/core/models/github/github-issue-filter.model.ts b/src/app/core/models/github/github-issue-filter.model.ts index 86ee8ce9..26393703 100644 --- a/src/app/core/models/github/github-issue-filter.model.ts +++ b/src/app/core/models/github/github-issue-filter.model.ts @@ -1,11 +1,13 @@ -import { IssueFilters, IssueState } from '../../../../../graphql/graphql-types'; +import { IssueFilters, IssueState, IssueStateReason } from '../../../../../graphql/graphql-types'; export type RestGithubIssueState = 'open' | 'close' | 'all'; +export type RestGithubIssueStateReason = 'completed' | 'notPlanned' | 'reopened'; export type RestGithubSortBy = 'created' | 'updated' | 'comments'; export type RestGithubSortDir = 'asc' | 'desc'; export interface RestGithubIssueFilterData { state?: RestGithubIssueState; + stateReason?: RestGithubIssueStateReason; labels?: Array; sort?: RestGithubSortBy; direction?: RestGithubSortDir; @@ -21,6 +23,7 @@ export interface RestGithubIssueFilterData { * */ export default class RestGithubIssueFilter implements RestGithubIssueFilterData { state?: RestGithubIssueState; + stateReason?: RestGithubIssueStateReason; labels?: Array; sort?: RestGithubSortBy; direction?: RestGithubSortDir; @@ -53,7 +56,12 @@ export default class RestGithubIssueFilter implements RestGithubIssueFilterData mentioned: this.mentioned, milestone: this.milestone, since: this.since, - states: [this.state === 'close' ? IssueState.Closed : IssueState.Open] + states: [this.state === 'close' ? IssueState.Closed : IssueState.Open], + stateReason: [this.stateReason === 'completed' + ? IssueStateReason.Completed + : this.stateReason === 'notPlanned' + ? IssueStateReason.NotPlanned + : IssueStateReason.Reopened] }; } } diff --git a/src/app/core/models/github/github-issue.model.ts b/src/app/core/models/github/github-issue.model.ts index 3cb48a33..2b1b4613 100644 --- a/src/app/core/models/github/github-issue.model.ts +++ b/src/app/core/models/github/github-issue.model.ts @@ -1,4 +1,4 @@ -import { IssueState } from '../../../../../graphql/graphql-types'; +import { IssueState, IssueStateReason } from '../../../../../graphql/graphql-types'; import { GithubComment } from './github-comment.model'; import { GithubLabel } from './github-label.model'; @@ -12,6 +12,7 @@ export class GithubIssue { created_at: string; labels: Array; state: IssueState; + stateReason: IssueStateReason; title: string; updated_at: string; closed_at: string; diff --git a/src/app/core/models/issue.model.ts b/src/app/core/models/issue.model.ts index 034ab0cf..19af1f01 100644 --- a/src/app/core/models/issue.model.ts +++ b/src/app/core/models/issue.model.ts @@ -19,6 +19,7 @@ export class Issue { closed_at: string; milestone: Milestone; state: string; + stateReason: string; issueOrPr: string; author: string; isDraft: boolean; @@ -84,6 +85,7 @@ export class Issue { // 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; this.author = githubIssue.user.login; // this.githubIssue = githubIssue; diff --git a/src/app/core/services/factories/factory.auth.service.ts b/src/app/core/services/factories/factory.auth.service.ts index 21476b48..aabdcada 100644 --- a/src/app/core/services/factories/factory.auth.service.ts +++ b/src/app/core/services/factories/factory.auth.service.ts @@ -41,7 +41,6 @@ export function AuthServiceFactory( // logger // ); // } - console.log(logger); return new AuthService( router, ngZone, @@ -54,5 +53,5 @@ export function AuthServiceFactory( titleService, errorHandlingService, logger - ); + ); } diff --git a/src/app/core/services/phase.service.ts b/src/app/core/services/phase.service.ts index 196aa43c..1b332673 100644 --- a/src/app/core/services/phase.service.ts +++ b/src/app/core/services/phase.service.ts @@ -61,10 +61,7 @@ export class PhaseService { public sessionData = STARTING_SESSION_DATA; // stores session data for the session - constructor( - private githubService: GithubService, - private repoUrlCacheService: RepoUrlCacheService, - public logger: LoggingService) {} + constructor(private githubService: GithubService, private repoUrlCacheService: RepoUrlCacheService, public logger: LoggingService) {} /** * Sets the current main repository and additional repos if any. diff --git a/src/app/shared/issue-pr-card/issue-pr-card-header/issue-pr-card-header.component.ts b/src/app/shared/issue-pr-card/issue-pr-card-header/issue-pr-card-header.component.ts index 7b0a8b65..9fb5c3ea 100644 --- a/src/app/shared/issue-pr-card/issue-pr-card-header/issue-pr-card-header.component.ts +++ b/src/app/shared/issue-pr-card/issue-pr-card-header/issue-pr-card-header.component.ts @@ -18,29 +18,31 @@ export class IssuePrCardHeaderComponent { getOcticon() { const type = this.issue.issueOrPr; const state = this.issue.state; + const stateReason = this.issue.stateReason; - switch (true) { - case type === 'Issue' && state === 'OPEN': { + if (type === 'Issue') { + if (state === 'OPEN') { return 'issue-opened'; + } else if (state === 'CLOSED') { + if (stateReason === 'COMPLETED') { + return 'issue-closed'; + } else if (stateReason === 'NOT_PLANNED') { + return 'issue-draft'; + } } - case type === 'Issue' && state === 'CLOSED': { - return 'issue-closed'; - } - case type === 'PullRequest' && state === 'OPEN': { + } else if (type === 'PullRequest') { + if (state === 'OPEN') { if (this.issue.isDraft) { return 'git-pull-request-draft'; } return 'git-pull-request'; - } - case type === 'PullRequest' && state === 'CLOSED': { + } else if (state === 'CLOSED') { return 'git-pull-request-closed'; - } - case type === 'PullRequest' && state === 'MERGED': { + } else if (state === 'MERGED') { return 'git-merge'; } - default: { - return 'circle'; // unknown type and state - } + } else { + return 'circle'; // unknown type and state } } @@ -53,6 +55,8 @@ export class IssuePrCardHeaderComponent { return 'green'; } else if (this.issue.issueOrPr === 'PullRequest' && this.issue.state === 'CLOSED') { return 'red'; + } else if (this.issue.issueOrPr === 'Issue' && this.issue.stateReason === 'NOT_PLANNED') { + return 'gray'; } else { return 'purple'; } diff --git a/src/app/shared/issue-pr-card/issue-pr-card.component.css b/src/app/shared/issue-pr-card/issue-pr-card.component.css index 63bba6cb..373546ae 100644 --- a/src/app/shared/issue-pr-card/issue-pr-card.component.css +++ b/src/app/shared/issue-pr-card/issue-pr-card.component.css @@ -23,6 +23,10 @@ border-left: 2.4px solid red; } +.border-gray { + border-left: 2.4px solid gray; +} + .mat-card-content { display: flex; align-items: center; diff --git a/src/app/shared/issue-pr-card/issue-pr-card.component.ts b/src/app/shared/issue-pr-card/issue-pr-card.component.ts index afdfc226..0d2164cd 100644 --- a/src/app/shared/issue-pr-card/issue-pr-card.component.ts +++ b/src/app/shared/issue-pr-card/issue-pr-card.component.ts @@ -31,6 +31,8 @@ export class IssuePrCardComponent { return 'border-green'; } else if (this.issue.issueOrPr === 'PullRequest' && this.issue.state === 'CLOSED') { return 'border-red'; + } else if (this.issue.issueOrPr === 'Issue' && this.issue.stateReason === 'NOT_PLANNED') { + return 'border-gray'; } else { return 'border-purple'; } diff --git a/src/app/shared/layout/header.component.html b/src/app/shared/layout/header.component.html index 85de623f..83c7a33e 100644 --- a/src/app/shared/layout/header.component.html +++ b/src/app/shared/layout/header.component.html @@ -39,9 +39,13 @@
- {{ this.currentRepo || "No Repository Set"}} + {{ this.currentRepo || 'No Repository Set' }} -
@@ -56,7 +60,7 @@