2020-07-28 23:09:34 +05:30
|
|
|
import Vue from 'vue';
|
2021-03-11 19:13:27 +05:30
|
|
|
import { groupMemberRequestFormatter } from '~/groups/members/utils';
|
2020-07-28 23:09:34 +05:30
|
|
|
import groupsSelect from '~/groups_select';
|
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-02-22 17:27:13 +05:30
|
|
|
import { s__ } from '~/locale';
|
2021-03-11 19:13:27 +05:30
|
|
|
import memberExpirationDate from '~/member_expiration_date';
|
|
|
|
import { initMembersApp } from '~/members/index';
|
|
|
|
import { groupLinkRequestFormatter } from '~/members/utils';
|
|
|
|
import UsersSelect from '~/users_select';
|
|
|
|
import RemoveMemberModal from '~/vue_shared/components/remove_member_modal.vue';
|
2020-07-28 23:09:34 +05:30
|
|
|
|
|
|
|
function mountRemoveMemberModal() {
|
|
|
|
const el = document.querySelector('.js-remove-member-modal');
|
|
|
|
if (!el) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
return new Vue({
|
|
|
|
el,
|
|
|
|
render(createComponent) {
|
|
|
|
return createComponent(RemoveMemberModal);
|
|
|
|
},
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2021-01-29 00:20:46 +05:30
|
|
|
const SHARED_FIELDS = ['account', 'expires', 'maxRole', 'expiration', 'actions'];
|
2021-02-22 17:27:13 +05:30
|
|
|
|
2021-03-11 19:13:27 +05:30
|
|
|
initMembersApp(document.querySelector('.js-group-members-list'), {
|
2021-02-22 17:27:13 +05:30
|
|
|
tableFields: SHARED_FIELDS.concat(['source', 'granted']),
|
|
|
|
tableAttrs: { tr: { 'data-qa-selector': 'member_row' } },
|
|
|
|
tableSortableFields: ['account', 'granted', 'maxRole', 'lastSignIn'],
|
2021-03-11 19:13:27 +05:30
|
|
|
requestFormatter: groupMemberRequestFormatter,
|
2021-02-22 17:27:13 +05:30
|
|
|
filteredSearchBar: {
|
|
|
|
show: true,
|
|
|
|
tokens: ['two_factor', 'with_inherited_permissions'],
|
|
|
|
searchParam: 'search',
|
|
|
|
placeholder: s__('Members|Filter members'),
|
|
|
|
recentSearchesStorageKey: 'group_members',
|
|
|
|
},
|
|
|
|
});
|
2021-03-11 19:13:27 +05:30
|
|
|
|
|
|
|
initMembersApp(document.querySelector('.js-group-group-links-list'), {
|
2021-02-22 17:27:13 +05:30
|
|
|
tableFields: SHARED_FIELDS.concat('granted'),
|
|
|
|
tableAttrs: {
|
|
|
|
table: { 'data-qa-selector': 'groups_list' },
|
|
|
|
tr: { 'data-qa-selector': 'group_row' },
|
|
|
|
},
|
|
|
|
requestFormatter: groupLinkRequestFormatter,
|
|
|
|
});
|
2021-03-11 19:13:27 +05:30
|
|
|
initMembersApp(document.querySelector('.js-group-invited-members-list'), {
|
2021-02-22 17:27:13 +05:30
|
|
|
tableFields: SHARED_FIELDS.concat('invited'),
|
2021-03-11 19:13:27 +05:30
|
|
|
requestFormatter: groupMemberRequestFormatter,
|
2021-02-22 17:27:13 +05:30
|
|
|
filteredSearchBar: {
|
|
|
|
show: true,
|
|
|
|
tokens: [],
|
|
|
|
searchParam: 'search_invited',
|
|
|
|
placeholder: s__('Members|Search invited'),
|
|
|
|
recentSearchesStorageKey: 'group_invited_members',
|
|
|
|
},
|
|
|
|
});
|
2021-03-11 19:13:27 +05:30
|
|
|
initMembersApp(document.querySelector('.js-group-access-requests-list'), {
|
2021-02-22 17:27:13 +05:30
|
|
|
tableFields: SHARED_FIELDS.concat('requested'),
|
2021-03-11 19:13:27 +05:30
|
|
|
requestFormatter: groupMemberRequestFormatter,
|
2021-02-22 17:27:13 +05:30
|
|
|
});
|
2020-07-28 23:09:34 +05:30
|
|
|
|
2021-01-29 00:20:46 +05:30
|
|
|
groupsSelect();
|
|
|
|
memberExpirationDate();
|
|
|
|
memberExpirationDate('.js-access-expiration-date-groups');
|
|
|
|
mountRemoveMemberModal();
|
2021-03-08 18:12:59 +05:30
|
|
|
initInviteMembersModal();
|
|
|
|
initInviteMembersTrigger();
|
2021-01-03 14:25:43 +05:30
|
|
|
|
2021-01-29 00:20:46 +05:30
|
|
|
new UsersSelect(); // eslint-disable-line no-new
|