Commit 9c4f6ecb authored by Enrique Alcántara's avatar Enrique Alcántara

Merge branch 'remove-eventlisteners-setting-pages' into 'master'

Remove DOMContentLoaded Eventlistener

See merge request gitlab-org/gitlab!47621
parents 695735e3 0c766b96
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({
mountPointSelector: '#js-test-cases-list',
});
initTestCaseList({
mountPointSelector: '#js-test-cases-list',
});
import { initTestCaseCreate } from 'ee/test_case_create/test_case_create_bundle';
document.addEventListener('DOMContentLoaded', () => {
initTestCaseCreate({
mountPointSelector: '#js-create-test-case',
});
initTestCaseCreate({
mountPointSelector: '#js-create-test-case',
});
......@@ -6,33 +6,31 @@ 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) {
const store = createStore();
store.dispatch('licenseManagement/setIsAdmin', Boolean(el.dataset.apiUrl));
store.dispatch('licenseManagement/setAPISettings', { apiUrlManageLicenses: el.dataset.apiUrl });
// eslint-disable-next-line no-new
new Vue({
el,
store,
render(createElement) {
return createElement(LicenseManagement, {
props: {
...el.dataset,
},
});
},
});
}
if (el?.dataset?.apiUrl) {
const store = createStore();
store.dispatch('licenseManagement/setIsAdmin', Boolean(el.dataset.apiUrl));
store.dispatch('licenseManagement/setAPISettings', { apiUrlManageLicenses: el.dataset.apiUrl });
// eslint-disable-next-line no-new
new Vue({
el,
store,
render(createElement) {
return createElement(LicenseManagement, {
props: {
...el.dataset,
},
});
},
});
}
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,24 +3,22 @@ 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
.get(countriesEndPoint)
.then(({ data }) => {
// fill #country_select element with array of <option>s
data.forEach(([name, code]) => {
const option = document.createElement('option');
option.value = code;
option.text = name;
axios
.get(countriesEndPoint)
.then(({ data }) => {
// fill #country_select element with array of <option>s
data.forEach(([name, code]) => {
const option = document.createElement('option');
option.value = code;
option.text = name;
selectElement.appendChild(option);
});
$(selectElement)
.val(selectedOption)
.trigger('change.select2');
})
.catch(() => new Flash(__('Error loading countries data.')));
});
selectElement.appendChild(option);
});
$(selectElement)
.val(selectedOption)
.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