Add latest changes from gitlab-org/gitlab@master

This commit is contained in:
GitLab Bot 2021-07-13 06:10:10 +00:00
parent 5dd05f8e99
commit 63d4054f26
9 changed files with 128 additions and 48 deletions

View File

@ -1 +1 @@
a8d42fb628ab8d4cbde0481d25724963f73e7931
d4ea957f6131538cd78e490a585ea3a455251064

View File

@ -1,5 +1,12 @@
<script>
import { GlLabel, GlTooltip, GlTooltipDirective, GlIcon, GlLoadingIcon } from '@gitlab/ui';
import {
GlLabel,
GlTooltip,
GlTooltipDirective,
GlIcon,
GlLoadingIcon,
GlSprintf,
} from '@gitlab/ui';
import { sortBy } from 'lodash';
import { mapActions, mapGetters, mapState } from 'vuex';
import boardCardInner from 'ee_else_ce/boards/mixins/board_card_inner';
@ -26,6 +33,7 @@ export default {
IssueTimeEstimate,
IssueCardWeight: () => import('ee_component/boards/components/issue_card_weight.vue'),
BoardBlockedIcon,
GlSprintf,
},
directives: {
GlTooltip: GlTooltipDirective,
@ -103,6 +111,9 @@ export default {
shouldRenderEpicCountables() {
return this.isEpicBoard && this.item.hasIssues;
},
shouldRenderEpicProgress() {
return this.totalWeight > 0;
},
showLabelFooter() {
return this.isShowingLabels && this.item.labels.find(this.showLabel);
},
@ -130,6 +141,9 @@ export default {
this.item.descendantWeightSum.openedIssues + this.item.descendantWeightSum.closedIssues
);
},
totalProgress() {
return Math.round((this.item.descendantWeightSum.closedIssues / this.totalWeight) * 100);
},
},
methods: {
...mapActions(['performSearch', 'setError']),
@ -246,40 +260,51 @@ export default {
<gl-tooltip :target="() => $refs.countBadge" data-testid="epic-countables-tooltip">
<p v-if="allowSubEpics" class="gl-font-weight-bold gl-m-0">
{{ __('Epics') }} &#8226;
<span class="gl-font-weight-normal"
>{{
sprintf(__('%{openedEpics} open, %{closedEpics} closed'), {
openedEpics: item.descendantCounts.openedEpics,
closedEpics: item.descendantCounts.closedEpics,
})
}}
<span class="gl-font-weight-normal">
<gl-sprintf :message="__('%{openedEpics} open, %{closedEpics} closed')">
<template #openedEpics>{{ item.descendantCounts.openedEpics }}</template>
<template #closedEpics>{{ item.descendantCounts.closedEpics }}</template>
</gl-sprintf>
</span>
</p>
<p class="gl-font-weight-bold gl-m-0">
{{ __('Issues') }} &#8226;
<span class="gl-font-weight-normal"
>{{
sprintf(__('%{openedIssues} open, %{closedIssues} closed'), {
openedIssues: item.descendantCounts.openedIssues,
closedIssues: item.descendantCounts.closedIssues,
})
}}
<span class="gl-font-weight-normal">
<gl-sprintf :message="__('%{openedIssues} open, %{closedIssues} closed')">
<template #openedIssues>{{ item.descendantCounts.openedIssues }}</template>
<template #closedIssues>{{ item.descendantCounts.closedIssues }}</template>
</gl-sprintf>
</span>
</p>
<p class="gl-font-weight-bold gl-m-0">
{{ __('Weight') }} &#8226;
<span class="gl-font-weight-normal" data-testid="epic-countables-total-weight"
>{{
sprintf(__('%{closedWeight} complete, %{openWeight} incomplete'), {
openWeight: item.descendantWeightSum.openedIssues,
closedWeight: item.descendantWeightSum.closedIssues,
})
}}
{{ __('Total weight') }} &#8226;
<span class="gl-font-weight-normal" data-testid="epic-countables-total-weight">
{{ totalWeight }}
</span>
</p>
</gl-tooltip>
<span ref="countBadge" class="issue-count-badge board-card-info">
<gl-tooltip
v-if="shouldRenderEpicProgress"
:target="() => $refs.progressBadge"
data-testid="epic-progress-tooltip"
>
<p class="gl-font-weight-bold gl-m-0">
{{ __('Progress') }} &#8226;
<span class="gl-font-weight-normal" data-testid="epic-progress-tooltip-content">
<gl-sprintf
:message="__('%{completedWeight} of %{totalWeight} weight completed')"
>
<template #completedWeight>{{
item.descendantWeightSum.closedIssues
}}</template>
<template #totalWeight>{{ totalWeight }}</template>
</gl-sprintf>
</span>
</p>
</gl-tooltip>
<span ref="countBadge" class="issue-count-badge board-card-info gl-mr-0 gl-pr-0">
<span v-if="allowSubEpics" class="gl-mr-3">
<gl-icon name="epic" />
{{ totalEpicsCount }}
@ -293,6 +318,17 @@ export default {
{{ totalWeight }}
</span>
</span>
<span
v-if="shouldRenderEpicProgress"
ref="progressBadge"
class="issue-count-badge board-card-info gl-pl-0"
>
<span class="gl-mr-3" data-testid="epic-progress">
<gl-icon name="progress" />
{{ totalProgress }}%
</span>
</span>
</span>
<span v-if="!isEpicBoard">
<issue-due-date

View File

@ -73,7 +73,7 @@ export default {
},
computed: {
...mapState(['activeId']),
...mapGetters(['isEpicBoard']),
...mapGetters(['isEpicBoard', 'isSwimlanesOn']),
isLoggedIn() {
return Boolean(this.currentUserId);
},
@ -169,7 +169,14 @@ export default {
},
showNewIssueForm() {
eventHub.$emit(`${toggleFormEventPrefix.issue}${this.list.id}`);
if (this.isSwimlanesOn) {
eventHub.$emit('open-unassigned-lane');
this.$nextTick(() => {
eventHub.$emit(`${toggleFormEventPrefix.issue}${this.list.id}`);
});
} else {
eventHub.$emit(`${toggleFormEventPrefix.issue}${this.list.id}`);
}
},
showNewEpicForm() {
eventHub.$emit(`${toggleFormEventPrefix.epic}${this.list.id}`);

View File

@ -25,6 +25,11 @@ DB_FILES_MESSAGE = <<~MSG
The following files require a review from the Database team:
MSG
DB_REMOVE_MESSAGE = <<~MSG
If you no longer require a database review, you can remove this suggestion
by removing the ~database label and re-running the [`danger-review` job](#{ENV['CI_JOB_URL']}).
MSG
DATABASE_APPROVED_LABEL = 'database::approved'
non_geo_db_schema_updated = !git.modified_files.grep(%r{\Adb/structure\.sql}).empty?
@ -53,7 +58,12 @@ if gitlab.mr_labels.include?('database') || db_paths_to_review.any?
'review from the [Database team](https://gitlab.com/groups/gl-database/-/group_members).'
markdown(DB_MESSAGE)
markdown(DB_FILES_MESSAGE + helper.markdown_list(db_paths_to_review)) if db_paths_to_review.any?
if db_paths_to_review.any?
markdown(DB_FILES_MESSAGE + helper.markdown_list(db_paths_to_review))
else
markdown(DB_REMOVE_MESSAGE)
end
unless helper.has_database_scoped_labels?
gitlab.api.update_merge_request(gitlab.mr_json['project_id'],

View File

@ -130,13 +130,14 @@ You can filter by the following:
- Author
- Label
### View count of issues and weight in an epic
### View count of issues, weight, and progress of an epic
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/331330) in GitLab 14.1.
Epics on an epic board show a summary of their issues and weight.
To see the number of open and closed issues and the completed and incomplete weight,
hover over the issues icon **{issues}** or weight icon **{weight}**.
Epics on an epic board show a summary of their issues, weight, and progress.
To see the number of open and closed issues and the completed and incomplete
weight, hover over the issues icon **{issues}**, weight icon **{weight}**, or
progress icon **{progress}**.
### Move epics and lists

View File

@ -444,9 +444,6 @@ msgid_plural "%{bold_start}%{count}%{bold_end} opened merge requests"
msgstr[0] ""
msgstr[1] ""
msgid "%{closedWeight} complete, %{openWeight} incomplete"
msgstr ""
msgid "%{code_open}Masked:%{code_close} Hidden in job logs. Must match masking requirements."
msgstr ""
@ -5343,6 +5340,9 @@ msgstr ""
msgid "Boards|An error occurred while fetching group projects. Please try again."
msgstr ""
msgid "Boards|An error occurred while fetching issues. Please reload the page."
msgstr ""
msgid "Boards|An error occurred while fetching labels. Please reload the page."
msgstr ""
@ -5432,9 +5432,15 @@ msgstr ""
msgid "Board|Failed to delete board. Please try again."
msgstr ""
msgid "Board|Load more epics"
msgstr ""
msgid "Board|Load more issues"
msgstr ""
msgid "Board|Loading epics"
msgstr ""
msgid "Bold text"
msgstr ""

View File

@ -31,4 +31,12 @@ RSpec.describe 'Project issue boards sidebar', :js do
def click_first_issue_card
click_card(first_card)
end
def refresh_and_click_first_card
page.refresh
wait_for_requests
first_card.click
end
end

View File

@ -40,7 +40,9 @@ describe('Board card component', () => {
const findEpicCountables = () => wrapper.findByTestId('epic-countables');
const findEpicCountablesBadgeIssues = () => wrapper.findByTestId('epic-countables-counts-issues');
const findEpicCountablesBadgeWeight = () => wrapper.findByTestId('epic-countables-weight-issues');
const findEpicBadgeProgress = () => wrapper.findByTestId('epic-progress');
const findEpicCountablesTotalWeight = () => wrapper.findByTestId('epic-countables-total-weight');
const findEpicProgressTooltip = () => wrapper.findByTestId('epic-progress-tooltip-content');
const createStore = ({ isEpicBoard = false } = {}) => {
store = new Vuex.Store({
@ -466,7 +468,7 @@ describe('Board card component', () => {
expect(findEpicCountablesBadgeIssues().exists()).toBe(false);
});
it('shows render item countBadge and weights correctly', () => {
it('shows render item countBadge, weights, and progress correctly', () => {
createWrapper({
item: {
...issue,
@ -475,15 +477,32 @@ describe('Board card component', () => {
openedIssues: 1,
},
descendantWeightSum: {
...descendantWeightSum,
openedIssues: 2,
closedIssues: 10,
openedIssues: 5,
},
hasIssues: true,
},
});
expect(findEpicCountablesBadgeIssues().text()).toBe('1');
expect(findEpicCountablesBadgeWeight().text()).toBe('2');
expect(findEpicCountablesBadgeWeight().text()).toBe('15');
expect(findEpicBadgeProgress().text()).toBe('67%');
});
it('does not render progress when weight is zero', () => {
createWrapper({
item: {
...issue,
descendantCounts: {
...descendantCounts,
openedIssues: 1,
},
descendantWeightSum,
hasIssues: true,
},
});
expect(findEpicBadgeProgress().exists()).toBe(false);
});
it('renders the tooltip with the correct data', () => {
@ -502,7 +521,8 @@ describe('Board card component', () => {
const tooltip = findEpicCountablesTotalTooltip();
expect(tooltip).toBeDefined();
expect(findEpicCountablesTotalWeight().text()).toBe('10 complete, 5 incomplete');
expect(findEpicCountablesTotalWeight().text()).toBe('15');
expect(findEpicProgressTooltip().text()).toBe('10 of 15 weight completed');
});
});
});

View File

@ -175,12 +175,4 @@ RSpec.shared_examples 'issue boards sidebar' do
end
end
end
def refresh_and_click_first_card
page.refresh
wait_for_requests
first_card.click
end
end