diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-09-06 21:09:15 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-09-06 21:09:15 +0300 |
commit | f011d78ffe71ec6778c8eb9ad981a6dbadd3a4dc (patch) | |
tree | b1a3daf03bbbdc560c1ab74d702ef671c8f13dfe /app/assets/javascripts/search | |
parent | 74739c4b9e2ced14233eaeee221c5472589d26cd (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets/javascripts/search')
-rw-r--r-- | app/assets/javascripts/search/index.js | 3 | ||||
-rw-r--r-- | app/assets/javascripts/search/sidebar/components/app.vue | 12 | ||||
-rw-r--r-- | app/assets/javascripts/search/sidebar/constants/index.js | 4 | ||||
-rw-r--r-- | app/assets/javascripts/search/sidebar/index.js | 6 | ||||
-rw-r--r-- | app/assets/javascripts/search/store/state.js | 3 |
5 files changed, 21 insertions, 7 deletions
diff --git a/app/assets/javascripts/search/index.js b/app/assets/javascripts/search/index.js index f5684cebbf9..f83130213f2 100644 --- a/app/assets/javascripts/search/index.js +++ b/app/assets/javascripts/search/index.js @@ -10,12 +10,13 @@ import { initBlobRefSwitcher } from './under_topbar'; export const initSearchApp = () => { syntaxHighlight(document.querySelectorAll('.js-search-results')); const query = queryToObject(window.location.search, { gatherArrays: true }); - const { navigationJsonParsed: navigation } = sidebarInitState() || {}; + const { navigationJsonParsed: navigation, searchType } = sidebarInitState() || {}; const store = createStore({ query, navigation, useSidebarNavigation: gon.use_new_navigation, + searchType, }); initTopbar(store); diff --git a/app/assets/javascripts/search/sidebar/components/app.vue b/app/assets/javascripts/search/sidebar/components/app.vue index e556c813d8e..eb7971a9d5a 100644 --- a/app/assets/javascripts/search/sidebar/components/app.vue +++ b/app/assets/javascripts/search/sidebar/components/app.vue @@ -5,7 +5,13 @@ import ScopeLegacyNavigation from '~/search/sidebar/components/scope_legacy_navi import ScopeSidebarNavigation from '~/search/sidebar/components/scope_sidebar_navigation.vue'; import SidebarPortal from '~/super_sidebar/components/sidebar_portal.vue'; import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin'; -import { SCOPE_ISSUES, SCOPE_MERGE_REQUESTS, SCOPE_BLOB, SCOPE_PROJECTS } from '../constants'; +import { + SCOPE_ISSUES, + SCOPE_MERGE_REQUESTS, + SCOPE_BLOB, + SCOPE_PROJECTS, + SEARCH_TYPE_ADVANCED, +} from '../constants'; import IssuesFilters from './issues_filters.vue'; import MergeRequestsFilters from './merge_requests_filters.vue'; import BlobsFilters from './blobs_filters.vue'; @@ -25,7 +31,7 @@ export default { mixins: [glFeatureFlagsMixin()], computed: { // useSidebarNavigation refers to whether the new left sidebar navigation is enabled - ...mapState(['useSidebarNavigation']), + ...mapState(['useSidebarNavigation', 'searchType']), ...mapGetters(['currentScope']), showIssuesFilters() { return this.currentScope === SCOPE_ISSUES; @@ -34,7 +40,7 @@ export default { return this.currentScope === SCOPE_MERGE_REQUESTS; }, showBlobFilters() { - return this.currentScope === SCOPE_BLOB; + return this.currentScope === SCOPE_BLOB && this.searchType === SEARCH_TYPE_ADVANCED; }, showProjectsFilters() { // for now the feature flag is here. Since we have only one filter in projects scope diff --git a/app/assets/javascripts/search/sidebar/constants/index.js b/app/assets/javascripts/search/sidebar/constants/index.js index 01d0aad206c..e5b803b92cb 100644 --- a/app/assets/javascripts/search/sidebar/constants/index.js +++ b/app/assets/javascripts/search/sidebar/constants/index.js @@ -19,3 +19,7 @@ export const ONLY_SHOW_MD = ['gl-display-none', 'gl-md-display-block']; export const TRACKING_ACTION_CLICK = 'search:filters:click'; export const TRACKING_LABEL_APPLY = 'Apply Filters'; export const TRACKING_LABEL_RESET = 'Reset Filters'; + +export const SEARCH_TYPE_BASIC = 'basic'; +export const SEARCH_TYPE_ADVANCED = 'advanced'; +export const SEARCH_TYPE_ZOEKT = 'zoekt'; diff --git a/app/assets/javascripts/search/sidebar/index.js b/app/assets/javascripts/search/sidebar/index.js index 415f6f7454c..3a699355dc9 100644 --- a/app/assets/javascripts/search/sidebar/index.js +++ b/app/assets/javascripts/search/sidebar/index.js @@ -8,9 +8,11 @@ export const sidebarInitState = () => { const el = document.getElementById('js-search-sidebar'); if (!el) return {}; - const { navigationJson } = el.dataset; + const { navigationJson, searchType } = el.dataset; + const navigationJsonParsed = JSON.parse(navigationJson); - return { navigationJsonParsed }; + + return { navigationJsonParsed, searchType }; }; export const initSidebar = (store) => { diff --git a/app/assets/javascripts/search/store/state.js b/app/assets/javascripts/search/store/state.js index 5407b08fa83..b4cd2af65ba 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, useSidebarNavigation }) => ({ +const createState = ({ query, navigation, useSidebarNavigation, searchType }) => ({ urlQuery: cloneDeep(query), query, groups: [], @@ -21,6 +21,7 @@ const createState = ({ query, navigation, useSidebarNavigation }) => ({ data: [], }, searchLabelString: '', + searchType, }); export default createState; |