2020-10-06 18:08:49 +00:00
|
|
|
<script>
|
2021-02-01 15:08:56 +00:00
|
|
|
import { s__, sprintf } from '~/locale';
|
2020-10-06 18:08:49 +00:00
|
|
|
import ActionButtonGroup from './action_button_group.vue';
|
2020-10-12 18:08:31 +00:00
|
|
|
import LeaveButton from './leave_button.vue';
|
2021-02-14 18:09:20 +00:00
|
|
|
import RemoveMemberButton from './remove_member_button.vue';
|
2020-10-06 18:08:49 +00:00
|
|
|
|
|
|
|
export default {
|
|
|
|
name: 'UserActionButtons',
|
2020-10-29 03:09:25 +00:00
|
|
|
components: {
|
|
|
|
ActionButtonGroup,
|
|
|
|
RemoveMemberButton,
|
|
|
|
LeaveButton,
|
|
|
|
LdapOverrideButton: () =>
|
2020-11-19 12:09:26 +00:00
|
|
|
import('ee_component/members/components/ldap/ldap_override_button.vue'),
|
2020-10-29 03:09:25 +00:00
|
|
|
},
|
2020-10-06 18:08:49 +00:00
|
|
|
props: {
|
|
|
|
member: {
|
|
|
|
type: Object,
|
|
|
|
required: true,
|
|
|
|
},
|
|
|
|
isCurrentUser: {
|
|
|
|
type: Boolean,
|
|
|
|
required: true,
|
|
|
|
},
|
|
|
|
permissions: {
|
|
|
|
type: Object,
|
|
|
|
required: true,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
message() {
|
|
|
|
const { user, source } = this.member;
|
|
|
|
|
|
|
|
if (user) {
|
|
|
|
return sprintf(
|
2021-04-15 09:09:03 +00:00
|
|
|
s__('Members|Are you sure you want to remove %{usersName} from "%{source}"?'),
|
2020-10-06 18:08:49 +00:00
|
|
|
{
|
|
|
|
usersName: user.name,
|
2021-01-14 18:10:59 +00:00
|
|
|
source: source.fullName,
|
2020-10-06 18:08:49 +00:00
|
|
|
},
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
return sprintf(
|
2021-04-15 09:09:03 +00:00
|
|
|
s__('Members|Are you sure you want to remove this orphaned member from "%{source}"?'),
|
2020-10-06 18:08:49 +00:00
|
|
|
{
|
2021-01-14 18:10:59 +00:00
|
|
|
source: source.fullName,
|
2020-10-06 18:08:49 +00:00
|
|
|
},
|
|
|
|
);
|
|
|
|
},
|
2021-04-15 09:09:03 +00:00
|
|
|
oncallScheduleUserData() {
|
|
|
|
const { user: { name, oncallSchedules: schedules } = {} } = this.member;
|
|
|
|
return { name, schedules };
|
|
|
|
},
|
2020-10-06 18:08:49 +00:00
|
|
|
},
|
|
|
|
};
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
|
|
|
<action-button-group>
|
|
|
|
<div v-if="permissions.canRemove" class="gl-px-1">
|
2020-10-12 18:08:31 +00:00
|
|
|
<leave-button v-if="isCurrentUser" :member="member" />
|
2020-10-06 18:08:49 +00:00
|
|
|
<remove-member-button
|
|
|
|
v-else
|
|
|
|
:member-id="member.id"
|
2021-03-23 12:09:33 +00:00
|
|
|
:member-type="member.type"
|
2021-04-15 09:09:03 +00:00
|
|
|
:oncall-schedules="oncallScheduleUserData"
|
2020-10-06 18:08:49 +00:00
|
|
|
:message="message"
|
|
|
|
:title="s__('Member|Remove member')"
|
|
|
|
/>
|
|
|
|
</div>
|
2020-10-29 03:09:25 +00:00
|
|
|
<div v-else-if="permissions.canOverride && !member.isOverridden" class="gl-px-1">
|
|
|
|
<ldap-override-button :member="member" />
|
|
|
|
</div>
|
2020-10-06 18:08:49 +00:00
|
|
|
</action-button-group>
|
|
|
|
</template>
|