Add latest changes from gitlab-org/gitlab@master

This commit is contained in:
GitLab Bot 2020-09-12 03:09:29 +00:00
parent 0f5dcf55e5
commit 8ca719f247
3 changed files with 26 additions and 18 deletions

View file

@ -111,18 +111,21 @@ function deferredInitialisation() {
initPersistentUserCallouts();
initDefaultTrackers();
document.querySelector('#search').addEventListener(
'focus',
() => {
import(/* webpackChunkName: 'globalSearch' */ './search_autocomplete')
.then(({ default: initSearchAutocomplete }) => {
const searchDropdown = initSearchAutocomplete();
searchDropdown.onSearchInputFocus();
})
.catch(() => {});
},
{ once: true },
);
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');

View file

@ -5,14 +5,15 @@ import axios from '~/lib/utils/axios_utils';
import PerformanceBarService from './services/performance_bar_service';
import PerformanceBarStore from './stores/performance_bar_store';
const initPerformanceBar = ({ container }) =>
new Vue({
el: container,
const initPerformanceBar = el => {
const performanceBarData = el.dataset;
return new Vue({
el,
components: {
PerformanceBarApp: () => import('./components/performance_bar_app.vue'),
},
data() {
const performanceBarData = document.querySelector(this.$options.el).dataset;
const store = new PerformanceBarStore();
return {
@ -118,9 +119,13 @@ const initPerformanceBar = ({ container }) =>
});
},
});
};
document.addEventListener('DOMContentLoaded', () => {
initPerformanceBar({ container: '#js-peek' });
const jsPeek = document.querySelector('#js-peek');
if (jsPeek) {
initPerformanceBar(jsPeek);
}
});
export default initPerformanceBar;

View file

@ -44,7 +44,7 @@ describe('performance bar wrapper', () => {
{},
);
vm = performanceBar({ container: '#js-peek' });
vm = performanceBar(peekWrapper);
});
afterEach(() => {