Commit 0c766b96 authored by Jannik Lehmann's avatar Jannik Lehmann Committed by Enrique Alcántara

Remove DOMContentLoaded Eventlisteners

Removing DOMContentLoaded Eventlisteners from
index files since the scripts
are embedded using the defer tag.
parent 9546e89c
import initInsights from 'ee/insights';
document.addEventListener('DOMContentLoaded', () => {
initInsights();
});
initInsights();
import initTestCaseList from 'ee/test_case_list/test_case_list_bundle';
document.addEventListener('DOMContentLoaded', () => {
initTestCaseList({
initTestCaseList({
mountPointSelector: '#js-test-cases-list',
});
});
import { initTestCaseCreate } from 'ee/test_case_create/test_case_create_bundle';
document.addEventListener('DOMContentLoaded', () => {
initTestCaseCreate({
initTestCaseCreate({
mountPointSelector: '#js-create-test-case',
});
});
......@@ -6,11 +6,10 @@ import ProtectedEnvironmentEditList from 'ee/protected_environments/protected_en
import showToast from '~/vue_shared/plugins/global_toast';
import '~/pages/projects/settings/ci_cd/show/index';
document.addEventListener('DOMContentLoaded', () => {
const el = document.getElementById('js-managed-licenses');
const toasts = document.querySelectorAll('.js-toast-message');
const el = document.getElementById('js-managed-licenses');
const toasts = document.querySelectorAll('.js-toast-message');
if (el && el.dataset && el.dataset.apiUrl) {
if (el?.dataset?.apiUrl) {
const store = createStore();
store.dispatch('licenseManagement/setIsAdmin', Boolean(el.dataset.apiUrl));
store.dispatch('licenseManagement/setAPISettings', { apiUrlManageLicenses: el.dataset.apiUrl });
......@@ -26,13 +25,12 @@ document.addEventListener('DOMContentLoaded', () => {
});
},
});
}
}
toasts.forEach(toast => showToast(toast.dataset.message));
toasts.forEach(toast => showToast(toast.dataset.message));
// eslint-disable-next-line no-new
new ProtectedEnvironmentCreate();
// eslint-disable-next-line no-new
new ProtectedEnvironmentCreate();
// eslint-disable-next-line no-new
new ProtectedEnvironmentEditList();
});
// eslint-disable-next-line no-new
new ProtectedEnvironmentEditList();
......@@ -3,11 +3,10 @@ import axios from '~/lib/utils/axios_utils';
import { __ } from '~/locale';
import { deprecatedCreateFlash as Flash } from '~/flash';
document.addEventListener('DOMContentLoaded', () => {
const selectElement = document.getElementById('country_select');
const { countriesEndPoint, selectedOption } = selectElement.dataset;
const selectElement = document.getElementById('country_select');
const { countriesEndPoint, selectedOption } = selectElement.dataset;
axios
axios
.get(countriesEndPoint)
.then(({ data }) => {
// fill #country_select element with array of <option>s
......@@ -23,4 +22,3 @@ document.addEventListener('DOMContentLoaded', () => {
.trigger('change.select2');
})
.catch(() => new Flash(__('Error loading countries data.')));
});
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment