1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
<script>
import { GlDropdown, GlDropdownItem, GlModal, GlModalDirective } from '@gitlab/ui';
import { s__ } from '~/locale';
import Tracking from '~/tracking';
export default {
i18n: {
deleteTask: s__('WorkItem|Delete task'),
},
components: {
GlDropdown,
GlDropdownItem,
GlModal,
},
directives: {
GlModal: GlModalDirective,
},
mixins: [Tracking.mixin({ label: 'actions_menu' })],
props: {
workItemId: {
type: String,
required: false,
default: null,
},
canDelete: {
type: Boolean,
required: false,
default: false,
},
},
emits: ['deleteWorkItem'],
methods: {
handleDeleteWorkItem() {
this.track('click_delete_work_item');
this.$emit('deleteWorkItem');
},
handleCancelDeleteWorkItem({ trigger }) {
if (trigger !== 'ok') {
this.track('cancel_delete_work_item');
}
},
},
};
</script>
<template>
<div v-if="canDelete">
<gl-dropdown
icon="ellipsis_v"
text-sr-only
:text="__('More actions')"
category="tertiary"
no-caret
right
>
<gl-dropdown-item v-gl-modal="'work-item-confirm-delete'">{{
$options.i18n.deleteTask
}}</gl-dropdown-item>
</gl-dropdown>
<gl-modal
modal-id="work-item-confirm-delete"
:title="$options.i18n.deleteWorkItem"
:ok-title="$options.i18n.deleteWorkItem"
ok-variant="danger"
@ok="handleDeleteWorkItem"
@hide="handleCancelDeleteWorkItem"
>
{{
s__('WorkItem|Are you sure you want to delete the task? This action cannot be reversed.')
}}
</gl-modal>
</div>
</template>
|