debian-mirror-gitlab/app/assets/javascripts/pages/groups/shared/group_details.js

34 lines
1.3 KiB
JavaScript
Raw Normal View History

2019-07-07 11:18:12 +05:30
/* eslint-disable no-new */
2019-12-21 20:55:43 +05:30
import { getPagePath, getDashPath } from '~/lib/utils/common_utils';
2019-07-07 11:18:12 +05:30
import { ACTIVE_TAB_SHARED, ACTIVE_TAB_ARCHIVED } from '~/groups/constants';
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 '~/behaviors/shortcuts/shortcuts_navigation';
import GroupTabs from './group_tabs';
2020-06-23 00:09:42 +05:30
import initNamespaceStorageLimitAlert from '~/namespace_storage_limit_alert';
2019-07-07 11:18:12 +05:30
export default function initGroupDetails(actionName = 'show') {
const newGroupChildWrapper = document.querySelector('.js-new-project-subgroup');
const loadableActions = [ACTIVE_TAB_SHARED, ACTIVE_TAB_ARCHIVED];
2019-12-21 20:55:43 +05:30
const dashPath = getDashPath();
let action = loadableActions.includes(dashPath) ? dashPath : getPagePath(1);
2019-07-07 11:18:12 +05:30
if (actionName && action === actionName) {
action = 'show'; // 'show' resets GroupTabs to default action through base class
}
new GroupTabs({ parentEl: '.groups-listing', action });
new ShortcutsNavigation();
new NotificationsForm();
notificationsDropdown();
new ProjectsList();
if (newGroupChildWrapper) {
new NewGroupChild(newGroupChildWrapper);
}
2020-06-23 00:09:42 +05:30
initNamespaceStorageLimitAlert();
2019-07-07 11:18:12 +05:30
}