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
|
<script>
import { GlDropdown, GlDropdownForm, GlFormTextarea, GlButton } from '@gitlab/ui';
export default {
components: { GlDropdown, GlDropdownForm, GlFormTextarea, GlButton },
props: {
disabled: {
type: Boolean,
required: false,
default: false,
},
defaultCommitMessage: {
type: String,
required: true,
},
},
data() {
return {
message: null,
};
},
methods: {
onApply() {
this.$emit('apply', this.message);
},
},
};
</script>
<template>
<gl-dropdown
:text="__('Apply suggestion')"
:disabled="disabled"
boundary="window"
right
menu-class="gl-w-full!"
data-qa-selector="apply_suggestion_dropdown"
@shown="$refs.commitMessage.$el.focus()"
>
<gl-dropdown-form class="gl-px-4! gl-m-0!">
<label for="commit-message">{{ __('Commit message') }}</label>
<gl-form-textarea
id="commit-message"
ref="commitMessage"
v-model="message"
:placeholder="defaultCommitMessage"
submit-on-enter
data-qa-selector="commit_message_field"
@submit="onApply"
/>
<gl-button
class="gl-w-auto! gl-mt-3 gl-text-center! gl-hover-text-white! gl-transition-medium! float-right"
category="primary"
variant="success"
data-qa-selector="commit_with_custom_message_button"
@click="onApply"
>
{{ __('Apply') }}
</gl-button>
</gl-dropdown-form>
</gl-dropdown>
</template>
|