Commit 0573b9ec authored by Jarek Ostrowski's avatar Jarek Ostrowski

Remove split dashboard buttons due to low usage

MR: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/68276
parent 9a5456ab
import initVariableList from '~/ci_variable_list'; import initVariableList from '~/ci_variable_list';
import projectSelect from '~/project_select';
import initSearchSettings from '~/search_settings'; import initSearchSettings from '~/search_settings';
import selfMonitor from '~/self_monitor'; import selfMonitor from '~/self_monitor';
import initSettingsPanels from '~/settings_panels'; import initSettingsPanels from '~/settings_panels';
...@@ -8,5 +7,4 @@ initVariableList('js-instance-variables'); ...@@ -8,5 +7,4 @@ initVariableList('js-instance-variables');
selfMonitor(); selfMonitor();
// Initialize expandable settings panels // Initialize expandable settings panels
initSettingsPanels(); initSettingsPanels();
projectSelect();
initSearchSettings(); initSearchSettings();
...@@ -2,7 +2,6 @@ import IssuableFilteredSearchTokenKeys from '~/filtered_search/issuable_filtered ...@@ -2,7 +2,6 @@ import IssuableFilteredSearchTokenKeys from '~/filtered_search/issuable_filtered
import initManualOrdering from '~/manual_ordering'; import initManualOrdering from '~/manual_ordering';
import { FILTERED_SEARCH } from '~/pages/constants'; import { FILTERED_SEARCH } from '~/pages/constants';
import initFilteredSearch from '~/pages/search/init_filtered_search'; import initFilteredSearch from '~/pages/search/init_filtered_search';
import projectSelect from '~/project_select';
initFilteredSearch({ initFilteredSearch({
page: FILTERED_SEARCH.ISSUES, page: FILTERED_SEARCH.ISSUES,
...@@ -10,5 +9,4 @@ initFilteredSearch({ ...@@ -10,5 +9,4 @@ initFilteredSearch({
useDefaultState: true, useDefaultState: true,
}); });
projectSelect();
initManualOrdering(); initManualOrdering();
...@@ -2,7 +2,6 @@ import addExtraTokensForMergeRequests from 'ee_else_ce/filtered_search/add_extra ...@@ -2,7 +2,6 @@ import addExtraTokensForMergeRequests from 'ee_else_ce/filtered_search/add_extra
import IssuableFilteredSearchTokenKeys from '~/filtered_search/issuable_filtered_search_token_keys'; import IssuableFilteredSearchTokenKeys from '~/filtered_search/issuable_filtered_search_token_keys';
import { FILTERED_SEARCH } from '~/pages/constants'; import { FILTERED_SEARCH } from '~/pages/constants';
import initFilteredSearch from '~/pages/search/init_filtered_search'; import initFilteredSearch from '~/pages/search/init_filtered_search';
import projectSelect from '~/project_select';
addExtraTokensForMergeRequests(IssuableFilteredSearchTokenKeys, true); addExtraTokensForMergeRequests(IssuableFilteredSearchTokenKeys, true);
...@@ -11,5 +10,3 @@ initFilteredSearch({ ...@@ -11,5 +10,3 @@ initFilteredSearch({
filteredSearchTokenKeys: IssuableFilteredSearchTokenKeys, filteredSearchTokenKeys: IssuableFilteredSearchTokenKeys,
useDefaultState: true, useDefaultState: true,
}); });
projectSelect();
import projectSelect from '~/project_select';
projectSelect();
...@@ -4,7 +4,6 @@ import { mountIssuablesListApp } from '~/issues_list'; ...@@ -4,7 +4,6 @@ import { mountIssuablesListApp } from '~/issues_list';
import initManualOrdering from '~/manual_ordering'; import initManualOrdering from '~/manual_ordering';
import { FILTERED_SEARCH } from '~/pages/constants'; import { FILTERED_SEARCH } from '~/pages/constants';
import initFilteredSearch from '~/pages/search/init_filtered_search'; import initFilteredSearch from '~/pages/search/init_filtered_search';
import projectSelect from '~/project_select';
const ISSUE_BULK_UPDATE_PREFIX = 'issue_'; const ISSUE_BULK_UPDATE_PREFIX = 'issue_';
...@@ -18,7 +17,6 @@ initFilteredSearch({ ...@@ -18,7 +17,6 @@ initFilteredSearch({
useDefaultState: true, useDefaultState: true,
filteredSearchTokenKeys: IssuableFilteredSearchTokenKeys, filteredSearchTokenKeys: IssuableFilteredSearchTokenKeys,
}); });
projectSelect();
initManualOrdering(); initManualOrdering();
if (gon.features?.vueIssuablesList) { if (gon.features?.vueIssuablesList) {
......
...@@ -3,7 +3,6 @@ import IssuableFilteredSearchTokenKeys from '~/filtered_search/issuable_filtered ...@@ -3,7 +3,6 @@ import IssuableFilteredSearchTokenKeys from '~/filtered_search/issuable_filtered
import issuableInitBulkUpdateSidebar from '~/issuable_bulk_update_sidebar/issuable_init_bulk_update_sidebar'; import issuableInitBulkUpdateSidebar from '~/issuable_bulk_update_sidebar/issuable_init_bulk_update_sidebar';
import { FILTERED_SEARCH } from '~/pages/constants'; import { FILTERED_SEARCH } from '~/pages/constants';
import initFilteredSearch from '~/pages/search/init_filtered_search'; import initFilteredSearch from '~/pages/search/init_filtered_search';
import projectSelect from '~/project_select';
const ISSUABLE_BULK_UPDATE_PREFIX = 'merge_request_'; const ISSUABLE_BULK_UPDATE_PREFIX = 'merge_request_';
...@@ -16,4 +15,3 @@ initFilteredSearch({ ...@@ -16,4 +15,3 @@ initFilteredSearch({
useDefaultState: true, useDefaultState: true,
filteredSearchTokenKeys: IssuableFilteredSearchTokenKeys, filteredSearchTokenKeys: IssuableFilteredSearchTokenKeys,
}); });
projectSelect();
...@@ -9,10 +9,6 @@ ...@@ -9,10 +9,6 @@
.page-title-holder.d-flex.align-items-center .page-title-holder.d-flex.align-items-center
%h1.page-title= _('Issues') %h1.page-title= _('Issues')
- if current_user
.page-title-controls
= render 'shared/new_project_item_select', path: 'issues/new', label: "New issue", with_feature_enabled: 'issues', type: :issues
.top-area .top-area
= render 'shared/issuable/nav', type: :issues, display_count: !@no_filters_set = render 'shared/issuable/nav', type: :issues, display_count: !@no_filters_set
.nav-controls .nav-controls
......
...@@ -7,10 +7,6 @@ ...@@ -7,10 +7,6 @@
.page-title-holder.d-flex.align-items-start.flex-column.flex-sm-row.align-items-sm-center .page-title-holder.d-flex.align-items-start.flex-column.flex-sm-row.align-items-sm-center
%h1.page-title= _('Merge requests') %h1.page-title= _('Merge requests')
- if current_user
.page-title-controls.ml-0.mb-3.ml-sm-auto.mb-sm-0
= render 'shared/new_project_item_select', path: 'merge_requests/new', label: "New merge request", with_feature_enabled: 'merge_requests', type: :merge_requests
.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
......
...@@ -6,12 +6,6 @@ ...@@ -6,12 +6,6 @@
.page-title-holder.d-flex.align-items-center .page-title-holder.d-flex.align-items-center
%h1.page-title= _('Milestones') %h1.page-title= _('Milestones')
- if current_user
.page-title-controls
= render 'shared/new_project_item_select',
path: '-/milestones/new', label: 'New milestone',
include_groups: true, type: :milestones
.top-area .top-area
= render 'shared/milestones_filter', counts: @milestone_states = render 'shared/milestones_filter', counts: @milestone_states
.nav-controls .nav-controls
......
...@@ -13,8 +13,6 @@ ...@@ -13,8 +13,6 @@
- if @can_bulk_update - if @can_bulk_update
= render_if_exists 'shared/issuable/bulk_update_button', type: :issues = 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
= render 'shared/issuable/search_bar', type: :issues = render 'shared/issuable/search_bar', type: :issues
- if @can_bulk_update - if @can_bulk_update
......
...@@ -12,8 +12,6 @@ ...@@ -12,8 +12,6 @@
- if @can_bulk_update - if @can_bulk_update
= render_if_exists 'shared/issuable/bulk_update_button', type: :merge_requests = 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 = render 'shared/issuable/search_bar', type: :merge_requests
- if @can_bulk_update - if @can_bulk_update
......
...@@ -46,38 +46,4 @@ RSpec.describe 'Dashboard Issues' do ...@@ -46,38 +46,4 @@ RSpec.describe 'Dashboard Issues' do
it_behaves_like "it has an RSS button with current_user's feed token" it_behaves_like "it has an RSS button with current_user's feed token"
it_behaves_like "an autodiscoverable RSS feed with current_user's feed token" it_behaves_like "an autodiscoverable RSS feed with current_user's feed token"
end end
describe 'new issue dropdown' do
it 'shows projects only with issues feature enabled', :js do
find('.new-project-item-select-button').click
page.within('.select2-results') do
expect(page).to have_content(project.full_name)
expect(page).not_to have_content(project_with_issues_disabled.full_name)
end
end
it 'shows the new issue page', :js do
find('.new-project-item-select-button').click
wait_for_requests
project_path = "/#{project.full_path}"
project_json = { name: project.full_name, url: project_path }.to_json
# simulate selection, and prevent overlap by dropdown menu
first('.project-item-select', visible: false)
execute_script("$('.project-item-select').val('#{project_json}').trigger('change');")
find('#select2-drop-mask', visible: false)
execute_script("$('#select2-drop-mask').remove();")
find('.new-project-item-link').click
expect(page).to have_current_path("#{project_path}/-/issues/new")
page.within('#content-body') do
expect(page).to have_selector('.issue-form')
end
end
end
end end
...@@ -25,24 +25,6 @@ RSpec.describe 'Dashboard Merge Requests' do ...@@ -25,24 +25,6 @@ RSpec.describe 'Dashboard Merge Requests' do
expect(page).not_to have_selector('#js-dropdown-target-branch', visible: false) expect(page).not_to have_selector('#js-dropdown-target-branch', visible: false)
end end
context 'new merge request dropdown' do
let(:project_with_disabled_merge_requests) { create(:project, :merge_requests_disabled) }
before do
project_with_disabled_merge_requests.add_maintainer(current_user)
visit merge_requests_dashboard_path
end
it 'shows projects only with merge requests feature enabled', :js do
find('.new-project-item-select-button').click
page.within('.select2-results') do
expect(page).to have_content(project.full_name)
expect(page).not_to have_content(project_with_disabled_merge_requests.full_name)
end
end
end
context 'no merge requests exist' do context 'no merge requests exist' do
it 'shows an empty state' do it 'shows an empty state' do
visit merge_requests_dashboard_path(assignee_username: current_user.username) visit merge_requests_dashboard_path(assignee_username: current_user.username)
......
...@@ -32,20 +32,6 @@ RSpec.describe 'Dashboard > Milestones' do ...@@ -32,20 +32,6 @@ RSpec.describe 'Dashboard > Milestones' do
expect(page).to have_content(group.name) expect(page).to have_content(group.name)
expect(first('.milestone')).to have_content('Merge requests') expect(first('.milestone')).to have_content('Merge requests')
end end
describe 'new milestones dropdown', :js do
it 'takes user to a new milestone page', :js do
find('.new-project-item-select-button').click
page.within('.select2-results') do
first('.select2-result-label').click
end
find('.new-project-item-link').click
expect(current_path).to eq(new_group_milestone_path(group))
end
end
end end
describe 'with merge requests disabled' do describe 'with merge requests disabled' do
......
...@@ -92,20 +92,6 @@ RSpec.describe 'Group empty states' do ...@@ -92,20 +92,6 @@ RSpec.describe 'Group empty states' do
it 'displays an empty state' do it 'displays an empty state' do
expect(page).to have_selector('.empty-state') expect(page).to have_selector('.empty-state')
end end
it "shows a new #{issuable_name} button" do
within '.empty-state' do
expect(page).to have_content("create #{issuable_name}")
end
end
it "the new #{issuable_name} button opens a project dropdown" do
within '.empty-state' do
find('.new-project-item-select-button').click
end
expect(page).to have_selector('.ajax-project-dropdown')
end
end end
end end
......
...@@ -96,28 +96,6 @@ RSpec.describe 'Group issues page' do ...@@ -96,28 +96,6 @@ RSpec.describe 'Group issues page' do
end end
end end
context 'projects with issues disabled' do
describe 'issue dropdown' do
let(:user_in_group) { create(:group_member, :maintainer, user: create(:user), group: group ).user }
before do
[project, project_with_issues_disabled].each { |project| project.add_maintainer(user_in_group) }
sign_in(user_in_group)
visit issues_group_path(group)
end
it 'shows projects only with issues feature enabled', :js do
find('.empty-state .js-lazy-loaded')
find('.empty-state .new-project-item-link').click
page.within('.select2-results') do
expect(page).to have_content(project.full_name)
expect(page).not_to have_content(project_with_issues_disabled.full_name)
end
end
end
end
context 'manual ordering', :js do context 'manual ordering', :js do
let(:user_in_group) { create(:group_member, :maintainer, user: create(:user), group: group ).user } let(:user_in_group) { create(:group_member, :maintainer, user: create(:user), group: group ).user }
......
...@@ -59,23 +59,6 @@ RSpec.describe 'Group merge requests page' do ...@@ -59,23 +59,6 @@ RSpec.describe 'Group merge requests page' do
end end
end end
describe 'new merge request dropdown' do
let(:project_with_merge_requests_disabled) { create(:project, :merge_requests_disabled, group: group) }
before do
visit path
end
it 'shows projects only with merge requests feature enabled', :js do
find('.new-project-item-link').click
page.within('.select2-results') do
expect(page).to have_content(project.name_with_namespace)
expect(page).not_to have_content(project_with_merge_requests_disabled.name_with_namespace)
end
end
end
context 'empty state with no merge requests' do context 'empty state with no merge requests' do
before do before do
MergeRequest.delete_all MergeRequest.delete_all
...@@ -85,7 +68,6 @@ RSpec.describe 'Group merge requests page' do ...@@ -85,7 +68,6 @@ RSpec.describe 'Group merge requests page' do
visit path visit path
expect(page).to have_selector('.empty-state') expect(page).to have_selector('.empty-state')
expect(page).to have_link('Select project to create merge request')
expect(page).not_to have_selector('.issues-filters') expect(page).not_to have_selector('.issues-filters')
end end
...@@ -95,7 +77,6 @@ RSpec.describe 'Group merge requests page' do ...@@ -95,7 +77,6 @@ RSpec.describe 'Group merge requests page' do
visit path visit path
expect(page).to have_selector('.empty-state') expect(page).to have_selector('.empty-state')
expect(page).to have_link('Select project to create merge request')
expect(page).to have_selector('.issues-filters') expect(page).to have_selector('.issues-filters')
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