diff options
Diffstat (limited to 'app/assets/javascripts/main.js')
-rw-r--r-- | app/assets/javascripts/main.js | 37 |
1 files changed, 23 insertions, 14 deletions
diff --git a/app/assets/javascripts/main.js b/app/assets/javascripts/main.js index 1aaefcaa13b..b96a2607552 100644 --- a/app/assets/javascripts/main.js +++ b/app/assets/javascripts/main.js @@ -19,6 +19,7 @@ import initAlertHandler from './alert_handler'; import { removeFlashClickListener } from './flash'; import initTodoToggle from './header'; import initLayoutNav from './layout_nav'; +import { logHelloDeferred } from './lib/logger/hello_deferred'; import { handleLocationHash, addSelectOnFocusBehaviour } from './lib/utils/common_utils'; import { localTimeAgo } from './lib/utils/datetime/timeago_utility'; import { getLocationHash, visitUrl } from './lib/utils/url_utility'; @@ -35,8 +36,12 @@ import GlFieldErrors from './gl_field_errors'; import initUserPopovers from './user_popovers'; import initBroadcastNotifications from './broadcast_notification'; import { initTopNav } from './nav'; +import { initHeaderSearchApp } from '~/header_search'; import 'ee_else_ce/main_ee'; +import 'jh_else_ce/main_jh'; + +logHelloDeferred(); applyGitLabUIConfig(); @@ -94,20 +99,24 @@ function deferredInitialisation() { initDefaultTrackers(); initFeatureHighlight(); - const search = document.querySelector('#search'); - if (search) { - search.addEventListener( - 'focus', - () => { - import(/* webpackChunkName: 'globalSearch' */ './search_autocomplete') - .then(({ default: initSearchAutocomplete }) => { - const searchDropdown = initSearchAutocomplete(); - searchDropdown.onSearchInputFocus(); - }) - .catch(() => {}); - }, - { once: true }, - ); + if (gon.features?.newHeaderSearch) { + initHeaderSearchApp(); + } else { + const search = document.querySelector('#search'); + if (search) { + search.addEventListener( + 'focus', + () => { + import(/* webpackChunkName: 'globalSearch' */ './search_autocomplete') + .then(({ default: initSearchAutocomplete }) => { + const searchDropdown = initSearchAutocomplete(); + searchDropdown.onSearchInputFocus(); + }) + .catch(() => {}); + }, + { once: true }, + ); + } } addSelectOnFocusBehaviour('.js-select-on-focus'); |