Commit 3adb7f41 authored by Kushal Pandya's avatar Kushal Pandya

Merge branch 'ph/207481/targetBranchFilterDashboard' into 'master'

Removes target branch filter from dashboard merge requests

See merge request gitlab-org/gitlab!44708
parents 9d966d55 39c48e8a
import { __ } from '~/locale';
export default IssuableTokenKeys => {
export default (IssuableTokenKeys, disableTargetBranchFilter = false) => {
const draftToken = {
token: {
formattedKey: __('Draft'),
......@@ -51,6 +51,7 @@ export default IssuableTokenKeys => {
IssuableTokenKeys.tokenKeysWithAlternative.push(draftToken.token);
IssuableTokenKeys.conditions.push(...draftToken.conditions);
if (!disableTargetBranchFilter) {
const targetBranchToken = {
formattedKey: __('Target-Branch'),
key: 'target-branch',
......@@ -63,6 +64,7 @@ export default IssuableTokenKeys => {
IssuableTokenKeys.tokenKeys.push(targetBranchToken);
IssuableTokenKeys.tokenKeysWithAlternative.push(targetBranchToken);
}
const approvedBy = {
token: {
......
......@@ -5,7 +5,7 @@ import IssuableFilteredSearchTokenKeys from '~/filtered_search/issuable_filtered
import { FILTERED_SEARCH } from '~/pages/constants';
document.addEventListener('DOMContentLoaded', () => {
addExtraTokensForMergeRequests(IssuableFilteredSearchTokenKeys);
addExtraTokensForMergeRequests(IssuableFilteredSearchTokenKeys, true);
initFilteredSearch({
page: FILTERED_SEARCH.MERGE_REQUESTS,
......
......@@ -14,7 +14,7 @@
.top-area
= render 'shared/issuable/nav', type: :merge_requests, display_count: !@no_filters_set
= render 'shared/issuable/search_bar', type: :merge_requests
= render 'shared/issuable/search_bar', type: :merge_requests, disable_target_branch: true
- if current_user && @no_filters_set
= render 'shared/dashboard/no_filter_selected'
......
- type = local_assigns.fetch(:type)
- board = local_assigns.fetch(:board, nil)
- show_sorting_dropdown = local_assigns.fetch(:show_sorting_dropdown, true)
- disable_target_branch = local_assigns.fetch(:disable_target_branch, false)
- placeholder = local_assigns[:placeholder] || _('Search or filter results...')
- is_not_boards_modal_or_productivity_analytics = type != :boards_modal && type != :productivity_analytics
- block_css_class = is_not_boards_modal_or_productivity_analytics ? 'row-content-block second-block' : ''
......@@ -154,6 +155,7 @@
%li.filter-dropdown-item{ data: { value: 'no', capitalize: true } }
%button.btn.btn-link{ type: 'button' }
= _('No')
- unless disable_target_branch
#js-dropdown-target-branch.filtered-search-input-dropdown-menu.dropdown-menu
%ul.filter-dropdown{ data: { dynamic: true, dropdown: true } }
%li.filter-dropdown-item
......
---
title: Disable target branch filter option on merge requests dashboard
merge_request:
author:
type: fixed
......@@ -39,8 +39,8 @@ const approvers = {
},
};
export default IssuableTokenKeys => {
addExtraTokensForMergeRequests(IssuableTokenKeys);
export default (IssuableTokenKeys, disableTargetBranchFilter = false) => {
addExtraTokensForMergeRequests(IssuableTokenKeys, disableTargetBranchFilter);
const tokenPosition = 2;
IssuableTokenKeys.tokenKeys.splice(tokenPosition, 0, ...[approvers.token]);
......
......@@ -19,6 +19,12 @@ RSpec.describe 'Dashboard Merge Requests' do
sign_in(current_user)
end
it 'disables target branch filter' do
visit merge_requests_dashboard_path
expect(page).not_to have_selector('#js-dropdown-target-branch', visible: false)
end
context 'new merge request dropdown' do
let(:project_with_disabled_merge_requests) { create(:project, :merge_requests_disabled) }
......
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