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