summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/members
diff options
context:
space:
mode:
Diffstat (limited to 'app/assets/javascripts/members')
-rw-r--r--app/assets/javascripts/members/components/action_buttons/access_request_action_buttons.vue4
-rw-r--r--app/assets/javascripts/members/components/action_buttons/invite_action_buttons.vue2
-rw-r--r--app/assets/javascripts/members/components/action_buttons/user_action_buttons.vue4
-rw-r--r--app/assets/javascripts/members/components/avatars/user_avatar.vue2
-rw-r--r--app/assets/javascripts/members/components/filter_sort/members_filtered_search_bar.vue6
-rw-r--r--app/assets/javascripts/members/components/filter_sort/sort_dropdown.vue24
-rw-r--r--app/assets/javascripts/members/components/modals/leave_modal.vue4
-rw-r--r--app/assets/javascripts/members/components/table/member_source.vue2
-rw-r--r--app/assets/javascripts/members/components/table/members_table.vue43
-rw-r--r--app/assets/javascripts/members/constants.js2
-rw-r--r--app/assets/javascripts/members/store/index.js2
-rw-r--r--app/assets/javascripts/members/store/utils.js3
-rw-r--r--app/assets/javascripts/members/utils.js12
13 files changed, 67 insertions, 43 deletions
diff --git a/app/assets/javascripts/members/components/action_buttons/access_request_action_buttons.vue b/app/assets/javascripts/members/components/action_buttons/access_request_action_buttons.vue
index 10078d5cd64..fcb70dd45a6 100644
--- a/app/assets/javascripts/members/components/action_buttons/access_request_action_buttons.vue
+++ b/app/assets/javascripts/members/components/action_buttons/access_request_action_buttons.vue
@@ -28,13 +28,13 @@ export default {
if (this.isCurrentUser) {
return sprintf(
s__('Members|Are you sure you want to withdraw your access request for "%{source}"'),
- { source: source.name },
+ { source: source.fullName },
);
}
return sprintf(
s__('Members|Are you sure you want to deny %{usersName}\'s request to join "%{source}"'),
- { usersName: user.name, source: source.name },
+ { usersName: user.name, source: source.fullName },
);
},
},
diff --git a/app/assets/javascripts/members/components/action_buttons/invite_action_buttons.vue b/app/assets/javascripts/members/components/action_buttons/invite_action_buttons.vue
index 2b0a75640e2..9a27348f146 100644
--- a/app/assets/javascripts/members/components/action_buttons/invite_action_buttons.vue
+++ b/app/assets/javascripts/members/components/action_buttons/invite_action_buttons.vue
@@ -25,7 +25,7 @@ export default {
s__(
'Members|Are you sure you want to revoke the invitation for %{inviteEmail} to join "%{source}"',
),
- { inviteEmail: invite.email, source: source.name },
+ { inviteEmail: invite.email, source: source.fullName },
);
},
},
diff --git a/app/assets/javascripts/members/components/action_buttons/user_action_buttons.vue b/app/assets/javascripts/members/components/action_buttons/user_action_buttons.vue
index f2bc9c7e876..0e5df961782 100644
--- a/app/assets/javascripts/members/components/action_buttons/user_action_buttons.vue
+++ b/app/assets/javascripts/members/components/action_buttons/user_action_buttons.vue
@@ -36,7 +36,7 @@ export default {
s__('Members|Are you sure you want to remove %{usersName} from "%{source}"'),
{
usersName: user.name,
- source: source.name,
+ source: source.fullName,
},
);
}
@@ -44,7 +44,7 @@ export default {
return sprintf(
s__('Members|Are you sure you want to remove this orphaned member from "%{source}"'),
{
- source: source.name,
+ source: source.fullName,
},
);
},
diff --git a/app/assets/javascripts/members/components/avatars/user_avatar.vue b/app/assets/javascripts/members/components/avatars/user_avatar.vue
index fe45ca769af..e2264085e67 100644
--- a/app/assets/javascripts/members/components/avatars/user_avatar.vue
+++ b/app/assets/javascripts/members/components/avatars/user_avatar.vue
@@ -38,7 +38,7 @@ export default {
return this.member.user;
},
badges() {
- return generateBadges(this.member, this.isCurrentUser).filter(badge => badge.show);
+ return generateBadges(this.member, this.isCurrentUser).filter((badge) => badge.show);
},
statusEmoji() {
return this.user?.status?.emoji;
diff --git a/app/assets/javascripts/members/components/filter_sort/members_filtered_search_bar.vue b/app/assets/javascripts/members/components/filter_sort/members_filtered_search_bar.vue
index c1df0b94234..cf7501d84fa 100644
--- a/app/assets/javascripts/members/components/filter_sort/members_filtered_search_bar.vue
+++ b/app/assets/javascripts/members/components/filter_sort/members_filtered_search_bar.vue
@@ -45,7 +45,7 @@ export default {
computed: {
...mapState(['sourceId', 'filteredSearchBar', 'canManageMembers']),
tokens() {
- return this.$options.availableTokens.filter(token => {
+ return this.$options.availableTokens.filter((token) => {
if (
Object.prototype.hasOwnProperty.call(token, 'requiredPermissions') &&
!this[token.requiredPermissions]
@@ -61,8 +61,8 @@ export default {
const query = queryToObject(window.location.search);
const tokens = this.tokens
- .filter(token => query[token.type])
- .map(token => ({
+ .filter((token) => query[token.type])
+ .map((token) => ({
type: token.type,
value: {
data: query[token.type],
diff --git a/app/assets/javascripts/members/components/filter_sort/sort_dropdown.vue b/app/assets/javascripts/members/components/filter_sort/sort_dropdown.vue
index de7fbc4241c..bcfe559768d 100644
--- a/app/assets/javascripts/members/components/filter_sort/sort_dropdown.vue
+++ b/app/assets/javascripts/members/components/filter_sort/sort_dropdown.vue
@@ -14,7 +14,7 @@ export default {
return parseSortParam(this.tableSortableFields);
},
activeOption() {
- return FIELDS.find(field => field.key === this.sort.sortByKey);
+ return FIELDS.find((field) => field.key === this.sort.sortByKey);
},
activeOptionLabel() {
return this.activeOption?.label;
@@ -23,18 +23,18 @@ export default {
return !this.sort.sortDesc;
},
filteredOptions() {
- return FIELDS.filter(field => this.tableSortableFields.includes(field.key) && field.sort).map(
- field => ({
- key: field.key,
- label: field.label,
- href: buildSortHref({
- sortBy: field.key,
- sortDesc: false,
- filteredSearchBarTokens: this.filteredSearchBar.tokens,
- filteredSearchBarSearchParam: this.filteredSearchBar.searchParam,
- }),
+ return FIELDS.filter(
+ (field) => this.tableSortableFields.includes(field.key) && field.sort,
+ ).map((field) => ({
+ key: field.key,
+ label: field.label,
+ href: buildSortHref({
+ sortBy: field.key,
+ sortDesc: false,
+ filteredSearchBarTokens: this.filteredSearchBar.tokens,
+ filteredSearchBarSearchParam: this.filteredSearchBar.searchParam,
}),
- );
+ }));
},
},
methods: {
diff --git a/app/assets/javascripts/members/components/modals/leave_modal.vue b/app/assets/javascripts/members/components/modals/leave_modal.vue
index 57a5da774e3..d231c7eabfa 100644
--- a/app/assets/javascripts/members/components/modals/leave_modal.vue
+++ b/app/assets/javascripts/members/components/modals/leave_modal.vue
@@ -35,7 +35,7 @@ export default {
return this.memberPath.replace(/:id$/, 'leave');
},
modalTitle() {
- return sprintf(s__('Members|Leave "%{source}"'), { source: this.member.source.name });
+ return sprintf(s__('Members|Leave "%{source}"'), { source: this.member.source.fullName });
},
},
methods: {
@@ -59,7 +59,7 @@ export default {
<gl-form ref="form" :action="leavePath" method="post">
<p>
<gl-sprintf :message="$options.modalContent">
- <template #source>{{ member.source.name }}</template>
+ <template #source>{{ member.source.fullName }}</template>
</gl-sprintf>
</p>
diff --git a/app/assets/javascripts/members/components/table/member_source.vue b/app/assets/javascripts/members/components/table/member_source.vue
index 030d72c3420..30fcbfcd3f8 100644
--- a/app/assets/javascripts/members/components/table/member_source.vue
+++ b/app/assets/javascripts/members/components/table/member_source.vue
@@ -22,6 +22,6 @@ export default {
<template>
<span v-if="isDirectMember">{{ __('Direct member') }}</span>
<a v-else v-gl-tooltip.hover :title="__('Inherited')" :href="memberSource.webUrl">{{
- memberSource.name
+ memberSource.fullName
}}</a>
</template>
diff --git a/app/assets/javascripts/members/components/table/members_table.vue b/app/assets/javascripts/members/components/table/members_table.vue
index da77e5caad2..16e0cd5ad4e 100644
--- a/app/assets/javascripts/members/components/table/members_table.vue
+++ b/app/assets/javascripts/members/components/table/members_table.vue
@@ -34,7 +34,16 @@ export default {
computed: {
...mapState(['members', 'tableFields', 'tableAttrs', 'currentUserId', 'sourceId']),
filteredFields() {
- return FIELDS.filter(field => this.tableFields.includes(field.key) && this.showField(field));
+ return FIELDS.filter(
+ (field) => this.tableFields.includes(field.key) && this.showField(field),
+ ).map((field) => {
+ const tdClassFunction = this[field.tdClassFunction];
+
+ return {
+ ...field,
+ ...(tdClassFunction && { tdClass: tdClassFunction }),
+ };
+ });
},
userIsLoggedIn() {
return this.currentUserId !== null;
@@ -44,6 +53,14 @@ export default {
initUserPopovers(this.$el.querySelectorAll('.js-user-link'));
},
methods: {
+ hasActionButtons(member) {
+ return (
+ canRemove(member, this.sourceId) ||
+ canResend(member) ||
+ canUpdate(member, this.currentUserId, this.sourceId) ||
+ canOverride(member)
+ );
+ },
showField(field) {
if (!Object.prototype.hasOwnProperty.call(field, 'showFunction')) {
return true;
@@ -56,14 +73,20 @@ export default {
return false;
}
- return this.members.some(member => {
- return (
- canRemove(member, this.sourceId) ||
- canResend(member) ||
- canUpdate(member, this.currentUserId, this.sourceId) ||
- canOverride(member)
- );
- });
+ return this.members.some((member) => this.hasActionButtons(member));
+ },
+ tdClassActions(value, key, member) {
+ if (this.hasActionButtons(member)) {
+ return 'col-actions';
+ }
+
+ return ['col-actions', 'gl-display-none!', 'gl-display-lg-table-cell!'];
+ },
+ tbodyTrAttr(member) {
+ return {
+ ...this.tableAttrs.tr,
+ ...(member?.id && { 'data-testid': `members-table-row-${member.id}` }),
+ };
},
},
};
@@ -83,7 +106,7 @@ export default {
thead-class="border-bottom"
:empty-text="__('No members found')"
show-empty
- :tbody-tr-attr="tableAttrs.tr"
+ :tbody-tr-attr="tbodyTrAttr"
>
<template #cell(account)="{ item: member }">
<members-table-cell #default="{ memberType, isCurrentUser }" :member="member">
diff --git a/app/assets/javascripts/members/constants.js b/app/assets/javascripts/members/constants.js
index 21af825f795..77cb150bff6 100644
--- a/app/assets/javascripts/members/constants.js
+++ b/app/assets/javascripts/members/constants.js
@@ -70,8 +70,8 @@ export const FIELDS = [
{
key: 'actions',
thClass: 'col-actions',
- tdClass: 'col-actions',
showFunction: 'showActionsField',
+ tdClassFunction: 'tdClassActions',
},
];
diff --git a/app/assets/javascripts/members/store/index.js b/app/assets/javascripts/members/store/index.js
index f219f8931b0..34c102999d2 100644
--- a/app/assets/javascripts/members/store/index.js
+++ b/app/assets/javascripts/members/store/index.js
@@ -2,7 +2,7 @@ import createState from 'ee_else_ce/members/store/state';
import mutations from 'ee_else_ce/members/store/mutations';
import * as actions from 'ee_else_ce/members/store/actions';
-export default initialState => ({
+export default (initialState) => ({
state: createState(initialState),
actions,
mutations,
diff --git a/app/assets/javascripts/members/store/utils.js b/app/assets/javascripts/members/store/utils.js
index 7dcd33111e8..585962be27e 100644
--- a/app/assets/javascripts/members/store/utils.js
+++ b/app/assets/javascripts/members/store/utils.js
@@ -1 +1,2 @@
-export const findMember = (state, memberId) => state.members.find(member => member.id === memberId);
+export const findMember = (state, memberId) =>
+ state.members.find((member) => member.id === memberId);
diff --git a/app/assets/javascripts/members/utils.js b/app/assets/javascripts/members/utils.js
index bf1fc2d7515..780b5a9df57 100644
--- a/app/assets/javascripts/members/utils.js
+++ b/app/assets/javascripts/members/utils.js
@@ -21,7 +21,7 @@ export const generateBadges = (member, isCurrentUser) => [
},
];
-export const isGroup = member => {
+export const isGroup = (member) => {
return Boolean(member.sharedWithGroup);
};
@@ -37,7 +37,7 @@ export const canRemove = (member, sourceId) => {
return isDirectMember(member, sourceId) && member.canRemove;
};
-export const canResend = member => {
+export const canResend = (member) => {
return Boolean(member.invite?.canResend);
};
@@ -47,11 +47,11 @@ export const canUpdate = (member, currentUserId, sourceId) => {
);
};
-export const parseSortParam = sortableFields => {
+export const parseSortParam = (sortableFields) => {
const sortParam = getParameterByName('sort');
- const sortedField = FIELDS.filter(field => sortableFields.includes(field.key)).find(
- field => field.sort?.asc === sortParam || field.sort?.desc === sortParam,
+ const sortedField = FIELDS.filter((field) => sortableFields.includes(field.key)).find(
+ (field) => field.sort?.asc === sortParam || field.sort?.desc === sortParam,
);
if (!sortedField) {
@@ -70,7 +70,7 @@ export const buildSortHref = ({
filteredSearchBarTokens,
filteredSearchBarSearchParam,
}) => {
- const sortDefinition = FIELDS.find(field => field.key === sortBy)?.sort;
+ const sortDefinition = FIELDS.find((field) => field.key === sortBy)?.sort;
if (!sortDefinition) {
return '';