diff options
12 files changed, 139 insertions, 149 deletions
diff --git a/GITLAB_KAS_VERSION b/GITLAB_KAS_VERSION index 9f6d8f2fdb4..9a411a350e5 100644 --- a/GITLAB_KAS_VERSION +++ b/GITLAB_KAS_VERSION @@ -1 +1 @@ -15.6.0 +15.7.0-rc1 diff --git a/app/assets/javascripts/search/sidebar/components/confidentiality_filter.vue b/app/assets/javascripts/search/sidebar/components/confidentiality_filter.vue index 38dccb9675d..4ddf695f61a 100644 --- a/app/assets/javascripts/search/sidebar/components/confidentiality_filter.vue +++ b/app/assets/javascripts/search/sidebar/components/confidentiality_filter.vue @@ -1,5 +1,5 @@ <script> -import { mapState } from 'vuex'; +import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin'; import { confidentialFilterData } from '../constants/confidential_filter_data'; import RadioFilter from './radio_filter.vue'; @@ -8,10 +8,10 @@ export default { components: { RadioFilter, }, + mixins: [glFeatureFlagsMixin()], computed: { - ...mapState(['query']), - showDropdown() { - return Object.values(confidentialFilterData.scopes).includes(this.query.scope); + ffBasedXPadding() { + return this.glFeatures.searchPageVerticalNav ? 'gl-px-5' : 'gl-px-0'; }, }, confidentialFilterData, @@ -19,8 +19,8 @@ export default { </script> <template> - <div v-if="showDropdown"> - <radio-filter :filter-data="$options.confidentialFilterData" /> + <div> + <radio-filter :class="ffBasedXPadding" :filter-data="$options.confidentialFilterData" /> <hr class="gl-my-5 gl-border-gray-100" /> </div> </template> diff --git a/app/assets/javascripts/search/sidebar/components/results_filters.vue b/app/assets/javascripts/search/sidebar/components/results_filters.vue index 5b53f94bb53..9b993ab9a86 100644 --- a/app/assets/javascripts/search/sidebar/components/results_filters.vue +++ b/app/assets/javascripts/search/sidebar/components/results_filters.vue @@ -2,6 +2,8 @@ import { GlButton, GlLink } from '@gitlab/ui'; import { mapActions, mapState } from 'vuex'; import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin'; +import { confidentialFilterData } from '../constants/confidential_filter_data'; +import { stateFilterData } from '../constants/state_filter_data'; import ConfidentialityFilter from './confidentiality_filter.vue'; import StatusFilter from './status_filter.vue'; @@ -22,6 +24,15 @@ export default { searchPageVerticalNavFeatureFlag() { return this.glFeatures.searchPageVerticalNav; }, + showConfidentialityFilter() { + return Object.values(confidentialFilterData.scopes).includes(this.urlQuery.scope); + }, + showStatusFilter() { + return Object.values(stateFilterData.scopes).includes(this.urlQuery.scope); + }, + ffBasedXPadding() { + return this.glFeatures.searchPageVerticalNav ? 'gl-px-5' : 'gl-px-0'; + }, }, methods: { ...mapActions(['applyQuery', 'resetQuery']), @@ -30,14 +41,14 @@ export default { </script> <template> - <form - :class="searchPageVerticalNavFeatureFlag ? 'gl-px-5' : 'gl-px-0'" - @submit.prevent="applyQuery" - > - <hr v-if="searchPageVerticalNavFeatureFlag" class="gl-my-5 gl-border-gray-100" /> - <status-filter /> - <confidentiality-filter /> - <div class="gl-display-flex gl-align-items-center gl-mt-4"> + <form class="gl-pt-5 gl-md-pt-0" @submit.prevent="applyQuery"> + <hr + v-if="searchPageVerticalNavFeatureFlag" + class="gl-my-5 gl-border-gray-100 gl-display-none gl-md-display-block" + /> + <status-filter v-if="showStatusFilter" /> + <confidentiality-filter v-if="showConfidentialityFilter" /> + <div class="gl-display-flex gl-align-items-center gl-mt-4" :class="ffBasedXPadding"> <gl-button category="primary" variant="confirm" type="submit" :disabled="!sidebarDirty"> {{ __('Apply') }} </gl-button> diff --git a/app/assets/javascripts/search/sidebar/components/status_filter.vue b/app/assets/javascripts/search/sidebar/components/status_filter.vue index 5cec2090906..eaf7d95822a 100644 --- a/app/assets/javascripts/search/sidebar/components/status_filter.vue +++ b/app/assets/javascripts/search/sidebar/components/status_filter.vue @@ -1,5 +1,5 @@ <script> -import { mapState } from 'vuex'; +import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin'; import { stateFilterData } from '../constants/state_filter_data'; import RadioFilter from './radio_filter.vue'; @@ -8,10 +8,10 @@ export default { components: { RadioFilter, }, + mixins: [glFeatureFlagsMixin()], computed: { - ...mapState(['query']), - showDropdown() { - return Object.values(stateFilterData.scopes).includes(this.query.scope); + ffBasedXPadding() { + return this.glFeatures.searchPageVerticalNav ? 'gl-px-5' : 'gl-px-0'; }, }, stateFilterData, @@ -19,8 +19,8 @@ export default { </script> <template> - <div v-if="showDropdown"> - <radio-filter :filter-data="$options.stateFilterData" /> + <div> + <radio-filter :class="ffBasedXPadding" :filter-data="$options.stateFilterData" /> <hr class="gl-my-5 gl-border-gray-100" /> </div> </template> diff --git a/danger/specs/Dangerfile b/danger/specs/Dangerfile index 145f7237458..1eb11843732 100644 --- a/danger/specs/Dangerfile +++ b/danger/specs/Dangerfile @@ -2,6 +2,7 @@ NO_SPECS_LABELS = [ 'maintenance::pipelines', + 'maintenance::refactor', 'maintenance::workflow', 'documentation', 'QA' diff --git a/lib/gitlab/usage_data_counters/issue_activity_unique_counter.rb b/lib/gitlab/usage_data_counters/issue_activity_unique_counter.rb index dda72f7fa3b..477fa288874 100644 --- a/lib/gitlab/usage_data_counters/issue_activity_unique_counter.rb +++ b/lib/gitlab/usage_data_counters/issue_activity_unique_counter.rb @@ -173,7 +173,7 @@ module Gitlab private - def track_snowplow_action(action, author, project) + def track_snowplow_action(event_name, author, project) return unless Feature.enabled?(:route_hll_to_snowplow_phase2, project.namespace) return unless author @@ -181,17 +181,18 @@ module Gitlab ISSUE_CATEGORY, ISSUE_ACTION, label: ISSUE_LABEL, - property: action, + property: event_name, project: project, namespace: project.namespace, - user: author + user: author, + context: [Gitlab::Tracking::ServicePingContext.new(data_source: :redis_hll, event: event_name).to_context] ) end - def track_unique_action(action, author) + def track_unique_action(event_name, author) return unless author - Gitlab::UsageDataCounters::HLLRedisCounter.track_event(action, values: author.id) + Gitlab::UsageDataCounters::HLLRedisCounter.track_event(event_name, values: author.id) end end end diff --git a/qa/qa/specs/features/api/12_systems/gitaly/distributed_reads_spec.rb b/qa/qa/specs/features/api/12_systems/gitaly/distributed_reads_spec.rb index 397fdb909ac..403fe468d69 100644 --- a/qa/qa/specs/features/api/12_systems/gitaly/distributed_reads_spec.rb +++ b/qa/qa/specs/features/api/12_systems/gitaly/distributed_reads_spec.rb @@ -45,11 +45,7 @@ module QA end it 'does not read from the unhealthy node', - testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347834', - quarantine: { - issue: 'https://gitlab.com/gitlab-org/gitlab/-/issues/378174', - type: :flaky - } do + testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347834' do pre_read_data = praefect_manager.query_read_distribution read_from_project(project, number_of_reads_per_loop * 10) diff --git a/spec/frontend/search/sidebar/components/confidentiality_filter_spec.js b/spec/frontend/search/sidebar/components/confidentiality_filter_spec.js index c57eabd57b9..d5ecca4636c 100644 --- a/spec/frontend/search/sidebar/components/confidentiality_filter_spec.js +++ b/spec/frontend/search/sidebar/components/confidentiality_filter_spec.js @@ -1,39 +1,16 @@ import { shallowMount } from '@vue/test-utils'; -import Vue from 'vue'; -import Vuex from 'vuex'; -import { MOCK_QUERY } from 'jest/search/mock_data'; import ConfidentialityFilter from '~/search/sidebar/components/confidentiality_filter.vue'; import RadioFilter from '~/search/sidebar/components/radio_filter.vue'; -Vue.use(Vuex); - describe('ConfidentialityFilter', () => { let wrapper; - const actionSpies = { - applyQuery: jest.fn(), - resetQuery: jest.fn(), - }; - - const createComponent = (initialState) => { - const store = new Vuex.Store({ - state: { - query: MOCK_QUERY, - ...initialState, - }, - actions: actionSpies, - }); - + const createComponent = (initProps) => { wrapper = shallowMount(ConfidentialityFilter, { - store, + ...initProps, }); }; - afterEach(() => { - wrapper.destroy(); - wrapper = null; - }); - const findRadioFilter = () => wrapper.findComponent(RadioFilter); describe('template', () => { @@ -41,24 +18,28 @@ describe('ConfidentialityFilter', () => { createComponent(); }); - describe.each` - scope | showFilter - ${'issues'} | ${true} - ${'merge_requests'} | ${false} - ${'projects'} | ${false} - ${'milestones'} | ${false} - ${'users'} | ${false} - ${'notes'} | ${false} - ${'wiki_blobs'} | ${false} - ${'blobs'} | ${false} - `(`dropdown`, ({ scope, showFilter }) => { - beforeEach(() => { - createComponent({ query: { scope } }); - }); + it('renders the component', () => { + expect(findRadioFilter().exists()).toBe(true); + }); + }); - it(`does${showFilter ? '' : ' not'} render when scope is ${scope}`, () => { - expect(findRadioFilter().exists()).toBe(showFilter); + describe.each` + hasFeatureFlagEnabled | paddingClass + ${true} | ${'gl-px-5'} + ${false} | ${'gl-px-0'} + `(`RadioFilter`, ({ hasFeatureFlagEnabled, paddingClass }) => { + beforeEach(() => { + createComponent({ + provide: { + glFeatures: { + searchPageVerticalNav: hasFeatureFlagEnabled, + }, + }, }); }); + + it(`has ${paddingClass} class`, () => { + expect(findRadioFilter().classes(paddingClass)).toBe(true); + }); }); }); diff --git a/spec/frontend/search/sidebar/components/filters_spec.js b/spec/frontend/search/sidebar/components/filters_spec.js index 4f217709297..7e564bfa005 100644 --- a/spec/frontend/search/sidebar/components/filters_spec.js +++ b/spec/frontend/search/sidebar/components/filters_spec.js @@ -129,4 +129,44 @@ describe('GlobalSearchSidebarFilters', () => { expect(actionSpies.resetQuery).toHaveBeenCalled(); }); }); + + describe.each` + scope | showFilter + ${'issues'} | ${true} + ${'merge_requests'} | ${false} + ${'projects'} | ${false} + ${'milestones'} | ${false} + ${'users'} | ${false} + ${'notes'} | ${false} + ${'wiki_blobs'} | ${false} + ${'blobs'} | ${false} + `(`ConfidentialityFilter`, ({ scope, showFilter }) => { + beforeEach(() => { + createComponent({ urlQuery: { scope } }); + }); + + it(`does${showFilter ? '' : ' not'} render when scope is ${scope}`, () => { + expect(findConfidentialityFilter().exists()).toBe(showFilter); + }); + }); + + describe.each` + scope | showFilter + ${'issues'} | ${true} + ${'merge_requests'} | ${true} + ${'projects'} | ${false} + ${'milestones'} | ${false} + ${'users'} | ${false} + ${'notes'} | ${false} + ${'wiki_blobs'} | ${false} + ${'blobs'} | ${false} + `(`StatusFilter`, ({ scope, showFilter }) => { + beforeEach(() => { + createComponent({ urlQuery: { scope } }); + }); + + it(`does${showFilter ? '' : ' not'} render when scope is ${scope}`, () => { + expect(findStatusFilter().exists()).toBe(showFilter); + }); + }); }); diff --git a/spec/frontend/search/sidebar/components/status_filter_spec.js b/spec/frontend/search/sidebar/components/status_filter_spec.js index f3152c014b6..2ed199469e6 100644 --- a/spec/frontend/search/sidebar/components/status_filter_spec.js +++ b/spec/frontend/search/sidebar/components/status_filter_spec.js @@ -1,39 +1,16 @@ import { shallowMount } from '@vue/test-utils'; -import Vue from 'vue'; -import Vuex from 'vuex'; -import { MOCK_QUERY } from 'jest/search/mock_data'; import RadioFilter from '~/search/sidebar/components/radio_filter.vue'; import StatusFilter from '~/search/sidebar/components/status_filter.vue'; -Vue.use(Vuex); - describe('StatusFilter', () => { let wrapper; - const actionSpies = { - applyQuery: jest.fn(), - resetQuery: jest.fn(), - }; - - const createComponent = (initialState) => { - const store = new Vuex.Store({ - state: { - query: MOCK_QUERY, - ...initialState, - }, - actions: actionSpies, - }); - + const createComponent = (initProps) => { wrapper = shallowMount(StatusFilter, { - store, + ...initProps, }); }; - afterEach(() => { - wrapper.destroy(); - wrapper = null; - }); - const findRadioFilter = () => wrapper.findComponent(RadioFilter); describe('template', () => { @@ -41,24 +18,28 @@ describe('StatusFilter', () => { createComponent(); }); - describe.each` - scope | showFilter - ${'issues'} | ${true} - ${'merge_requests'} | ${true} - ${'projects'} | ${false} - ${'milestones'} | ${false} - ${'users'} | ${false} - ${'notes'} | ${false} - ${'wiki_blobs'} | ${false} - ${'blobs'} | ${false} - `(`dropdown`, ({ scope, showFilter }) => { - beforeEach(() => { - createComponent({ query: { scope } }); - }); + it('renders the component', () => { + expect(findRadioFilter().exists()).toBe(true); + }); + }); - it(`does${showFilter ? '' : ' not'} render when scope is ${scope}`, () => { - expect(findRadioFilter().exists()).toBe(showFilter); + describe.each` + hasFeatureFlagEnabled | paddingClass + ${true} | ${'gl-px-5'} + ${false} | ${'gl-px-0'} + `(`RadioFilter`, ({ hasFeatureFlagEnabled, paddingClass }) => { + beforeEach(() => { + createComponent({ + provide: { + glFeatures: { + searchPageVerticalNav: hasFeatureFlagEnabled, + }, + }, }); }); + + it(`has ${paddingClass} class`, () => { + expect(findRadioFilter().classes(paddingClass)).toBe(true); + }); }); }); diff --git a/spec/support/shared_examples/lib/gitlab/usage_data_counters/issuable_activity_shared_examples.rb b/spec/support/shared_examples/lib/gitlab/usage_data_counters/issuable_activity_shared_examples.rb index 481e11bcf0e..d4802a19202 100644 --- a/spec/support/shared_examples/lib/gitlab/usage_data_counters/issuable_activity_shared_examples.rb +++ b/spec/support/shared_examples/lib/gitlab/usage_data_counters/issuable_activity_shared_examples.rb @@ -1,38 +1,5 @@ # frozen_string_literal: true -RSpec.shared_examples 'a daily tracked issuable event' do - before do - stub_application_setting(usage_ping_enabled: true) - end - - def count_unique(date_from: 1.minute.ago, date_to: 1.minute.from_now) - Gitlab::UsageDataCounters::HLLRedisCounter.unique_events(event_names: action, start_date: date_from, end_date: date_to) - end - - specify do - aggregate_failures do - expect(track_action(author: user1)).to be_truthy - expect(track_action(author: user1)).to be_truthy - expect(track_action(author: user2)).to be_truthy - expect(count_unique).to eq(2) - end - end - - it 'does not track edit actions if author is not present' do - expect(track_action(author: nil)).to be_nil - end -end - -RSpec.shared_examples 'does not track when feature flag is disabled' do |feature_flag| - context "when feature flag #{feature_flag} is disabled" do - it 'does not track action' do - stub_feature_flags(feature_flag => false) - - expect(track_action(author: user1)).to be_nil - end - end -end - RSpec.shared_examples 'a daily tracked issuable snowplow and service ping events for given event params' do before do stub_application_setting(usage_ping_enabled: true) @@ -76,15 +43,27 @@ end RSpec.shared_examples 'daily tracked issuable snowplow and service ping events with project' do it_behaves_like 'a daily tracked issuable snowplow and service ping events for given event params' do + let(:context) do + Gitlab::Tracking::ServicePingContext + .new(data_source: :redis_hll, event: event_property) + .to_h + end + let(:track_params) { { project: project } } - let(:event_params) { track_params.merge(label: event_label, property: event_property, namespace: project.namespace) } + let(:event_params) { track_params.merge(label: event_label, property: event_property, namespace: project.namespace, context: [context]) } end end RSpec.shared_examples 'a daily tracked issuable snowplow and service ping events with namespace' do it_behaves_like 'a daily tracked issuable snowplow and service ping events for given event params' do + let(:context) do + Gitlab::Tracking::ServicePingContext + .new(data_source: :redis_hll, event: event_property) + .to_h + end + let(:track_params) { { namespace: namespace } } - let(:event_params) { track_params.merge(label: event_label, property: event_property) } + let(:event_params) { track_params.merge(label: event_label, property: event_property, context: [context]) } end end diff --git a/spec/support/shared_examples/services/snowplow_tracking_shared_examples.rb b/spec/support/shared_examples/services/snowplow_tracking_shared_examples.rb index 31919a4263d..e72e8e79411 100644 --- a/spec/support/shared_examples/services/snowplow_tracking_shared_examples.rb +++ b/spec/support/shared_examples/services/snowplow_tracking_shared_examples.rb @@ -7,5 +7,5 @@ RSpec.shared_examples 'issue_edit snowplow tracking' do let(:namespace) { project.namespace } let(:feature_flag_name) { :route_hll_to_snowplow_phase2 } - it_behaves_like 'Snowplow event tracking' + it_behaves_like 'Snowplow event tracking with RedisHLL context' end |