diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-02-18 10:34:06 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-02-18 10:34:06 +0000 |
commit | 859a6fb938bb9ee2a317c46dfa4fcc1af49608f0 (patch) | |
tree | d7f2700abe6b4ffcb2dcfc80631b2d87d0609239 /app/assets/javascripts/search/topbar/index.js | |
parent | 446d496a6d000c73a304be52587cd9bbc7493136 (diff) | |
download | gitlab-ce-859a6fb938bb9ee2a317c46dfa4fcc1af49608f0.tar.gz |
Add latest changes from gitlab-org/gitlab@13-9-stable-eev13.9.0-rc42
Diffstat (limited to 'app/assets/javascripts/search/topbar/index.js')
-rw-r--r-- | app/assets/javascripts/search/topbar/index.js | 31 |
1 files changed, 9 insertions, 22 deletions
diff --git a/app/assets/javascripts/search/topbar/index.js b/app/assets/javascripts/search/topbar/index.js index f0308109b32..87316e10e8d 100644 --- a/app/assets/javascripts/search/topbar/index.js +++ b/app/assets/javascripts/search/topbar/index.js @@ -1,44 +1,31 @@ import Vue from 'vue'; import Translate from '~/vue_shared/translate'; -import GroupFilter from './components/group_filter.vue'; -import ProjectFilter from './components/project_filter.vue'; +import GlobalSearchTopbar from './components/app.vue'; Vue.use(Translate); -const mountSearchableDropdown = (store, { id, component }) => { - const el = document.getElementById(id); +export const initTopbar = (store) => { + const el = document.getElementById('js-search-topbar'); if (!el) { return false; } - let { initialData } = el.dataset; + let { groupInitialData, projectInitialData } = el.dataset; - initialData = JSON.parse(initialData); + groupInitialData = JSON.parse(groupInitialData); + projectInitialData = JSON.parse(projectInitialData); return new Vue({ el, store, render(createElement) { - return createElement(component, { + return createElement(GlobalSearchTopbar, { props: { - initialData, + groupInitialData, + projectInitialData, }, }); }, }); }; - -const searchableDropdowns = [ - { - id: 'js-search-group-dropdown', - component: GroupFilter, - }, - { - id: 'js-search-project-dropdown', - component: ProjectFilter, - }, -]; - -export const initTopbar = (store) => - searchableDropdowns.map((dropdown) => mountSearchableDropdown(store, dropdown)); |