Commit 1c0390c7 authored by Denys Mishunov's avatar Denys Mishunov

Merge branch 'jnnkl-remove-initial-eventlisteners' into 'master'

Remove obsolete DOMContentLoadedEventListener

See merge request gitlab-org/gitlab!67436
parents 4de44833 5192166b
...@@ -4,14 +4,12 @@ import { FILTERED_SEARCH } from '~/pages/constants'; ...@@ -4,14 +4,12 @@ import { FILTERED_SEARCH } from '~/pages/constants';
import initFilteredSearch from '~/pages/search/init_filtered_search'; import initFilteredSearch from '~/pages/search/init_filtered_search';
import projectSelect from '~/project_select'; import projectSelect from '~/project_select';
document.addEventListener('DOMContentLoaded', () => { addExtraTokensForMergeRequests(IssuableFilteredSearchTokenKeys, true);
addExtraTokensForMergeRequests(IssuableFilteredSearchTokenKeys, true);
initFilteredSearch({ initFilteredSearch({
page: FILTERED_SEARCH.MERGE_REQUESTS, page: FILTERED_SEARCH.MERGE_REQUESTS,
filteredSearchTokenKeys: IssuableFilteredSearchTokenKeys, filteredSearchTokenKeys: IssuableFilteredSearchTokenKeys,
useDefaultState: true, useDefaultState: true,
});
projectSelect();
}); });
projectSelect();
import projectSelect from '~/project_select'; import projectSelect from '~/project_select';
document.addEventListener('DOMContentLoaded', projectSelect); projectSelect();
...@@ -2,7 +2,7 @@ import GroupsList from '~/groups_list'; ...@@ -2,7 +2,7 @@ import GroupsList from '~/groups_list';
import Landing from '~/landing'; import Landing from '~/landing';
import initGroupsList from '../../../groups'; import initGroupsList from '../../../groups';
document.addEventListener('DOMContentLoaded', () => { function exploreGroups() {
new GroupsList(); // eslint-disable-line no-new new GroupsList(); // eslint-disable-line no-new
initGroupsList(); initGroupsList();
const landingElement = document.querySelector('.js-explore-groups-landing'); const landingElement = document.querySelector('.js-explore-groups-landing');
...@@ -13,4 +13,6 @@ document.addEventListener('DOMContentLoaded', () => { ...@@ -13,4 +13,6 @@ document.addEventListener('DOMContentLoaded', () => {
'explore_groups_landing_dismissed', 'explore_groups_landing_dismissed',
); );
exploreGroupsLanding.toggle(); exploreGroupsLanding.toggle();
}); }
exploreGroups();
...@@ -2,7 +2,5 @@ import $ from 'jquery'; ...@@ -2,7 +2,5 @@ import $ from 'jquery';
import docs from '~/docs/docs_bundle'; import docs from '~/docs/docs_bundle';
import VersionCheckImage from '~/version_check_image'; import VersionCheckImage from '~/version_check_image';
document.addEventListener('DOMContentLoaded', () => { docs();
docs(); VersionCheckImage.bindErrorEvent($('img.js-version-status-badge'));
VersionCheckImage.bindErrorEvent($('img.js-version-status-badge'));
});
import initUIKit from '~/ui_development_kit'; import initUIKit from '~/ui_development_kit';
document.addEventListener('DOMContentLoaded', initUIKit); initUIKit();
...@@ -2,7 +2,7 @@ import Vue from 'vue'; ...@@ -2,7 +2,7 @@ import Vue from 'vue';
import { initStoreFromElement, initPropsFromElement } from '~/import_entities/import_projects'; import { initStoreFromElement, initPropsFromElement } from '~/import_entities/import_projects';
import BitbucketStatusTable from '~/import_entities/import_projects/components/bitbucket_status_table.vue'; import BitbucketStatusTable from '~/import_entities/import_projects/components/bitbucket_status_table.vue';
document.addEventListener('DOMContentLoaded', () => { function importBitBucket() {
const mountElement = document.getElementById('import-projects-mount-element'); const mountElement = document.getElementById('import-projects-mount-element');
if (!mountElement) return undefined; if (!mountElement) return undefined;
...@@ -16,4 +16,6 @@ document.addEventListener('DOMContentLoaded', () => { ...@@ -16,4 +16,6 @@ document.addEventListener('DOMContentLoaded', () => {
return createElement(BitbucketStatusTable, { attrs }); return createElement(BitbucketStatusTable, { attrs });
}, },
}); });
}); }
importBitBucket();
...@@ -2,7 +2,7 @@ import Vue from 'vue'; ...@@ -2,7 +2,7 @@ import Vue from 'vue';
import { initStoreFromElement, initPropsFromElement } from '~/import_entities/import_projects'; import { initStoreFromElement, initPropsFromElement } from '~/import_entities/import_projects';
import BitbucketServerStatusTable from './components/bitbucket_server_status_table.vue'; import BitbucketServerStatusTable from './components/bitbucket_server_status_table.vue';
document.addEventListener('DOMContentLoaded', () => { function BitbucketServerStatus() {
const mountElement = document.getElementById('import-projects-mount-element'); const mountElement = document.getElementById('import-projects-mount-element');
if (!mountElement) return undefined; if (!mountElement) return undefined;
...@@ -19,4 +19,6 @@ document.addEventListener('DOMContentLoaded', () => { ...@@ -19,4 +19,6 @@ document.addEventListener('DOMContentLoaded', () => {
}); });
}, },
}); });
}); }
BitbucketServerStatus();
import mountImportProjectsTable from '~/import_entities/import_projects'; import mountImportProjectsTable from '~/import_entities/import_projects';
document.addEventListener('DOMContentLoaded', () => { const mountElement = document.getElementById('import-projects-mount-element');
const mountElement = document.getElementById('import-projects-mount-element');
mountImportProjectsTable(mountElement); mountImportProjectsTable(mountElement);
});
import mountImportProjectsTable from '~/import_entities/import_projects'; import mountImportProjectsTable from '~/import_entities/import_projects';
document.addEventListener('DOMContentLoaded', () => { const mountElement = document.getElementById('import-projects-mount-element');
const mountElement = document.getElementById('import-projects-mount-element');
mountImportProjectsTable(mountElement); mountImportProjectsTable(mountElement);
});
import initGitLabImportProject from '~/projects/project_import_gitlab_project'; import initGitLabImportProject from '~/projects/project_import_gitlab_project';
document.addEventListener('DOMContentLoaded', initGitLabImportProject); initGitLabImportProject();
import mountImportProjectsTable from '~/import_entities/import_projects'; import mountImportProjectsTable from '~/import_entities/import_projects';
document.addEventListener('DOMContentLoaded', () => { const mountElement = document.getElementById('import-projects-mount-element');
const mountElement = document.getElementById('import-projects-mount-element');
mountImportProjectsTable(mountElement); mountImportProjectsTable(mountElement);
});
import { mount2faAuthentication } from '~/authentication/mount_2fa'; import { mount2faAuthentication } from '~/authentication/mount_2fa';
document.addEventListener('DOMContentLoaded', mount2faAuthentication); mount2faAuthentication();
...@@ -2,16 +2,14 @@ import IntegrationSettingsForm from '~/integrations/integration_settings_form'; ...@@ -2,16 +2,14 @@ import IntegrationSettingsForm from '~/integrations/integration_settings_form';
import PrometheusAlerts from '~/prometheus_alerts'; import PrometheusAlerts from '~/prometheus_alerts';
import CustomMetrics from '~/prometheus_metrics/custom_metrics'; import CustomMetrics from '~/prometheus_metrics/custom_metrics';
document.addEventListener('DOMContentLoaded', () => { const integrationSettingsForm = new IntegrationSettingsForm('.js-integration-settings-form');
const integrationSettingsForm = new IntegrationSettingsForm('.js-integration-settings-form'); integrationSettingsForm.init();
integrationSettingsForm.init();
const prometheusSettingsSelector = '.js-prometheus-metrics-monitoring'; const prometheusSettingsSelector = '.js-prometheus-metrics-monitoring';
const prometheusSettingsWrapper = document.querySelector(prometheusSettingsSelector); const prometheusSettingsWrapper = document.querySelector(prometheusSettingsSelector);
if (prometheusSettingsWrapper) { if (prometheusSettingsWrapper) {
const customMetrics = new CustomMetrics(prometheusSettingsSelector); const customMetrics = new CustomMetrics(prometheusSettingsSelector);
customMetrics.init(); customMetrics.init();
} }
PrometheusAlerts(); PrometheusAlerts();
});
import { mount2faAuthentication } from '~/authentication/mount_2fa'; import { mount2faAuthentication } from '~/authentication/mount_2fa';
document.addEventListener('DOMContentLoaded', mount2faAuthentication); mount2faAuthentication();
...@@ -7,18 +7,16 @@ import preserveUrlFragment from './preserve_url_fragment'; ...@@ -7,18 +7,16 @@ import preserveUrlFragment from './preserve_url_fragment';
import SigninTabsMemoizer from './signin_tabs_memoizer'; import SigninTabsMemoizer from './signin_tabs_memoizer';
import UsernameValidator from './username_validator'; import UsernameValidator from './username_validator';
document.addEventListener('DOMContentLoaded', () => { new UsernameValidator(); // eslint-disable-line no-new
new UsernameValidator(); // eslint-disable-line no-new new LengthValidator(); // eslint-disable-line no-new
new LengthValidator(); // eslint-disable-line no-new new SigninTabsMemoizer(); // eslint-disable-line no-new
new SigninTabsMemoizer(); // eslint-disable-line no-new new NoEmojiValidator(); // eslint-disable-line no-new
new NoEmojiValidator(); // eslint-disable-line no-new
new OAuthRememberMe({ new OAuthRememberMe({
container: $('.omniauth-container'), container: $('.omniauth-container'),
}).bindEvents(); }).bindEvents();
// Save the URL fragment from the current window location. This will be present if the user was // Save the URL fragment from the current window location. This will be present if the user was
// redirected to sign-in after attempting to access a protected URL that included a fragment. // redirected to sign-in after attempting to access a protected URL that included a fragment.
preserveUrlFragment(window.location.hash); preserveUrlFragment(window.location.hash);
initVueAlerts(); initVueAlerts();
});
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