summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClement Ho <clemmakesapps@gmail.com>2018-02-22 17:50:52 +0000
committerJacob Schatz <jschatz@gitlab.com>2018-02-22 17:50:52 +0000
commit4317f5a48789d7b0fabffedfe48f7c40dfe27529 (patch)
treecaed2b931df442e997599b2a6fd4e2d3a275e425
parent9251d1f3f671a30f8442b7bf37089561234f2e40 (diff)
downloadgitlab-ce-4317f5a48789d7b0fabffedfe48f7c40dfe27529.tar.gz
Use dynamic imports in dispatcher (Part 3)
-rw-r--r--app/assets/javascripts/dispatcher.js100
-rw-r--r--app/assets/javascripts/pages/admin/conversational_development_index/show/index.js4
-rw-r--r--app/assets/javascripts/pages/admin/impersonation_tokens/index.js4
-rw-r--r--app/assets/javascripts/pages/ci/lints/create/index.js3
-rw-r--r--app/assets/javascripts/pages/ci/lints/index.js3
-rw-r--r--app/assets/javascripts/pages/ci/lints/show/index.js3
-rw-r--r--app/assets/javascripts/pages/dashboard/groups/index/index.js2
-rw-r--r--app/assets/javascripts/pages/groups/labels/edit/index.js2
-rw-r--r--app/assets/javascripts/pages/groups/labels/index/index.js2
-rw-r--r--app/assets/javascripts/pages/groups/labels/new/index.js2
-rw-r--r--app/assets/javascripts/pages/groups/settings/ci_cd/show/index.js4
-rw-r--r--app/assets/javascripts/pages/import/fogbugz/new_user_map/index.js4
-rw-r--r--app/assets/javascripts/pages/profiles/personal_access_tokens/index.js4
-rw-r--r--app/assets/javascripts/pages/projects/artifacts/browse/index.js4
-rw-r--r--app/assets/javascripts/pages/projects/artifacts/file/index.js4
-rw-r--r--app/assets/javascripts/pages/projects/forks/new/index.js4
-rw-r--r--app/assets/javascripts/pages/projects/labels/edit/index.js2
-rw-r--r--app/assets/javascripts/pages/projects/labels/index/index.js2
-rw-r--r--app/assets/javascripts/pages/projects/labels/new/index.js2
-rw-r--r--app/assets/javascripts/pages/projects/settings/ci_cd/show/index.js4
-rw-r--r--app/assets/javascripts/pages/projects/settings/repository/show/index.js2
-rw-r--r--app/assets/javascripts/pages/search/show/index.js2
22 files changed, 32 insertions, 131 deletions
diff --git a/app/assets/javascripts/dispatcher.js b/app/assets/javascripts/dispatcher.js
index 80ee41d3bbb..f66ce1c083b 100644
--- a/app/assets/javascripts/dispatcher.js
+++ b/app/assets/javascripts/dispatcher.js
@@ -61,111 +61,11 @@ var Dispatcher;
case 'projects:find_file:show':
case 'projects:blob:show':
case 'projects:blame:show':
- shortcut_handler = true;
- break;
- case 'groups:labels:new':
- import('./pages/groups/labels/new')
- .then(callDefault)
- .catch(fail);
- break;
- case 'groups:labels:edit':
- import('./pages/groups/labels/edit')
- .then(callDefault)
- .catch(fail);
- break;
- case 'projects:labels:new':
- import('./pages/projects/labels/new')
- .then(callDefault)
- .catch(fail);
- break;
- case 'projects:labels:edit':
- import('./pages/projects/labels/edit')
- .then(callDefault)
- .catch(fail);
- break;
- case 'groups:labels:index':
- import('./pages/groups/labels/index')
- .then(callDefault)
- .catch(fail);
- break;
- case 'projects:labels:index':
- import('./pages/projects/labels/index')
- .then(callDefault)
- .catch(fail);
- break;
case 'projects:network:show':
- // Ensure we don't create a particular shortcut handler here. This is
- // already created, where the network graph is created.
- shortcut_handler = true;
- break;
- case 'projects:forks:new':
- import('./pages/projects/forks/new')
- .then(callDefault)
- .catch(fail);
- break;
case 'projects:artifacts:browse':
- import('./pages/projects/artifacts/browse')
- .then(callDefault)
- .catch(fail);
- shortcut_handler = true;
- break;
case 'projects:artifacts:file':
- import('./pages/projects/artifacts/file')
- .then(callDefault)
- .catch(fail);
shortcut_handler = true;
break;
- case 'search:show':
- import('./pages/search/show')
- .then(callDefault)
- .catch(fail);
- break;
- case 'projects:settings:repository:show':
- import('./pages/projects/settings/repository/show')
- .then(callDefault)
- .catch(fail);
- break;
- case 'projects:settings:ci_cd:show':
- import('./pages/projects/settings/ci_cd/show')
- .then(callDefault)
- .catch(fail);
- break;
- case 'groups:settings:ci_cd:show':
- import('./pages/groups/settings/ci_cd/show')
- .then(callDefault)
- .catch(fail);
- break;
- case 'ci:lints:create':
- case 'ci:lints:show':
- import('./pages/ci/lints')
- .then(callDefault)
- .catch(fail);
- break;
- case 'admin:conversational_development_index:show':
- import('./pages/admin/conversational_development_index/show')
- .then(callDefault)
- .catch(fail);
- break;
- case 'import:fogbugz:new_user_map':
- import('./pages/import/fogbugz/new_user_map')
- .then(callDefault)
- .catch(fail);
- break;
- case 'profiles:personal_access_tokens:index':
- import('./pages/profiles/personal_access_tokens')
- .then(callDefault)
- .catch(fail);
- break;
- case 'admin:impersonation_tokens:index':
- import('./pages/admin/impersonation_tokens')
- .then(callDefault)
- .catch(fail);
- break;
- case 'dashboard:groups:index':
- import('./pages/dashboard/groups/index')
- .then(callDefault)
- .catch(fail);
- break;
}
switch (path[0]) {
case 'admin':
diff --git a/app/assets/javascripts/pages/admin/conversational_development_index/show/index.js b/app/assets/javascripts/pages/admin/conversational_development_index/show/index.js
index 6e66ef69fe1..c1056537f90 100644
--- a/app/assets/javascripts/pages/admin/conversational_development_index/show/index.js
+++ b/app/assets/javascripts/pages/admin/conversational_development_index/show/index.js
@@ -1,3 +1,3 @@
-import UserCallout from '../../../../user_callout';
+import UserCallout from '~/user_callout';
-export default () => new UserCallout();
+document.addEventListener('DOMContentLoaded', () => new UserCallout());
diff --git a/app/assets/javascripts/pages/admin/impersonation_tokens/index.js b/app/assets/javascripts/pages/admin/impersonation_tokens/index.js
index 030328a1363..78a5c4c27be 100644
--- a/app/assets/javascripts/pages/admin/impersonation_tokens/index.js
+++ b/app/assets/javascripts/pages/admin/impersonation_tokens/index.js
@@ -1,3 +1,3 @@
-import DueDateSelectors from '../../../due_date_select';
+import DueDateSelectors from '~/due_date_select';
-export default () => new DueDateSelectors();
+document.addEventListener('DOMContentLoaded', () => new DueDateSelectors());
diff --git a/app/assets/javascripts/pages/ci/lints/create/index.js b/app/assets/javascripts/pages/ci/lints/create/index.js
new file mode 100644
index 00000000000..8e8a843da0b
--- /dev/null
+++ b/app/assets/javascripts/pages/ci/lints/create/index.js
@@ -0,0 +1,3 @@
+import CILintEditor from '../ci_lint_editor';
+
+document.addEventListener('DOMContentLoaded', () => new CILintEditor());
diff --git a/app/assets/javascripts/pages/ci/lints/index.js b/app/assets/javascripts/pages/ci/lints/index.js
deleted file mode 100644
index 5cc66546109..00000000000
--- a/app/assets/javascripts/pages/ci/lints/index.js
+++ /dev/null
@@ -1,3 +0,0 @@
-import CILintEditor from './ci_lint_editor';
-
-export default () => new CILintEditor();
diff --git a/app/assets/javascripts/pages/ci/lints/show/index.js b/app/assets/javascripts/pages/ci/lints/show/index.js
new file mode 100644
index 00000000000..8e8a843da0b
--- /dev/null
+++ b/app/assets/javascripts/pages/ci/lints/show/index.js
@@ -0,0 +1,3 @@
+import CILintEditor from '../ci_lint_editor';
+
+document.addEventListener('DOMContentLoaded', () => new CILintEditor());
diff --git a/app/assets/javascripts/pages/dashboard/groups/index/index.js b/app/assets/javascripts/pages/dashboard/groups/index/index.js
index 9f235ed6a98..79987642796 100644
--- a/app/assets/javascripts/pages/dashboard/groups/index/index.js
+++ b/app/assets/javascripts/pages/dashboard/groups/index/index.js
@@ -1,3 +1,3 @@
import initGroupsList from '~/groups';
-export default initGroupsList;
+document.addEventListener('DOMContentLoaded', initGroupsList);
diff --git a/app/assets/javascripts/pages/groups/labels/edit/index.js b/app/assets/javascripts/pages/groups/labels/edit/index.js
index 72c5e4744ac..fa81ad914ba 100644
--- a/app/assets/javascripts/pages/groups/labels/edit/index.js
+++ b/app/assets/javascripts/pages/groups/labels/edit/index.js
@@ -1,3 +1,3 @@
import Labels from '~/labels';
-export default () => new Labels();
+document.addEventListener('DOMContentLoaded', () => new Labels());
diff --git a/app/assets/javascripts/pages/groups/labels/index/index.js b/app/assets/javascripts/pages/groups/labels/index/index.js
index 018345fa112..6e45de2a724 100644
--- a/app/assets/javascripts/pages/groups/labels/index/index.js
+++ b/app/assets/javascripts/pages/groups/labels/index/index.js
@@ -1,3 +1,3 @@
import initLabels from '~/init_labels';
-export default initLabels;
+document.addEventListener('DOMContentLoaded', initLabels);
diff --git a/app/assets/javascripts/pages/groups/labels/new/index.js b/app/assets/javascripts/pages/groups/labels/new/index.js
index 72c5e4744ac..fa81ad914ba 100644
--- a/app/assets/javascripts/pages/groups/labels/new/index.js
+++ b/app/assets/javascripts/pages/groups/labels/new/index.js
@@ -1,3 +1,3 @@
import Labels from '~/labels';
-export default () => new Labels();
+document.addEventListener('DOMContentLoaded', () => new Labels());
diff --git a/app/assets/javascripts/pages/groups/settings/ci_cd/show/index.js b/app/assets/javascripts/pages/groups/settings/ci_cd/show/index.js
index ad79f7e09ac..04a0d8117cc 100644
--- a/app/assets/javascripts/pages/groups/settings/ci_cd/show/index.js
+++ b/app/assets/javascripts/pages/groups/settings/ci_cd/show/index.js
@@ -1,6 +1,6 @@
import AjaxVariableList from '~/ci_variable_list/ajax_variable_list';
-export default () => {
+document.addEventListener('DOMContentLoaded', () => {
const variableListEl = document.querySelector('.js-ci-variable-list-section');
// eslint-disable-next-line no-new
new AjaxVariableList({
@@ -9,4 +9,4 @@ export default () => {
errorBox: variableListEl.querySelector('.js-ci-variable-error-box'),
saveEndpoint: variableListEl.dataset.saveEndpoint,
});
-};
+});
diff --git a/app/assets/javascripts/pages/import/fogbugz/new_user_map/index.js b/app/assets/javascripts/pages/import/fogbugz/new_user_map/index.js
index 5defea104d4..68d4c1f049f 100644
--- a/app/assets/javascripts/pages/import/fogbugz/new_user_map/index.js
+++ b/app/assets/javascripts/pages/import/fogbugz/new_user_map/index.js
@@ -1,3 +1,3 @@
-import UsersSelect from '../../../../users_select';
+import UsersSelect from '~/users_select';
-export default () => new UsersSelect();
+document.addEventListener('DOMContentLoaded', () => new UsersSelect());
diff --git a/app/assets/javascripts/pages/profiles/personal_access_tokens/index.js b/app/assets/javascripts/pages/profiles/personal_access_tokens/index.js
index 030328a1363..78a5c4c27be 100644
--- a/app/assets/javascripts/pages/profiles/personal_access_tokens/index.js
+++ b/app/assets/javascripts/pages/profiles/personal_access_tokens/index.js
@@ -1,3 +1,3 @@
-import DueDateSelectors from '../../../due_date_select';
+import DueDateSelectors from '~/due_date_select';
-export default () => new DueDateSelectors();
+document.addEventListener('DOMContentLoaded', () => new DueDateSelectors());
diff --git a/app/assets/javascripts/pages/projects/artifacts/browse/index.js b/app/assets/javascripts/pages/projects/artifacts/browse/index.js
index 02456071086..ea7458fe9b8 100644
--- a/app/assets/javascripts/pages/projects/artifacts/browse/index.js
+++ b/app/assets/javascripts/pages/projects/artifacts/browse/index.js
@@ -1,7 +1,7 @@
import BuildArtifacts from '~/build_artifacts';
import ShortcutsNavigation from '~/shortcuts_navigation';
-export default function () {
+document.addEventListener('DOMContentLoaded', () => {
new ShortcutsNavigation(); // eslint-disable-line no-new
new BuildArtifacts(); // eslint-disable-line no-new
-}
+});
diff --git a/app/assets/javascripts/pages/projects/artifacts/file/index.js b/app/assets/javascripts/pages/projects/artifacts/file/index.js
index 4cd67ac76e3..8484e5e9848 100644
--- a/app/assets/javascripts/pages/projects/artifacts/file/index.js
+++ b/app/assets/javascripts/pages/projects/artifacts/file/index.js
@@ -1,7 +1,7 @@
import BlobViewer from '~/blob/viewer/index';
import ShortcutsNavigation from '~/shortcuts_navigation';
-export default function () {
+document.addEventListener('DOMContentLoaded', () => {
new ShortcutsNavigation(); // eslint-disable-line no-new
new BlobViewer(); // eslint-disable-line no-new
-}
+});
diff --git a/app/assets/javascripts/pages/projects/forks/new/index.js b/app/assets/javascripts/pages/projects/forks/new/index.js
index 7825eb01949..d80e27e9156 100644
--- a/app/assets/javascripts/pages/projects/forks/new/index.js
+++ b/app/assets/javascripts/pages/projects/forks/new/index.js
@@ -1,5 +1,3 @@
import ProjectFork from '~/project_fork';
-export default () => {
- new ProjectFork(); // eslint-disable-line no-new
-};
+document.addEventListener('DOMContentLoaded', () => new ProjectFork());
diff --git a/app/assets/javascripts/pages/projects/labels/edit/index.js b/app/assets/javascripts/pages/projects/labels/edit/index.js
index 72c5e4744ac..fa81ad914ba 100644
--- a/app/assets/javascripts/pages/projects/labels/edit/index.js
+++ b/app/assets/javascripts/pages/projects/labels/edit/index.js
@@ -1,3 +1,3 @@
import Labels from '~/labels';
-export default () => new Labels();
+document.addEventListener('DOMContentLoaded', () => new Labels());
diff --git a/app/assets/javascripts/pages/projects/labels/index/index.js b/app/assets/javascripts/pages/projects/labels/index/index.js
index 018345fa112..6e45de2a724 100644
--- a/app/assets/javascripts/pages/projects/labels/index/index.js
+++ b/app/assets/javascripts/pages/projects/labels/index/index.js
@@ -1,3 +1,3 @@
import initLabels from '~/init_labels';
-export default initLabels;
+document.addEventListener('DOMContentLoaded', initLabels);
diff --git a/app/assets/javascripts/pages/projects/labels/new/index.js b/app/assets/javascripts/pages/projects/labels/new/index.js
index 72c5e4744ac..fa81ad914ba 100644
--- a/app/assets/javascripts/pages/projects/labels/new/index.js
+++ b/app/assets/javascripts/pages/projects/labels/new/index.js
@@ -1,3 +1,3 @@
import Labels from '~/labels';
-export default () => new Labels();
+document.addEventListener('DOMContentLoaded', () => new Labels());
diff --git a/app/assets/javascripts/pages/projects/settings/ci_cd/show/index.js b/app/assets/javascripts/pages/projects/settings/ci_cd/show/index.js
index a563d0f9961..6c2a785c0af 100644
--- a/app/assets/javascripts/pages/projects/settings/ci_cd/show/index.js
+++ b/app/assets/javascripts/pages/projects/settings/ci_cd/show/index.js
@@ -2,7 +2,7 @@ import initSettingsPanels from '~/settings_panels';
import SecretValues from '~/behaviors/secret_values';
import AjaxVariableList from '~/ci_variable_list/ajax_variable_list';
-export default function () {
+document.addEventListener('DOMContentLoaded', () => {
// Initialize expandable settings panels
initSettingsPanels();
@@ -22,4 +22,4 @@ export default function () {
errorBox: variableListEl.querySelector('.js-ci-variable-error-box'),
saveEndpoint: variableListEl.dataset.saveEndpoint,
});
-}
+});
diff --git a/app/assets/javascripts/pages/projects/settings/repository/show/index.js b/app/assets/javascripts/pages/projects/settings/repository/show/index.js
index 83b5467fbc0..d88527351c1 100644
--- a/app/assets/javascripts/pages/projects/settings/repository/show/index.js
+++ b/app/assets/javascripts/pages/projects/settings/repository/show/index.js
@@ -1,3 +1,3 @@
import initSettingsPanels from '~/settings_panels';
-export default initSettingsPanels;
+document.addEventListener('DOMContentLoaded', initSettingsPanels);
diff --git a/app/assets/javascripts/pages/search/show/index.js b/app/assets/javascripts/pages/search/show/index.js
index 4264c5c9dbe..85aaaa2c9da 100644
--- a/app/assets/javascripts/pages/search/show/index.js
+++ b/app/assets/javascripts/pages/search/show/index.js
@@ -1,3 +1,3 @@
import Search from './search';
-export default () => new Search();
+document.addEventListener('DOMContentLoaded', () => new Search());