Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix oction displayed for draft pr #199

Merged
merged 7 commits into from
Sep 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion codegen.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
overwrite: true
schema: "graphql/schema/github-schema.ts"
schema:
- "graphql/schema/github-schema.ts"
- "graphql/schema/schema-extension.graphql"
documents:
- graphql/fragments/*.graphql
- graphql/queries/*.graphql
Expand Down
1 change: 1 addition & 0 deletions graphql/fragments/issue-model.fragment.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,5 @@ fragment issueModel on Issue {
}
}
}
isDraft
}
1 change: 1 addition & 0 deletions graphql/queries/fetch-pullrequests.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ query FetchPullRequests($owner: String!, $name: String!, $cursor: String) {
cursor
node {
...pullrequest
isDraft
labels(first: 100) {
edges {
node {
Expand Down
3 changes: 3 additions & 0 deletions graphql/schema/schema-extension.graphql
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
extend type Issue {
isDraft: Boolean
}
3 changes: 2 additions & 1 deletion src/app/core/models/github/github-graphql.issue-or-pr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ export class GithubGraphqlIssueOrPr extends GithubIssue {
},
assignees: flattenEdges(issue.assignees.edges),
labels: flattenEdges(issue.labels.edges),
milestone: issue.milestone ? issue.milestone : null
milestone: issue.milestone ? issue.milestone : null,
isDraft: issue.isDraft
});
}
}
1 change: 1 addition & 0 deletions src/app/core/models/github/github-issue.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export class GithubIssue {
};
comments?: Array<GithubComment>;
issueOrPr?: string;
isDraft: boolean;

constructor(githubIssue: {}) {
Object.assign(this, githubIssue);
Expand Down
2 changes: 2 additions & 0 deletions src/app/core/models/issue.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export class Issue {
state: string;
issueOrPr: string;
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 */
assignees?: string[];
Expand Down Expand Up @@ -86,6 +87,7 @@ export class Issue {
this.issueOrPr = githubIssue.issueOrPr;
this.author = githubIssue.user.login;
// this.githubIssue = githubIssue;
this.isDraft = githubIssue.isDraft;

this.assignees = githubIssue.assignees.map((assignee) => assignee.login);
this.githubLabels = githubIssue.labels;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ export class IssuePrCardHeaderComponent {
return 'issue-closed';
}
case type === 'PullRequest' && state === 'OPEN': {
if (this.issue.isDraft) {
return 'git-pull-request-draft';
}
return 'git-pull-request';
}
case type === 'PullRequest' && state === 'CLOSED': {
Expand All @@ -43,6 +46,9 @@ export class IssuePrCardHeaderComponent {

/** Returns status color for issue */
getIssueOpenOrCloseColor() {
if (this.issue.isDraft) {
return 'grey';
}
if (this.issue.state === 'OPEN') {
return 'green';
} else if (this.issue.issueOrPr === 'PullRequest' && this.issue.state === 'CLOSED') {
Expand Down
3 changes: 3 additions & 0 deletions src/app/shared/issue-pr-card/issue-pr-card.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ export class IssuePrCardComponent {

/** Returns CSS class for border color */
getIssueOpenOrCloseColorCSSClass() {
if (this.issue.isDraft) {
return 'grey';
}
if (this.issue.state === 'OPEN') {
return 'border-green';
} else if (this.issue.issueOrPr === 'PullRequest' && this.issue.state === 'CLOSED') {
Expand Down
Loading