Commit fbcd5197 authored by Jacob Schatz's avatar Jacob Schatz

Merge branch 'dispatcher-groups' into 'master'

dynamic imports for groups: pages

See merge request gitlab-org/gitlab-ce!16342
parents 584fc5c5 cda2516a
/* 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 */ /* 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 */
import projectSelect from './project_select';
import Milestone from './milestone'; import Milestone from './milestone';
import IssuableForm from './issuable_form'; import IssuableForm from './issuable_form';
import LabelsSelect from './labels_select'; import LabelsSelect from './labels_select';
import MilestoneSelect from './milestone_select'; import MilestoneSelect from './milestone_select';
import NotificationsForm from './notifications_form'; import NotificationsForm from './notifications_form';
import notificationsDropdown from './notifications_dropdown'; import notificationsDropdown from './notifications_dropdown';
import groupAvatar from './group_avatar';
import GroupLabelSubscription from './group_label_subscription';
import LineHighlighter from './line_highlighter'; import LineHighlighter from './line_highlighter';
import MergeRequest from './merge_request'; import MergeRequest from './merge_request';
import Labels from './labels';
import LabelManager from './label_manager';
import Sidebar from './right_sidebar'; import Sidebar from './right_sidebar';
import IssuableTemplateSelectors from './templates/issuable_template_selectors'; import IssuableTemplateSelectors from './templates/issuable_template_selectors';
import Flash from './flash'; import Flash from './flash';
import BindInOut from './behaviors/bind_in_out';
import SecretValues from './behaviors/secret_values'; import SecretValues from './behaviors/secret_values';
import Group from './group';
import ProjectsList from './projects_list';
import UserCallout from './user_callout'; import UserCallout from './user_callout';
import BlobViewer from './blob/viewer/index'; import BlobViewer from './blob/viewer/index';
import UsersSelect from './users_select';
import GfmAutoComplete from './gfm_auto_complete'; import GfmAutoComplete from './gfm_auto_complete';
import Star from './star'; import Star from './star';
import TreeView from './tree'; import TreeView from './tree';
...@@ -30,7 +21,6 @@ import initSettingsPanels from './settings_panels'; ...@@ -30,7 +21,6 @@ import initSettingsPanels from './settings_panels';
import PerformanceBar from './performance_bar'; import PerformanceBar from './performance_bar';
import initNotes from './init_notes'; import initNotes from './init_notes';
import initIssuableSidebar from './init_issuable_sidebar'; import initIssuableSidebar from './init_issuable_sidebar';
import NewGroupChild from './groups/new_group_child';
import { ajaxGet, convertPermissionToBoolean } from './lib/utils/common_utils'; import { ajaxGet, convertPermissionToBoolean } from './lib/utils/common_utils';
import GlFieldErrors from './gl_field_errors'; import GlFieldErrors from './gl_field_errors';
import GLForm from './gl_form'; import GLForm from './gl_form';
...@@ -38,10 +28,7 @@ import Shortcuts from './shortcuts'; ...@@ -38,10 +28,7 @@ import Shortcuts from './shortcuts';
import ShortcutsNavigation from './shortcuts_navigation'; import ShortcutsNavigation from './shortcuts_navigation';
import ShortcutsIssuable from './shortcuts_issuable'; import ShortcutsIssuable from './shortcuts_issuable';
import U2FAuthenticate from './u2f/authenticate'; import U2FAuthenticate from './u2f/authenticate';
import Members from './members';
import memberExpirationDate from './member_expiration_date';
import Diff from './diff'; import Diff from './diff';
import ProjectLabelSubscription from './project_label_subscription';
import SearchAutocomplete from './search_autocomplete'; import SearchAutocomplete from './search_autocomplete';
import Activities from './activities'; import Activities from './activities';
...@@ -81,8 +68,6 @@ import Activities from './activities'; ...@@ -81,8 +68,6 @@ import Activities from './activities';
}); });
}); });
const filteredSearchEnabled = gl.FilteredSearchManager && document.querySelector('.filtered-search');
switch (page) { switch (page) {
case 'sessions:new': case 'sessions:new':
import('./pages/sessions/new') import('./pages/sessions/new')
...@@ -140,12 +125,14 @@ import Activities from './activities'; ...@@ -140,12 +125,14 @@ import Activities from './activities';
.catch(fail); .catch(fail);
break; break;
case 'groups:issues': case 'groups:issues':
import('./pages/groups/issues')
.then(callDefault)
.catch(fail);
break;
case 'groups:merge_requests': case 'groups:merge_requests':
if (filteredSearchEnabled) { import('./pages/groups/merge_requests')
const filteredSearchManager = new gl.FilteredSearchManager(page === 'groups:issues' ? 'issues' : 'merge_requests'); .then(callDefault)
filteredSearchManager.setup(); .catch(fail);
}
projectSelect();
break; break;
case 'dashboard:todos:index': case 'dashboard:todos:index':
import('./pages/dashboard/todos/index').then(callDefault).catch(fail); import('./pages/dashboard/todos/index').then(callDefault).catch(fail);
...@@ -363,34 +350,36 @@ import Activities from './activities'; ...@@ -363,34 +350,36 @@ import Activities from './activities';
.catch(fail); .catch(fail);
break; break;
case 'groups:activity': case 'groups:activity':
new Activities(); import('./pages/groups/activity')
.then(callDefault)
.catch(fail);
break; break;
case 'groups:show': case 'groups:show':
const newGroupChildWrapper = document.querySelector('.js-new-project-subgroup'); import('./pages/groups/show')
shortcut_handler = new ShortcutsNavigation(); .then(callDefault)
new NotificationsForm(); .catch(fail);
notificationsDropdown(); shortcut_handler = true;
new ProjectsList();
if (newGroupChildWrapper) {
new NewGroupChild(newGroupChildWrapper);
}
break; break;
case 'groups:group_members:index': case 'groups:group_members:index':
memberExpirationDate(); import('./pages/groups/group_members/index')
new Members(); .then(callDefault)
new UsersSelect(); .catch(fail);
break; break;
case 'projects:project_members:index': case 'projects:project_members:index':
import('./pages/projects/project_members/') import('./pages/projects/project_members/')
.then(callDefault) .then(callDefault)
.catch(fail); .catch(fail);
break; break;
case 'groups:new':
case 'groups:create': case 'groups:create':
BindInOut.initAll(); case 'groups:new':
new Group(); import('./pages/groups/new')
groupAvatar(); .then(callDefault)
.catch(fail);
break;
case 'groups:edit':
import('./pages/groups/edit')
.then(callDefault)
.catch(fail);
break; break;
case 'admin:groups:create': case 'admin:groups:create':
case 'admin:groups:new': case 'admin:groups:new':
...@@ -403,9 +392,6 @@ import Activities from './activities'; ...@@ -403,9 +392,6 @@ import Activities from './activities';
.then(callDefault) .then(callDefault)
.catch(fail); .catch(fail);
break; break;
case 'groups:edit':
groupAvatar();
break;
case 'projects:tree:show': case 'projects:tree:show':
import('./pages/projects/tree/show') import('./pages/projects/tree/show')
.then(callDefault) .then(callDefault)
...@@ -431,8 +417,14 @@ import Activities from './activities'; ...@@ -431,8 +417,14 @@ import Activities from './activities';
shortcut_handler = true; shortcut_handler = true;
break; break;
case 'groups:labels:new': case 'groups:labels:new':
import('./pages/groups/labels/new')
.then(callDefault)
.catch(fail);
break;
case 'groups:labels:edit': case 'groups:labels:edit':
new Labels(); import('./pages/groups/labels/edit')
.then(callDefault)
.catch(fail);
break; break;
case 'projects:labels:new': case 'projects:labels:new':
import('./pages/projects/labels/new') import('./pages/projects/labels/new')
...@@ -444,25 +436,16 @@ import Activities from './activities'; ...@@ -444,25 +436,16 @@ import Activities from './activities';
.then(callDefault) .then(callDefault)
.catch(fail); .catch(fail);
break; break;
case 'groups:labels:index':
import('./pages/groups/labels/index')
.then(callDefault)
.catch(fail);
break;
case 'projects:labels:index': case 'projects:labels:index':
import('./pages/projects/labels/index') import('./pages/projects/labels/index')
.then(callDefault) .then(callDefault)
.catch(fail); .catch(fail);
break; break;
case 'groups:labels:index':
if ($('.prioritized-labels').length) {
new LabelManager();
}
$('.label-subscription').each((i, el) => {
const $el = $(el);
if ($el.find('.dropdown-group-label').length) {
new GroupLabelSubscription($el);
} else {
new ProjectLabelSubscription($el);
}
});
break;
case 'projects:network:show': case 'projects:network:show':
// Ensure we don't create a particular shortcut handler here. This is // Ensure we don't create a particular shortcut handler here. This is
// already created, where the network graph is created. // already created, where the network graph is created.
...@@ -509,11 +492,9 @@ import Activities from './activities'; ...@@ -509,11 +492,9 @@ import Activities from './activities';
runnerTokenSecretValue.init(); runnerTokenSecretValue.init();
} }
case 'groups:settings:ci_cd:show': case 'groups:settings:ci_cd:show':
const secretVariableTable = document.querySelector('.js-secret-variable-table'); import('./pages/groups/settings/ci_cd/show')
if (secretVariableTable) { .then(callDefault)
const secretVariableTableValues = new SecretValues(secretVariableTable); .catch(fail);
secretVariableTableValues.init();
}
break; break;
case 'ci:lints:create': case 'ci:lints:create':
case 'ci:lints:show': case 'ci:lints:show':
......
/* eslint-disable import/prefer-default-export */
export const FILTERED_SEARCH = {
MERGE_REQUESTS: 'merge_requests',
ISSUES: 'issues',
};
import Activities from '~/activities';
export default new Activities();
import groupAvatar from '~/group_avatar';
export default groupAvatar;
/* eslint-disable no-new */
import memberExpirationDate from '~/member_expiration_date';
import Members from '~/members';
import UsersSelect from '~/users_select';
export default () => {
memberExpirationDate();
new Members();
new UsersSelect();
};
import projectSelect from '~/project_select';
import initFilteredSearch from '~/pages/search/init_filtered_search';
import { FILTERED_SEARCH } from '~/pages/constants';
export default () => {
initFilteredSearch(FILTERED_SEARCH.ISSUES);
projectSelect();
};
import Labels from '~/labels';
export default new Labels();
import initLabels from '~/init_labels';
export default initLabels;
import Labels from '~/labels';
export default new Labels();
import projectSelect from '~/project_select';
import initFilteredSearch from '~/pages/search/init_filtered_search';
import { FILTERED_SEARCH } from '~/pages/constants';
export default () => {
initFilteredSearch(FILTERED_SEARCH.MERGE_REQUESTS);
projectSelect();
};
import BindInOut from '~/behaviors/bind_in_out';
import Group from '~/group';
import groupAvatar from '~/group_avatar';
export default () => {
BindInOut.initAll();
new Group(); // eslint-disable-line no-new
groupAvatar();
};
import SecretValues from '~/behaviors/secret_values';
export default () => {
const secretVariableTable = document.querySelector('.js-secret-variable-table');
if (secretVariableTable) {
const secretVariableTableValues = new SecretValues(secretVariableTable);
secretVariableTableValues.init();
}
};
/* eslint-disable no-new */
import NewGroupChild from '~/groups/new_group_child';
import notificationsDropdown from '~/notifications_dropdown';
import NotificationsForm from '~/notifications_form';
import ProjectsList from '~/projects_list';
import ShortcutsNavigation from '~/shortcuts_navigation';
export default () => {
const newGroupChildWrapper = document.querySelector('.js-new-project-subgroup');
new ShortcutsNavigation();
new NotificationsForm();
notificationsDropdown();
new ProjectsList();
if (newGroupChildWrapper) {
new NewGroupChild(newGroupChildWrapper);
}
};
/* eslint-disable import/prefer-default-export */
export const ISSUABLE_INDEX = {
MERGE_REQUEST: 'merge_request_',
ISSUE: 'issue_',
};
/* eslint-disable no-new */ /* eslint-disable no-new */
import IssuableIndex from '~/issuable_index'; import IssuableIndex from '~/issuable_index';
import ShortcutsNavigation from '~/shortcuts_navigation'; import ShortcutsNavigation from '~/shortcuts_navigation';
import UsersSelect from '~/users_select'; import UsersSelect from '~/users_select';
import initFilteredSearch from '~/pages/search/init_filtered_search';
import { FILTERED_SEARCH } from '~/pages/constants';
import { ISSUABLE_INDEX } from '~/pages/projects/constants';
export default () => { export default () => {
const filteredSearchEnabled = gl.FilteredSearchManager && document.querySelector('.filtered-search'); initFilteredSearch(FILTERED_SEARCH.ISSUES);
if (filteredSearchEnabled) { new IssuableIndex(ISSUABLE_INDEX.ISSUE);
const filteredSearchManager = new gl.FilteredSearchManager('issues');
filteredSearchManager.setup();
}
new IssuableIndex('issue_');
new ShortcutsNavigation(); new ShortcutsNavigation();
new UsersSelect(); new UsersSelect();
......
import IssuableIndex from '~/issuable_index'; import IssuableIndex from '~/issuable_index';
import ShortcutsNavigation from '~/shortcuts_navigation'; import ShortcutsNavigation from '~/shortcuts_navigation';
import UsersSelect from '~/users_select'; import UsersSelect from '~/users_select';
import initFilteredSearch from '~/pages/search/init_filtered_search';
import { FILTERED_SEARCH } from '~/pages/constants';
import { ISSUABLE_INDEX } from '~/pages/projects/constants';
export default () => { export default () => {
const filteredSearchEnabled = gl.FilteredSearchManager && document.querySelector('.filtered-search'); initFilteredSearch(FILTERED_SEARCH.MERGE_REQUESTS);
new IssuableIndex(ISSUABLE_INDEX.MERGE_REQUEST); // eslint-disable-line no-new
if (filteredSearchEnabled) {
const filteredSearchManager = new gl.FilteredSearchManager('merge_requests');
filteredSearchManager.setup();
}
new IssuableIndex('merge_request_'); // eslint-disable-line no-new
new ShortcutsNavigation(); // eslint-disable-line no-new new ShortcutsNavigation(); // eslint-disable-line no-new
new UsersSelect(); // eslint-disable-line no-new new UsersSelect(); // eslint-disable-line no-new
}; };
export default (page) => {
const filteredSearchEnabled = gl.FilteredSearchManager && document.querySelector('.filtered-search');
if (filteredSearchEnabled) {
const filteredSearchManager = new gl.FilteredSearchManager(page);
filteredSearchManager.setup();
}
};
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