debian-mirror-gitlab/app/assets/javascripts/pages/projects/project_members/index.js

66 lines
2.5 KiB
JavaScript
Raw Normal View History

2020-07-28 23:09:34 +05:30
import groupsSelect from '~/groups_select';
2021-04-17 20:07:23 +05:30
import initInviteGroupTrigger from '~/invite_members/init_invite_group_trigger';
import initInviteMembersForm from '~/invite_members/init_invite_members_form';
2021-03-08 18:12:59 +05:30
import initInviteMembersModal from '~/invite_members/init_invite_members_modal';
import initInviteMembersTrigger from '~/invite_members/init_invite_members_trigger';
2021-04-17 20:07:23 +05:30
import { s__ } from '~/locale';
2021-03-11 19:13:27 +05:30
import memberExpirationDate from '~/member_expiration_date';
2021-04-17 20:07:23 +05:30
import { initMembersApp } from '~/members';
2021-04-29 21:17:54 +05:30
import { MEMBER_TYPES } from '~/members/constants';
2021-04-17 20:07:23 +05:30
import { groupLinkRequestFormatter } from '~/members/utils';
import { projectMemberRequestFormatter } from '~/projects/members/utils';
2021-03-11 19:13:27 +05:30
import UsersSelect from '~/users_select';
2018-03-17 18:26:18 +05:30
2021-03-11 19:13:27 +05:30
groupsSelect();
memberExpirationDate();
memberExpirationDate('.js-access-expiration-date-groups');
initInviteMembersModal();
initInviteMembersTrigger();
2021-04-17 20:07:23 +05:30
initInviteGroupTrigger();
2021-03-11 19:13:27 +05:30
2021-04-17 20:07:23 +05:30
// This is only used when `invite_members_group_modal` feature flag is disabled.
// This can be removed when `invite_members_group_modal` feature flag is removed.
initInviteMembersForm();
2021-03-11 19:13:27 +05:30
2021-04-17 20:07:23 +05:30
new UsersSelect(); // eslint-disable-line no-new
2021-03-11 19:13:27 +05:30
2021-04-17 20:07:23 +05:30
const SHARED_FIELDS = ['account', 'expires', 'maxRole', 'expiration', 'actions'];
2021-09-04 01:27:46 +05:30
initMembersApp(document.querySelector('.js-project-members-list-app'), {
[MEMBER_TYPES.user]: {
tableFields: SHARED_FIELDS.concat(['source', 'granted']),
tableAttrs: { tr: { 'data-qa-selector': 'member_row' } },
tableSortableFields: ['account', 'granted', 'maxRole', 'lastSignIn'],
requestFormatter: projectMemberRequestFormatter,
filteredSearchBar: {
show: true,
tokens: ['with_inherited_permissions'],
searchParam: 'search',
placeholder: s__('Members|Filter members'),
recentSearchesStorageKey: 'project_members',
},
2021-04-17 20:07:23 +05:30
},
2021-09-04 01:27:46 +05:30
[MEMBER_TYPES.group]: {
tableFields: SHARED_FIELDS.concat('granted'),
tableAttrs: {
table: { 'data-qa-selector': 'groups_list' },
tr: { 'data-qa-selector': 'group_row' },
},
requestFormatter: groupLinkRequestFormatter,
filteredSearchBar: {
show: true,
tokens: [],
searchParam: 'search_groups',
placeholder: s__('Members|Search groups'),
recentSearchesStorageKey: 'project_group_links',
},
2021-04-17 20:07:23 +05:30
},
2021-09-04 01:27:46 +05:30
[MEMBER_TYPES.invite]: {
tableFields: SHARED_FIELDS.concat('invited'),
requestFormatter: projectMemberRequestFormatter,
},
[MEMBER_TYPES.accessRequest]: {
tableFields: SHARED_FIELDS.concat('requested'),
requestFormatter: projectMemberRequestFormatter,
2021-04-17 20:07:23 +05:30
},
});