2022-05-07 20:08:51 +05:30
|
|
|
import { GlFilteredSearchToken } from '@gitlab/ui';
|
|
|
|
|
|
|
|
import { __, s__ } from '~/locale';
|
2023-03-04 22:38:38 +05:30
|
|
|
import { OPERATORS_IS } from '~/vue_shared/components/filtered_search_bar/constants';
|
2021-01-03 14:25:43 +05:30
|
|
|
|
2022-08-13 15:12:31 +05:30
|
|
|
// Overridden in EE
|
|
|
|
export const EE_APP_OPTIONS = {};
|
|
|
|
|
|
|
|
// Overridden in EE
|
|
|
|
export const EE_TABS = [];
|
|
|
|
|
2022-08-27 11:52:29 +05:30
|
|
|
export const EE_ACTION_BUTTONS = {};
|
|
|
|
|
2022-03-02 08:16:31 +05:30
|
|
|
export const FIELD_KEY_ACCOUNT = 'account';
|
|
|
|
export const FIELD_KEY_SOURCE = 'source';
|
|
|
|
export const FIELD_KEY_GRANTED = 'granted';
|
|
|
|
export const FIELD_KEY_INVITED = 'invited';
|
|
|
|
export const FIELD_KEY_REQUESTED = 'requested';
|
|
|
|
export const FIELD_KEY_MAX_ROLE = 'maxRole';
|
2022-06-21 17:19:12 +05:30
|
|
|
export const FIELD_KEY_USER_CREATED_AT = 'userCreatedAt';
|
|
|
|
export const FIELD_KEY_LAST_ACTIVITY_ON = 'lastActivityOn';
|
2022-03-02 08:16:31 +05:30
|
|
|
export const FIELD_KEY_EXPIRATION = 'expiration';
|
2023-03-17 16:20:25 +05:30
|
|
|
export const FIELD_KEY_ACTIVITY = 'activity';
|
2022-03-02 08:16:31 +05:30
|
|
|
export const FIELD_KEY_LAST_SIGN_IN = 'lastSignIn';
|
|
|
|
export const FIELD_KEY_ACTIONS = 'actions';
|
|
|
|
|
2021-01-03 14:25:43 +05:30
|
|
|
export const FIELDS = [
|
|
|
|
{
|
2022-03-02 08:16:31 +05:30
|
|
|
key: FIELD_KEY_ACCOUNT,
|
2021-01-03 14:25:43 +05:30
|
|
|
label: __('Account'),
|
2021-02-22 17:27:13 +05:30
|
|
|
sort: {
|
|
|
|
asc: 'name_asc',
|
|
|
|
desc: 'name_desc',
|
|
|
|
},
|
2021-01-03 14:25:43 +05:30
|
|
|
},
|
|
|
|
{
|
2022-03-02 08:16:31 +05:30
|
|
|
key: FIELD_KEY_SOURCE,
|
2021-01-03 14:25:43 +05:30
|
|
|
label: __('Source'),
|
|
|
|
thClass: 'col-meta',
|
|
|
|
tdClass: 'col-meta',
|
|
|
|
},
|
|
|
|
{
|
2022-03-02 08:16:31 +05:30
|
|
|
key: FIELD_KEY_GRANTED,
|
2021-01-03 14:25:43 +05:30
|
|
|
label: __('Access granted'),
|
2021-02-22 17:27:13 +05:30
|
|
|
sort: {
|
|
|
|
asc: 'last_joined',
|
|
|
|
desc: 'oldest_joined',
|
|
|
|
},
|
2021-01-03 14:25:43 +05:30
|
|
|
},
|
|
|
|
{
|
2022-03-02 08:16:31 +05:30
|
|
|
key: FIELD_KEY_INVITED,
|
2021-01-03 14:25:43 +05:30
|
|
|
label: __('Invited'),
|
|
|
|
thClass: 'col-meta',
|
|
|
|
tdClass: 'col-meta',
|
|
|
|
},
|
|
|
|
{
|
2022-03-02 08:16:31 +05:30
|
|
|
key: FIELD_KEY_REQUESTED,
|
2021-01-03 14:25:43 +05:30
|
|
|
label: __('Requested'),
|
|
|
|
thClass: 'col-meta',
|
|
|
|
tdClass: 'col-meta',
|
|
|
|
},
|
|
|
|
{
|
2022-03-02 08:16:31 +05:30
|
|
|
key: FIELD_KEY_MAX_ROLE,
|
2021-01-03 14:25:43 +05:30
|
|
|
label: __('Max role'),
|
|
|
|
thClass: 'col-max-role',
|
|
|
|
tdClass: 'col-max-role',
|
2021-02-22 17:27:13 +05:30
|
|
|
sort: {
|
|
|
|
asc: 'access_level_asc',
|
|
|
|
desc: 'access_level_desc',
|
|
|
|
},
|
2021-01-03 14:25:43 +05:30
|
|
|
},
|
|
|
|
{
|
2022-03-02 08:16:31 +05:30
|
|
|
key: FIELD_KEY_EXPIRATION,
|
2021-01-03 14:25:43 +05:30
|
|
|
label: __('Expiration'),
|
|
|
|
thClass: 'col-expiration',
|
|
|
|
tdClass: 'col-expiration',
|
|
|
|
},
|
2023-03-17 16:20:25 +05:30
|
|
|
{
|
|
|
|
key: FIELD_KEY_ACTIVITY,
|
|
|
|
label: s__('Members|Activity'),
|
|
|
|
thClass: 'col-activity',
|
|
|
|
tdClass: 'col-activity',
|
|
|
|
},
|
2022-06-21 17:19:12 +05:30
|
|
|
{
|
|
|
|
key: FIELD_KEY_USER_CREATED_AT,
|
2023-03-17 16:20:25 +05:30
|
|
|
label: s__('Members|User created'),
|
2022-06-21 17:19:12 +05:30
|
|
|
sort: {
|
|
|
|
asc: 'oldest_created_user',
|
|
|
|
desc: 'recent_created_user',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
key: FIELD_KEY_LAST_ACTIVITY_ON,
|
|
|
|
label: __('Last activity'),
|
|
|
|
sort: {
|
|
|
|
asc: 'oldest_last_activity',
|
|
|
|
desc: 'recent_last_activity',
|
|
|
|
},
|
|
|
|
},
|
2021-02-22 17:27:13 +05:30
|
|
|
{
|
2022-03-02 08:16:31 +05:30
|
|
|
key: FIELD_KEY_LAST_SIGN_IN,
|
2021-02-22 17:27:13 +05:30
|
|
|
label: __('Last sign-in'),
|
|
|
|
sort: {
|
|
|
|
asc: 'recent_sign_in',
|
|
|
|
desc: 'oldest_sign_in',
|
|
|
|
},
|
|
|
|
},
|
2021-01-03 14:25:43 +05:30
|
|
|
{
|
2022-03-02 08:16:31 +05:30
|
|
|
key: FIELD_KEY_ACTIONS,
|
2021-01-03 14:25:43 +05:30
|
|
|
thClass: 'col-actions',
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
2021-02-22 17:27:13 +05:30
|
|
|
export const DEFAULT_SORT = {
|
|
|
|
sortByKey: 'account',
|
|
|
|
sortDesc: false,
|
|
|
|
};
|
|
|
|
|
2022-05-07 20:08:51 +05:30
|
|
|
export const FILTERED_SEARCH_TOKEN_TWO_FACTOR = {
|
|
|
|
type: 'two_factor',
|
|
|
|
icon: 'lock',
|
|
|
|
title: s__('Members|2FA'),
|
|
|
|
token: GlFilteredSearchToken,
|
|
|
|
unique: true,
|
2023-03-04 22:38:38 +05:30
|
|
|
operators: OPERATORS_IS,
|
2022-05-07 20:08:51 +05:30
|
|
|
options: [
|
|
|
|
{ value: 'enabled', title: s__('Members|Enabled') },
|
|
|
|
{ value: 'disabled', title: s__('Members|Disabled') },
|
|
|
|
],
|
|
|
|
requiredPermissions: 'canManageMembers',
|
|
|
|
};
|
|
|
|
|
|
|
|
export const FILTERED_SEARCH_TOKEN_WITH_INHERITED_PERMISSIONS = {
|
|
|
|
type: 'with_inherited_permissions',
|
|
|
|
icon: 'group',
|
|
|
|
title: s__('Members|Membership'),
|
|
|
|
token: GlFilteredSearchToken,
|
|
|
|
unique: true,
|
2023-03-04 22:38:38 +05:30
|
|
|
operators: OPERATORS_IS,
|
2022-05-07 20:08:51 +05:30
|
|
|
options: [
|
|
|
|
{ value: 'exclude', title: s__('Members|Direct') },
|
|
|
|
{ value: 'only', title: s__('Members|Inherited') },
|
|
|
|
],
|
|
|
|
};
|
|
|
|
|
2022-07-23 23:45:48 +05:30
|
|
|
export const FILTERED_SEARCH_TOKEN_GROUPS_WITH_INHERITED_PERMISSIONS = {
|
|
|
|
...FILTERED_SEARCH_TOKEN_WITH_INHERITED_PERMISSIONS,
|
|
|
|
type: 'groups_with_inherited_permissions',
|
|
|
|
};
|
|
|
|
|
2022-05-07 20:08:51 +05:30
|
|
|
export const AVAILABLE_FILTERED_SEARCH_TOKENS = [
|
|
|
|
FILTERED_SEARCH_TOKEN_TWO_FACTOR,
|
|
|
|
FILTERED_SEARCH_TOKEN_WITH_INHERITED_PERMISSIONS,
|
2022-07-23 23:45:48 +05:30
|
|
|
FILTERED_SEARCH_TOKEN_GROUPS_WITH_INHERITED_PERMISSIONS,
|
2022-05-07 20:08:51 +05:30
|
|
|
];
|
|
|
|
|
2021-01-03 14:25:43 +05:30
|
|
|
export const AVATAR_SIZE = 48;
|
|
|
|
|
|
|
|
export const MEMBER_TYPES = {
|
|
|
|
user: 'user',
|
|
|
|
group: 'group',
|
|
|
|
invite: 'invite',
|
|
|
|
accessRequest: 'accessRequest',
|
|
|
|
};
|
|
|
|
|
2023-03-17 16:20:25 +05:30
|
|
|
// `app/models/members/group_member.rb`
|
|
|
|
export const MEMBER_MODEL_TYPE_GROUP_MEMBER = 'GroupMember';
|
|
|
|
|
|
|
|
// `app/models/members/project_member.rb`
|
|
|
|
export const MEMBER_MODEL_TYPE_PROJECT_MEMBER = 'ProjectMember';
|
|
|
|
|
2021-09-30 23:02:18 +05:30
|
|
|
export const TAB_QUERY_PARAM_VALUES = {
|
|
|
|
group: 'groups',
|
|
|
|
invite: 'invited',
|
|
|
|
accessRequest: 'access_requests',
|
|
|
|
};
|
|
|
|
|
2021-11-18 22:05:49 +05:30
|
|
|
/**
|
|
|
|
* This user state value comes from the User model
|
|
|
|
* see the state machine in app/models/user.rb
|
|
|
|
*/
|
2022-07-23 23:45:48 +05:30
|
|
|
export const USER_STATE_BLOCKED = 'blocked_pending_approval';
|
2021-11-18 22:05:49 +05:30
|
|
|
|
|
|
|
/**
|
|
|
|
* This and following member state constants' values
|
|
|
|
* come from ee/app/models/ee/member.rb
|
|
|
|
*/
|
|
|
|
export const MEMBER_STATE_CREATED = 0;
|
|
|
|
export const MEMBER_STATE_AWAITING = 1;
|
|
|
|
export const MEMBER_STATE_ACTIVE = 2;
|
|
|
|
|
2022-07-23 23:45:48 +05:30
|
|
|
export const BADGE_LABELS_AWAITING_SIGNUP = __('Awaiting user signup');
|
|
|
|
export const BADGE_LABELS_PENDING = __('Pending owner action');
|
2021-11-18 22:05:49 +05:30
|
|
|
|
2021-01-03 14:25:43 +05:30
|
|
|
export const DAYS_TO_EXPIRE_SOON = 7;
|
|
|
|
|
|
|
|
export const LEAVE_MODAL_ID = 'member-leave-modal';
|
|
|
|
|
|
|
|
export const REMOVE_GROUP_LINK_MODAL_ID = 'remove-group-link-modal-id';
|
2021-02-22 17:27:13 +05:30
|
|
|
|
2021-09-30 23:02:18 +05:30
|
|
|
export const SORT_QUERY_PARAM_NAME = 'sort';
|
|
|
|
export const ACTIVE_TAB_QUERY_PARAM_NAME = 'tab';
|
2021-03-11 19:13:27 +05:30
|
|
|
|
|
|
|
export const MEMBER_ACCESS_LEVEL_PROPERTY_NAME = 'access_level';
|
|
|
|
|
|
|
|
export const GROUP_LINK_BASE_PROPERTY_NAME = 'group_link';
|
|
|
|
export const GROUP_LINK_ACCESS_LEVEL_PROPERTY_NAME = 'group_access';
|
2022-10-11 01:57:18 +05:30
|
|
|
|
|
|
|
export const I18N_USER_YOU = __("It's you");
|
|
|
|
export const I18N_USER_BLOCKED = __('Blocked');
|
|
|
|
export const I18N_USER_BOT = __('Bot');
|
|
|
|
export const I188N_USER_2FA = __('2FA');
|