Skip to content

Commit

Permalink
#2474 Make full name optional
Browse files Browse the repository at this point in the history
  • Loading branch information
dwalizer committed Nov 22, 2023
1 parent 54ed698 commit c174762
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
12 changes: 6 additions & 6 deletions dashboard/src/components/access/RevokeUserAccess.vue
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ limitations under the License.
tableStoredStateId="privateProjectUsersTable"
data-cy="privateProjectUsersTable">
<template v-slot:cell(userId)="data">
{{ getUserDisplay(data.item) }}
{{ getUserDisplay(data.item, true) }}

<b-button-group class="float-right">
<b-button @click="revokeAccess(data.value, getUserDisplay(data.item))"
Expand Down Expand Up @@ -166,23 +166,23 @@ limitations under the License.
}
});
},
getUserDisplay(props) {
getUserDisplay(props, fullName = false) {
const userDisplay = props.userIdForDisplay ? props.userIdForDisplay : props.userId;
const { oAuthProviders } = this.$store.getters.config;
let userName = '';
if (props.firstName && props.lastName) {
userName = `(${props.lastName}, ${props.firstName})`;
if (fullName && props.firstName && props.lastName) {
userName = ` (${props.lastName}, ${props.firstName})`;
}
if (oAuthProviders) {
const indexOfDash = userDisplay.lastIndexOf('-');
if (indexOfDash > 0) {
const provider = userDisplay.substr(indexOfDash + 1);
if (oAuthProviders.includes(provider)) {
return `${userDisplay.substr(0, indexOfDash)} ${userName}`;
return `${userDisplay.substr(0, indexOfDash)}${userName}`;
}
}
}
return `${userDisplay} ${userName}`;
return `${userDisplay}${userName}`;
},
},
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ limitations under the License.
@page-size-changed="pageSizeChanged"
@sort-changed="sortTable">
<template v-slot:cell(userId)="data">
{{ getUserDisplay(data.item) }}
{{ getUserDisplay(data.item, true) }}

<b-button-group class="float-right">
<b-button :to="calculateClientDisplayRoute(data.item)"
Expand Down
10 changes: 5 additions & 5 deletions dashboard/src/components/users/UserIdForDisplayMixin.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,23 @@ limitations under the License.
export default {
name: 'UserIdForDisplayMixin',
methods: {
getUserDisplay(props) {
getUserDisplay(props, fullName = false) {
const userDisplay = props.userIdForDisplay ? props.userIdForDisplay : props.userId;
const { oAuthProviders } = this.$store.getters.config;
let userName = '';
if (props.firstName && props.lastName) {
userName = `(${props.lastName}, ${props.firstName})`;
if (fullName && props.firstName && props.lastName) {
userName = ` (${props.lastName}, ${props.firstName})`;
}
if (oAuthProviders) {
const indexOfDash = userDisplay.lastIndexOf('-');
if (indexOfDash > 0) {
const provider = userDisplay.substr(indexOfDash + 1);
if (oAuthProviders.includes(provider)) {
return `${userDisplay.substr(0, indexOfDash)} ${userName}`;
return `${userDisplay.substr(0, indexOfDash)}${userName}`;
}
}
}
return `${userDisplay} ${userName}`;
return `${userDisplay}${userName}`;
},
},
};
Expand Down

0 comments on commit c174762

Please sign in to comment.