Commit 268be250 authored by Nicolò Maria Mezzopera's avatar Nicolò Maria Mezzopera

Merge branch 'remove-EventListeners-from-analytics-pages' into 'master'

Remove DOMContentLoaded Eventlistener

See merge request gitlab-org/gitlab!47648
parents aa7b4408 e573e772
document.addEventListener('DOMContentLoaded', () => { const licenseFile = document.querySelector('.license-file');
const licenseFile = document.querySelector('.license-file'); const licenseKey = document.querySelector('.license-key');
const licenseKey = document.querySelector('.license-key'); const acceptEULACheckBox = document.querySelector('#accept_eula');
const acceptEULACheckBox = document.querySelector('#accept_eula'); const uploadLicenseBtn = document.querySelector('#js-upload-license');
const uploadLicenseBtn = document.querySelector('#js-upload-license'); const licenseType = document.querySelectorAll('input[name="license_type"]');
const licenseType = document.querySelectorAll('input[name="license_type"]');
const showLicenseType = () => { const showLicenseType = () => {
const checkedFile = const checkedFile = document.querySelector('input[name="license_type"]:checked').value === 'file';
document.querySelector('input[name="license_type"]:checked').value === 'file';
licenseFile.classList.toggle('hidden', !checkedFile); licenseFile.classList.toggle('hidden', !checkedFile);
licenseKey.classList.toggle('hidden', checkedFile); licenseKey.classList.toggle('hidden', checkedFile);
}; };
const toggleUploadLicenseButton = () => { const toggleUploadLicenseButton = () => {
uploadLicenseBtn.toggleAttribute('disabled', !acceptEULACheckBox.checked); uploadLicenseBtn.toggleAttribute('disabled', !acceptEULACheckBox.checked);
}; };
licenseType.forEach(el => el.addEventListener('change', showLicenseType)); licenseType.forEach(el => el.addEventListener('change', showLicenseType));
acceptEULACheckBox.addEventListener('change', toggleUploadLicenseButton); acceptEULACheckBox.addEventListener('change', toggleUploadLicenseButton);
showLicenseType(); showLicenseType();
});
import initCodeReviewAnalyticsApp from 'ee/analytics/code_review_analytics/code_review_analytics_bundle'; import initCodeReviewAnalyticsApp from 'ee/analytics/code_review_analytics/code_review_analytics_bundle';
document.addEventListener('DOMContentLoaded', () => { initCodeReviewAnalyticsApp();
initCodeReviewAnalyticsApp();
});
import initIssuesAnalytics from 'ee/issues_analytics'; import initIssuesAnalytics from 'ee/issues_analytics';
document.addEventListener('DOMContentLoaded', () => { initIssuesAnalytics();
initIssuesAnalytics();
});
import initMergeRequestAnalyticsApp from 'ee/analytics/merge_request_analytics'; import initMergeRequestAnalyticsApp from 'ee/analytics/merge_request_analytics';
document.addEventListener('DOMContentLoaded', initMergeRequestAnalyticsApp); initMergeRequestAnalyticsApp();
import initLicenseComplianceApp from 'ee/license_compliance'; import initLicenseComplianceApp from 'ee/license_compliance';
document.addEventListener('DOMContentLoaded', initLicenseComplianceApp); initLicenseComplianceApp();
import initSidebarBundle from '~/sidebar/sidebar_bundle'; import initSidebarBundle from '~/sidebar/sidebar_bundle';
import initMergeConflicts from '~/merge_conflicts/merge_conflicts_bundle'; import initMergeConflicts from '~/merge_conflicts/merge_conflicts_bundle';
document.addEventListener('DOMContentLoaded', () => { initSidebarBundle();
initSidebarBundle(); initMergeConflicts();
initMergeConflicts();
});
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