Commit 2eda97be authored by Robert Speicher's avatar Robert Speicher

Merge branch '12719-group-bulk-edit-merge-requests-change-milestone-ce' into 'master'

CE port for Group bulk edit merge requests

See merge request gitlab-org/gitlab-ce!30569
parents 4435cdde 89d5663e
import projectSelect from '~/project_select';
import initFilteredSearch from '~/pages/search/init_filtered_search';
import issuableInitBulkUpdateSidebar from '~/issuable_init_bulk_update_sidebar';
import IssuableFilteredSearchTokenKeys from '~/filtered_search/issuable_filtered_search_token_keys';
import addExtraTokensForMergeRequests from 'ee_else_ce/filtered_search/add_extra_tokens_for_merge_requests';
import { FILTERED_SEARCH } from '~/pages/constants';
const ISSUABLE_BULK_UPDATE_PREFIX = 'merge_request_';
document.addEventListener('DOMContentLoaded', () => {
addExtraTokensForMergeRequests(IssuableFilteredSearchTokenKeys);
issuableInitBulkUpdateSidebar.init(ISSUABLE_BULK_UPDATE_PREFIX);
initFilteredSearch({
page: FILTERED_SEARCH.MERGE_REQUESTS,
......
......@@ -13,7 +13,7 @@
= render 'shared/issuable/feed_buttons'
- if @can_bulk_update
= render_if_exists 'shared/issuable/bulk_update_button'
= render_if_exists 'shared/issuable/bulk_update_button', type: :issues
= render 'shared/new_project_item_select', path: 'issues/new', label: "New issue", type: :issues, with_feature_enabled: 'issues', with_shared: false, include_projects_in_subgroups: true
......
- @can_bulk_update = can?(current_user, :admin_merge_request, @group)
- page_title "Merge Requests"
- if group_merge_requests_count(state: 'all').zero?
......@@ -7,8 +9,14 @@
= render 'shared/issuable/nav', type: :merge_requests
- if current_user
.nav-controls
- if @can_bulk_update
= render_if_exists 'shared/issuable/bulk_update_button', type: :merge_requests
= render 'shared/new_project_item_select', path: 'merge_requests/new', label: "New merge request", type: :merge_requests, with_feature_enabled: 'merge_requests', with_shared: false, include_projects_in_subgroups: true
= render 'shared/issuable/search_bar', type: :merge_requests
- if @can_bulk_update
= render_if_exists 'shared/issuable/group_bulk_update_sidebar', group: @group, type: :merge_requests
= render 'shared/merge_requests'
# Bulk editing issue milestones **(PREMIUM)**
# Bulk editing issue and merge request milestones **(PREMIUM)**
> [Introduced](https://gitlab.com/gitlab-org/gitlab-ee/issues/7249) in
[GitLab Ultimate](https://about.gitlab.com/pricing/) 12.1.
> - [Introduced](https://gitlab.com/gitlab-org/gitlab-ee/issues/7249) for issues in
[GitLab Premium](https://about.gitlab.com/pricing/) 12.1.
> - [Introduced](https://gitlab.com/gitlab-org/gitlab-ee/issues/12719) for merge
requests in GitLab [GitLab Premium](https://about.gitlab.com/pricing/) 12.2.
NOTE: **Note:**
A permission level of `Reporter` or higher is required in order to manage issues.
> NOTE: **Note:**
>
> - A permission level of `Reporter` or higher is required in order to manage issues.
> - A permission level of `Developer` or higher is required in order to manage merge requests.
Milestones can be updated simultaneously across multiple issues by using the bulk editing feature.
Milestones can be updated simultaneously across multiple issues or merge requests by using the bulk editing feature.
![Bulk editing](img/bulk-editing.png)
To bulk update group issue milestones:
To bulk update group issue or merge request milestones:
1. Navigate to the issues list.
1. Click **Edit issues**.
1. Navigate to the issues or merge requests list.
1. Click the **Edit issues** or **Edit merge requests** button.
- This will open a sidebar on the right-hand side of your screen where an editable field
for milestones will be displayed.
- Checkboxes will also appear beside each issue.
- Checkboxes will also appear beside each issue or merge request.
1. Check the checkbox beside each issue to be edited.
1. Select the desired milestone from the sidebar.
1. Click **Update all**.
......@@ -78,9 +78,9 @@ Issues and merge requests are part of projects. For a given group, you can view
[issues](../project/issues/index.md#issues-list) and [merge requests](../project/merge_requests/index.md#merge-requests-per-group) across all projects in that group,
together in a single list view.
### Bulk editing issues
### Bulk editing issues and merge requests
For details, see [bulk editing issues](../group/bulk_editing/index.md).
For details, see [bulk editing issues and merge requests](../group/bulk_editing/index.md).
## Create a new group
......
......@@ -13,8 +13,8 @@ by using the bulk editing feature.
![Bulk editing](img/bulk-editing.png)
NOTE: **Note:**
Bulk editing of merge requests is only available at the project level.
For more details, see [bulk editing group issues](../group/bulk_editing/index.md).
Bulk editing issues and merge requests is also available at the group level.
For more details, see [bulk editing group issues and merge requests](../group/bulk_editing/index.md).
To update multiple project issues or merge requests at the same time:
......
......@@ -16,22 +16,22 @@ describe Issuable::BulkUpdateService do
shared_examples 'updates milestones' do
it 'succeeds' do
result = bulk_update(issues, milestone_id: milestone.id)
result = bulk_update(issuables, milestone_id: milestone.id)
expect(result[:success]).to be_truthy
expect(result[:count]).to eq(issues.count)
expect(result[:count]).to eq(issuables.count)
end
it 'updates the issues milestone' do
bulk_update(issues, milestone_id: milestone.id)
it 'updates the issuables milestone' do
bulk_update(issuables, milestone_id: milestone.id)
issues.each do |issue|
expect(issue.reload.milestone).to eq(milestone)
issuables.each do |issuable|
expect(issuable.reload.milestone).to eq(milestone)
end
end
end
context 'with project issues' do
context 'with project issuables' do
describe 'close issues' do
let(:issues) { create_list(:issue, 2, project: project) }
......@@ -171,7 +171,7 @@ describe Issuable::BulkUpdateService do
end
describe 'updating milestones' do
let(:issues) { [create(:issue, project: project)] }
let(:issuables) { [create(:issue, project: project)] }
let(:milestone) { create(:milestone, project: project) }
it_behaves_like 'updates milestones'
......@@ -360,22 +360,32 @@ describe Issuable::BulkUpdateService do
end
end
context 'with group issues' do
context 'with group issuables ' do
let(:group) { create(:group) }
context 'updating milestone' do
describe 'updating milestones' do
let(:milestone) { create(:milestone, group: group) }
let(:project1) { create(:project, :repository, group: group) }
let(:project2) { create(:project, :repository, group: group) }
let(:issue1) { create(:issue, project: project1) }
let(:issue2) { create(:issue, project: project2) }
let(:issues) { [issue1, issue2] }
let(:project) { create(:project, :repository, group: group) }
before do
group.add_maintainer(user)
end
it_behaves_like 'updates milestones'
context 'when issues' do
let(:issue1) { create(:issue, project: project) }
let(:issue2) { create(:issue, project: project) }
let(:issuables) { [issue1, issue2] }
it_behaves_like 'updates milestones'
end
context 'when merge requests' do
let(:merge_request1) { create(:merge_request, source_project: project, source_branch: 'branch-1') }
let(:merge_request2) { create(:merge_request, source_project: project, source_branch: 'branch-2') }
let(:issuables) { [merge_request1, merge_request2] }
it_behaves_like 'updates milestones'
end
end
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment