2021-02-22 17:27:13 +05:30
|
|
|
import Vue from 'vue';
|
|
|
|
import Translate from '~/vue_shared/translate';
|
2021-03-11 19:13:27 +05:30
|
|
|
import GlobalSearchTopbar from './components/app.vue';
|
2021-02-22 17:27:13 +05:30
|
|
|
|
|
|
|
Vue.use(Translate);
|
|
|
|
|
2021-03-11 19:13:27 +05:30
|
|
|
export const initTopbar = (store) => {
|
|
|
|
const el = document.getElementById('js-search-topbar');
|
2021-02-22 17:27:13 +05:30
|
|
|
|
|
|
|
if (!el) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2023-03-04 22:38:38 +05:30
|
|
|
const {
|
|
|
|
groupInitialJson,
|
|
|
|
projectInitialJson,
|
|
|
|
elasticsearchEnabled,
|
|
|
|
defaultBranchName,
|
|
|
|
} = el.dataset;
|
2021-02-22 17:27:13 +05:30
|
|
|
|
2023-03-04 22:38:38 +05:30
|
|
|
const groupInitialJsonParsed = JSON.parse(groupInitialJson);
|
|
|
|
const projectInitialJsonParsed = JSON.parse(projectInitialJson);
|
|
|
|
const elasticsearchEnabledParsed = elasticsearchEnabled
|
|
|
|
? JSON.parse(elasticsearchEnabled)
|
|
|
|
: false;
|
2021-02-22 17:27:13 +05:30
|
|
|
|
|
|
|
return new Vue({
|
|
|
|
el,
|
|
|
|
store,
|
|
|
|
render(createElement) {
|
2021-03-11 19:13:27 +05:30
|
|
|
return createElement(GlobalSearchTopbar, {
|
2021-02-22 17:27:13 +05:30
|
|
|
props: {
|
2023-03-04 22:38:38 +05:30
|
|
|
groupInitialJson: groupInitialJsonParsed,
|
|
|
|
projectInitialJson: projectInitialJsonParsed,
|
|
|
|
elasticsearchEnabled: elasticsearchEnabledParsed,
|
|
|
|
defaultBranchName,
|
2021-02-22 17:27:13 +05:30
|
|
|
},
|
|
|
|
});
|
|
|
|
},
|
|
|
|
});
|
|
|
|
};
|