Commit 2f2f63a0 authored by Jacob Schatz's avatar Jacob Schatz

Merge branch 'more-dispatcher-refactoring' into 'master'

More dispatcher refactoring

See merge request gitlab-org/gitlab-ce!17232
parents 715b10bc ba5ae88a
...@@ -51,68 +51,9 @@ var Dispatcher; ...@@ -51,68 +51,9 @@ var Dispatcher;
case 'projects:merge_requests:creations:new': case 'projects:merge_requests:creations:new':
case 'projects:merge_requests:creations:diffs': case 'projects:merge_requests:creations:diffs':
case 'projects:merge_requests:edit': case 'projects:merge_requests:edit':
shortcut_handler = true;
break;
case 'projects:tags:new':
import('./pages/projects/tags/new')
.then(callDefault)
.catch(fail);
break;
case 'projects:snippets:show':
import('./pages/projects/snippets/show')
.then(callDefault)
.catch(fail);
break;
case 'projects:snippets:new':
case 'projects:snippets:create':
import('./pages/projects/snippets/new')
.then(callDefault)
.catch(fail);
break;
case 'projects:services:edit':
import('./pages/projects/services/edit')
.then(callDefault)
.catch(fail);
break;
case 'projects:snippets:edit':
case 'projects:snippets:update':
import('./pages/projects/snippets/edit')
.then(callDefault)
.catch(fail);
break;
case 'snippets:new':
import('./pages/snippets/new')
.then(callDefault)
.catch(fail);
break;
case 'snippets:edit':
import('./pages/snippets/edit')
.then(callDefault)
.catch(fail);
break;
case 'snippets:create':
import('./pages/snippets/new')
.then(callDefault)
.catch(fail);
break;
case 'snippets:update':
import('./pages/snippets/edit')
.then(callDefault)
.catch(fail);
break;
case 'projects:releases:edit':
import('./pages/projects/releases/edit')
.then(callDefault)
.catch(fail);
break;
case 'projects:merge_requests:show': case 'projects:merge_requests:show':
shortcut_handler = true; shortcut_handler = true;
break; break;
case 'dashboard:activity':
import('./pages/dashboard/activity')
.then(callDefault)
.catch(fail);
break;
case 'projects:commit:show': case 'projects:commit:show':
import('./pages/projects/commit/show') import('./pages/projects/commit/show')
.then(callDefault) .then(callDefault)
...@@ -314,11 +255,6 @@ var Dispatcher; ...@@ -314,11 +255,6 @@ var Dispatcher;
.then(callDefault) .then(callDefault)
.catch(fail); .catch(fail);
break; break;
case 'snippets:show':
import('./pages/snippets/show')
.then(callDefault)
.catch(fail);
break;
case 'import:fogbugz:new_user_map': case 'import:fogbugz:new_user_map':
import('./pages/import/fogbugz/new_user_map') import('./pages/import/fogbugz/new_user_map')
.then(callDefault) .then(callDefault)
...@@ -334,18 +270,6 @@ var Dispatcher; ...@@ -334,18 +270,6 @@ var Dispatcher;
.then(callDefault) .then(callDefault)
.catch(fail); .catch(fail);
break; break;
case 'projects:clusters:show':
case 'projects:clusters:update':
case 'projects:clusters:destroy':
import('./pages/projects/clusters/show')
.then(callDefault)
.catch(fail);
break;
case 'projects:clusters:index':
import('./pages/projects/clusters/index')
.then(callDefault)
.catch(fail);
break;
case 'dashboard:groups:index': case 'dashboard:groups:index':
import('./pages/dashboard/groups/index') import('./pages/dashboard/groups/index')
.then(callDefault) .then(callDefault)
...@@ -353,20 +277,7 @@ var Dispatcher; ...@@ -353,20 +277,7 @@ var Dispatcher;
break; break;
} }
switch (path[0]) { switch (path[0]) {
case 'sessions':
import('./pages/sessions')
.then(callDefault)
.catch(fail);
break;
case 'omniauth_callbacks':
import('./pages/omniauth_callbacks')
.then(callDefault)
.catch(fail);
break;
case 'admin': case 'admin':
import('./pages/admin')
.then(callDefault)
.catch(fail);
switch (path[1]) { switch (path[1]) {
case 'broadcast_messages': case 'broadcast_messages':
import('./pages/admin/broadcast_messages') import('./pages/admin/broadcast_messages')
......
...@@ -61,7 +61,7 @@ gl.lazyLoader = new LazyLoader({ ...@@ -61,7 +61,7 @@ gl.lazyLoader = new LazyLoader({
observerNode: '#content-body', observerNode: '#content-body',
}); });
$(() => { document.addEventListener('DOMContentLoaded', () => {
const $body = $('body'); const $body = $('body');
const $document = $(document); const $document = $(document);
const $window = $(window); const $window = $(window);
......
import initAdmin from './admin'; import initAdmin from './admin';
export default () => initAdmin(); document.addEventListener('DOMContentLoaded', initAdmin);
import Activities from '~/activities'; import Activities from '~/activities';
export default () => new Activities(); document.addEventListener('DOMContentLoaded', () => new Activities());
import initU2F from '../../shared/sessions/u2f'; import initU2F from '../../shared/sessions/u2f';
export default () => { document.addEventListener('DOMContentLoaded', initU2F);
initU2F();
};
import ClustersBundle from '~/clusters/clusters_bundle';
document.addEventListener('DOMContentLoaded', () => {
new ClustersBundle(); // eslint-disable-line no-new
});
import ClustersIndex from '~/clusters/clusters_index'; import ClustersIndex from '~/clusters/clusters_index';
export default () => { document.addEventListener('DOMContentLoaded', () => {
new ClustersIndex(); // eslint-disable-line no-new new ClustersIndex(); // eslint-disable-line no-new
}; });
import ClustersBundle from '~/clusters/clusters_bundle'; import ClustersBundle from '~/clusters/clusters_bundle';
export default () => { document.addEventListener('DOMContentLoaded', () => {
new ClustersBundle(); // eslint-disable-line no-new new ClustersBundle(); // eslint-disable-line no-new
}; });
import ClustersBundle from '~/clusters/clusters_bundle';
document.addEventListener('DOMContentLoaded', () => {
new ClustersBundle(); // eslint-disable-line no-new
});
import initForm from '~/pages/projects/init_form'; import initForm from '~/pages/projects/init_form';
export default initForm($('.release-form')); document.addEventListener('DOMContentLoaded', () => initForm($('.release-form')));
import IntegrationSettingsForm from '~/integrations/integration_settings_form'; import IntegrationSettingsForm from '~/integrations/integration_settings_form';
import PrometheusMetrics from '~/prometheus_metrics/prometheus_metrics'; import PrometheusMetrics from '~/prometheus_metrics/prometheus_metrics';
export default () => { document.addEventListener('DOMContentLoaded', () => {
const prometheusSettingsWrapper = document.querySelector('.js-prometheus-metrics-monitoring'); const prometheusSettingsWrapper = document.querySelector('.js-prometheus-metrics-monitoring');
const integrationSettingsForm = new IntegrationSettingsForm('.js-integration-settings-form'); const integrationSettingsForm = new IntegrationSettingsForm('.js-integration-settings-form');
integrationSettingsForm.init(); integrationSettingsForm.init();
...@@ -10,4 +10,4 @@ export default () => { ...@@ -10,4 +10,4 @@ export default () => {
const prometheusMetrics = new PrometheusMetrics('.js-prometheus-metrics-monitoring'); const prometheusMetrics = new PrometheusMetrics('.js-prometheus-metrics-monitoring');
prometheusMetrics.loadActiveMetrics(); prometheusMetrics.loadActiveMetrics();
} }
}; });
import initForm from '~/pages/projects/init_form'; import initForm from '~/pages/projects/init_form';
export default initForm($('.snippet-form')); document.addEventListener('DOMContentLoaded', () => initForm($('.snippet-form')));
import initForm from '~/pages/projects/init_form'; import initForm from '~/pages/projects/init_form';
export default initForm($('.snippet-form')); document.addEventListener('DOMContentLoaded', () => initForm($('.snippet-form')));
...@@ -3,9 +3,9 @@ import ZenMode from '~/zen_mode'; ...@@ -3,9 +3,9 @@ import ZenMode from '~/zen_mode';
import LineHighlighter from '../../../../line_highlighter'; import LineHighlighter from '../../../../line_highlighter';
import BlobViewer from '../../../../blob/viewer'; import BlobViewer from '../../../../blob/viewer';
export default function () { document.addEventListener('DOMContentLoaded', () => {
new LineHighlighter(); // eslint-disable-line no-new new LineHighlighter(); // eslint-disable-line no-new
new BlobViewer(); // eslint-disable-line no-new new BlobViewer(); // eslint-disable-line no-new
initNotes(); initNotes();
new ZenMode(); // eslint-disable-line no-new new ZenMode(); // eslint-disable-line no-new
} });
...@@ -2,8 +2,8 @@ import RefSelectDropdown from '../../../../ref_select_dropdown'; ...@@ -2,8 +2,8 @@ import RefSelectDropdown from '../../../../ref_select_dropdown';
import ZenMode from '../../../../zen_mode'; import ZenMode from '../../../../zen_mode';
import GLForm from '../../../../gl_form'; import GLForm from '../../../../gl_form';
export default () => { document.addEventListener('DOMContentLoaded', () => {
new ZenMode(); // eslint-disable-line no-new new ZenMode(); // eslint-disable-line no-new
new GLForm($('.tag-form'), true); // eslint-disable-line no-new new GLForm($('.tag-form'), true); // eslint-disable-line no-new
new RefSelectDropdown($('.js-branch-select')); // eslint-disable-line no-new new RefSelectDropdown($('.js-branch-select')); // eslint-disable-line no-new
}; });
import initU2F from '../../shared/sessions/u2f'; import initU2F from '../../shared/sessions/u2f';
export default () => { document.addEventListener('DOMContentLoaded', initU2F);
initU2F();
};
import form from '../form'; import form from '../form';
export default form; document.addEventListener('DOMContentLoaded', form);
import form from '../form'; import form from '../form';
export default form; document.addEventListener('DOMContentLoaded', form);
/* eslint-disable no-new */
import LineHighlighter from '../../../line_highlighter'; import LineHighlighter from '../../../line_highlighter';
import BlobViewer from '../../../blob/viewer'; import BlobViewer from '../../../blob/viewer';
import ZenMode from '../../../zen_mode'; import ZenMode from '../../../zen_mode';
import initNotes from '../../../init_notes'; import initNotes from '../../../init_notes';
export default () => { document.addEventListener('DOMContentLoaded', () => {
new LineHighlighter(); new LineHighlighter(); // eslint-disable-line no-new
new BlobViewer(); new BlobViewer(); // eslint-disable-line no-new
initNotes(); initNotes();
new ZenMode(); new ZenMode(); // eslint-disable-line no-new
}; });
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