diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-11-03 00:09:10 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-11-03 00:09:10 +0300 |
commit | a97f1426db3f521d2fcf699fa106a2ca4eddb801 (patch) | |
tree | 01ab04f8cd044e46998602cabe5bc77285bad782 /app/assets/javascripts/releases | |
parent | 77cf68da37567a0432108d6755b6c7578e5b7dc8 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets/javascripts/releases')
-rw-r--r-- | app/assets/javascripts/releases/components/issuable_stats.vue | 4 | ||||
-rw-r--r-- | app/assets/javascripts/releases/components/release_block_milestone_info.vue | 76 |
2 files changed, 66 insertions, 14 deletions
diff --git a/app/assets/javascripts/releases/components/issuable_stats.vue b/app/assets/javascripts/releases/components/issuable_stats.vue index 5f28331c543..0ae0e5c6d6a 100644 --- a/app/assets/javascripts/releases/components/issuable_stats.vue +++ b/app/assets/javascripts/releases/components/issuable_stats.vue @@ -54,9 +54,7 @@ export default { </script> <template> - <div - class="gl-display-flex gl-flex-direction-column gl-flex-shrink-0 gl-mr-6 gl-mb-5 js-issues-container" - > + <div class="gl-display-flex gl-flex-direction-column gl-flex-shrink-0 gl-mr-6 gl-mb-5"> <span class="gl-mb-2"> {{ label }} <gl-badge variant="muted" size="sm">{{ total }}</gl-badge> diff --git a/app/assets/javascripts/releases/components/release_block_milestone_info.vue b/app/assets/javascripts/releases/components/release_block_milestone_info.vue index 30598a5eec1..152f400f624 100644 --- a/app/assets/javascripts/releases/components/release_block_milestone_info.vue +++ b/app/assets/javascripts/releases/components/release_block_milestone_info.vue @@ -1,6 +1,5 @@ <script> import { GlProgressBar, GlLink, GlButton, GlTooltipDirective } from '@gitlab/ui'; -import { sum } from 'lodash'; import { __, n__, sprintf } from '~/locale'; import { MAX_MILESTONES_TO_DISPLAY } from '../constants'; import IssuableStats from './issuable_stats.vue'; @@ -31,6 +30,21 @@ export default { required: false, default: '', }, + openMergeRequestsPath: { + type: String, + required: false, + default: '', + }, + mergedMergeRequestsPath: { + type: String, + required: false, + default: '', + }, + closedMergeRequestsPath: { + type: String, + required: false, + default: '', + }, }, data() { return { @@ -45,17 +59,45 @@ export default { }); }, percentComplete() { - const percent = Math.round((this.closedIssuesCount / this.totalIssuesCount) * 100); + const percent = Math.round((this.issueCounts.closed / this.issueCounts.total) * 100); return Number.isNaN(percent) ? 0 : percent; }, - allIssueStats() { - return this.milestones.map(m => m.issueStats || {}); + issueCounts() { + return this.milestones + .map(m => m.issueStats || {}) + .reduce( + (acc, current) => { + acc.total += current.total || 0; + acc.closed += current.closed || 0; + + return acc; + }, + { + total: 0, + closed: 0, + }, + ); }, - totalIssuesCount() { - return sum(this.allIssueStats.map(stats => stats.total || 0)); + showMergeRequestStats() { + return this.milestones.some(m => m.mrStats); }, - closedIssuesCount() { - return sum(this.allIssueStats.map(stats => stats.closed || 0)); + mergeRequestCounts() { + return this.milestones + .map(m => m.mrStats || {}) + .reduce( + (acc, current) => { + acc.total += current.total || 0; + acc.merged += current.merged || 0; + acc.closed += current.closed || 0; + + return acc; + }, + { + total: 0, + merged: 0, + closed: 0, + }, + ); }, milestoneLabelText() { return n__('Milestone', 'Milestones', this.milestones.length); @@ -98,7 +140,7 @@ export default { > <span class="gl-mb-3">{{ percentCompleteText }}</span> <span class="gl-w-full"> - <gl-progress-bar :value="closedIssuesCount" :max="totalIssuesCount" variant="success" /> + <gl-progress-bar :value="issueCounts.closed" :max="issueCounts.total" variant="success" /> </span> </div> <div @@ -129,10 +171,22 @@ export default { </div> <issuable-stats :label="__('Issues')" - :total="totalIssuesCount" - :closed="closedIssuesCount" + :total="issueCounts.total" + :closed="issueCounts.closed" :open-path="openIssuesPath" :closed-path="closedIssuesPath" + data-testid="issue-stats" + /> + <issuable-stats + v-if="showMergeRequestStats" + :label="__('Merge Requests')" + :total="mergeRequestCounts.total" + :merged="mergeRequestCounts.merged" + :closed="mergeRequestCounts.closed" + :open-path="openMergeRequestsPath" + :merged-path="mergedMergeRequestsPath" + :closed-path="closedMergeRequestsPath" + data-testid="merge-request-stats" /> </div> </template> |