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
|
<script>
import { GlButton, GlModalDirective } from '@gitlab/ui';
import { CONFIRM_DANGER_MODAL_ID } from './constants';
import ConfirmDangerModal from './confirm_danger_modal.vue';
export default {
name: 'ConfirmDanger',
components: {
GlButton,
ConfirmDangerModal,
},
directives: {
GlModal: GlModalDirective,
},
props: {
disabled: {
type: Boolean,
required: false,
default: false,
},
phrase: {
type: String,
required: true,
},
buttonText: {
type: String,
required: true,
},
buttonClass: {
type: String,
required: false,
default: '',
},
buttonTestid: {
type: String,
required: false,
default: 'confirm-danger-button',
},
},
modalId: CONFIRM_DANGER_MODAL_ID,
};
</script>
<template>
<div>
<gl-button
v-gl-modal="$options.modalId"
:class="buttonClass"
variant="danger"
:disabled="disabled"
:data-testid="buttonTestid"
>{{ buttonText }}</gl-button
>
<confirm-danger-modal
:modal-id="$options.modalId"
:phrase="phrase"
@confirm="$emit('confirm')"
/>
</div>
</template>
|