BigW Consortium Gitlab

Commit 601164ca by Clement Ho Committed by Jacob Schatz

Use dynamic imports for project dispatcher paths

parent 8579894f
...@@ -52,57 +52,12 @@ var Dispatcher; ...@@ -52,57 +52,12 @@ var Dispatcher;
case 'projects:merge_requests:creations:diffs': case 'projects:merge_requests:creations:diffs':
case 'projects:merge_requests:edit': case 'projects:merge_requests:edit':
case 'projects:merge_requests:show': case 'projects:merge_requests:show':
shortcut_handler = true;
break;
case 'projects:commit:show': case 'projects:commit:show':
import('./pages/projects/commit/show')
.then(callDefault)
.catch(fail);
shortcut_handler = true;
break;
case 'projects:commit:pipelines':
import('./pages/projects/commit/pipelines')
.then(callDefault)
.catch(fail);
break;
case 'projects:activity': case 'projects:activity':
import('./pages/projects/activity')
.then(callDefault)
.catch(fail);
shortcut_handler = true;
break;
case 'projects:commits:show': case 'projects:commits:show':
import('./pages/projects/commits/show')
.then(callDefault)
.catch(fail);
shortcut_handler = true;
break;
case 'projects:show': case 'projects:show':
shortcut_handler = true; shortcut_handler = true;
break; break;
case 'projects:edit':
import('./pages/projects/edit')
.then(callDefault)
.catch(fail);
break;
case 'projects:imports:show':
import('./pages/projects/imports/show')
.then(callDefault)
.catch(fail);
break;
case 'projects:pipelines:new':
case 'projects:pipelines:create':
import('./pages/projects/pipelines/new')
.then(callDefault)
.catch(fail);
break;
case 'projects:pipelines:builds':
case 'projects:pipelines:failures':
case 'projects:pipelines:show':
import('./pages/projects/pipelines/builds')
.then(callDefault)
.catch(fail);
break;
case 'groups:activity': case 'groups:activity':
import('./pages/groups/activity') import('./pages/groups/activity')
.then(callDefault) .then(callDefault)
......
import Activities from '~/activities'; import Activities from '~/activities';
import ShortcutsNavigation from '~/shortcuts_navigation'; import ShortcutsNavigation from '~/shortcuts_navigation';
export default function () { document.addEventListener('DOMContentLoaded', () => {
new Activities(); // eslint-disable-line no-new new Activities(); // eslint-disable-line no-new
new ShortcutsNavigation(); // eslint-disable-line no-new new ShortcutsNavigation(); // eslint-disable-line no-new
} });
import MiniPipelineGraph from '~/mini_pipeline_graph_dropdown'; import MiniPipelineGraph from '~/mini_pipeline_graph_dropdown';
export default () => { document.addEventListener('DOMContentLoaded', () => {
new MiniPipelineGraph({ new MiniPipelineGraph({
container: '.js-commit-pipeline-graph', container: '.js-commit-pipeline-graph',
}).bindEvents(); }).bindEvents();
$('.commit-info.branches').load(document.querySelector('.js-commit-box').dataset.commitPath); $('.commit-info.branches').load(document.querySelector('.js-commit-box').dataset.commitPath);
}; });
...@@ -7,7 +7,7 @@ import initNotes from '~/init_notes'; ...@@ -7,7 +7,7 @@ import initNotes from '~/init_notes';
import initChangesDropdown from '~/init_changes_dropdown'; import initChangesDropdown from '~/init_changes_dropdown';
import { fetchCommitMergeRequests } from '~/commit_merge_requests'; import { fetchCommitMergeRequests } from '~/commit_merge_requests';
export default () => { document.addEventListener('DOMContentLoaded', () => {
new Diff(); new Diff();
new ZenMode(); new ZenMode();
new ShortcutsNavigation(); new ShortcutsNavigation();
...@@ -19,4 +19,4 @@ export default () => { ...@@ -19,4 +19,4 @@ export default () => {
initChangesDropdown(document.querySelector('.navbar-gitlab').offsetHeight - stickyBarPaddingTop); initChangesDropdown(document.querySelector('.navbar-gitlab').offsetHeight - stickyBarPaddingTop);
$('.commit-info.branches').load(document.querySelector('.js-commit-box').dataset.commitPath); $('.commit-info.branches').load(document.querySelector('.js-commit-box').dataset.commitPath);
fetchCommitMergeRequests(); fetchCommitMergeRequests();
}; });
...@@ -2,8 +2,8 @@ import CommitsList from '~/commits'; ...@@ -2,8 +2,8 @@ import CommitsList from '~/commits';
import GpgBadges from '~/gpg_badges'; import GpgBadges from '~/gpg_badges';
import ShortcutsNavigation from '~/shortcuts_navigation'; import ShortcutsNavigation from '~/shortcuts_navigation';
export default () => { document.addEventListener('DOMContentLoaded', () => {
new CommitsList(document.querySelector('.js-project-commits-show').dataset.commitsLimit); // eslint-disable-line no-new new CommitsList(document.querySelector('.js-project-commits-show').dataset.commitsLimit); // eslint-disable-line no-new
new ShortcutsNavigation(); // eslint-disable-line no-new new ShortcutsNavigation(); // eslint-disable-line no-new
GpgBadges.fetch(); GpgBadges.fetch();
}; });
...@@ -4,11 +4,11 @@ import ProjectNew from '../shared/project_new'; ...@@ -4,11 +4,11 @@ import ProjectNew from '../shared/project_new';
import projectAvatar from '../shared/project_avatar'; import projectAvatar from '../shared/project_avatar';
import initProjectPermissionsSettings from '../shared/permissions'; import initProjectPermissionsSettings from '../shared/permissions';
export default () => { document.addEventListener('DOMContentLoaded', () => {
new ProjectNew(); // eslint-disable-line no-new new ProjectNew(); // eslint-disable-line no-new
setupProjectEdit(); setupProjectEdit();
// Initialize expandable settings panels // Initialize expandable settings panels
initSettingsPanels(); initSettingsPanels();
projectAvatar(); projectAvatar();
initProjectPermissionsSettings(); initProjectPermissionsSettings();
}; });
import ProjectImport from '~/project_import'; import ProjectImport from '~/project_import';
export default () => { document.addEventListener('DOMContentLoaded', () => {
new ProjectImport(); // eslint-disable-line no-new new ProjectImport(); // eslint-disable-line no-new
}; });
import Pipelines from '../../../../pipelines'; import initPipelines from '../init_pipelines';
export default () => { document.addEventListener('DOMContentLoaded', initPipelines);
const { controllerAction } = document.querySelector('.js-pipeline-container').dataset;
const pipelineStatusUrl = `${document.querySelector('.js-pipeline-tab-link a').getAttribute('href')}/status.json`;
new Pipelines({ // eslint-disable-line no-new
initTabs: true,
pipelineStatusUrl,
tabsOptions: {
action: controllerAction,
defaultAction: 'pipelines',
parentEl: '.pipelines-tabs',
},
});
};
import initPipelines from '../init_pipelines';
document.addEventListener('DOMContentLoaded', initPipelines);
import Pipelines from '~/pipelines';
export default () => {
const { controllerAction } = document.querySelector('.js-pipeline-container').dataset;
const pipelineStatusUrl = `${document.querySelector('.js-pipeline-tab-link a').getAttribute('href')}/status.json`;
new Pipelines({ // eslint-disable-line no-new
initTabs: true,
pipelineStatusUrl,
tabsOptions: {
action: controllerAction,
defaultAction: 'pipelines',
parentEl: '.pipelines-tabs',
},
});
};
import NewBranchForm from '../../../../new_branch_form'; import NewBranchForm from '~/new_branch_form';
export default () => { document.addEventListener('DOMContentLoaded', () => {
new NewBranchForm($('.js-new-pipeline-form')); // eslint-disable-line no-new new NewBranchForm($('.js-new-pipeline-form')); // eslint-disable-line no-new
}; });
import initPipelines from '../init_pipelines';
document.addEventListener('DOMContentLoaded', initPipelines);
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