Commit d314a600 authored by Martin Wortschack's avatar Martin Wortschack Committed by Sean McGivern

Remove codeReviewAnalyticsHasNewSearch

feature flag
parent 8bb7aacd
<script>
import { mapState, mapActions } from 'vuex';
import { GlBadge, GlLoadingIcon, GlEmptyState, GlPagination } from '@gitlab/ui';
import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin';
import MergeRequestTable from './merge_request_table.vue';
import FilterBar from './filter_bar.vue';
import FilteredSearchCodeReviewAnalytics from '../filtered_search_code_review_analytics';
export default {
components: {
......@@ -15,7 +13,6 @@ export default {
FilterBar,
MergeRequestTable,
},
mixins: [glFeatureFlagsMixin()],
props: {
projectId: {
type: Number,
......@@ -50,16 +47,8 @@ export default {
this.fetchMergeRequests();
},
},
codeReviewAnalyticsHasNewSearch() {
return this.glFeatures.codeReviewAnalyticsHasNewSearch;
},
},
created() {
if (!this.codeReviewAnalyticsHasNewSearch) {
this.filterManager = new FilteredSearchCodeReviewAnalytics();
this.filterManager.setup();
}
this.setProjectId(this.projectId);
this.fetchMergeRequests();
},
......@@ -71,7 +60,7 @@ export default {
<template>
<div>
<filter-bar v-if="codeReviewAnalyticsHasNewSearch" :project-path="projectPath" />
<filter-bar :project-path="projectPath" />
<div class="mt-2">
<gl-loading-icon v-show="isLoading" size="md" class="mt-3" />
<template v-if="!isLoading">
......
......@@ -7,7 +7,6 @@ module Projects
before_action :authorize_read_code_review_analytics!
before_action do
push_frontend_feature_flag(:code_review_analytics_has_new_search)
push_frontend_feature_flag(:not_issuable_queries, @project, default_enabled: true)
end
......
......@@ -5,6 +5,4 @@
%h3.mb-2
= _('Code Review')
%span.text-secondary= _('Review time is defined as the time it takes from first comment until merged.')
- if Feature.disabled?(:code_review_analytics_has_new_search)
= render 'shared/issuable/search_bar', type: :issues_analytics, show_sorting_dropdown: false, placeholder: _('Filter results...')
#js-code-review-analytics{ data: { project_id: @project.id, project_path: project_path(@project), new_merge_request_url: namespace_project_new_merge_request_path(@project.namespace), empty_state_svg_path: image_path('illustrations/merge_requests.svg'), milestone_path: project_milestones_path(@project), labels_path: project_labels_path(@project) } }
---
name: code_review_analytics_has_new_search
introduced_by_url:
rollout_issue_url:
milestone:
type: development
group:
default_enabled: false
......@@ -3,8 +3,6 @@
require 'spec_helper'
RSpec.describe 'CodeReviewAnalytics Filtered Search', :js do
include FilteredSearchHelpers
let_it_be(:user) { create(:user) }
let_it_be(:project) { create(:project) }
......@@ -12,68 +10,30 @@ RSpec.describe 'CodeReviewAnalytics Filtered Search', :js do
stub_licensed_features(code_review_analytics: true)
project.add_reporter(user)
end
context 'when the "new search" feature is disabled' do
before do
stub_feature_flags(code_review_analytics_has_new_search: false)
sign_in(user)
visit project_analytics_code_reviews_path(project)
end
sign_in(user)
it 'renders the filtered search bar correctly' do
page.within('.content-wrapper .content .issues-filters') do
expect(page).to have_css('.filtered-search-box')
end
end
it 'displays label and milestone in search hint' do
filtered_search.click
page.within('#js-dropdown-hint') do
expect(page).to have_content('Label')
expect(page).to have_content('Milestone')
end
end
context 'with merge_requests' do
let(:label) { create(:label, title: 'awesome label', project: project) }
before do
create(:merge_request, title: "Bug fix-1", source_project: project, source_branch: "branch-1")
create(:labeled_merge_request, title: "Bug fix with label", source_project: project, source_branch: "branch-with-label", labels: [label])
create(:labeled_merge_request, title: "Bug fix with label#2", source_project: project, source_branch: "branch-with-label-2", labels: [label])
end
it 'filters the list of merge requests', quarantine: 'https://gitlab.com/gitlab-org/gitlab/-/issues/250638' do
has_merge_requests(3)
select_label_on_dropdown(label.title)
visit project_analytics_code_reviews_path(project)
end
has_merge_requests(2)
end
it 'renders the filtered search bar correctly' do
page.within('.content-wrapper .content .vue-filtered-search-bar-container') do
expect(page).to have_selector('.gl-search-box-by-click')
expect(page.find('.gl-filtered-search-term-input')[:placeholder]).to eq('Filter results')
end
end
context 'when the "new search" feature is enabled' do
before do
stub_feature_flags(code_review_analytics_has_new_search: true)
it 'displays label and milestone in search hint' do
page.within('.content-wrapper .content .vue-filtered-search-bar-container') do
page.find('.gl-search-box-by-click').click
sign_in(user)
expect(page).to have_selector('.gl-filtered-search-suggestion-list')
visit project_analytics_code_reviews_path(project)
end
hints = page.find_all('.gl-filtered-search-suggestion-list > li')
it 'does not render the filtered search bar' do
page.within('.content-wrapper .content') do
expect(page).not_to have_css('.issues-filters')
end
expect(hints.length).to eq(2)
expect(hints[0]).to have_content('Milestone')
expect(hints[1]).to have_content('Label')
end
end
def has_merge_requests(num = 0)
expect(page).to have_text("Merge Requests in Review #{num}")
end
end
......@@ -9,13 +9,6 @@ import createMergeRequestsState from 'ee/analytics/code_review_analytics/store/m
import { TEST_HOST } from 'helpers/test_constants';
import createFiltersState from '~/vue_shared/components/filtered_search_bar/store/modules/filters/state';
const mockFilterManagerSetup = jest.fn();
jest.mock('ee/analytics/code_review_analytics/filtered_search_code_review_analytics', () =>
jest.fn().mockImplementation(() => ({
setup: mockFilterManagerSetup,
})),
);
const localVue = createLocalVue();
localVue.use(Vuex);
......@@ -62,7 +55,7 @@ describe('CodeReviewAnalyticsApp component', () => {
},
});
const createComponent = (store, codeReviewAnalyticsHasNewSearch = false) =>
const createComponent = store =>
shallowMount(CodeReviewAnalyticsApp, {
localVue,
store,
......@@ -74,11 +67,6 @@ describe('CodeReviewAnalyticsApp component', () => {
projectPath: TEST_HOST,
labelsPath: `${TEST_HOST}/labels`,
},
provide: {
glFeatures: {
codeReviewAnalyticsHasNewSearch,
},
},
});
beforeEach(() => {
......@@ -98,36 +86,11 @@ describe('CodeReviewAnalyticsApp component', () => {
const findPagination = () => wrapper.find(GlPagination);
describe('template', () => {
describe('when "codeReviewAnalyticsHasNewSearch" is disabled', () => {
beforeEach(() => {
vuexStore = createStore();
wrapper = createComponent(vuexStore);
});
it('does not render the filter bar component', () => {
expect(findFilterBar().exists()).toBe(false);
});
it("calls the filterManager's setup method", () => {
expect(mockFilterManagerSetup).toHaveBeenCalled();
});
});
describe('when "codeReviewAnalyticsHasNewSearch" is enabled', () => {
describe('when the feature is enabled', () => {
beforeEach(() => {
vuexStore = createStore();
wrapper = createComponent(vuexStore, true);
});
it('renders the filter bar component', () => {
vuexStore = createStore();
wrapper = createComponent(vuexStore, true);
it('renders the filter bar component', () => {
expect(findFilterBar().exists()).toBe(true);
});
it("does not call the filterManager's setup method", () => {
expect(mockFilterManagerSetup).not.toHaveBeenCalled();
});
});
expect(findFilterBar().exists()).toBe(true);
});
describe('while loading', () => {
......
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