1<script> 2import { GlDropdownItem } from '@gitlab/ui'; 3import { sprintf, s__, __ } from '~/locale'; 4import eventHub, { EVENT_OPEN_CONFIRM_MODAL } from '~/vue_shared/components/confirm_modal_eventhub'; 5import { I18N_USER_ACTIONS } from '../../constants'; 6 7export default { 8 components: { 9 GlDropdownItem, 10 }, 11 props: { 12 username: { 13 type: String, 14 required: true, 15 }, 16 path: { 17 type: String, 18 required: true, 19 }, 20 }, 21 methods: { 22 onClick() { 23 eventHub.$emit(EVENT_OPEN_CONFIRM_MODAL, { 24 path: this.path, 25 method: 'put', 26 modalAttributes: { 27 title: sprintf(s__('AdminUsers|Unlock user %{username}?'), { username: this.username }), 28 message: __('Are you sure?'), 29 actionCancel: { 30 text: __('Cancel'), 31 }, 32 actionPrimary: { 33 text: I18N_USER_ACTIONS.unlock, 34 attributes: [{ variant: 'confirm' }], 35 }, 36 }, 37 }); 38 }, 39 }, 40}; 41</script> 42 43<template> 44 <gl-dropdown-item @click="onClick"> 45 <slot></slot> 46 </gl-dropdown-item> 47</template> 48