2021-01-22 04:08:53 -05:00
|
|
|
import setHighlightClass from 'ee_else_ce/search/highlight_blob_search_result';
|
|
|
|
import Project from '~/pages/projects/project';
|
2021-02-12 04:08:48 -05:00
|
|
|
import refreshCounts from '~/pages/search/show/refresh_counts';
|
2020-10-08 14:08:32 -04:00
|
|
|
import { queryToObject } from '~/lib/utils/url_utility';
|
|
|
|
import createStore from './store';
|
2020-12-03 16:09:35 -05:00
|
|
|
import { initTopbar } from './topbar';
|
2020-11-06 01:08:51 -05:00
|
|
|
import { initSidebar } from './sidebar';
|
2021-02-02 13:09:42 -05:00
|
|
|
import { initSearchSort } from './sort';
|
2020-10-08 14:08:32 -04:00
|
|
|
|
2020-11-16 19:09:16 -05:00
|
|
|
export const initSearchApp = () => {
|
|
|
|
// Similar to url_utility.decodeUrlParameter
|
|
|
|
// Our query treats + as %20. This replaces the query + symbols with %20.
|
|
|
|
const sanitizedSearch = window.location.search.replace(/\+/g, '%20');
|
2021-01-22 04:08:53 -05:00
|
|
|
const query = queryToObject(sanitizedSearch);
|
|
|
|
|
|
|
|
const store = createStore({ query });
|
2020-11-10 19:08:58 -05:00
|
|
|
|
2020-12-03 16:09:35 -05:00
|
|
|
initTopbar(store);
|
2020-11-16 19:09:16 -05:00
|
|
|
initSidebar(store);
|
2021-02-02 13:09:42 -05:00
|
|
|
initSearchSort(store);
|
2021-01-22 04:08:53 -05:00
|
|
|
|
|
|
|
setHighlightClass(query.search); // Code Highlighting
|
2021-02-12 04:08:48 -05:00
|
|
|
refreshCounts(); // Other Scope Tab Counts
|
2021-01-22 04:08:53 -05:00
|
|
|
Project.initRefSwitcher(); // Code Search Branch Picker
|
2020-10-08 14:08:32 -04:00
|
|
|
};
|