diff options
Diffstat (limited to 'app/assets/javascripts/search')
-rw-r--r-- | app/assets/javascripts/search/index.js | 2 | ||||
-rw-r--r-- | app/assets/javascripts/search/sidebar/components/app.vue | 23 | ||||
-rw-r--r-- | app/assets/javascripts/search/sidebar/components/scope_legacy_navigation.vue (renamed from app/assets/javascripts/search/sidebar/components/scope_navigation.vue) | 2 | ||||
-rw-r--r-- | app/assets/javascripts/search/sidebar/components/scope_sidebar_navigation.vue (renamed from app/assets/javascripts/search/sidebar/components/scope_new_navigation.vue) | 2 | ||||
-rw-r--r-- | app/assets/javascripts/search/store/index.js | 4 | ||||
-rw-r--r-- | app/assets/javascripts/search/store/state.js | 4 |
6 files changed, 20 insertions, 17 deletions
diff --git a/app/assets/javascripts/search/index.js b/app/assets/javascripts/search/index.js index 1e4b1e36514..f5684cebbf9 100644 --- a/app/assets/javascripts/search/index.js +++ b/app/assets/javascripts/search/index.js @@ -15,7 +15,7 @@ export const initSearchApp = () => { const store = createStore({ query, navigation, - useNewNavigation: gon.use_new_navigation, + useSidebarNavigation: gon.use_new_navigation, }); initTopbar(store); diff --git a/app/assets/javascripts/search/sidebar/components/app.vue b/app/assets/javascripts/search/sidebar/components/app.vue index 317145d4cd1..7046a57058d 100644 --- a/app/assets/javascripts/search/sidebar/components/app.vue +++ b/app/assets/javascripts/search/sidebar/components/app.vue @@ -1,7 +1,7 @@ <script> import { mapState, mapGetters } from 'vuex'; -import ScopeNavigation from '~/search/sidebar/components/scope_navigation.vue'; -import ScopeNewNavigation from '~/search/sidebar/components/scope_new_navigation.vue'; +import ScopeLegacyNavigation from '~/search/sidebar/components/scope_legacy_navigation.vue'; +import ScopeSidebarNavigation from '~/search/sidebar/components/scope_sidebar_navigation.vue'; import SidebarPortal from '~/super_sidebar/components/sidebar_portal.vue'; import { SCOPE_ISSUES, SCOPE_MERGE_REQUESTS, SCOPE_BLOB } from '../constants'; import ResultsFilters from './results_filters.vue'; @@ -11,13 +11,14 @@ export default { name: 'GlobalSearchSidebar', components: { ResultsFilters, - ScopeNavigation, - ScopeNewNavigation, + ScopeLegacyNavigation, + ScopeSidebarNavigation, LanguageFilter, SidebarPortal, }, computed: { - ...mapState(['urlQuery', 'useNewNavigation']), + // useSidebarNavigation refers to whether the new left sidebar navigation is enabled + ...mapState(['useSidebarNavigation']), ...mapGetters(['currentScope']), showIssueAndMergeFilters() { return this.currentScope === SCOPE_ISSUES || this.currentScope === SCOPE_MERGE_REQUESTS; @@ -25,7 +26,9 @@ export default { showBlobFilter() { return this.currentScope === SCOPE_BLOB; }, - showOldNavigation() { + showScopeNavigation() { + // showLegacyNavigation refers to whether the scope navigation should be shown + // while the legacy navigation is being used and there are no search results the scope navigation has to be hidden return Boolean(this.currentScope); }, }, @@ -33,18 +36,18 @@ export default { </script> <template> - <section v-if="useNewNavigation"> + <section v-if="useSidebarNavigation"> <sidebar-portal> - <scope-new-navigation /> + <scope-sidebar-navigation /> <results-filters v-if="showIssueAndMergeFilters" /> <language-filter v-if="showBlobFilter" /> </sidebar-portal> </section> <section - v-else + v-else-if="showScopeNavigation" class="search-sidebar gl-display-flex gl-flex-direction-column gl-md-mr-5 gl-mb-6 gl-mt-5" > - <scope-navigation /> + <scope-legacy-navigation /> <results-filters v-if="showIssueAndMergeFilters" /> <language-filter v-if="showBlobFilter" /> </section> diff --git a/app/assets/javascripts/search/sidebar/components/scope_navigation.vue b/app/assets/javascripts/search/sidebar/components/scope_legacy_navigation.vue index fc41baee831..e682369d60b 100644 --- a/app/assets/javascripts/search/sidebar/components/scope_navigation.vue +++ b/app/assets/javascripts/search/sidebar/components/scope_legacy_navigation.vue @@ -8,7 +8,7 @@ import { NAV_LINK_DEFAULT_CLASSES, NAV_LINK_COUNT_DEFAULT_CLASSES } from '../con import { slugifyWithUnderscore } from '../../../lib/utils/text_utility'; export default { - name: 'ScopeNavigation', + name: 'ScopeLegacyNavigation', i18n: { countOverLimitLabel: s__('GlobalSearch|Result count is over limit.'), }, diff --git a/app/assets/javascripts/search/sidebar/components/scope_new_navigation.vue b/app/assets/javascripts/search/sidebar/components/scope_sidebar_navigation.vue index 86b7cc577a6..3707e152e47 100644 --- a/app/assets/javascripts/search/sidebar/components/scope_new_navigation.vue +++ b/app/assets/javascripts/search/sidebar/components/scope_sidebar_navigation.vue @@ -6,7 +6,7 @@ import NavItem from '~/super_sidebar/components/nav_item.vue'; import { NAV_LINK_DEFAULT_CLASSES, NAV_LINK_COUNT_DEFAULT_CLASSES } from '../constants'; export default { - name: 'ScopeNewNavigation', + name: 'ScopeSidebarNavigation', i18n: { countOverLimitLabel: s__('GlobalSearch|Result count is over limit.'), }, diff --git a/app/assets/javascripts/search/store/index.js b/app/assets/javascripts/search/store/index.js index 634f8f7a7fa..2478518c157 100644 --- a/app/assets/javascripts/search/store/index.js +++ b/app/assets/javascripts/search/store/index.js @@ -7,11 +7,11 @@ import createState from './state'; Vue.use(Vuex); -export const getStoreConfig = ({ query, navigation, useNewNavigation }) => ({ +export const getStoreConfig = (storeInitValues) => ({ actions, getters, mutations, - state: createState({ query, navigation, useNewNavigation }), + state: createState(storeInitValues), }); const createStore = (config) => new Vuex.Store(getStoreConfig(config)); diff --git a/app/assets/javascripts/search/store/state.js b/app/assets/javascripts/search/store/state.js index a62b6728819..c897d4108a8 100644 --- a/app/assets/javascripts/search/store/state.js +++ b/app/assets/javascripts/search/store/state.js @@ -1,7 +1,7 @@ import { cloneDeep } from 'lodash'; import { GROUPS_LOCAL_STORAGE_KEY, PROJECTS_LOCAL_STORAGE_KEY } from './constants'; -const createState = ({ query, navigation, useNewNavigation }) => ({ +const createState = ({ query, navigation, useSidebarNavigation }) => ({ urlQuery: cloneDeep(query), query, groups: [], @@ -14,7 +14,7 @@ const createState = ({ query, navigation, useNewNavigation }) => ({ }, sidebarDirty: false, navigation, - useNewNavigation, + useSidebarNavigation, aggregations: { error: false, fetching: false, |