debian-mirror-gitlab/app/assets/javascripts/dispatcher.js

649 lines
20 KiB
JavaScript
Raw Normal View History

2017-08-17 22:00:37 +05:30
/* eslint-disable func-names, space-before-function-paren, no-var, prefer-arrow-callback, wrap-iife, no-shadow, consistent-return, one-var, one-var-declaration-per-line, camelcase, default-case, no-new, quotes, no-duplicate-case, no-case-declarations, no-fallthrough, max-len */
2018-03-17 18:26:18 +05:30
import MergeRequest from './merge_request';
import Flash from './flash';
2017-09-10 17:25:29 +05:30
import GfmAutoComplete from './gfm_auto_complete';
import ZenMode from './zen_mode';
import initNotes from './init_notes';
import initIssuableSidebar from './init_issuable_sidebar';
2018-03-17 18:26:18 +05:30
import { convertPermissionToBoolean } from './lib/utils/common_utils';
import GlFieldErrors from './gl_field_errors';
import Shortcuts from './shortcuts';
import ShortcutsIssuable from './shortcuts_issuable';
import Diff from './diff';
import SearchAutocomplete from './search_autocomplete';
2017-08-17 22:00:37 +05:30
2018-03-17 18:26:18 +05:30
var Dispatcher;
2017-08-17 22:00:37 +05:30
2018-03-17 18:26:18 +05:30
(function() {
2017-08-17 22:00:37 +05:30
Dispatcher = (function() {
function Dispatcher() {
this.initSearch();
this.initFieldErrors();
this.initPageScripts();
}
Dispatcher.prototype.initPageScripts = function() {
2018-03-17 18:26:18 +05:30
var path, shortcut_handler;
const page = $('body').attr('data-page');
2017-08-17 22:00:37 +05:30
if (!page) {
return false;
}
2017-09-10 17:25:29 +05:30
2018-03-17 18:26:18 +05:30
const fail = () => Flash('Error loading dynamic module');
const callDefault = m => m.default();
2017-08-17 22:00:37 +05:30
path = page.split(':');
shortcut_handler = null;
2018-03-17 18:26:18 +05:30
$('.js-gfm-input:not(.js-vue-textarea)').each((i, el) => {
2017-09-10 17:25:29 +05:30
const gfm = new GfmAutoComplete(gl.GfmAutoComplete && gl.GfmAutoComplete.dataSources);
2018-03-17 18:26:18 +05:30
const enableGFM = convertPermissionToBoolean(el.dataset.supportsAutocomplete);
2017-09-10 17:25:29 +05:30
gfm.setup($(el), {
emojis: true,
members: enableGFM,
issues: enableGFM,
milestones: enableGFM,
mergeRequests: enableGFM,
labels: enableGFM,
});
});
2017-08-17 22:00:37 +05:30
switch (page) {
2018-03-17 18:26:18 +05:30
case 'projects:environments:metrics':
import('./pages/projects/environments/metrics')
.then(callDefault)
.catch(fail);
2017-08-17 22:00:37 +05:30
break;
case 'projects:merge_requests:index':
case 'projects:issues:index':
case 'projects:issues:show':
2018-03-17 18:26:18 +05:30
shortcut_handler = true;
2017-09-10 17:25:29 +05:30
break;
2018-03-17 18:26:18 +05:30
case 'projects:milestones:index':
import('./pages/projects/milestones/index')
.then(callDefault)
.catch(fail);
2017-08-17 22:00:37 +05:30
break;
case 'projects:milestones:show':
2018-03-17 18:26:18 +05:30
import('./pages/projects/milestones/show')
.then(callDefault)
.catch(fail);
break;
2017-08-17 22:00:37 +05:30
case 'groups:milestones:show':
2018-03-17 18:26:18 +05:30
import('./pages/groups/milestones/show')
.then(callDefault)
.catch(fail);
break;
2017-08-17 22:00:37 +05:30
case 'dashboard:milestones:show':
2018-03-17 18:26:18 +05:30
import('./pages/dashboard/milestones/show')
.then(callDefault)
.catch(fail);
2017-08-17 22:00:37 +05:30
break;
2017-09-10 17:25:29 +05:30
case 'dashboard:issues':
2018-03-17 18:26:18 +05:30
import('./pages/dashboard/issues')
.then(callDefault)
.catch(fail);
break;
2017-09-10 17:25:29 +05:30
case 'dashboard:merge_requests':
2018-03-17 18:26:18 +05:30
import('./pages/dashboard/merge_requests')
.then(callDefault)
.catch(fail);
2017-09-10 17:25:29 +05:30
break;
case 'groups:issues':
2018-03-17 18:26:18 +05:30
import('./pages/groups/issues')
.then(callDefault)
.catch(fail);
break;
case 'groups:merge_requests':
import('./pages/groups/merge_requests')
.then(callDefault)
.catch(fail);
2017-09-10 17:25:29 +05:30
break;
2017-08-17 22:00:37 +05:30
case 'dashboard:todos:index':
2018-03-17 18:26:18 +05:30
import('./pages/dashboard/todos/index')
.then(callDefault)
.catch(fail);
break;
case 'admin:jobs:index':
import('./pages/admin/jobs/index')
.then(callDefault)
.catch(fail);
break;
case 'admin:projects:index':
import('./pages/admin/projects/index/index')
.then(callDefault)
.catch(fail);
break;
case 'admin:users:index':
import('./pages/admin/users/shared')
.then(callDefault)
.catch(fail);
break;
case 'admin:users:show':
import('./pages/admin/users/shared')
.then(callDefault)
.catch(fail);
2017-08-17 22:00:37 +05:30
break;
case 'dashboard:projects:index':
case 'dashboard:projects:starred':
2018-03-17 18:26:18 +05:30
import('./pages/dashboard/projects')
.then(callDefault)
.catch(fail);
break;
2017-08-17 22:00:37 +05:30
case 'explore:projects:index':
case 'explore:projects:trending':
case 'explore:projects:starred':
2018-03-17 18:26:18 +05:30
import('./pages/explore/projects')
.then(callDefault)
.catch(fail);
2017-08-17 22:00:37 +05:30
break;
case 'explore:groups:index':
2018-03-17 18:26:18 +05:30
import('./pages/explore/groups')
.then(callDefault)
.catch(fail);
2017-08-17 22:00:37 +05:30
break;
case 'projects:milestones:new':
2018-03-17 18:26:18 +05:30
case 'projects:milestones:create':
import('./pages/projects/milestones/new')
.then(callDefault)
.catch(fail);
break;
2017-08-17 22:00:37 +05:30
case 'projects:milestones:edit':
case 'projects:milestones:update':
2018-03-17 18:26:18 +05:30
import('./pages/projects/milestones/edit')
.then(callDefault)
.catch(fail);
break;
2017-08-17 22:00:37 +05:30
case 'groups:milestones:new':
2018-03-17 18:26:18 +05:30
case 'groups:milestones:create':
import('./pages/groups/milestones/new')
.then(callDefault)
.catch(fail);
break;
2017-08-17 22:00:37 +05:30
case 'groups:milestones:edit':
case 'groups:milestones:update':
2018-03-17 18:26:18 +05:30
import('./pages/groups/milestones/edit')
.then(callDefault)
.catch(fail);
2017-08-17 22:00:37 +05:30
break;
case 'projects:compare:show':
2018-03-17 18:26:18 +05:30
import('./pages/projects/compare/show')
.then(callDefault)
.catch(fail);
2017-09-10 17:25:29 +05:30
break;
case 'projects:branches:new':
2018-03-17 18:26:18 +05:30
import('./pages/projects/branches/new')
.then(callDefault)
.catch(fail);
break;
2017-09-10 17:25:29 +05:30
case 'projects:branches:create':
2018-03-17 18:26:18 +05:30
import('./pages/projects/branches/new')
.then(callDefault)
.catch(fail);
2017-08-17 22:00:37 +05:30
break;
case 'projects:branches:index':
2018-03-17 18:26:18 +05:30
import('./pages/projects/branches/index')
.then(callDefault)
.catch(fail);
2017-08-17 22:00:37 +05:30
break;
case 'projects:issues:new':
2018-03-17 18:26:18 +05:30
import('./pages/projects/issues/new')
.then(callDefault)
.catch(fail);
shortcut_handler = true;
break;
2017-08-17 22:00:37 +05:30
case 'projects:issues:edit':
2018-03-17 18:26:18 +05:30
import('./pages/projects/issues/edit')
.then(callDefault)
.catch(fail);
shortcut_handler = true;
2017-08-17 22:00:37 +05:30
break;
2017-09-10 17:25:29 +05:30
case 'projects:merge_requests:creations:new':
2018-03-17 18:26:18 +05:30
import('./pages/projects/merge_requests/creations/new')
.then(callDefault)
.catch(fail);
2017-09-10 17:25:29 +05:30
case 'projects:merge_requests:creations:diffs':
2018-03-17 18:26:18 +05:30
import('./pages/projects/merge_requests/creations/diffs')
.then(callDefault)
.catch(fail);
shortcut_handler = true;
break;
2017-08-17 22:00:37 +05:30
case 'projects:merge_requests:edit':
2018-03-17 18:26:18 +05:30
import('./pages/projects/merge_requests/edit')
.then(callDefault)
.catch(fail);
shortcut_handler = true;
2017-08-17 22:00:37 +05:30
break;
case 'projects:tags:new':
2018-03-17 18:26:18 +05:30
import('./pages/projects/tags/new')
.then(callDefault)
.catch(fail);
2017-09-10 17:25:29 +05:30
break;
case 'projects:snippets:show':
2018-03-17 18:26:18 +05:30
import('./pages/projects/snippets/show')
.then(callDefault)
.catch(fail);
2017-09-10 17:25:29 +05:30
break;
case 'projects:snippets:new':
case 'projects:snippets:create':
2018-03-17 18:26:18 +05:30
import('./pages/projects/snippets/new')
.then(callDefault)
.catch(fail);
break;
case 'projects:snippets:edit':
2017-09-10 17:25:29 +05:30
case 'projects:snippets:update':
2018-03-17 18:26:18 +05:30
import('./pages/projects/snippets/edit')
.then(callDefault)
.catch(fail);
2017-09-10 17:25:29 +05:30
break;
case 'snippets:new':
2018-03-17 18:26:18 +05:30
import('./pages/snippets/new')
.then(callDefault)
.catch(fail);
break;
2017-09-10 17:25:29 +05:30
case 'snippets:edit':
2018-03-17 18:26:18 +05:30
import('./pages/snippets/edit')
.then(callDefault)
.catch(fail);
break;
2017-09-10 17:25:29 +05:30
case 'snippets:create':
2018-03-17 18:26:18 +05:30
import('./pages/snippets/new')
.then(callDefault)
.catch(fail);
break;
2017-09-10 17:25:29 +05:30
case 'snippets:update':
2018-03-17 18:26:18 +05:30
import('./pages/snippets/edit')
.then(callDefault)
.catch(fail);
2017-08-17 22:00:37 +05:30
break;
case 'projects:releases:edit':
2018-03-17 18:26:18 +05:30
import('./pages/projects/releases/edit')
.then(callDefault)
.catch(fail);
2017-08-17 22:00:37 +05:30
break;
case 'projects:merge_requests:show':
2018-03-17 18:26:18 +05:30
new Diff();
2017-08-17 22:00:37 +05:30
new ZenMode();
2017-09-10 17:25:29 +05:30
initIssuableSidebar();
initNotes();
const mrShowNode = document.querySelector('.merge-request');
window.mergeRequest = new MergeRequest({
action: mrShowNode.dataset.mrAction,
});
2018-03-17 18:26:18 +05:30
shortcut_handler = new ShortcutsIssuable(true);
2017-08-17 22:00:37 +05:30
break;
case 'dashboard:activity':
2018-03-17 18:26:18 +05:30
import('./pages/dashboard/activity')
.then(callDefault)
.catch(fail);
2017-08-17 22:00:37 +05:30
break;
case 'projects:commit:show':
2018-03-17 18:26:18 +05:30
import('./pages/projects/commit/show')
.then(callDefault)
.catch(fail);
shortcut_handler = true;
2017-08-17 22:00:37 +05:30
break;
case 'projects:commit:pipelines':
2018-03-17 18:26:18 +05:30
import('./pages/projects/commit/pipelines')
.then(callDefault)
.catch(fail);
2017-08-17 22:00:37 +05:30
break;
case 'projects:activity':
2018-03-17 18:26:18 +05:30
import('./pages/projects/activity')
.then(callDefault)
.catch(fail);
shortcut_handler = true;
2017-09-10 17:25:29 +05:30
break;
case 'projects:commits:show':
2018-03-17 18:26:18 +05:30
import('./pages/projects/commits/show')
.then(callDefault)
.catch(fail);
shortcut_handler = true;
2017-08-17 22:00:37 +05:30
break;
case 'projects:show':
2018-03-17 18:26:18 +05:30
shortcut_handler = true;
2017-09-10 17:25:29 +05:30
break;
case 'projects:edit':
2018-03-17 18:26:18 +05:30
import('./pages/projects/edit')
.then(callDefault)
.catch(fail);
2017-09-10 17:25:29 +05:30
break;
case 'projects:imports:show':
2018-03-17 18:26:18 +05:30
import('./pages/projects/imports/show')
.then(callDefault)
.catch(fail);
2017-09-10 17:25:29 +05:30
break;
case 'projects:pipelines:new':
2018-03-17 18:26:18 +05:30
case 'projects:pipelines:create':
import('./pages/projects/pipelines/new')
.then(callDefault)
.catch(fail);
2017-08-17 22:00:37 +05:30
break;
case 'projects:pipelines:builds':
case 'projects:pipelines:failures':
case 'projects:pipelines:show':
2018-03-17 18:26:18 +05:30
import('./pages/projects/pipelines/builds')
.then(callDefault)
.catch(fail);
2017-08-17 22:00:37 +05:30
break;
case 'groups:activity':
2018-03-17 18:26:18 +05:30
import('./pages/groups/activity')
.then(callDefault)
.catch(fail);
2017-08-17 22:00:37 +05:30
break;
case 'groups:show':
2018-03-17 18:26:18 +05:30
shortcut_handler = true;
2017-08-17 22:00:37 +05:30
break;
case 'groups:group_members:index':
2018-03-17 18:26:18 +05:30
import('./pages/groups/group_members/index')
.then(callDefault)
.catch(fail);
2017-08-17 22:00:37 +05:30
break;
2017-09-10 17:25:29 +05:30
case 'projects:project_members:index':
2018-03-17 18:26:18 +05:30
import('./pages/projects/project_members')
.then(callDefault)
.catch(fail);
2017-08-17 22:00:37 +05:30
break;
case 'groups:create':
2018-03-17 18:26:18 +05:30
case 'groups:new':
import('./pages/groups/new')
.then(callDefault)
.catch(fail);
2017-08-17 22:00:37 +05:30
break;
case 'groups:edit':
2018-03-17 18:26:18 +05:30
import('./pages/groups/edit')
.then(callDefault)
.catch(fail);
break;
case 'admin:groups:create':
case 'admin:groups:new':
import('./pages/admin/groups/new')
.then(callDefault)
.catch(fail);
break;
2017-08-17 22:00:37 +05:30
case 'admin:groups:edit':
2018-03-17 18:26:18 +05:30
import('./pages/admin/groups/edit')
.then(callDefault)
.catch(fail);
2017-08-17 22:00:37 +05:30
break;
case 'projects:tree:show':
2018-03-17 18:26:18 +05:30
import('./pages/projects/tree/show')
.then(callDefault)
.catch(fail);
shortcut_handler = true;
2017-08-17 22:00:37 +05:30
break;
case 'projects:find_file:show':
2018-03-17 18:26:18 +05:30
import('./pages/projects/find_file/show')
.then(callDefault)
.catch(fail);
2017-08-17 22:00:37 +05:30
shortcut_handler = true;
break;
case 'projects:blob:show':
2018-03-17 18:26:18 +05:30
import('./pages/projects/blob/show')
.then(callDefault)
.catch(fail);
shortcut_handler = true;
2017-08-17 22:00:37 +05:30
break;
case 'projects:blame:show':
2018-03-17 18:26:18 +05:30
import('./pages/projects/blame/show')
.then(callDefault)
.catch(fail);
shortcut_handler = true;
2017-08-17 22:00:37 +05:30
break;
case 'groups:labels:new':
2018-03-17 18:26:18 +05:30
import('./pages/groups/labels/new')
.then(callDefault)
.catch(fail);
break;
2017-08-17 22:00:37 +05:30
case 'groups:labels:edit':
2018-03-17 18:26:18 +05:30
import('./pages/groups/labels/edit')
.then(callDefault)
.catch(fail);
break;
2017-08-17 22:00:37 +05:30
case 'projects:labels:new':
2018-03-17 18:26:18 +05:30
import('./pages/projects/labels/new')
.then(callDefault)
.catch(fail);
break;
2017-08-17 22:00:37 +05:30
case 'projects:labels:edit':
2018-03-17 18:26:18 +05:30
import('./pages/projects/labels/edit')
.then(callDefault)
.catch(fail);
2017-08-17 22:00:37 +05:30
break;
2017-09-10 17:25:29 +05:30
case 'groups:labels:index':
2018-03-17 18:26:18 +05:30
import('./pages/groups/labels/index')
.then(callDefault)
.catch(fail);
break;
2017-08-17 22:00:37 +05:30
case 'projects:labels:index':
2018-03-17 18:26:18 +05:30
import('./pages/projects/labels/index')
.then(callDefault)
.catch(fail);
2017-08-17 22:00:37 +05:30
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':
2018-03-17 18:26:18 +05:30
import('./pages/projects/forks/new')
.then(callDefault)
.catch(fail);
2017-08-17 22:00:37 +05:30
break;
case 'projects:artifacts:browse':
2018-03-17 18:26:18 +05:30
import('./pages/projects/artifacts/browse')
.then(callDefault)
.catch(fail);
shortcut_handler = true;
2017-08-17 22:00:37 +05:30
break;
case 'projects:artifacts:file':
2018-03-17 18:26:18 +05:30
import('./pages/projects/artifacts/file')
.then(callDefault)
.catch(fail);
shortcut_handler = true;
2017-08-17 22:00:37 +05:30
break;
case 'help:index':
2018-03-17 18:26:18 +05:30
import('./pages/help')
.then(callDefault)
.catch(fail);
2017-08-17 22:00:37 +05:30
break;
case 'search:show':
2018-03-17 18:26:18 +05:30
import('./pages/search/show')
.then(callDefault)
.catch(fail);
2017-08-17 22:00:37 +05:30
break;
2017-09-10 17:25:29 +05:30
case 'projects:settings:repository:show':
2018-03-17 18:26:18 +05:30
import('./pages/projects/settings/repository/show')
.then(callDefault)
.catch(fail);
2017-08-17 22:00:37 +05:30
break;
2017-09-10 17:25:29 +05:30
case 'projects:settings:ci_cd:show':
2018-03-17 18:26:18 +05:30
import('./pages/projects/settings/ci_cd/show')
.then(callDefault)
.catch(fail);
break;
2017-09-10 17:25:29 +05:30
case 'groups:settings:ci_cd:show':
2018-03-17 18:26:18 +05:30
import('./pages/groups/settings/ci_cd/show')
.then(callDefault)
.catch(fail);
2017-08-17 22:00:37 +05:30
break;
case 'ci:lints:create':
case 'ci:lints:show':
2018-03-17 18:26:18 +05:30
import('./pages/ci/lints')
.then(callDefault)
.catch(fail);
2017-08-17 22:00:37 +05:30
break;
case 'users:show':
2018-03-17 18:26:18 +05:30
import('./pages/users/show')
.then(callDefault)
.catch(fail);
2017-08-17 22:00:37 +05:30
break;
2017-09-10 17:25:29 +05:30
case 'admin:conversational_development_index:show':
2018-03-17 18:26:18 +05:30
import('./pages/admin/conversational_development_index/show')
.then(callDefault)
.catch(fail);
2017-09-10 17:25:29 +05:30
break;
2017-08-17 22:00:37 +05:30
case 'snippets:show':
2018-03-17 18:26:18 +05:30
import('./pages/snippets/show')
.then(callDefault)
.catch(fail);
2017-09-10 17:25:29 +05:30
break;
case 'import:fogbugz:new_user_map':
2018-03-17 18:26:18 +05:30
import('./pages/import/fogbugz/new_user_map')
.then(callDefault)
.catch(fail);
2017-09-10 17:25:29 +05:30
break;
case 'profiles:personal_access_tokens:index':
2018-03-17 18:26:18 +05:30
import('./pages/profiles/personal_access_tokens')
.then(callDefault)
.catch(fail);
break;
2017-09-10 17:25:29 +05:30
case 'admin:impersonation_tokens:index':
2018-03-17 18:26:18 +05:30
import('./pages/admin/impersonation_tokens')
.then(callDefault)
.catch(fail);
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':
import('./pages/dashboard/groups/index')
.then(callDefault)
.catch(fail);
2017-08-17 22:00:37 +05:30
break;
}
2017-09-10 17:25:29 +05:30
switch (path[0]) {
2017-08-17 22:00:37 +05:30
case 'sessions':
2018-03-17 18:26:18 +05:30
import('./pages/sessions')
.then(callDefault)
.catch(fail);
break;
2017-08-17 22:00:37 +05:30
case 'omniauth_callbacks':
2018-03-17 18:26:18 +05:30
import('./pages/omniauth_callbacks')
.then(callDefault)
.catch(fail);
break;
2017-08-17 22:00:37 +05:30
case 'admin':
2018-03-17 18:26:18 +05:30
import('./pages/admin')
.then(callDefault)
.catch(fail);
2017-08-17 22:00:37 +05:30
switch (path[1]) {
2018-03-17 18:26:18 +05:30
case 'broadcast_messages':
import('./pages/admin/broadcast_messages')
.then(callDefault)
.catch(fail);
break;
2017-08-17 22:00:37 +05:30
case 'cohorts':
2018-03-17 18:26:18 +05:30
import('./pages/admin/cohorts')
.then(callDefault)
.catch(fail);
2017-08-17 22:00:37 +05:30
break;
case 'groups':
2018-03-17 18:26:18 +05:30
switch (path[2]) {
case 'show':
import('./pages/admin/groups/show')
.then(callDefault)
.catch(fail);
break;
}
2017-08-17 22:00:37 +05:30
break;
case 'projects':
2018-03-17 18:26:18 +05:30
import('./pages/admin/projects')
.then(callDefault)
.catch(fail);
2017-08-17 22:00:37 +05:30
break;
case 'labels':
switch (path[2]) {
case 'new':
2018-03-17 18:26:18 +05:30
import('./pages/admin/labels/new')
.then(callDefault)
.catch(fail);
break;
2017-08-17 22:00:37 +05:30
case 'edit':
2018-03-17 18:26:18 +05:30
import('./pages/admin/labels/edit')
.then(callDefault)
.catch(fail);
break;
2017-08-17 22:00:37 +05:30
}
case 'abuse_reports':
2018-03-17 18:26:18 +05:30
import('./pages/admin/abuse_reports')
.then(callDefault)
.catch(fail);
2017-08-17 22:00:37 +05:30
break;
}
break;
case 'profiles':
2018-03-17 18:26:18 +05:30
import('./pages/profiles/index')
.then(callDefault)
.catch(fail);
2017-08-17 22:00:37 +05:30
break;
case 'projects':
2018-03-17 18:26:18 +05:30
import('./pages/projects')
.then(callDefault)
.catch(fail);
shortcut_handler = true;
2017-08-17 22:00:37 +05:30
switch (path[1]) {
case 'compare':
2018-03-17 18:26:18 +05:30
import('./pages/projects/compare')
.then(callDefault)
.catch(fail);
2017-08-17 22:00:37 +05:30
break;
2018-03-17 18:26:18 +05:30
case 'create':
2017-08-17 22:00:37 +05:30
case 'new':
2018-03-17 18:26:18 +05:30
import('./pages/projects/new')
.then(callDefault)
.catch(fail);
2017-08-17 22:00:37 +05:30
break;
case 'wikis':
2018-03-17 18:26:18 +05:30
import('./pages/projects/wikis')
.then(callDefault)
.catch(fail);
shortcut_handler = true;
2017-08-17 22:00:37 +05:30
break;
}
2017-09-10 17:25:29 +05:30
break;
2017-08-17 22:00:37 +05:30
}
// If we haven't installed a custom shortcut handler, install the default one
if (!shortcut_handler) {
new Shortcuts();
}
2017-09-10 17:25:29 +05:30
if (document.querySelector('#peek')) {
2018-03-17 18:26:18 +05:30
import('./performance_bar')
.then(m => new m.default({ container: '#peek' })) // eslint-disable-line new-cap
.catch(fail);
2017-09-10 17:25:29 +05:30
}
2017-08-17 22:00:37 +05:30
};
Dispatcher.prototype.initSearch = function() {
// Only when search form is present
if ($('.search').length) {
2018-03-17 18:26:18 +05:30
return new SearchAutocomplete();
2017-08-17 22:00:37 +05:30
}
};
Dispatcher.prototype.initFieldErrors = function() {
$('.gl-show-field-errors').each((i, form) => {
2018-03-17 18:26:18 +05:30
new GlFieldErrors(form);
2017-08-17 22:00:37 +05:30
});
};
return Dispatcher;
})();
2018-03-17 18:26:18 +05:30
})();
2017-09-10 17:25:29 +05:30
2018-03-17 18:26:18 +05:30
export default function initDispatcher() {
return new Dispatcher();
}