2021-03-11 19:13:27 +05:30
|
|
|
<script>
|
2022-06-21 17:19:12 +05:30
|
|
|
import { GlDropdownItem } from '@gitlab/ui';
|
|
|
|
import { s__ } from '~/locale';
|
|
|
|
import eventHub, { EVENT_OPEN_DELETE_USER_MODAL } from '../modals/delete_user_modal_event_hub';
|
2021-03-11 19:13:27 +05:30
|
|
|
|
|
|
|
export default {
|
|
|
|
components: {
|
2022-06-21 17:19:12 +05:30
|
|
|
GlDropdownItem,
|
2021-03-11 19:13:27 +05:30
|
|
|
},
|
|
|
|
props: {
|
|
|
|
username: {
|
|
|
|
type: String,
|
|
|
|
required: true,
|
|
|
|
},
|
|
|
|
paths: {
|
|
|
|
type: Object,
|
|
|
|
required: true,
|
|
|
|
},
|
2021-11-18 22:05:49 +05:30
|
|
|
userDeletionObstacles: {
|
2021-06-08 01:23:25 +05:30
|
|
|
type: Array,
|
|
|
|
required: false,
|
|
|
|
default: () => [],
|
|
|
|
},
|
2021-03-11 19:13:27 +05:30
|
|
|
},
|
2022-06-21 17:19:12 +05:30
|
|
|
methods: {
|
|
|
|
onClick() {
|
|
|
|
const { username, paths, userDeletionObstacles } = this;
|
|
|
|
eventHub.$emit(EVENT_OPEN_DELETE_USER_MODAL, {
|
|
|
|
username,
|
|
|
|
blockPath: paths.block,
|
|
|
|
deletePath: paths.delete,
|
|
|
|
userDeletionObstacles,
|
|
|
|
i18n: {
|
|
|
|
title: s__('AdminUsers|Delete User %{username}?'),
|
|
|
|
primaryButtonLabel: s__('AdminUsers|Delete user'),
|
|
|
|
messageBody: s__(`AdminUsers|You are about to permanently delete the user %{username}. Issues, merge requests,
|
|
|
|
and groups linked to them will be transferred to a system-wide "Ghost-user". To avoid data loss,
|
|
|
|
consider using the %{strongStart}block user%{strongEnd} feature instead. Once you %{strongStart}Delete user%{strongEnd},
|
|
|
|
it cannot be undone or recovered.`),
|
|
|
|
},
|
|
|
|
});
|
|
|
|
},
|
|
|
|
},
|
2021-03-11 19:13:27 +05:30
|
|
|
};
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
2022-06-21 17:19:12 +05:30
|
|
|
<gl-dropdown-item @click="onClick">
|
|
|
|
<span class="gl-text-red-500">
|
|
|
|
<slot></slot>
|
|
|
|
</span>
|
|
|
|
</gl-dropdown-item>
|
2021-03-11 19:13:27 +05:30
|
|
|
</template>
|