From 0e8365d2ca6e2aca5d7651c170031f7cc61b5307 Mon Sep 17 00:00:00 2001 From: Bram Hagens Date: Mon, 29 Jan 2024 15:50:30 +0100 Subject: [PATCH] show correct pr icon in ContextPopups --- web_src/js/components/ContextPopup.vue | 16 ++++++++++++---- web_src/js/svg.js | 2 ++ 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/web_src/js/components/ContextPopup.vue b/web_src/js/components/ContextPopup.vue index 303e6d0c8912c..87cdb060ecfcb 100644 --- a/web_src/js/components/ContextPopup.vue +++ b/web_src/js/components/ContextPopup.vue @@ -30,6 +30,9 @@ export default { icon() { if (this.issue.pull_request !== null) { if (this.issue.state === 'open') { + if (this.issue.pull_request.draft === true) { + return 'octicon-git-pull-request-draft'; // Draft PR + } return 'octicon-git-pull-request'; // Open PR } else if (this.issue.pull_request.merged === true) { return 'octicon-git-merge'; // Merged PR @@ -42,12 +45,17 @@ export default { }, color() { + if (this.issue.pull_request !== null) { + if (this.issue.pull_request.draft === true) { + return 'grey'; // Draft PR + } else if (this.issue.pull_request.merged === true) { + return 'purple'; // Merged PR + } + } if (this.issue.state === 'open') { - return 'green'; - } else if (this.issue.pull_request !== null && this.issue.pull_request.merged === true) { - return 'purple'; + return 'green'; // Open Issue } - return 'red'; + return 'red'; // Closed Issue }, labels() { diff --git a/web_src/js/svg.js b/web_src/js/svg.js index c2a96fba3f040..084256587c518 100644 --- a/web_src/js/svg.js +++ b/web_src/js/svg.js @@ -33,6 +33,7 @@ import octiconGitBranch from '../../public/assets/img/svg/octicon-git-branch.svg import octiconGitCommit from '../../public/assets/img/svg/octicon-git-commit.svg'; import octiconGitMerge from '../../public/assets/img/svg/octicon-git-merge.svg'; import octiconGitPullRequest from '../../public/assets/img/svg/octicon-git-pull-request.svg'; +import octiconGitPullRequestDraft from '../../public/assets/img/svg/octicon-git-pull-request-draft.svg'; import octiconHeading from '../../public/assets/img/svg/octicon-heading.svg'; import octiconHorizontalRule from '../../public/assets/img/svg/octicon-horizontal-rule.svg'; import octiconImage from '../../public/assets/img/svg/octicon-image.svg'; @@ -104,6 +105,7 @@ const svgs = { 'octicon-git-commit': octiconGitCommit, 'octicon-git-merge': octiconGitMerge, 'octicon-git-pull-request': octiconGitPullRequest, + 'octicon-git-pull-request-draft': octiconGitPullRequestDraft, 'octicon-heading': octiconHeading, 'octicon-horizontal-rule': octiconHorizontalRule, 'octicon-image': octiconImage,