diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-03-16 09:11:11 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-03-16 09:11:11 +0300 |
commit | 79767d781a739ab0ac4370ab20a4dbd3dd4e0f02 (patch) | |
tree | a25eacb245a68f14311fa19feb3f421b047004f0 /app/assets/javascripts/search | |
parent | f6557be1fb0b2fc0eb48b670002ac07fb8eb591c (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets/javascripts/search')
4 files changed, 13 insertions, 16 deletions
diff --git a/app/assets/javascripts/search/sidebar/components/checkbox_filter.vue b/app/assets/javascripts/search/sidebar/components/checkbox_filter.vue index 3784f08adcc..f7873a994aa 100644 --- a/app/assets/javascripts/search/sidebar/components/checkbox_filter.vue +++ b/app/assets/javascripts/search/sidebar/components/checkbox_filter.vue @@ -20,9 +20,6 @@ export default { computed: { ...mapState(['query']), ...mapGetters(['queryLanguageFilters']), - scope() { - return this.query.scope; - }, dataFilters() { return Object.values(this.filtersData?.filters || []); }, diff --git a/app/assets/javascripts/search/sidebar/components/radio_filter.vue b/app/assets/javascripts/search/sidebar/components/radio_filter.vue index aa7c26b8044..0733dc72d2e 100644 --- a/app/assets/javascripts/search/sidebar/components/radio_filter.vue +++ b/app/assets/javascripts/search/sidebar/components/radio_filter.vue @@ -1,6 +1,6 @@ <script> import { GlFormRadioGroup, GlFormRadio } from '@gitlab/ui'; -import { mapState, mapActions } from 'vuex'; +import { mapState, mapActions, mapGetters } from 'vuex'; import { sprintf, __ } from '~/locale'; export default { @@ -17,12 +17,10 @@ export default { }, computed: { ...mapState(['query']), + ...mapGetters(['currentScope']), ANY() { return this.filterData.filters.ANY; }, - scope() { - return this.query.scope; - }, initialFilter() { return this.query[this.filterData.filterParam]; }, @@ -30,7 +28,7 @@ export default { return this.initialFilter || this.ANY.value; }, filtersArray() { - return this.filterData.filterByScope[this.scope]; + return this.filterData.filterByScope[this.currentScope]; }, selectedFilter: { get() { diff --git a/app/assets/javascripts/search/sidebar/components/results_filters.vue b/app/assets/javascripts/search/sidebar/components/results_filters.vue index 4d9cc9d6450..7d995f26684 100644 --- a/app/assets/javascripts/search/sidebar/components/results_filters.vue +++ b/app/assets/javascripts/search/sidebar/components/results_filters.vue @@ -1,6 +1,6 @@ <script> import { GlButton, GlLink } from '@gitlab/ui'; -import { mapActions, mapState } from 'vuex'; +import { mapActions, mapState, mapGetters } from 'vuex'; import { confidentialFilterData } from '../constants/confidential_filter_data'; import { stateFilterData } from '../constants/state_filter_data'; import ConfidentialityFilter from './confidentiality_filter.vue'; @@ -16,14 +16,15 @@ export default { }, computed: { ...mapState(['urlQuery', 'sidebarDirty']), + ...mapGetters(['currentScope']), showReset() { return this.urlQuery.state || this.urlQuery.confidential; }, showConfidentialityFilter() { - return Object.values(confidentialFilterData.scopes).includes(this.urlQuery.scope); + return Object.values(confidentialFilterData.scopes).includes(this.currentScope); }, showStatusFilter() { - return Object.values(stateFilterData.scopes).includes(this.urlQuery.scope); + return Object.values(stateFilterData.scopes).includes(this.currentScope); }, }, methods: { diff --git a/app/assets/javascripts/search/store/actions.js b/app/assets/javascripts/search/store/actions.js index cd89234a231..da2bf4b602e 100644 --- a/app/assets/javascripts/search/store/actions.js +++ b/app/assets/javascripts/search/store/actions.js @@ -121,13 +121,13 @@ export const resetLanguageQuery = ({ commit }) => { }; export const fetchSidebarCount = ({ commit, state }) => { - const promises = Object.keys(state.navigation).map((scope) => { + const promises = Object.values(state.navigation).map((navItem) => { // active nav item has count already so we skip it - if (scope !== state.urlQuery.scope) { + if (!navItem.active) { return axios - .get(state.navigation[scope].count_link) + .get(navItem.count_link) .then(({ data: { count } }) => { - commit(types.RECEIVE_NAVIGATION_COUNT, { key: scope, count }); + commit(types.RECEIVE_NAVIGATION_COUNT, { key: navItem.scope, count }); }) .catch((e) => logError(e)); } @@ -140,7 +140,8 @@ export const fetchLanguageAggregation = ({ commit, state }) => { commit(types.REQUEST_AGGREGATIONS); return axios .get(getAggregationsUrl()) - .then(({ data }) => { + .then((result) => { + const { data } = result; commit(types.RECEIVE_AGGREGATIONS_SUCCESS, prepareSearchAggregations(state, data)); }) .catch((e) => { |